From 5fd965bb132620ef2a6c319d09c111eef9f9dbcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustav=20H=C3=A5llberg?= Date: Fri, 14 Aug 2009 10:45:15 +0200 Subject: [PATCH] stgit.el: Bugfix "P" when point is not on a patch line MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gustav HÃ¥llberg --- contrib/stgit.el | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 @@ With numeric prefix argument, pop that many patches." (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))) -- 2.11.0