mu4e: allow to disable the global mode-line items

Fixes #2463
This commit is contained in:
Nacho Barrientos 2023-04-05 09:51:35 +02:00 committed by Dirk-Jan C. Binnema
parent 3dc633364d
commit 0291573909
2 changed files with 19 additions and 6 deletions

View File

@ -48,6 +48,14 @@ display the bookmark name rather than the query."
:type 'boolean
:group 'mu4e-modeline)
(defcustom mu4e-modeline-show-global t
"Whether to populate global modeline segments.
If non-nil, show both buffer-specific and global modeline items,
otherwise only present buffer-specific information."
:type 'boolean
:group 'mu4e-modeline)
(defvar-local mu4e--modeline-buffer-items nil
"List of buffer-local items for the mu4e modeline.
Each element is function that evaluates to a string.")
@ -90,15 +98,17 @@ originate.")
(mapconcat
(lambda (func) (or (funcall func) "")) lst " ")))
(global-string ;; global string is _cached_ as it may be expensive.
(or mu4e--modeline-global-string-cached
(setq mu4e--modeline-global-string-cached
(funcall collect mu4e--modeline-global-items)))))
(and
mu4e-modeline-show-global
(or mu4e--modeline-global-string-cached
(setq mu4e--modeline-global-string-cached
(funcall collect mu4e--modeline-global-items))))))
(concat
;; (local) buffer items are _not_ cached, so they'll get update
;; automatically when leaving the buffer.
(mu4e--modeline-quote-and-truncate
(funcall collect mu4e--modeline-buffer-items))
" "
(and global-string " ")
global-string)))
(define-minor-mode mu4e-modeline-mode

View File

@ -3127,8 +3127,11 @@ To completely turn off the modeline support, set @code{mu4e-modeline-support} to
@item global: information about the results for the ``favorite query''
@end itemize
All of the bookmark items provide more details in their @code{help-echo}, i.e.,
their tooltip.
The global indicators can be disabled by setting @code{mu4e-modeline-show-global}
to @t{nil}.
All of the bookmark items provide more details in their @code{help-echo},
i.e., their tooltip.
@subsection Query parameters bookmark item
The query parameters in the modeline start with the various query flags (such as