Subject: [StGit PATCH 05/17] Emacs mode: push/pop next patch, not patch at point

From: David Kågedal <[email-masked]>
Date: Fri, 14 Dec 2007 11:57:19 +0100

From: Karl Hasselström <[email-masked]>

The three operations we should have are:

  * Pop the topmost applied patch, no matter where point is.

  * Push the first unapplied patch, no matter where point is.

  * Push/pop the patch at point, depending on whether it's currently
    applied.

This patch makes "<" and ">" do the first two operations. The third is
coming in a later patch.

Signed-off-by: Karl Hasselström <[email-masked]>
Signed-off-by: David Kågedal <[email-masked]>
---

 contrib/stgit.el |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/contrib/stgit.el b/contrib/stgit.el
index cce0c0e..17b5d6b 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -81,7 +81,7 @@ Argument DIR is the repository path."
   (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)
+  (define-key stgit-mode-map "<"   'stgit-pop-next)
   (define-key stgit-mode-map "="   'stgit-show))
 
 (defun stgit-mode ()
@@ -127,22 +127,16 @@ Commands:
     (stgit-goto-patch name)))
 
 (defun stgit-push-next ()
-  "Push the patch on the line after pos"
+  "Push the first unapplied patch"
   (interactive)
-  (forward-line 1)
-  (let ((patch (stgit-patch-at-point)))
-    (stgit-capture-output nil
-      (stgit-run "push" patch))
-    (stgit-refresh)))
+  (stgit-capture-output nil (stgit-run "push"))
+  (stgit-refresh))
 
-(defun stgit-pop ()
-  "Pop the patch on the current line"
+(defun stgit-pop-next ()
+  "Pop the topmost applied patch"
   (interactive)
-  (let ((patch (stgit-patch-at-point)))
-    (stgit-capture-output nil
-      (stgit-run "pop" patch))
-    (stgit-refresh)
-    (previous-line)))
+  (stgit-capture-output nil (stgit-run "pop"))
+  (stgit-refresh))
 
 (defun stgit-show ()
   "Show the patch on the current line"