From 6c2d68ea173a0bcfa6d424818ad2482087a379dc Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 16 Dec 2020 04:23:23 +0800 Subject: [PATCH] Mu4e: ensure that attachment isn't mixed with text Ensure that mail-add-attachment is called on a blank line at the end of the buffer. --- modules/email/mu4e/autoload/email.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/email/mu4e/autoload/email.el b/modules/email/mu4e/autoload/email.el index 73df19655..08744e34f 100644 --- a/modules/email/mu4e/autoload/email.el +++ b/modules/email/mu4e/autoload/email.el @@ -247,7 +247,13 @@ When otherwise called, open a dired buffer." (location (read-file-name "Attach: "))) (if (not (file-directory-p location)) (pcase major-mode - ('mu4e-compose-mode (mail-add-attachment location)) + ('mu4e-compose-mode + (save-excursion + (goto-char (point-max)) + (unless (eq (current-column) 0) + (insert "\n\n") + (forward-line 2)) + (mail-add-attachment location))) ('org-msg-edit-mode (org-msg-attach-attach location))) (split-window-sensibly) (with-current-buffer (dired location)