GNU bug report logs - #30978
25.3; Suggestion: define-minor-mode should define mode-lighter variable

Previous Next

Package: emacs;

Reported by: Howard Melman <hmelman <at> gmail.com>

Date: Wed, 28 Mar 2018 20:13:02 UTC

Severity: wishlist

Tags: moreinfo, wontfix

Found in version 25.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Howard Melman <hmelman <at> gmail.com>
Cc: 30978 <at> debbugs.gnu.org
Subject: bug#30978: 25.3; Suggestion: define-minor-mode should define mode-lighter variable
Date: Thu, 29 Jul 2021 14:11:07 +0200
Howard Melman <hmelman <at> gmail.com> writes:

> Maybe include an example of disabling a lighter in the elisp
> manual (where minor-mode-alist is mentioned).  E.g.,
>
>     (setcar (cdr (assoc 'eldoc-mode minor-mode-alist)) "")
>
> I realize this is "pretty easy" lisp but it's not a simple
> setq and I think non-lispers might want to do this.

Kévin Le Gouguec <kevin.legouguec <at> gmail.com> writes:

> Manipulating minor-mode-alist is not that hard indeed; there are some
> sources of hassle though:
>
> (1) figuring out the name of the mode variable (e.g. auto-fill-function,
>     defining-kbd-macro);
>
> (2) some modes seem not to add their variables to minor-mode-alist for
>     some reason (e.g. caps-lock-mode on GNU ELPA), so this recipe does
>     not work (neither does delight); one needs to fallback to
>     add-to-list.
>
> Nothing too herculean, but I'm sure some users would appreciate a
> built-in function to figure out this stuff for them.

I did consider adding a new function like `set-minor-mode-lighter' that
would just alter `minor-mode-alist' like that setcar, but that has (at
least) two problems -- the one you mention in (1), and loading
precedence issues: If you alter the entry in `minor-mode-alist', and
then load the .el file with the `define-minor-mode', then it'll
overwrite your own setting.

So you have to say

(require 'foo)
(setcar ...)

in your .emacs to make it work reliably, so just adding a naive helper
function, or talking about this too much, is that helpful, because it'll
trip people up.

Adding a -lighter defcustom would indeed have none of these problems,
but I'm just not sure that people would use it enough to justify the
(minor) performance impact, as well as the defcustom explosion.  Which
is why I think that using a package like delight is the right solution
here for those that want to change the lighters.  Probably.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 300 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.