diff options
author | Gustav HÃ¥llberg <gustav@virtutech.com> | 2009-12-04 08:55:03 +0100 |
---|---|---|
committer | Karl Wiberg <kha@treskal.com> | 2009-12-04 08:55:05 +0100 |
commit | da30db2adfb74c19189b7d9ae7658a0a799a3945 (patch) | |
tree | 5aa019f6c4c66d8293ed9e4693536aab774cfa9b | |
parent | d6e17ce04e5b6e766bec35f7c7e56d1b5139b307 (diff) | |
download | stgit-da30db2adfb74c19189b7d9ae7658a0a799a3945.tar.gz |
stgit.el: Do not emit trailing whitespace
Signed-off-by: Gustav HÃ¥llberg <gustav@virtutech.com>
-rw-r--r-- | contrib/stgit.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el index 3dd1989..3ebeb72 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -262,6 +262,13 @@ directory DIR or `default-directory'" (:work "Work Tree") (t (symbol-name name))))) +(defun stgit-insert-without-trailing-whitespace (text) + "Insert TEXT in buffer using `insert', without trailing whitespace. +A newline is appended." + (unless (string-match "\\(.*?\\) *$" text) + (error)) + (insert (match-string 1 text) ?\n)) + (defun stgit-patch-pp (patch) (let* ((status (stgit-patch->status patch)) (start (point)) @@ -286,9 +293,10 @@ directory DIR or `default-directory'" 'face 'stgit-description-face) ?D (propertize (or (stgit-patch->desc patch) (stgit-patch-display-name patch)) - 'face face)))) + 'face face))) + (text (format-spec fmt spec))) - (insert (format-spec fmt spec) "\n") + (stgit-insert-without-trailing-whitespace text) (put-text-property start (point) 'entry-type 'patch) (when (memq name stgit-expanded-patches) (stgit-insert-patch-files patch)) @@ -651,7 +659,8 @@ Cf. `stgit-file-type-change-string'." (stgit-file->old-perm file) (stgit-file->new-perm file)) 'face 'stgit-description-face)))) - (insert (format-spec stgit-file-line-format spec) "\n") + (stgit-insert-without-trailing-whitespace + (format-spec stgit-file-line-format spec)) (add-text-properties start (point) (list 'entry-type 'file 'file-data file)))) |