Mu4e: Select reply account when multiple addrs set

Modify +mu4e-set-from-address-h to account for messages with multiple
to/from headers by finding the intersection between the headers and
registered accounts.

While I'm at it, there was a rather silly typo in the when-let line
that's been corrected.
This commit is contained in:
TEC 2021-07-31 01:32:57 +08:00
parent 6b690547b0
commit 896f7dd3df
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C

View file

@ -334,16 +334,15 @@ When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-
within a context, set `user-mail-address' to an alias found in the 'To' or
'From' headers of the parent message if present, or prompt the user for a
preferred alias"
(when-let ((addresses (if (or mu4e-contexts+mu4e-personal-addresses)
(when-let ((addresses (if (or mu4e-contexts +mu4e-personal-addresses)
(and (> (length +mu4e-personal-addresses) 1)
+mu4e-personal-addresses)
(mu4e-personal-addresses))))
(setq user-mail-address
(if mu4e-compose-parent-message
(let ((to (cdr (car (mu4e-message-field mu4e-compose-parent-message :to))))
(from (cdr (car (mu4e-message-field mu4e-compose-parent-message :from)))))
(cond
((member to addresses) to)
((member from addresses) from)
(t (completing-read "From: " addresses))))
(let ((to (mapcar #'cdr (mu4e-message-field mu4e-compose-parent-message :to)))
(from (mapcar #'cdr (mu4e-message-field mu4e-compose-parent-message :from))))
(or (car (seq-intersection to addresses))
(car (seq-intersection from addresses))
(completing-read "From: " addresses)))
(completing-read "From: " addresses)))))