Mu4e: Fix setting default context

The default-p argument to `set-email-account!` now works as intended.
mu4e checks the first context on startup to determine the default and
uses functions for that, so we can't really get around it by setting
the bare mu4e~context-current variable.
This commit is contained in:
Liam Hupfer 2021-07-10 13:50:20 -05:00 committed by TEC
parent 95971d2dc7
commit 3d54471b2a
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C

View file

@ -23,6 +23,7 @@ default/fallback account."
(when (version< mu4e-mu-version "1.4")
(when-let (address (cdr (assq 'user-mail-address letvars)))
(add-to-list 'mu4e-user-mail-address-list address)))
;; remove existing context with same label
(setq mu4e-contexts
(cl-loop for context in mu4e-contexts
unless (string= (mu4e-context-name context) label)
@ -37,9 +38,7 @@ default/fallback account."
(string-prefix-p (format "/%s" label)
(mu4e-message-field msg :maildir))))
:vars letvars)))
(push context mu4e-contexts)
(when default-p
(setq-default mu4e-context-current context))
(add-to-list 'mu4e-contexts context (not default-p))
context)))