X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/adeef6bc6f43fbccb1a046e00f57c559ee363737..e558a4abe4756f98845f1b8443b8730f816bd4e3:/contrib/stgit.el?ds=sidebyside diff --git a/contrib/stgit.el b/contrib/stgit.el index 7fd3786..c8d9368 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -65,7 +65,9 @@ Argument DIR is the repository path." buf)) (defmacro stgit-capture-output (name &rest body) - "Capture StGit output and show it in a window at the end." + "Capture StGit output and, if there was any output, show it in a window +at the end. +Returns nil if there was no output." `(let ((output-buf (get-buffer-create ,(or name "*StGit output*"))) (stgit-dir default-directory) (inhibit-read-only t)) @@ -526,7 +528,7 @@ find copied files." ("r" . stgit-refresh) ("\C-c\C-r" . stgit-rename) ("e" . stgit-edit) - ("c" . stgit-coalesce) + ("S" . stgit-squash) ("N" . stgit-new) ("R" . stgit-repair) ("C" . stgit-commit) @@ -562,11 +564,23 @@ Commands: (defun stgit-add-mark (patchsym) "Mark the patch PATCHSYM." - (setq stgit-marked-patches (cons patchsym stgit-marked-patches))) + (setq stgit-marked-patches (cons patchsym stgit-marked-patches)) + (save-excursion + (when (stgit-goto-patch patchsym) + (move-to-column 1) + (let ((inhibit-read-only t)) + (insert-and-inherit ?*) + (delete-char 1))))) (defun stgit-remove-mark (patchsym) "Unmark the patch PATCHSYM." - (setq stgit-marked-patches (delq patchsym stgit-marked-patches))) + (setq stgit-marked-patches (delq patchsym stgit-marked-patches)) + (save-excursion + (when (stgit-goto-patch patchsym) + (move-to-column 1) + (let ((inhibit-read-only t)) + (insert-and-inherit ? ) + (delete-char 1))))) (defun stgit-clear-marks () "Unmark all patches." @@ -636,22 +650,19 @@ If that patch cannot be found, return nil." "Mark the patch under point." (interactive) (let ((patch (stgit-patch-at-point t))) - (stgit-add-mark patch) - (stgit-reload)) + (stgit-add-mark patch)) (stgit-next-patch)) (defun stgit-unmark-up () "Remove mark from the patch on the previous line." (interactive) (stgit-previous-patch) - (stgit-remove-mark (stgit-patch-at-point t)) - (stgit-reload)) + (stgit-remove-mark (stgit-patch-at-point t))) (defun stgit-unmark-down () "Remove mark from the patch on the current line." (interactive) (stgit-remove-mark (stgit-patch-at-point t)) - (stgit-reload) (stgit-next-patch)) (defun stgit-rename (name) @@ -866,26 +877,26 @@ the work tree and index." (apply 'stgit-run "delete" args)) (stgit-reload))))) -(defun stgit-coalesce (patchsyms) - "Coalesce the patches in PATCHSYMS. -Interactively, coalesce the marked patches." +(defun stgit-squash (patchsyms) + "Squash the patches in PATCHSYMS. +Interactively, squash the marked patches." (interactive (list stgit-marked-patches)) (when (< (length patchsyms) 2) - (error "Need at least two patches to coalesce")) + (error "Need at least two patches to squash")) (let ((edit-buf (get-buffer-create "*StGit edit*")) (dir default-directory)) - (log-edit 'stgit-confirm-coalesce t nil edit-buf) + (log-edit 'stgit-confirm-squash t nil edit-buf) (set (make-local-variable 'stgit-patchsyms) patchsyms) (setq default-directory dir) (let ((standard-output edit-buf)) - (apply 'stgit-run-silent "coalesce" "--save-template=-" patchsyms)))) + (apply 'stgit-run-silent "squash" "--save-template=-" patchsyms)))) -(defun stgit-confirm-coalesce () +(defun stgit-confirm-squash () (interactive) (let ((file (make-temp-file "stgit-edit-"))) (write-region (point-min) (point-max) file) (stgit-capture-output nil - (apply 'stgit-run "coalesce" "-f" file stgit-patchsyms)) + (apply 'stgit-run "squash" "-f" file stgit-patchsyms)) (with-current-buffer log-edit-parent-buffer (stgit-clear-marks) ;; Go to first marked patch and stay there