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

From: Gerd Möllmann <[email-masked]>
Date: Sat, 16 Sep 2023 08:38:22 +0200

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.

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.

(Note that two-column and kmacro are the only packages with autoloads
for global-set-key.  Maybe that plays a role, but TBH I don't have a
clue what's going on here.)