From bbd8f55700030078d043c73e327f8a29d008595f Mon Sep 17 00:00:00 2001 From: John Whitbeck Date: Sat, 11 Mar 2017 22:17:56 -0800 Subject: [PATCH] mu4e: fix sending emails with no body --- mu4e/mu4e-draft.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mu4e/mu4e-draft.el b/mu4e/mu4e-draft.el index dca747f5..8a06e048 100644 --- a/mu4e/mu4e-draft.el +++ b/mu4e/mu4e-draft.el @@ -302,10 +302,15 @@ separator is never written to the message file. Also see ;; search for the first empty line (goto-char (point-min)) (if (search-forward-regexp "^$" nil t) - (replace-match sepa) - (progn ;; no empty line? then prepend one - (goto-char (point-max)) - (insert "\n" sepa)))))) + (progn + (replace-match sepa) + ;; `message-narrow-to-headers` searches for a `mail-header-separator` followed by a new + ;; line. Therefore, we must insert a newline if on the last line of the buffer. + (when (= (point) (point-max)) + (insert "\n"))) + (progn ;; no empty line? then prepend one + (goto-char (point-max)) + (insert "\n" sepa)))))) (defun mu4e~draft-remove-mail-header-separator () "Remove `mail-header-separator; we do this before saving a