chiark / gitweb /
stgit.el: Add message when there are no patches in the series
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 a50cffddb86b8286c9cc859043959ce613f5d507..12ae7dec3f6c14ff523236cc6bb9bd27eda27902 100644 (file)
@@ -353,13 +353,15 @@ (defun stgit-expand-patch (patchsym)
 (defun stgit-rescan ()
   "Rescan the status buffer."
   (save-excursion
 (defun stgit-rescan ()
   "Rescan the status buffer."
   (save-excursion
-    (let ((marked ()))
+    (let ((marked ())
+         found-any)
       (goto-char (point-min))
       (while (not (eobp))
         (cond ((looking-at "Branch: \\(.*\\)")
                (put-text-property (match-beginning 1) (match-end 1)
                                   'face 'bold))
               ((looking-at "\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
       (goto-char (point-min))
       (while (not (eobp))
         (cond ((looking-at "Branch: \\(.*\\)")
                (put-text-property (match-beginning 1) (match-end 1)
                                   'face 'bold))
               ((looking-at "\\([>+-]\\)\\( \\)\\([^ ]+\\) *[|#] \\(.*\\)")
+              (setq found-any t)
                (let ((state (match-string 1))
                      (patchsym (intern (match-string 3))))
                  (put-text-property
                (let ((state (match-string 1))
                      (patchsym (intern (match-string 3))))
                  (put-text-property
@@ -379,10 +381,15 @@ (defun stgit-rescan ()
                  ))
               ((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"))
+              (setq found-any t)
                (forward-line 1)
                (insert "Run M-x stgit-init to initialise")))
         (forward-line 1))
                (forward-line 1)
                (insert "Run M-x stgit-init to initialise")))
         (forward-line 1))
-      (setq stgit-marked-patches (nreverse marked)))))
+      (setq stgit-marked-patches (nreverse marked))
+      (unless found-any
+       (insert "\n  "
+               (propertize "no patches in series"
+                           'face 'stgit-description-face))))))
 
 (defun stgit-select ()
   "Expand or collapse the current entry"
 
 (defun stgit-select ()
   "Expand or collapse the current entry"