chiark / gitweb /
stgit.el: Bugfix "P" when point is not on a patch line
authorGustav Hållberg <gustav@virtutech.com>
Fri, 14 Aug 2009 08:45:15 +0000 (10:45 +0200)
committerGustav Hållberg <gustav@virtutech.com>
Fri, 14 Aug 2009 08:53:23 +0000 (10:53 +0200)
Signed-off-by: Gustav Hållberg <gustav@virtutech.com>
contrib/stgit.el

index bbc7eb1e6bfc56f3b78fcadf4fe89e251c35aa99..c96b7ffac56bce6f62c6a8b136331c009358aa38 100644 (file)
@@ -1226,17 +1226,16 @@ (defun stgit-pop-next (npatches)
   (stgit-reload)
   (stgit-refresh-git-status))
 
-(defun stgit-applied-at-point ()
-  "Is the patch on the current line applied?"
-  (save-excursion
-    (beginning-of-line)
-    (looking-at "[>+]")))
+(defun stgit-applied-at-point-p ()
+  "Return non-nil if the patch at point is applied."
+  (let ((patch (stgit-patch-at-point t)))
+    (not (eq (stgit-patch-status patch) 'unapplied))))
 
 (defun stgit-push-or-pop ()
   "Push or pop the patch on the current line."
   (interactive)
-  (let ((patchsym (stgit-patch-name-at-point t))
-        (applied (stgit-applied-at-point)))
+  (let ((patchsym (stgit-patch-name-at-point t t))
+        (applied (stgit-applied-at-point-p)))
     (stgit-capture-output nil
       (stgit-run (if applied "pop" "push") patchsym))
     (stgit-reload)))