GNU bug report logs - #78582
30.1; which-key-mode overwrites custom key bindings

Previous Next

Package: emacs;

Reported by: Rick <rbielaws <at> gmail.com>

Date: Sat, 24 May 2025 21:17:02 UTC

Severity: normal

Found in version 30.1

Full log


Message #86 received at 78582 <at> debbugs.gnu.org (full text, mbox):

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: murray.alex <at> gmail.com, luangruo <at> yahoo.com, Eli Zaretskii <eliz <at> gnu.org>,
 78582 <at> debbugs.gnu.org
Subject: Re: bug#78582: 30.1; which-key-mode overwrites custom key bindings
Date: Mon, 02 Jun 2025 17:08:57 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> doc.c:
>>   310 static void
>>   311 reread_doc_file (Lisp_Object file)
>>   312 {
>>   313   if (NILP (file))
>>   314     Fsnarf_documentation (Vdoc_file_name);
>>   315   else
>>   316     save_match_data_load (file, Qt, Qt, Qt, Qnil);
>>   317 }
>>
>> Secondly, doc strings can point to loaddefs.el
>>
>>   (function-documentation 'rectangle-mark-mode)
>>    => ("loaddefs.elc" . 1059343)
>
> AFAICT the problem you describe is not specific to `loaddefs.el`.
> The same thing can happen with any file that has a `global-set-key` call
> at top-level.
>
> This reloading business is supposed to happen only if the in-memory
> doc-string-reference is out-of-sync with the installed files, presumably
> because you're running Emacs "in place" and the files have changed in
> the mean time.
> If that's indeed your situation, then "all is well": the problem you're
> seeing is "on purpose".  You can fix it by removing the above reloading
> mechanism (in exchange for being unable to see the docstring in those
> cases where the reloading would be needed).
>

Alas, the "supposed to happen only" is apparently not the case. The
Emacs where I see this is an Emacs installation. In the case of macOS,
this means "make install" has created an Emacs.app directory, a "bundle"
as it is called on macOS, containing what a "normal" installation would
contain. That Emacs.app I copied to the Desktop folder and start if from
there.

Too bad that I don't have a debug build so that I could see more.
Why does it think in my case that it needs to reread_doc_file?

> I tend to see this every once in a while where `C-x C-c` (which
> I normally rebind to a less-drastic operation) gets redefined
> to its default binding because `files.elc` gets reloaded.  🙂
>
> Maybe we should try and work harder to make such reloading more harmless
> (e.g. replace the `define-key/global-set-key`s with functions which do
> nothing if the key is already bound?), but it's an issue that affects
> only those people who hack on the code of the very Emacs they're
> running, so it's not super-high priority.

See above 🤷.





This bug report was last modified 9 days ago.

Previous Next


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