From 69ba57db4b0e912e942d7fcb96e49634938d6dbb Mon Sep 17 00:00:00 2001 From: yoctocell Date: Mon, 4 Jan 2021 16:27:09 +0100 Subject: 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): --- git-email.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'git-email.el') 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)))) -- cgit v1.2.3