mirror of https://github.com/djcb/mu.git
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:
parent
9da7fbb3de
commit
a085c881ef
|
@ -127,7 +127,8 @@ If POLICY is
|
||||||
|
|
||||||
In all other cases, if any context matches (using its match
|
In all other cases, if any context matches (using its match
|
||||||
function), this context is returned. If none of the contexts
|
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
|
- pick-first: pick the first of the contexts available
|
||||||
- ask: ask the user
|
- ask: ask the user
|
||||||
|
|
|
@ -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
|
In all other cases, if any context matches (using its match
|
||||||
function), this context is returned. If none of the contexts
|
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
|
- pick-first: pick the first of the contexts available
|
||||||
- ask: ask the user
|
- ask: ask the user
|
||||||
|
@ -138,11 +139,14 @@ match, POLICY determines what to do:
|
||||||
(when mu4e-contexts
|
(when mu4e-contexts
|
||||||
(if (eq policy 'always-ask)
|
(if (eq policy 'always-ask)
|
||||||
(mu4e~context-ask-user "Select context: ")
|
(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)
|
(and (mu4e-context-match-func context)
|
||||||
(funcall (mu4e-context-match-func context) msg)))
|
(funcall (mu4e-context-match-func context) msg)))
|
||||||
mu4e-contexts)
|
mu4e-contexts)
|
||||||
;; no context found
|
;; no matching one; but is there a current one?
|
||||||
|
(mu4e-context-current)
|
||||||
|
;; no context found yet; consult policy
|
||||||
(case policy
|
(case policy
|
||||||
(pick-first (car mu4e-contexts))
|
(pick-first (car mu4e-contexts))
|
||||||
(ask (mu4e~context-ask-user "Select context: "))
|
(ask (mu4e~context-ask-user "Select context: "))
|
||||||
|
|
|
@ -97,9 +97,9 @@ User's addresses are set in `mu4e-user-mail-address-list')."
|
||||||
(declare (indent 2))
|
(declare (indent 2))
|
||||||
`(let* ((vars (and ,context (mu4e-context-vars ,context))))
|
`(let* ((vars (and ,context (mu4e-context-vars ,context))))
|
||||||
(progv ;; XXX: perhaps use eval's lexical environment instead of progv?
|
(progv ;; XXX: perhaps use eval's lexical environment instead of progv?
|
||||||
(mapcar (lambda(cell) (car cell)) vars)
|
(mapcar (lambda(cell) (car cell)) vars)
|
||||||
(mapcar (lambda(cell) (cdr cell)) vars)
|
(mapcar (lambda(cell) (cdr cell)) vars)
|
||||||
(eval ,@body))))
|
(eval ,@body))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; the standard folders can be functions too
|
;; the standard folders can be functions too
|
||||||
|
|
|
@ -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
|
In all other cases, if any context matches (using its match
|
||||||
function), this context is returned. If none of the contexts
|
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
|
- pick-first: pick the first of the contexts available
|
||||||
- ask: ask the user
|
- ask: ask the user
|
||||||
|
|
Loading…
Reference in New Issue