mu4e: support message-user-organization

Automatically include Organziation: if set and update when changing the context.

Fixes: issue #2112.
This commit is contained in:
Dirk-Jan C. Binnema
2021-11-07 12:46:15 +02:00
parent 90a748aba1
commit 67b16acbb2
4 changed files with 16 additions and 2 deletions

View File

@ -281,6 +281,7 @@ removing the In-Reply-To header."
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
(define-key map (kbd "C-c C-u") 'mu4e-update-mail-and-index)
(define-key map (kbd "C-c C-k") 'mu4e-message-kill-buffer)
(define-key map (kbd "C-c ;") 'mu4e-compose-context-switch)
(define-key map (kbd "M-q") 'mu4e-fill-paragraph)
map)))
@ -643,10 +644,14 @@ when the buffer is in `mu4e-compose-mode':
"Draft must be saved before switching context. Save?"))
(unless (and (not force)
(eq old-context (mu4e-context-switch nil name)))
;; Change From field to user-mail-address
;; Change From / Organization if needed.
(message-replace-header "Organization"
(or (message-make-organization) "")
'("Subject")) ;; keep in same place
(message-replace-header "From"
(or (mu4e~draft-from-construct) ""))
;; Move message to mu4e-draft-folder
;; Move message to mu4e-draft-folder
(if has-file
(progn (save-buffer)
(let ((msg-id (message-fetch-field "Message-ID"))