X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/82a12e6e69b54fce426b71c5889303977fb9cdb9..f9182fcafc4fb715758c5da6d5232ec4d012a2e3:/contrib/stgit.el diff --git a/contrib/stgit.el b/contrib/stgit.el index 17b5d6b..d371e71 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -82,6 +82,7 @@ (define-key stgit-mode-map "g" 'stgit-refresh) (define-key stgit-mode-map "r" 'stgit-rename) (define-key stgit-mode-map ">" 'stgit-push-next) (define-key stgit-mode-map "<" 'stgit-pop-next) + (define-key stgit-mode-map "P" 'stgit-push-or-pop) (define-key stgit-mode-map "=" 'stgit-show)) (defun stgit-mode () @@ -138,6 +139,21 @@ (defun stgit-pop-next () (stgit-capture-output nil (stgit-run "pop")) (stgit-refresh)) +(defun stgit-applied-at-point () + "Is the patch on the current line applied?" + (save-excursion + (beginning-of-line) + (looking-at "[>+]"))) + +(defun stgit-push-or-pop () + "Push or pop the patch on the current line" + (interactive) + (let ((patch (stgit-patch-at-point)) + (applied (stgit-applied-at-point))) + (stgit-capture-output nil + (stgit-run (if applied "pop" "push") patch)) + (stgit-refresh))) + (defun stgit-show () "Show the patch on the current line" (interactive)