stgit.el: Fix some incorrect indentation
[stgit] / contrib / stgit.el
index c96b7ff..9dc8bfd 100644 (file)
@@ -267,7 +267,7 @@ Returns nil if there was no output."
                    (propertize
                     (substitute-command-keys "--\n\"\\[stgit-toggle-worktree]\"\
  shows the working tree\n")
-                   'face 'stgit-description-face)))
+                    'face 'stgit-description-face)))
     (stgit-run-series stgit-ewoc)
     (if curpatch
         (stgit-goto-patch curpatch (and curfile (stgit-file-file curfile)))
@@ -505,10 +505,8 @@ Cf. `stgit-file-type-change-string'."
   old-perm new-perm copy-or-rename cr-score cr-from cr-to status file)
 
 (defun stgit-describe-copy-or-rename (file)
-  (let (from to common-head common-tail
-        (arrow (concat " "
-                       (propertize "->" 'face 'stgit-description-face)
-                       " ")))
+  (let ((arrow (concat " " (propertize "->" 'face 'stgit-description-face) " "))
+        from to common-head common-tail)
 
     (when stgit-abbreviate-copies-and-renames
       (setq from (split-string (stgit-file-cr-from file) "/")
@@ -793,6 +791,7 @@ file for (applied) copies and renames."
             ("M" .        stgit-move-patches)
             ("S" .        stgit-squash)
             ("N" .        stgit-new)
+            ("c" .        stgit-new-and-refresh)
             ("\C-c\C-c" . stgit-commit)
             ("\C-c\C-u" . stgit-uncommit)
             ("U" .        stgit-revert-file)
@@ -851,6 +850,7 @@ Commands for patches:
 \\[stgit-diff] Show the patch log and diff
 
 \\[stgit-new]  Create a new, empty patch
+\\[stgit-new-and-refresh]      Create a new patch from index or work tree
 \\[stgit-rename]       Rename patch
 \\[stgit-edit] Edit patch description
 \\[stgit-delete]       Delete patch(es)
@@ -1049,10 +1049,10 @@ PATCHSYM."
     (let ((name-sym (intern name)))
       (when (memq old-patchsym stgit-expanded-patches)
         (setq stgit-expanded-patches
-            (cons name-sym (delq old-patchsym stgit-expanded-patches))))
+              (cons name-sym (delq old-patchsym stgit-expanded-patches))))
       (when (memq old-patchsym stgit-marked-patches)
         (setq stgit-marked-patches
-            (cons name-sym (delq old-patchsym stgit-marked-patches))))
+              (cons name-sym (delq old-patchsym stgit-marked-patches))))
       (stgit-reload)
       (stgit-goto-patch name-sym))))
 
@@ -1308,8 +1308,8 @@ which stage to diff against in the case of unmerged files."
                                  (and space-arg (list "-O" space-arg))
                                  (list (stgit-patch-name-at-point)))))
                (apply 'stgit-run args)))))
-         (t
-          (error "No patch or file at point")))
+        (t
+         (error "No patch or file at point")))
       (with-current-buffer standard-output
         (goto-char (point-min))
         (diff-mode)))))
@@ -1376,8 +1376,8 @@ file ended up. You can then jump to the file with \
                           (stgit-file-cr-to patched-file)
                         (stgit-file-file patched-file)))
            (point-file  (if (eq patched-status 'rename)
-                          (stgit-file-cr-from patched-file)
-                        (stgit-neighbour-file))))
+                            (stgit-file-cr-from patched-file)
+                          (stgit-neighbour-file))))
 
       (cond ((eq patch-name :work)
              (stgit-move-change-to-index (stgit-file-file patched-file)
@@ -1413,7 +1413,7 @@ file ended up. You can then jump to the file with \
     (with-current-buffer log-edit-parent-buffer
       (stgit-reload))))
 
-(defun stgit-new (add-sign)
+(defun stgit-new (add-sign &optional refresh)
   "Create a new patch.
 With a prefix argument, include a \"Signed-off-by:\" line at the
 end of the patch."
@@ -1422,6 +1422,7 @@ end of the patch."
         (dir default-directory))
     (log-edit 'stgit-confirm-new t nil edit-buf)
     (setq default-directory dir)
+    (set (make-local-variable 'stgit-refresh-after-new) refresh)
     (when add-sign
       (save-excursion
         (let ((standard-output (current-buffer)))
@@ -1429,12 +1430,25 @@ end of the patch."
 
 (defun stgit-confirm-new ()
   (interactive)
-  (let ((file (make-temp-file "stgit-edit-")))
+  (let ((file (make-temp-file "stgit-edit-"))
+        (refresh stgit-refresh-after-new))
     (write-region (point-min) (point-max) file)
     (stgit-capture-output nil
       (stgit-run "new" "-f" file))
     (with-current-buffer log-edit-parent-buffer
-      (stgit-reload))))
+      (if refresh
+          (stgit-refresh)
+        (stgit-reload)))))
+
+(defun stgit-new-and-refresh (add-sign)
+  "Create a new patch and refresh it with the current changes.
+
+With a prefix argument, include a \"Signed-off-by:\" line at the
+end of the patch.
+
+This works just like running `stgit-new' followed by `stgit-refresh'."
+  (interactive "P")
+  (stgit-new add-sign t))
 
 (defun stgit-create-patch-name (description)
   "Create a patch name from a long description"