From b98b46466ada12b42c5060ecea3f605a3cb14332 Mon Sep 17 00:00:00 2001 From: yoctocell Date: Sat, 9 Jan 2021 15:51:44 +0100 Subject: Delete patches after sending them * git-email.el (git-email-format-patch): Delete the patches generated by 'git format-patch' after sending the emails. --- git-email.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'git-email.el') diff --git a/git-email.el b/git-email.el index f3b8aae..e89fcef 100644 --- a/git-email.el +++ b/git-email.el @@ -311,11 +311,15 @@ them into the message buffer." (cadr (log-view-current-entry (point) t)))) ;;;###autoload -(defun git-email-format-patch (&optional args) +(defun git-email-format-patch (&optional args keep) "Format and send patch(es) using 'git format-patch'. + With optional ARGS (\\[universal-argument]) you can specify extra arguments to give to 'git format-patch'. By default, the -arguments in `git-email-format-patch-default-args' will be used." +arguments in `git-email-format-patch-default-args' will be used. + +If KEEP is a non-nil value, keep the generated patches. The default +behavior is to delete them after sending email." (interactive "P") (let* ((rev (or (seq-some (lambda (fn) (funcall fn)) @@ -340,7 +344,8 @@ arguments in `git-email-format-patch-default-args' will be used." (dolist (file files) (run-hooks 'git-email-pre-compose-email-hook) (git-email--compose-email file) - (run-hooks 'git-email-post-compose-email-hook)))) + (run-hooks 'git-email-post-compose-email-hook)) + (mapc #'delete-file files))) ;;;; Operate on emails (defun git-email-send-all () -- cgit v1.2.3