mu4e-draft: move the user-agent setting

This updates commit 411407f03e and moves
the check to where we set the special headers.
This commit is contained in:
Dirk-Jan C. Binnema
2024-08-28 23:05:33 +03:00
parent fbe8c24cef
commit 797ca3e37f

View File

@ -565,13 +565,14 @@ PARENT is the parent message, if any."
(defun mu4e--prepare-draft-headers (compose-type) (defun mu4e--prepare-draft-headers (compose-type)
"Add extra headers for message based on COMPOSE-TYPE." "Add extra headers for message based on COMPOSE-TYPE."
(message-generate-headers (let ((message-newsreader mu4e-user-agent-string))
(seq-filter #'identity ;; ensure needed headers are generated. (message-generate-headers
`(From Subject Date Message-ID (seq-filter #'identity ;; ensure needed headers are generated.
,(when (memq compose-type '(reply forward)) 'References) `(From Subject Date Message-ID
,(when (eq compose-type 'reply) 'In-Reply-To) ,(when (memq compose-type '(reply forward)) 'References)
,(when message-newsreader 'User-Agent) ,(when (eq compose-type 'reply) 'In-Reply-To)
,(when message-user-organization 'Organization))))) ,(when message-newsreader 'User-Agent)
,(when message-user-organization 'Organization))))))
(defun mu4e--prepare-draft-buffer (compose-type parent) (defun mu4e--prepare-draft-buffer (compose-type parent)
"Prepare the current buffer as a draft-buffer. "Prepare the current buffer as a draft-buffer.
@ -723,8 +724,7 @@ Returns the new buffer."
;; compose-func ;; compose-func
(let ((draft-buffer) (let ((draft-buffer)
(oldframe (selected-frame)) (oldframe (selected-frame))
(oldwinconf (current-window-configuration)) (oldwinconf (current-window-configuration)))
(message-newsreader mu4e-user-agent-string))
(with-temp-buffer (with-temp-buffer
;; provide a temp buffer so the compose-func can do its thing ;; provide a temp buffer so the compose-func can do its thing
(setq draft-buffer (mu4e--validate-hidden-buffer (funcall compose-func))) (setq draft-buffer (mu4e--validate-hidden-buffer (funcall compose-func)))