mu4e: better handle alternative address

In compose / contacts
This commit is contained in:
Dirk-Jan C. Binnema 2023-10-29 17:04:21 +02:00
parent 00191a3ec7
commit eee73f8199
3 changed files with 16 additions and 18 deletions

View File

@ -194,7 +194,7 @@ predicate function. A value of nil keeps all the addresses."
"If non-nil, do not include self.
Whether a given address belongs to this user (the \"self\") is
determined by `mu4e-personal-or-alternative-address', which
determined by `mu4e-personal-or-alternative-address-p', which
overrides `message-dont-reply-to-names' when replying to
messages, if `mu4e-compose-dont-reply-to-self' is non-nil."
:type 'boolean
@ -787,7 +787,7 @@ of message."
(let ((message-dont-reply-to-names
(if mu4e-compose-dont-reply-to-self
message-dont-reply-to-names
#'mu4e-personal-or-alternative-address)))
#'mu4e-personal-or-alternative-address-p)))
(message-reply nil wide)
(insert (mu4e--compose-cite parent))))))

View File

@ -149,23 +149,21 @@ with both the plain addresses and /regular expressions/."
(eq t (compare-strings addr nil nil m nil nil 'case-insensitive))))
(mu4e-personal-addresses))))
(defun mu4e-personal-or-alternative-address ()
"Return a function matching user's addresses.
Function takes one parameter, an address. This glues mu4e's
personal addresses together with gnus'
(defun mu4e-personal-or-alternative-address-p (addr)
"Is ADDR either a personal or an alternative address?
That is, does it match either `mu4e-personal-address-p' or
`message-alternative-emails'.
Note that this expanded definition of user-addresses is only for the
message composition."
(let* ((alts message-alternative-emails))
(lambda (addr)
(or (mu4e-personal-address-p addr)
(cond
((functionp alts) (funcall alts addr))
((stringp alts) (string-match alts addr))
(t nil))))))
Note that this expanded definition of user-addresses not used for
indexing mu does not know about `message-alternative-emails' so
it cannot use it for indexing."
(let ((alts message-alternative-emails))
(or (mu4e-personal-address-p addr)
(cond
((functionp alts) (funcall alts addr))
((stringp alts) (string-match alts addr))
(t nil)))))
;; Helpers

View File

@ -725,7 +725,7 @@ determine which browser function to use."
;; Possibly add headers (before "Attachments")
(gnus-display-mime-function (mu4e--view-gnus-display-mime msg))
(message-alternative-emails
(mu4e-personal-or-alternative-address)))
#'mu4e-personal-or-alternative-address-p))
(condition-case err
(progn
(mm-enable-multibyte)