diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index 741df3e6..8c4613a0 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -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 diff --git a/mu4e/mu4e-context.el b/mu4e/mu4e-context.el index 4e73f9f4..f82ceab4 100644 --- a/mu4e/mu4e-context.el +++ b/mu4e/mu4e-context.el @@ -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: ")) diff --git a/mu4e/mu4e-utils.el b/mu4e/mu4e-utils.el index 57c1f633..1f048f75 100644 --- a/mu4e/mu4e-utils.el +++ b/mu4e/mu4e-utils.el @@ -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 diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el index a603fc88..95652edf 100644 --- a/mu4e/mu4e-vars.el +++ b/mu4e/mu4e-vars.el @@ -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