Subject: bug#66022: 30.0.50; kmacro overwriting global keybindings

From: Andreas Schwab <[email-masked]>
Date: Sat, 16 Sep 2023 09:01:37 +0200

On Sep 16 2023, Gerd Möllmann wrote:

> current master 1442f4043a761e9bdeeb4e1fbe9822c2987c1502, emacs -Q
>
>   (keymap-global-set "S-<mouse-3>" 'ignore)
>
> then C-x ( C-g.
>
>   (keymap-lookup global-map "S-<mouse-3>")
>   => kmacro-end-call-mouse
>
> Notice that the binding has been overwritten.

That's kmacro-call-mouse-event.

> This is actually not the binding I care about, but it's the only one I
> can easily reproduce with emacs -Q.  With my init file, and with a
> (trace-function 'global-set-key) I see
>
> ======================================================================
> 1 -> (global-set-key "(" kmacro-start-macro)
> 1 <- global-set-key: kmacro-start-macro
> ======================================================================
> 1 -> (global-set-key ")" kmacro-end-macro)
> 1 <- global-set-key: kmacro-end-macro
> ======================================================================
> 1 -> (global-set-key "e" kmacro-end-and-call-macro)
> 1 <- global-set-key: kmacro-end-and-call-macro
> ======================================================================
> 1 -> (global-set-key [f3] kmacro-start-macro-or-insert-counter)
> 1 <- global-set-key: kmacro-start-macro-or-insert-counter
> ======================================================================
> 1 -> (global-set-key [f4] kmacro-end-or-call-macro)
> 1 <- global-set-key: kmacro-end-or-call-macro
> ======================================================================
> 1 -> (global-set-key "" kmacro-keymap)
> 1 <- global-set-key: kmacro-keymap
> ======================================================================
> 1 -> (global-set-key "6" 2C-command)
> 1 <- global-set-key: 2C-command
> ======================================================================
> 1 -> (global-set-key [f2] 2C-command)
> 1 <- global-set-key: 2C-command
>
> which overwrites part of my key bindings, also with ones from two-column.

>From kmacro.el:

;;; Provide some binding for startup:
;;;###autoload (global-set-key "\C-x(" #'kmacro-start-macro)
;;;###autoload (global-set-key "\C-x)" #'kmacro-end-macro)
;;;###autoload (global-set-key "\C-xe" #'kmacro-end-and-call-macro)
;;;###autoload (global-set-key [f3] #'kmacro-start-macro-or-insert-counter)
;;;###autoload (global-set-key [f4] #'kmacro-end-or-call-macro)
;;;###autoload (global-set-key "\C-x\C-k" #'kmacro-keymap)

They are all commented out (only to be put in loaddefs.el), so they
should not be executed when kmacro is loaded.

Maybe try make bootstrap?

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."