stgit.el: Default to showing index and work tree
[stgit] / contrib / stgit.el
index 132c19e..ae74b46 100644 (file)
@@ -9,6 +9,9 @@
 ;;
 ;; To start: `M-x stgit'
 
+(when (< emacs-major-version 22)
+  (error "Emacs older than 22 is not supported by stgit.el"))
+
 (require 'git nil t)
 (require 'cl)
 (require 'ewoc)
@@ -718,8 +721,10 @@ file for (applied) copies and renames."
             ("G" .        stgit-goto)
             ("=" .        stgit-diff)
             ("D" .        stgit-delete)
-            ([(control ?/)] . stgit-undo)
+            ([?\C-/] .    stgit-undo)
             ("\C-_" .     stgit-undo)
+            ([?\C-c ?\C-/] . stgit-redo)
+            ("\C-c\C-_" . stgit-redo)
             ("B" .        stgit-branch)
             ("t" .        ,toggle-map)
             ("d" .        ,diff-map)
@@ -1392,7 +1397,9 @@ deepest patch had before the squash."
 
 (defun stgit-undo (&optional arg)
   "Run stg undo.
-With prefix argument, run it with the --hard flag."
+With prefix argument, run it with the --hard flag.
+
+See also `stgit-redo'."
   (interactive "P")
   (stgit-capture-output nil
     (if arg
@@ -1400,6 +1407,18 @@ With prefix argument, run it with the --hard flag."
       (stgit-run "undo")))
   (stgit-reload))
 
+(defun stgit-redo (&optional arg)
+  "Run stg redo.
+With prefix argument, run it with the --hard flag.
+
+See also `stgit-undo'."
+  (interactive "P")
+  (stgit-capture-output nil
+    (if arg
+        (stgit-run "redo" "--hard")
+      (stgit-run "redo")))
+  (stgit-reload))
+
 (defun stgit-refresh (&optional arg)
   "Run stg refresh.
 If the index contains any changes, only refresh from index.
@@ -1437,7 +1456,7 @@ See also `stgit-show-worktree'."
   :group 'stgit)
 
 (defcustom stgit-default-show-worktree
-  nil
+  t
   "Set to non-nil to by default show the working tree in a new stgit buffer.
 
 This value is used as the default value for `stgit-show-worktree'."