mu4e: update context handling

Make mu4e-context-autoswitch works a before we updated the pong-handler

Avoid unnecessary mu4e~start int he composer.
This commit is contained in:
Dirk-Jan C. Binnema 2020-02-18 22:23:16 +02:00
parent 000c19e505
commit c09a9c4372
3 changed files with 5 additions and 3 deletions

View File

@ -456,7 +456,8 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(setq message-default-charset 'utf-8))
;; make sure mu4e is started in the background (ie. we don't want to error
;; out when sending the message; better to do it now if there's a problem)
(mu4e~start) ;; start mu4e in background, if needed
(unless (mu4e-running-p)
(mu4e~start)) ;; start mu4e in background, if needed
(mu4e~compose-register-message-save-hooks)
;; set the default directory to the user's home dir; this is probably more
;; useful e.g. when finding an attachment file the directory the current

View File

@ -239,7 +239,7 @@ non-nil."
"When contexts are defined but there is no context yet, switch
to the first whose :match-func return non-nil. If none of them
match, return the first. For MSG and POLICY, see `mu4e-context-determine'."
(when (and mu4e-contexts (not mu4e~context-current))
(when mu4e-contexts
(let ((context (mu4e-context-determine msg policy)))
(when context (mu4e-context-switch
nil (mu4e-context-name context))))))

View File

@ -780,7 +780,8 @@ nothing."
"Handle 'pong' responses from the mu server."
(setq mu4e~server-props (plist-get data :props)) ;; save info from the server
(let ((doccount (plist-get mu4e~server-props :doccount)))
(mu4e~context-autoswitch nil mu4e-context-policy)
(unless (mu4e-context-current)
(mu4e~context-autoswitch nil mu4e-context-policy))
(mu4e~check-requirements)
(when func (funcall func))
(when (zerop doccount)