mu4e: don't change context at startup when there is one

Since people often go start/stop mu4e, we shouldn't try to pick a
default context if one is already set.
This commit is contained in:
djcb 2015-12-30 17:39:59 +02:00
parent 9da7fbb3de
commit a085c881ef
4 changed files with 15 additions and 9 deletions

View File

@ -127,7 +127,8 @@ If POLICY is
In all other cases, if any context matches (using its match
function), this context is returned. If none of the contexts
match, POLICY determines what to do:
match, and if there is no current context, POLICY determines what
to do:
- pick-first: pick the first of the contexts available
- ask: ask the user

View File

@ -130,7 +130,8 @@ POLICY specifies how to do the determination. If POLICY is
In all other cases, if any context matches (using its match
function), this context is returned. If none of the contexts
match, POLICY determines what to do:
match, and if there is no current context, POLICY determines what
to do:
- pick-first: pick the first of the contexts available
- ask: ask the user
@ -138,11 +139,14 @@ match, POLICY determines what to do:
(when mu4e-contexts
(if (eq policy 'always-ask)
(mu4e~context-ask-user "Select context: ")
(or (find-if (lambda (context)
(or ;; is there a matching one?
(find-if (lambda (context)
(and (mu4e-context-match-func context)
(funcall (mu4e-context-match-func context) msg)))
mu4e-contexts)
;; no context found
mu4e-contexts)
;; no matching one; but is there a current one?
(mu4e-context-current)
;; no context found yet; consult policy
(case policy
(pick-first (car mu4e-contexts))
(ask (mu4e~context-ask-user "Select context: "))

View File

@ -97,9 +97,9 @@ User's addresses are set in `mu4e-user-mail-address-list')."
(declare (indent 2))
`(let* ((vars (and ,context (mu4e-context-vars ,context))))
(progv ;; XXX: perhaps use eval's lexical environment instead of progv?
(mapcar (lambda(cell) (car cell)) vars)
(mapcar (lambda(cell) (cdr cell)) vars)
(eval ,@body))))
(mapcar (lambda(cell) (car cell)) vars)
(mapcar (lambda(cell) (cdr cell)) vars)
(eval ,@body))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; the standard folders can be functions too

View File

@ -224,7 +224,8 @@ If POLICY is 'always-ask, we ask the user unconditionally.
In all other cases, if any context matches (using its match
function), this context is returned. If none of the contexts
match, POLICY determines what to do:
match, and if there is no current context, POLICY determines what
to do:
- pick-first: pick the first of the contexts available
- ask: ask the user