git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH 1/3] stgit.el: Added undo command

From
David Kågedal <davidk@lysator.liu.se>
Date
Oct 30, 2008, 09:52 UTC
Message-ID
<20081030095248.10290.81253.stgit@krank>
In-Reply-To
<20081030095221.10290.58637.stgit@krank>
Bound it to the two standard bindings C-/ and C-_.
Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---
 contrib/stgit.el |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/contrib/stgit.el b/contrib/stgit.el
index aafefaf..e6b7d70 100644
--- a/contrib/stgit.el
+++ b/contrib/stgit.el
@@ -165,7 +165,9 @@ Argument DIR is the repository path."
   (define-key stgit-mode-map "P"   'stgit-push-or-pop)
   (define-key stgit-mode-map "G"   'stgit-goto)
   (define-key stgit-mode-map "="   'stgit-show)
-  (define-key stgit-mode-map "D"   'stgit-delete))
+  (define-key stgit-mode-map "D"   'stgit-delete)
+  (define-key stgit-mode-map [(control ?/)] 'stgit-undo)
+  (define-key stgit-mode-map "\C-_" 'stgit-undo))
 
 (defun stgit-mode ()
   "Major mode for interacting with StGit.
@@ -408,4 +410,14 @@ Commands:
   (interactive)
   (describe-function 'stgit-mode))
 
+(defun stgit-undo (&optional arg)
+  "Run stg undo.
+With prefix argument, run it with the --hard flag."
+  (interactive "P")
+  (stgit-capture-output nil
+    (if arg
+        (stgit-run "undo" "--hard")
+      (stgit-run "undo")))
+  (stgit-refresh))
+
 (provide 'stgit)
Previous: David KågedalNext: Karl Hasselström
Message 2 of 6 in “stgit.el patches”
  1. 0/3 stgit.el patchesDavid Kågedal, Oct 30, 2008
  2. 1/3 stgit.el: Added undo commandDavid Kågedal, Oct 30, 2008
  3. Karl HasselströmOct 30, 2008
  4. David KågedalOct 30, 2008
  5. 2/3 stgit.el: Added numeric prefix argument to push and pop commands.David Kågedal, Oct 30, 2008
  6. 3/3 stgit.el: Adapt to new output from stg series.David Kågedal, Oct 30, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.