mu4e-context: improve mode-line item

This commit is contained in:
Dirk-Jan C. Binnema 2023-01-17 20:06:10 +02:00
parent 3716e6da3b
commit d7eed9e9ff
1 changed files with 10 additions and 8 deletions

View File

@ -214,12 +214,16 @@ as it is."
(defun mu4e--context-modeline-item ()
"Propertized string with the current context or nil."
(when (mu4e-context-current)
(concat
"["
(propertize (mu4e-quote-for-modeline
(mu4e-context-name (mu4e-context-current)))
'face 'mu4e-context-face) "] " )))
(when-let* ((ctx (mu4e-context-current))
(name (and ctx (mu4e-context-name ctx))))
(concat
"<"
(propertize
name
'face 'mu4e-context-face
'help-echo
(format "mu4e context: %s" name))
">")))
(define-minor-mode mu4e-context-minor-mode
"Mode for switching the mu4e context."
@ -229,14 +233,12 @@ as it is."
:lighter ""
(mu4e--modeline-register #'mu4e--context-modeline-item))
(defvar mu4e--context-menu-items
'("--"
["Switch-context" mu4e-context-switch
:help "Switch the mu4e context"])
"Easy menu items for mu4e-context.")
;;;
(provide 'mu4e-context)
;;; mu4e-context.el ends here