Subject: bug#72624: 31.0.50; minor-mode-overriding-map-alist doesn't have higher priority than local map, which differs from docs

From: Stefan Monnier <[email-masked]>
Date: Mon, 19 Aug 2024 10:52:14 -0400

> ‘minor-mode-overriding-map-alist` should have higher priority than the
> buffer local keymap.

According to my tests, it does.

> (defvar-keymap mk/test-map
> "RET" #'(lambda () (interactive) (message "mk/test-map")))
[...]
> (keymap-set outline-minor-mode-map "<return>" #'(lambda () (interactive)
> (message "outline-minor-mode-map")))

Binding a command to "<return>" is generally a bug.
You should bind it to "RET" instead, unless you really know what
you're doing.

The way the bug manifests itself is exactly in the way you show here.

Emacs will first look for a binding for `return` and if it finds one
it'll use it in preference to a binding for `RET`, regardless of the
relative precedence of the keymaps involved.

[ Side note:

  > ```elisp
  [...]
  > (setq minor-mode-overriding-map-alist '((outline-minor-mode . nil)))
  [...]
  > ```
  
  `minor-mode-overriding-map-alist` is automatically buffer-local, so
  setting it at the toplevel of an ELisp file doesn't make much sense: it
  will set it only in the buffer that happens to be current when you load
  that ELisp file.  ]

        Stefan