From: Gustav Hållberg Date: Thu, 26 Feb 2009 19:59:07 +0000 (+0100) Subject: stgit.el: make stgit-delete with prefix argument spill patch contents to index X-Git-Tag: v0.15-rc1~47 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/9008e45b6a5573ae35f151dcfc16af8971b94b55?hp=0584ad1dfd6c3df0f009e36f189e4391f9355b4c stgit.el: make stgit-delete with prefix argument spill patch contents to index Signed-off-by: Gustav Hållberg Signed-off-by: Karl Hasselström --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 7c83a9e..3c8734c 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -804,19 +804,29 @@ (defun stgit-create-patch-name (description) (substring patch 0 20)) (t patch)))) -(defun stgit-delete (patchsyms) +(defun stgit-delete (patchsyms &optional spill-p) "Delete the patches in PATCHSYMS. -Interactively, delete the marked patches, or the patch at point." - (interactive (list (stgit-patches-marked-or-at-point))) +Interactively, delete the marked patches, or the patch at point. + +With a prefix argument, or SPILL-P, spill the patch contents to +the work tree and index." + (interactive (list (stgit-patches-marked-or-at-point) + current-prefix-arg)) (unless patchsyms (error "No patches to delete")) (let ((npatches (length patchsyms))) - (when (yes-or-no-p (format "Really delete %d patch%s? " + (when (yes-or-no-p (format "Really delete %d patch%s%s? " npatches - (if (= 1 npatches) "" "es"))) - (stgit-capture-output nil - (apply 'stgit-run "delete" patchsyms)) - (stgit-reload)))) + (if (= 1 npatches) "" "es") + (if spill-p + " (spilling contents to index)" + ""))) + (let ((args (if spill-p + (cons "--spill" patchsyms) + patchsyms))) + (stgit-capture-output nil + (apply 'stgit-run "delete" args)) + (stgit-reload))))) (defun stgit-coalesce (patchsyms) "Coalesce the patches in PATCHSYMS.