mu4e-compose: restrict to headers in before-save-hook-fn

Follow up to issue #1846.
This commit is contained in:
Dirk-Jan C. Binnema 2020-12-05 11:40:54 +02:00
parent ecafe54c99
commit 9cab1ae751
1 changed files with 5 additions and 3 deletions

View File

@ -361,10 +361,12 @@ Message-ID."
nil t))
(defun mu4e~compose-before-save-hook-fn ()
;; replace the date
"Add the message-id if necessary and update the date."
(save-excursion
(unless (message-fetch-field "Message-ID")
(message-generate-headers '(Date Message-ID)))
(save-restriction
(message-narrow-to-headers)
(unless (message-fetch-field "Message-ID")
(message-generate-headers '(Date Message-ID))))
(save-match-data
(mu4e~draft-remove-mail-header-separator))))