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

@ -45,6 +45,11 @@
your hook-functions (or elsewhere) you can check if anything changed using
the new variable ~mu4e-index-update-status~.
- `message-user-organization` can now be used to set the `Organization:`
header. See its docstring for details.
- undo is now supported across message-saves
- a lot of the internals have been changed:
- =mu4e= is slowly moving from using the =~= to the more common =--= separator

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"))

View File

@ -607,6 +607,8 @@ You can append flags."
(defun mu4e~draft-common-construct ()
"Construct the common headers for each message."
(concat
(when-let ((organization (message-make-organization)))
(mu4e~draft-header "Organization" organization))
(when mu4e-user-agent-string
(mu4e~draft-header "User-agent" mu4e-user-agent-string))
(mu4e~draft-header "Date" (message-make-date))))

View File

@ -2458,6 +2458,7 @@ when starting; see the discussion in the previous section.
:to "aliced@@home.example.com")))
:vars '( ( user-mail-address . "aliced@@home.example.com" )
( user-full-name . "Alice Derleth" )
( message-user-organization . "Homebase" )
( mu4e-compose-signature .
(concat
"Alice Derleth\n"
@ -2473,6 +2474,7 @@ when starting; see the discussion in the previous section.
(string-match-p "^/Arkham" (mu4e-message-field msg :maildir))))
:vars '( ( user-mail-address . "aderleth@@miskatonic.example.com" )
( user-full-name . "Alice Derleth" )
( message-user-organization . "Miskatonic University" )
( mu4e-compose-signature .
(concat
"Prof. Alice Derleth\n"