[emacs] Fix mu4e-change-from-to-catchall to access message fields via plist

This commit is contained in:
Sebastian Schulze 2022-11-09 16:24:34 +01:00
parent e56c6b3bd4
commit df32aeaa2b
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
1 changed files with 6 additions and 6 deletions

View File

@ -209,12 +209,12 @@
(magit-status-setup-buffer))))
(defun bascht/mu4e-change-from-to-catchall (msg)
"Set the From address based on the To address of the original message."
(when msg
(setq user-mail-address
(cond
((mu4e-message-contact-field-matches msg :to "bascht.com") (cdr-safe (car-safe (mu4e-message-field msg :to))))
(t user-mail-address)))))
"Set the From address based on the To address of the original message if I reply."
(setq user-mail-address
(if (and msg (mu4e-message-contact-field-matches msg :to "bascht.com"))
(plist-get (car-safe (mu4e-message-field msg :to)) :email)
(cdr-safe (assoc 'user-mail-address (mu4e-context-vars (mu4e-context-current)))))))
(after! mu4e
(setq
org-msg-signature (with-current-buffer (find-file-noselect "/home/bascht/.signature") (buffer-string))