From ff8e0455dc0acab6bb25ff673e9a33dabceb9ea3 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 14 Jun 2022 23:12:41 +0300 Subject: [PATCH] mu4e-compose/compose-mail: add brackets for in-reply-to Seems in some contexts we get them _without_ brackets in other-headers; so let's fix that up. Fixes #2273. --- mu4e/mu4e-compose.el | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 0e31f2f4..6cc1c29d 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -858,11 +858,15 @@ buffer buried." (message-add-header (concat "Subject: " subject "\n")) ;; add any other headers specified - (when other-headers - (dolist (h other-headers other-headers) - (if (symbolp (car h)) (setcar h (symbol-name (car h)))) - (message-add-header - (concat (capitalize (car h)) ": " (cdr h) "\n" )))) + (seq-each (lambda(hdr) + (let ((field (capitalize(car hdr))) (value (cdr hdr))) + ;; fix in-reply without <> + (when (and (string= field "In-Reply-To") + (string-match-p "\\`[^ @]+@[^ @]+\\'" value) + (not (string-match-p "\\`<.*>\\'" value))) + (setq value (concat "<" value ">"))) + (message-add-header (concat (capitalize field) ": " value "\n")))) + other-headers) ;; yank message (if (bufferp yank-action)