chiark / gitweb /
stgit.el: Indicate empty patches
authorGustav Hållberg <gustav@virtutech.com>
Mon, 12 Jan 2009 20:20:13 +0000 (21:20 +0100)
committerKarl Hasselström <kha@treskal.com>
Thu, 22 Jan 2009 22:57:38 +0000 (23:57 +0100)
Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
Signed-off-by: Karl Hasselström <kha@treskal.com>
contrib/stgit.el

index 12ae7dec3f6c14ff523236cc6bb9bd27eda27902..acad87b4c135ebc4014e1c77e575b37323864374 100644 (file)
@@ -124,7 +124,7 @@ (defun stgit-reload ()
     (erase-buffer)
     (insert "Branch: ")
     (stgit-run-silent "branch")
     (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)
     (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))
         (cond ((looking-at "Branch: \\(.*\\)")
                (put-text-property (match-beginning 1) (match-end 1)
                                   'face 'bold))
-              ((looking-at "\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
+              ((looking-at "\\([0 ]\\)\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
               (setq found-any t)
               (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
                  (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)))
                   (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)
                                     '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))
                    (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"))
                  ))
               ((or (looking-at "stg series: Branch \".*\" not initialised")
                    (looking-at "stg series: .*: branch not initialized"))