From 6bde2618ab9a6b5ab9be7351b280ebf001586881 Mon Sep 17 00:00:00 2001 From: djcb Date: Sat, 6 May 2017 12:54:43 +0300 Subject: [PATCH] mu4e: make mu4e-context-current interactive So it will output the name of the current context when used in an interactive context. --- mu4e/mu4e-context.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mu4e/mu4e-context.el b/mu4e/mu4e-context.el index fa3f3a9f..9d8e6a83 100644 --- a/mu4e/mu4e-context.el +++ b/mu4e/mu4e-context.el @@ -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) ""))) + 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) -