bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64417: 30.0.50; keymap-unset :REMOVE keyword not working


From: Stefan Monnier
Subject: bug#64417: 30.0.50; keymap-unset :REMOVE keyword not working
Date: Sun, 02 Jul 2023 12:02:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> When I evaluate:
> (keymap-unset diff-mode-map "M-SPC" :REMOVE)
> M-SPC still runs scroll-up-command
>
> (keymap-unset diff-mode-map "M-SPC")
> M-SPC is removed from diff-mode-map and cycle-spacing (global-mode-map)
> is activated
>
> This contradicts the keymap-unset docstring:
>
> If REMOVE, remove the binding instead of unsetting it.  This only
> makes a difference when there’s a parent keymap.  When unsetting
> a key in a child map, it will still shadow the same key in the
> parent keymap.  Removing the binding will allow the key in the
> parent keymap to be used.

Thanks for providing a great example of why the `remove` arg of
`keymap-unset` is a problematic feature :-)

The technical reason for the above: while `diff-mode-map` has no parent,
the keymap bound to ESC in `diff-mode-map` has `diff-mode-shared-map`
as parent, and `M-SPC` is the same (for keymap purposes) as `ESC SPC`.
Of curse, there's no binding of anything to `scroll-up-command` itself
in `diff-mode-shared-map` itself: the binding is to be found in
`diff-mode-shared-map`s parent, `special-mode-map`.

So we can't *remove* the binding from `M-SPC` to `scroll-up-command`
without modifying some other keymap.

So, the code is doing The Right Thing :-(


        Stefan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]