summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-12-22 15:52:37 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-12-22 22:31:03 -0700
commitb756b09c5fc6e32f13e4ba32423ee3a221481d64 (patch)
treeab382f95622f3061cd2e1368886cd331ff10ddfe
parentbffc5311bee634ed10c955bc184ef1c373b94028 (diff)
downloadmailscripts-b756b09c5fc6e32f13e4ba32423ee3a221481d64.tar.gz
mailscripts-prepare-patch: call mailscripts-git-format-patch-append
Expand comment about the control flow in this function. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--mailscripts.el22
1 files changed, 18 insertions, 4 deletions
diff --git a/mailscripts.el b/mailscripts.el
index d152e92..81c3ccc 100644
--- a/mailscripts.el
+++ b/mailscripts.el
@@ -269,10 +269,24 @@ generate patches, etc.."
(call-interactively
(if (eq (vc-deduce-backend) 'Git)
;; For Git, default to one message per patch, like git-send-email(1).
- (if (and (local-variable-p 'vc-prepare-patches-separately)
- (not vc-prepare-patches-separately))
- #'mailscripts-git-format-patch-attach
- #'mailscripts-git-format-patch-drafts)
+ ;; Only use attachments when configured for this project.
+ ;;
+ ;; We presently assume that if patches-as-attachments has been
+ ;; configured for this project, it's unlikely that you'll want to send
+ ;; any messages with --scissors patches. That may not be correct.
+ (cond
+ ((and (local-variable-p 'vc-prepare-patches-separately)
+ (not vc-prepare-patches-separately))
+ #'mailscripts-git-format-patch-attach)
+ ((and (catch 'found
+ (dolist (buffer (buffer-list))
+ (when (and (string-search "unsent " (buffer-name buffer))
+ (with-current-buffer buffer
+ (derived-mode-p 'mail-mode 'message-mode)))
+ (throw 'found t))))
+ (yes-or-no-p "Append -- >8 -- patch to unsent message?"))
+ #'mailscripts-git-format-patch-append)
+ (t #'mailscripts-git-format-patch-drafts))
#'vc-prepare-patch)))
;;;###autoload