mu4e: make mu4e-context-current interactive

So it will output the name of the current context when used in an
interactive context.
This commit is contained in:
djcb 2017-05-06 12:54:43 +03:00
parent 465e069a3d
commit 6bde2618ab
1 changed files with 10 additions and 4 deletions

View File

@ -37,9 +37,16 @@ describing mu4e's contexts.")
"The current context; for internal use. Use
`mu4e-context-switch' to change it.")
(defun mu4e-context-current ()
"Get the currently active context, or nil if there is none."
mu4e~context-current)
(defun mu4e-context-current (&optional output)
"Get the currently active context, or nil if there is none.
When OUTPUT is non-nil, echo the name of the current context or
none."
(interactive "p")
(let ((ctx mu4e~context-current))
(when output
(mu4e-message "Current context: %s"
(if ctx (mu4e-context-name ctx) "<none>")))
ctx))
(defun mu4e-context-label ()
"Propertized string with the current context name, or \"\" if
@ -155,4 +162,3 @@ match, POLICY determines what to do:
(otherwise nil))))))
(provide 'mu4e-context)