GNU bug report logs -
#77361
[PATCH] New user option to hide minor mode lighters
Previous Next
Reported by: Pengji Zhang <me <at> pengjiz.com>
Date: Sat, 29 Mar 2025 11:09:02 UTC
Severity: normal
Tags: patch
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Pengji Zhang <me <at> pengjiz.com>
> Date: Sat, 29 Mar 2025 19:07:40 +0800
>
> The attached patch adds a new user option to hide some minor mode
> lighters on the mode line (by collapsing them into a menu), which is to
> shorten the mode line and prioritize important information when many
> minor modes are on.
>
> There exist a few packages that solve the problem. To name a few:
>
> - diminish[1] and delight[2]. Both offer a way to change the minor mode
> lighters by modifying 'minor-mode-alist'. To hide a minor mode
> lighter, one may change it to nil.
>
> - minions[3], which partially inspired this patch. It replaces minor
> mode lighters by a menu to toggle all minor modes.
>
> This patch is different from those solutions in two aspects:
>
> - Unlike diminish or delight, one can still see the lighters by clicking
> the button, instead of hiding them permanently. Besides, this patch is
> compatible with those two packages.
>
> - Unlike minions, this patch focuses on *lighters* for *enabled* minor
> modes. The menu contains only lighters, making it a more space
> efficient replacement for lighters on mode line, instead of a way to
> manage minor modes like minions.
>
> So I hope this patch is still useful given the existing similar
> solutions.
>
> Please let me know what you think. Thanks!
Thanks, some comments below.
> >From c1e27606247761c31cec3d363714875c74b30277 Mon Sep 17 00:00:00 2001
> From: Pengji Zhang <me <at> pengjiz.com>
> Date: Sat, 29 Mar 2025 19:04:58 +0800
> Subject: [PATCH] New user option to hide minor mode lighters
>
> * lisp/bindings.el (mode-line-collapse-minor-modes): New user
> option.
> (mode-line-minor-modes): New variable to hold mode line
> constructs for minor modes.
> (mode-line-modes): Use the new variable 'mode-line-minor-modes',
> and adjust the order of elements so the indicator for hidden
> minor modes is shown towards the end.
> (mode-line--make-lighter-menu): New helper function to generate
> the menu for hidden minor modes.
> (mode-line--minor-modes): New helper function to computer mode
> line constructs for minor mode lighters.
>
> * doc/lispref/modes.texi (Mode Line Basics): Document the new
> user option.
> * etc/NEWS (Note): Annouce the new user option.
Please in future submissions of the patch mention the bug number in
the log message.
> --- a/doc/lispref/modes.texi
> +++ b/doc/lispref/modes.texi
> @@ -2163,6 +2163,18 @@ Mode Line Basics
> variable can be buffer-local to only compress mode-lines in certain
> buffers.
>
> +@vindex mode-line-collapse-minor-modes
> + To further ``compress'' the mode line, you may customize the
> +@code{mode-line-collapse-minor-modes} option to a non-@code{nil} value,
> +and Emacs will hide some minor mode indicators on the mode line by
> +collapsing them into a single clickable button. The option can also be
> +a list of symbols to select minor modes indicators to hide or show. If
> +the list starts with the symbol @code{not}, it specifies minor modes to
> +show, otherwise it means minor modes to hide. For example, setting it
> +to @code{(not flymake-mode)} makes only the indicator for Flymake mode
> +shown, and setting it to @code{(eldoc-mode)} hides only the indicator
> +for ElDoc mode.
I think this text and the preceding paragraph should be moved to the
Emacs user manual, into the "Optional Mode Line" node. These are
user-facing features, so their place is not in the ELisp Reference
manual.
For the user manual, the above description of the possible values of
mode-line-collapse-minor-modes is too detailed. I suggest to have
there only the first sentence, and then refer to the doc string for
the various alternative forms of the value.
> ++++
> +*** New user option 'mode-line-collapse-minor-modes'.
> +If non-nil, minor mode lighters on the mode line are collapsed into a
> +single button. It could also be a list to specify minor mode lighters
^^^^^^^^^^^^^^^^^^^^^^^
"The value could also be a list..."
> +(defcustom mode-line-collapse-minor-modes nil
> + "Minor modes for which mode line lighters are hidden.
> +Hidden lighters are collapsed into one.
> +
> +The value could be a list (MODES ...) which means to collapse lighters
> +only for MODES, or a list (not MODES ...) which means to collapse all
> +lighters for minor modes not in MODES. Other non-nil values make all
> +lighters hidden."
> + :type '(choice (const :tag "No modes" nil)
> + (repeat :tag "Modes" symbol)
> + (cons :tag "All modes except"
> + (const not) (repeat symbol))
> + (const :tag "All modes" t))
> + :group 'mode-line)
The :version tag is missing.
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.