GNU bug report logs -
#79518
30.2; Enabled-by-default minor modes are not described by describe-mode
Previous Next
To reply to this bug, email your comments to 79518 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Fri, 26 Sep 2025 02:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Phil Sainty <psainty <at> orcon.net.nz>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Fri, 26 Sep 2025 02:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
I noticed this with `windmove-mode' which is defined with:
(define-minor-mode windmove-mode
"Global minor mode for default windmove commands."
:keymap windmove-mode-map
:init-value t
:global t)
When using "C-h m" the *Help* buffer makes no mention of it.
If I toggle that mode off and then back on, and try "C-h m" again,
then the mode is listed.
I can trivially reproduce this with new modes with ":init-value t":
(define-minor-mode my-local-mode "local" :init-value t)
(define-minor-mode my-global-mode "global" :global t :init-value t)
(If testing, it helps to use "C-c @ C-q" to collapse the *Help*
buffer to just the headings.)
-Phil
In GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw scroll bars) of 2025-09-02 built on phil-lp
Repository revision: 636f166cfc86aa90d63f592fd99f3fdd9ef95ebd
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version
11.0.12101004
System Description: Ubuntu 22.04.5 LTS
Configured using:
'configure --prefix=/home/phil/emacs/30.x.nc/usr/local
--with-native-compilation=aot --with-x-toolkit=lucid --without-sound
'--program-transform-name=s/^ctags$/ctags_emacs/''
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
X11 XDBE XIM XPM LUCID ZLIB
Important settings:
value of $LC_MONETARY: en_NZ.UTF-8
value of $LC_NUMERIC: en_NZ.UTF-8
value of $LC_TIME: en_NZ.UTF-8
value of $LANG: en_GB.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: ELisp/l
Minor modes in effect:
savehist-mode: t
windmove-mode: t
winner-mode: t
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
minibuffer-regexp-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug cus-start cus-load shortdoc misearch
multi-isearch diary-lib diary-loaddefs help-fns radix-tree mule-util
cal-move vc-git diff-mode track-changes easy-mmode vc-dispatcher
oc-basic cl-extra help-mode org-element org-persist org-id org-refile
org-element-ast inline avl-tree generator ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus
compile comp-run comp-common xml gnus-cloud nnimap nnmail browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source cl-seq
eieio eieio-core cl-macs json map byte-opt gv bytecomp byte-compile
url-vars mail-source utf7 nnoo parse-time gnus-spec gnus-int gnus-range
message sendmail mailcap yank-media puny rfc822 mml mml-sec
password-cache epa derived epg rfc6068 epg-config mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
gmm-utils mailheader gnus-win gnus nnheader gnus-util
text-property-search mail-utils range mm-util mail-prsvr wid-edit
ol-docview doc-view filenotify jka-compr image-mode exif ol-bibtex
bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie treesit
executable ob-comint org-pcomplete pcomplete comint ansi-osc ansi-color
org-list org-footnote org-faces org-entities time-date subr-x noutline
outline icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx
org-fold org-fold-core org-keys oc org-loaddefs thingatpt find-func
cal-menu calendar cal-loaddefs org-version org-compat org-macs
format-spec savehist windmove winner ring dired-aux cl-loaddefs cl-lib
dired dired-loaddefs advice rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
x multi-tty move-toolbar make-network-process native-compile emacs)
Memory information:
((conses 16 352962 50390) (symbols 48 23621 0) (strings 32 84991 2057)
(string-bytes 1 3217165) (vectors 16 38605)
(vector-slots 8 498693 30384) (floats 8 396 105)
(intervals 56 1458 0) (buffers 992 20))
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility.
(Fri, 26 Sep 2025 11:58:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Phil Sainty <psainty <at> orcon.net.nz>:
bug acknowledged by developer.
(Fri, 26 Sep 2025 11:58:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 79518-done <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 26 Sep 2025 14:02:57 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
>
> I noticed this with `windmove-mode' which is defined with:
>
> (define-minor-mode windmove-mode
> "Global minor mode for default windmove commands."
> :keymap windmove-mode-map
> :init-value t
> :global t)
>
> When using "C-h m" the *Help* buffer makes no mention of it.
>
> If I toggle that mode off and then back on, and try "C-h m" again,
> then the mode is listed.
Thanks, fixed on the master branch, and closing the bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Sat, 27 Sep 2025 23:32:07 GMT)
Full text and
rfc822 format available.
Message #13 received at 79518 <at> debbugs.gnu.org (full text, mbox):
>> I noticed this with `windmove-mode' which is defined with:
>>
>> (define-minor-mode windmove-mode
>> "Global minor mode for default windmove commands."
>> :keymap windmove-mode-map
>> :init-value t
>> :global t)
>>
>> When using "C-h m" the *Help* buffer makes no mention of it.
That's because the package is not even loaded.
>> If I toggle that mode off and then back on, and try "C-h m" again,
>> then the mode is listed.
You can also just `M-x load-library RET` after which `C-h m` should show
you that same info.
> Thanks, fixed on the master branch, and closing the bug.
This fix causes `windmove.el` to be loaded unconditionally every time
Emacs is launched, I don't think that was the intention: if we want
that, then we should preload this file.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Sun, 28 Sep 2025 05:23:06 GMT)
Full text and
rfc822 format available.
Message #16 received at 79518 <at> debbugs.gnu.org (full text, mbox):
> Cc: 79518 <at> debbugs.gnu.org
> Date: Sat, 27 Sep 2025 19:31:25 -0400
> From: Stefan Monnier via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> >> I noticed this with `windmove-mode' which is defined with:
> >>
> >> (define-minor-mode windmove-mode
> >> "Global minor mode for default windmove commands."
> >> :keymap windmove-mode-map
> >> :init-value t
> >> :global t)
> >>
> >> When using "C-h m" the *Help* buffer makes no mention of it.
>
> That's because the package is not even loaded.
>
> >> If I toggle that mode off and then back on, and try "C-h m" again,
> >> then the mode is listed.
>
> You can also just `M-x load-library RET` after which `C-h m` should show
> you that same info.
>
> > Thanks, fixed on the master branch, and closing the bug.
>
> This fix causes `windmove.el` to be loaded unconditionally every time
> Emacs is launched, I don't think that was the intention: if we want
> that, then we should preload this file.
Thanks, I've reverted that commit.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Sun, 28 Sep 2025 06:59:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 79518 <at> debbugs.gnu.org (full text, mbox):
On 2025-09-28 12:31, Stefan Monnier wrote:
>>> I noticed this with `windmove-mode' which is defined with:
>>> When using "C-h m" the *Help* buffer makes no mention of it.
>
> That's because the package is not even loaded.
True; I can see in lisp/ldefs-boot.el:
(defvar windmove-mode t "DOCSTRING")
(custom-autoload 'windmove-mode "windmove" nil)
(autoload 'windmove-mode "windmove" "DOCSTRING" t)
(autoload 'windmove-default-keybindings "windmove" "DOCSTRING" t)
...
So if I run "emacs -Q" then `windmove-mode' is t, but the library
hasn't been loaded.
However, if I then call (windmove-default-keybindings) then the
library IS loaded, and the mode is having an effect, but the bug
remains: There is no mention of `windmove-mode' in the `describe-mode'
*Help* buffer. Not unless you toggle the mode off and back on.
>>> If I toggle that mode off and then back on, and try "C-h m" again,
>>> then the mode is listed.
>
> You can also just `M-x load-library RET` after which `C-h m` should
> show you that same info.
This is not the case (which aligns with the autoloading not having
that effect when calling (windmove-default-keybindings).
Furthermore, this does not seem particular to `windmove-mode' but
rather a general issue with ":init t" for minor modes. As mentioned
in the initial report, I can replicate the same problem like so:
(define-minor-mode my-local-mode "local" :init-value t)
(define-minor-mode my-global-mode "global" :global t :init-value t)
Evaluating those forms causes both modes to be enabled, but with
neither of them described by `describe-mode' (unless I toggle them
off and back on -- or just forcibly re-enable them -- after which
they appear).
-Phil
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Sun, 28 Sep 2025 07:02:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 79518 <at> debbugs.gnu.org (full text, mbox):
On 2025-09-28 19:58, Phil Sainty wrote:
> rather a general issue with ":init t" for minor modes.
By which I meant ":init-value t" of course.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Tue, 30 Sep 2025 21:47:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 79518 <at> debbugs.gnu.org (full text, mbox):
> However, if I then call (windmove-default-keybindings) then the
> library IS loaded, and the mode is having an effect, but the bug
> remains: There is no mention of `windmove-mode' in the `describe-mode'
> *Help* buffer. Not unless you toggle the mode off and back on.
Hmm... indeed, I was confused about the way `global-minor-modes` works.
Maybe a patch like:
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 3f8c9f49a93..844af3ad18f 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -320,12 +320,16 @@
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `%s'."))))
- `(defcustom ,mode ,init-value
+ `(progn
+ (defcustom ,mode ,init-value
,(format base-doc-string pretty-name mode mode)
,@set
,@initialize
,@type
- ,@(nreverse extra-keywords)))))
+ ,@(nreverse extra-keywords))
+ (when init-value
+ (if ,getter
+ (add-to-list 'global-minor-modes ',modefun)))))))
;; The actual function.
,(funcall
is in order?
Stefan ":init-value is evil"
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Tue, 30 Sep 2025 21:58:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 79518 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> However, if I then call (windmove-default-keybindings) then the
>> library IS loaded, and the mode is having an effect, but the bug
>> remains: There is no mention of `windmove-mode' in the `describe-mode'
>> *Help* buffer. Not unless you toggle the mode off and back on.
>
> Hmm... indeed, I was confused about the way `global-minor-modes` works.
>
> Maybe a patch like:
>
> diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
> index 3f8c9f49a93..844af3ad18f 100644
> --- a/lisp/emacs-lisp/easy-mmode.el
> +++ b/lisp/emacs-lisp/easy-mmode.el
> @@ -320,12 +320,16 @@
> Setting this variable directly does not take effect;
> either customize it (see the info node `Easy Customization')
> or call the function `%s'."))))
> - `(defcustom ,mode ,init-value
> + `(progn
> + (defcustom ,mode ,init-value
> ,(format base-doc-string pretty-name mode mode)
> ,@set
> ,@initialize
> ,@type
> - ,@(nreverse extra-keywords)))))
> + ,@(nreverse extra-keywords))
> + (when init-value
> + (if ,getter
> + (add-to-list 'global-minor-modes ',modefun)))))))
>
> ;; The actual function.
> ,(funcall
>
> is in order?
Even after fixing the obvious errors, the problem is that
`lisp/loaddefs.el` is loaded before `simple.el` so when the above code
tries to add `windmove-mode` to `global-minor-modes`,
`global-minor-modes` doesn't exist yet. 🙁
So I suggest the patch below.
Stefan
[minor-modes.patch (text/x-diff, inline)]
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index a3ab5f18690..d883c4bb680 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -332,12 +332,16 @@ define-minor-mode
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `%s'."))))
- `(defcustom ,mode ,init-value
- ,(format base-doc-string pretty-name mode mode)
- ,@set
- ,@initialize
- ,@type
- ,@(nreverse extra-keywords)))))
+ `(progn
+ (defcustom ,mode ,init-value
+ ,(format base-doc-string pretty-name mode mode)
+ ,@set
+ ,@initialize
+ ,@type
+ ,@(nreverse extra-keywords))
+ ,(when init-value
+ `(when ,getter
+ (add-to-list 'global-minor-modes ',modefun)))))))
;; The actual function.
,(funcall
@@ -360,30 +364,21 @@ define-minor-mode
'toggle)))))
(let ((,last-message (current-message)))
(,@setter
- (cond ((eq arg 'toggle)
- (not ,getter))
- ((and (numberp arg)
- (< arg 1))
- nil)
- (t
- t)))
+ (cond ((eq arg 'toggle) (not ,getter))
+ (t (not (and (numberp arg) (< arg 1))))))
;; Keep minor modes list up to date.
- ,@(if globalp
- ;; When running this byte-compiled code in earlier
- ;; Emacs versions, these variables may not be defined
- ;; there. So check defensively, even if they're
- ;; always defined in Emacs 28 and up.
- `((when (boundp 'global-minor-modes)
- (setq global-minor-modes
- (delq ',modefun global-minor-modes))
- (when ,getter
- (push ',modefun global-minor-modes))))
- ;; Ditto check.
- `((when (boundp 'local-minor-modes)
- (setq local-minor-modes
- (delq ',modefun local-minor-modes))
- (when ,getter
- (push ',modefun local-minor-modes)))))
+ ,(let ((minor-modes-var (if globalp
+ 'global-minor-modes
+ 'local-minor-modes)))
+ ;; When running this byte-compiled code in earlier
+ ;; Emacs versions, these variables may not be defined
+ ;; there. So check defensively, even if they're
+ ;; always defined in Emacs 28 and up.
+ `(when (boundp ',minor-modes-var)
+ (if ,getter
+ (add-to-list ',minor-modes-var ',modefun)
+ (setq ,minor-modes-var
+ (delq ',modefun ,minor-modes-var)))))
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,getter ',hook-on ',hook-off))
diff --git a/lisp/simple.el b/lisp/simple.el
index fb60ba5ca16..1092506984b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -157,10 +157,6 @@ next-error--message-highlight-overlay
nil
"Overlay highlighting the current error message in the `next-error' buffer.")
-(defvar global-minor-modes nil
- "A list of the currently enabled global minor modes.
-This is a list of symbols.")
-
(defcustom next-error-hook nil
"List of hook functions run by `next-error' after visiting source file."
:type 'hook
diff --git a/lisp/subr.el b/lisp/subr.el
index 08c22737539..e743263b619 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3055,6 +3055,10 @@ minor-mode-list
hs-minor-mode)
"List of all minor mode functions.")
+(defvar global-minor-modes nil
+ "A list of the currently enabled global minor modes.
+This is a list of symbols.")
+
(defun add-minor-mode (toggle name &optional keymap after toggle-fun)
"Register a new minor mode.
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#79518; Package
emacs.
(Tue, 14 Oct 2025 15:49:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 79518-done <at> debbugs.gnu.org (full text, mbox):
> So I suggest the patch below.
Pushed to `master`, closing,
Stefan
This bug report was last modified 22 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.