From eee73f8199803a8d699eb0062ab0d7365b58f1aa Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 29 Oct 2023 17:04:21 +0200 Subject: [PATCH] mu4e: better handle alternative address In compose / contacts --- mu4e/mu4e-compose.el | 4 ++-- mu4e/mu4e-contacts.el | 28 +++++++++++++--------------- mu4e/mu4e-view.el | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 66f7a907..ae8ddce2 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -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)))))) diff --git a/mu4e/mu4e-contacts.el b/mu4e/mu4e-contacts.el index e8f957fe..e63057cf 100644 --- a/mu4e/mu4e-contacts.el +++ b/mu4e/mu4e-contacts.el @@ -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 diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 36a32d79..ab9fd2b4 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -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)