mu4e: context policy tweaking

As discussed in issue #751, mu4e should tried to accommodate some
different ways of choosing the context.

We add a new policy `ask-if-none', that will only query the user if
there is no context yet; this is the new default for
mu4e-context-policy, i.e. what happens when entering the main view.

The default policy for mu4e-compose-context-policy is now `ask',
i.e. ask if none of the contexts match.

The idea is for the defaults to ask when we don't know a context, and we
can't determine one using the match functions; this is probably the
least confusing. When user gets annoyed by too many question, they can
tweak the behavior to their liking. I.e. 'ask questions first, shoot
later'

Document all of this.
This commit is contained in:
djcb
2016-01-03 13:29:19 +02:00
parent 8e43e8cac3
commit b373f8e5f0
5 changed files with 150 additions and 113 deletions

View File

@ -217,25 +217,27 @@ Suggested possible values are:
:options '(completing-read ido-completing-read)
:group 'mu4e)
(defcustom mu4e-context-policy 'pick-first
"Determines how mu4e should determine the context when starting up.
(defcustom mu4e-context-policy 'ask-if-none
"The policy to determine the context when entering the mu4e main view.
If POLICY is 'always-ask, we ask the user unconditionally.
If the value is `always-ask', 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, and if there is no current context, POLICY determines what
to do:
function), this context is used. Otherwise, if none of the
contexts match, we have the following choices:
- pick-first: pick the first of the contexts available
- ask: ask the user
- otherwise, return nil. Effectively, this leaves the current context in place.
- `pick-first': pick the first of the contexts available (ie. the default)
- `ask': ask the user
- `ask-if-none': ask if there is no context yet, otherwise leave it as it is
- nil: return nil; leaves the current context as is.
Also see `mu4e-compose-context-policy'."
:type '(choice
(const :tag "Always ask what context to use" 'always-ask)
(const :tag "Always ask what context to use, even if one matches"
'always-ask)
(const :tag "Ask if none of the contexts match" 'ask)
(const :tag "Pick the default (first) context if none match" 'pick-first)
(const :tag "Ask when there's no context yet" 'ask-if-none)
(const :tag "Pick the first context if none match" 'pick-first)
(const :tag "Don't change the context when none match" nil)
:safe 'symbolp
:group 'mu4e))
@ -779,7 +781,6 @@ when mu4e starts.")
(defvar mu4e~headers-last-query nil
"The present (most recent) query.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; our handlers funcs