From: Gustav HÃ¥llberg Date: Fri, 14 Aug 2009 08:45:15 +0000 (+0200) Subject: stgit.el: Bugfix "P" when point is not on a patch line X-Git-Tag: v0.15-rc2~11^2~8 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/5fd965bb132620ef2a6c319d09c111eef9f9dbcf?ds=sidebyside stgit.el: Bugfix "P" when point is not on a patch line Signed-off-by: Gustav HÃ¥llberg --- diff --git a/contrib/stgit.el b/contrib/stgit.el index bbc7eb1..c96b7ff 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -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)))