Merge pull request #2468 from nbarrientos/issue2463

mu4e: allow to disable the global mode-line items
This commit is contained in:
Dirk-Jan C. Binnema
2023-04-06 07:22:48 +03:00
committed by GitHub
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 :type 'boolean
:group 'mu4e-modeline) :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 (defvar-local mu4e--modeline-buffer-items nil
"List of buffer-local items for the mu4e modeline. "List of buffer-local items for the mu4e modeline.
Each element is function that evaluates to a string.") Each element is function that evaluates to a string.")
@ -90,15 +98,17 @@ originate.")
(mapconcat (mapconcat
(lambda (func) (or (funcall func) "")) lst " "))) (lambda (func) (or (funcall func) "")) lst " ")))
(global-string ;; global string is _cached_ as it may be expensive. (global-string ;; global string is _cached_ as it may be expensive.
(or mu4e--modeline-global-string-cached (and
(setq mu4e--modeline-global-string-cached mu4e-modeline-show-global
(funcall collect mu4e--modeline-global-items))))) (or mu4e--modeline-global-string-cached
(setq mu4e--modeline-global-string-cached
(funcall collect mu4e--modeline-global-items))))))
(concat (concat
;; (local) buffer items are _not_ cached, so they'll get update ;; (local) buffer items are _not_ cached, so they'll get update
;; automatically when leaving the buffer. ;; automatically when leaving the buffer.
(mu4e--modeline-quote-and-truncate (mu4e--modeline-quote-and-truncate
(funcall collect mu4e--modeline-buffer-items)) (funcall collect mu4e--modeline-buffer-items))
" " (and global-string " ")
global-string))) global-string)))
(define-minor-mode mu4e-modeline-mode (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'' @item global: information about the results for the ``favorite query''
@end itemize @end itemize
All of the bookmark items provide more details in their @code{help-echo}, i.e., The global indicators can be disabled by setting @code{mu4e-modeline-show-global}
their tooltip. 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 @subsection Query parameters bookmark item
The query parameters in the modeline start with the various query flags (such as The query parameters in the modeline start with the various query flags (such as