Hi,
I feel like I should be able to figure this out, or find other discussion of it in the archives, but I’ve been unsuccessful.
I recently upgraded from 1.10.x to 1.12.5. I’ve noticed that when I switch accounts, my email address is no longer updated. (I want no...@work.domain for work messages,
n...@nwalsh.com for non-work ones, etc.)
This is the function that I add as an mu4e-compose-pre-hook, but it no longer works, and the Multiple-accounts.html page no longer exists :-(
Is my error obvious?
(defun my-mu4e-set-account ()
"Set the account for composing a message.
This function is taken from:
https://www.djcbsoftware.nl/code/mu/mu4e/Multiple-accounts.html"
(let* ((account
(cond
(mu4e-compose-parent-message
(let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
(string-match "/\\(.*?\\)/" maildir)
(match-string 1 maildir)))
((mu4e-context-current)
(mu4e-context-name (mu4e-context-current)))
(t
(completing-read (format "Compose with account: (%s) "
(mapconcat #'(lambda (var) (car var))
my-mu4e-account-alist "/"))
(mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
nil t nil nil (caar my-mu4e-account-alist)))))
(account-vars (cdr (assoc account my-mu4e-account-alist))))
(if account-vars
(mapc #'(lambda (var)
(set (car var) (cadr var)))
account-vars)
(error (concat "No email account found: " account)))))
The my-mu4e-account-alist might have been part of the original solution, or I might have added it. It’s something like this:
(defvar my-mu4e-account-alist
'(("Personal"
(mu4e-sent-folder "/Personal/Sent")
(mu4e-drafts-folder "/Personal/Drafts")
(user-mail-address "
n...@nwalsh.com")
)
("Work"
(mu4e-sent-folder "/Work/Sent")
(mu4e-drafts-folder "/Work/Drafts")
(user-mail-address "no...@work.domain")
)
…
))
Be seeing you,
norm
--
Norm Tovey-Walsh <
n...@nwalsh.com>
https://norm.tovey-walsh.com/
> There is only one difference between a madman and me. I am not
> mad.--Salvador Dali