From 2ebdf23dd0136dd138eb955bd3587d74f19ac43c Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 4 Apr 2024 18:59:54 +0300 Subject: [PATCH] mu4e-compose: explicitly remove Date: before update Seems older emacsen require that or they won't update the Date, see issue #2502. --- mu4e/mu4e-compose.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 07307fdb..8ab42713 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -445,6 +445,9 @@ If MSGPATH is nil, do nothing." (message-narrow-to-headers) (unless (message-fetch-field "Message-ID") (message-generate-headers '(Message-ID))) + ;; older Emacsen (<= 28 perhaps?) won't update the Date + ;; if there already is one; so make sure it's gone. + (message-remove-header "Date") (message-generate-headers '(Date))) (mu4e--delimit-headers 'undelimit))) ;; remove separator @@ -539,11 +542,13 @@ appropriate flag at the message forwarded or replied-to." ;; Remove References: if In-Reply-To: is missing. ;; This allows the user to effectively start a new message-thread by ;; removing the In-Reply-To header. - (when (eq mu4e-compose-type 'reply) - (unless (message-fetch-field "In-Reply-To") - (message-remove-header "References"))) - (when use-hard-newlines - (mu4e--send-harden-newlines)) + (save-restriction + (message-narrow-to-headers) + (when (eq mu4e-compose-type 'reply) + (unless (message-fetch-field "In-Reply-To") + (message-remove-header "References"))) + (when use-hard-newlines + (mu4e--send-harden-newlines))) ;; for safety, always save the draft before sending (set-buffer-modified-p t) (save-buffer))