From: Gustav Hållberg Date: Mon, 12 Jan 2009 20:20:13 +0000 (+0100) Subject: stgit.el: Indicate empty patches X-Git-Tag: v0.15-rc1~54 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/bce79a6aa39e4d135b675131f68e6bbd12433e4a?ds=sidebyside;hp=3a1cf8148f79dfc3734fdc427a18e12f08bb9af5 stgit.el: Indicate empty patches Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 12ae7de..acad87b 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -124,7 +124,7 @@ (defun stgit-reload () (erase-buffer) (insert "Branch: ") (stgit-run-silent "branch") - (stgit-run-silent "series" "--description") + (stgit-run-silent "series" "--description" "--empty") (stgit-rescan) (if curpatch (stgit-goto-patch curpatch) @@ -360,24 +360,31 @@ (defun stgit-rescan () (cond ((looking-at "Branch: \\(.*\\)") (put-text-property (match-beginning 1) (match-end 1) 'face 'bold)) - ((looking-at "\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)") + ((looking-at "\\([0 ]\\)\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)") (setq found-any t) - (let ((state (match-string 1)) - (patchsym (intern (match-string 3)))) + (let ((empty (match-string 1)) + (state (match-string 2)) + (patchsym (intern (match-string 4)))) (put-text-property - (match-beginning 3) (match-end 3) 'face + (match-beginning 4) (match-end 4) 'face (cond ((string= state ">") 'stgit-top-patch-face) ((string= state "+") 'stgit-applied-patch-face) ((string= state "-") 'stgit-unapplied-patch-face))) - (put-text-property (match-beginning 4) (match-end 4) + (put-text-property (match-beginning 5) (match-end 5) 'face 'stgit-description-face) (when (memq patchsym stgit-marked-patches) - (replace-match "*" nil nil nil 2) + (save-excursion + (replace-match "*" nil nil nil 3)) (setq marked (cons patchsym marked))) (put-text-property (match-beginning 0) (match-end 0) 'stgit-patchsym patchsym) (when (memq patchsym stgit-expanded-patches) (stgit-expand-patch patchsym)) + (when (equal "0" empty) + (save-excursion + (goto-char (match-beginning 5)) + (insert "(empty) "))) + (delete-char 1) )) ((or (looking-at "stg series: Branch \".*\" not initialised") (looking-at "stg series: .*: branch not initialized"))