aboutsummaryrefslogtreecommitdiff
path: root/git-email.el
diff options
context:
space:
mode:
authoryoctocell <public@yoctocell.xyz>2021-01-04 16:27:09 +0100
committeryoctocell <public@yoctocell.xyz>2021-01-04 16:30:08 +0100
commit69ba57db4b0e912e942d7fcb96e49634938d6dbb (patch)
tree2f2600be1c60c328e221d4a84b71dad65564f30f /git-email.el
parent2ed354ea4960aaf9263a6ad2ba5b4e73a25495db (diff)
Insert diff at beginning of body instead of EOF
Some mail clients will automatically pre-populate the message buffer with the users signature, inserting the diff at the end of the file would then mess up the formatting. This patch make it so that the diff is inserted after '--text follows this line--' or a pgp attachment. * git-email.el (git-email--compose-email):
Diffstat (limited to 'git-email.el')
-rw-r--r--git-email.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/git-email.el b/git-email.el
index 0539dc2..f510d30 100644
--- a/git-email.el
+++ b/git-email.el
@@ -207,11 +207,12 @@ them into the message buffer."
(diff (git-email--extract-diff patch-file)))
(funcall git-email-compose-email-function to (cadr (assoc "subject" used-headers))
used-headers)
- ;; (let ((body (or (re-search-forward "<#part .*>")
- ;; (re-search-forward "--text follows this line--"))))
- (goto-char (point-max))
- (save-excursion
- (insert diff))
+ (goto-char (point-min))
+ (let ((body (or (re-search-forward "<#part \\(encrypt\\|sign\\)=.*mime>" nil t)
+ (re-search-forward "--text follows this line--" nil t))))
+ (goto-char (+ body 1))
+ (save-excursion
+ (insert diff)))
(when (re-search-backward "\\*\\*\\* SUBJECT HERE \\*\\*\\*" nil t)
(kill-line))))