Subject: Re: bug#78582: 30.1; which-key-mode overwrites custom key bindings

From: Eli Zaretskii <[email-masked]>
Date: Sun, 25 May 2025 09:16:25 +0300

> Date: Sat, 24 May 2025 16:16:23 -0500
> From: Rick <[email-masked]>
> 
> The problem can't be reproduced with -Q however with -q one only needs
> 2 lines in .emacs to recreate.  Also, be forewarned that the problem 
> DOES NOT happen if you specify --debug-init.  This is the only command 
> line option I tried and it hampered predictable recreation efforts.
> 
> .emacs content =
> 
>     (global-set-key [f3] 'describe-key) 
>     (custom-set-variables '(which-key-mode t))
> 
> Upon startup, quickly type C-h k F3.
> It shows F3 is bound to describe-key as expected and the key works 
> normally as do any others you have set. Try it as much as you like.
> 
> Now comes the insidious part.  If you type the 'k' a little bit too
> slowly F3 is overwritten by kmacro-start-macro-or-insert-counter.
> Specifically, type C-h and wait before typing k.  Then F3.

I cannot reproduce this.  I tried both on GNU/Linux and on MS-Windows,
with Emacs 30.1 and the current master branch (which will be some day
Emacs 31), and I don't see the problem.  But then I don't actually
understand what you mean by "F3 is overwritten by
kmacro-start-macro-or-insert-counter" -- can you describe what you
see?  What I see is the *Help* buffer showing the description of
describe-key, as expected.  And that doesn't change if I type 'k'
immediately or after a delay, the only difference between these two is
that when I wait before typing 'k', Emacs pops up the which-key
display showing the possible keys to type after "C-h".  But once I
type 'k', all the rest is the same regardless.

Are you sure you don't have some early-init or site-start file which
could explain the problem?

Does the problem happen if you start "emacs -Q" and then evaluate
those two lines in *scratch* ?

Can anyone else reproduce this strange problem?