[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making a key undefined again
From: |
Jonas Bernoulli |
Subject: |
Re: Making a key undefined again |
Date: |
Tue, 26 Oct 2021 18:11:53 +0200 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> There always is a (EVENT) entry in the keymap itself because of this line
>> further up:
>>
>> (define-key keymap key nil)
>>
>> (At which point KEY still has the form [EVENT], not (EVENT).)
>
> Actually, it's not guaranteed. Try it with:
>
> (let ((parent (make-sparse-keymap))
> (child (make-keymap)))
> (set-keymap-parent child parent)
> (define-key parent [?a] nil)
> (define-key child [?a] 'bar)
> child)
>
> :-(
That can be fixed too. How does one determine if an event is / would be
stored in a keymap's char-table? So far I have:
(and (char-table-p (cadr MAP))
(ignore-errors (char-table-range (cadr MAP) EVENT) t))
>> but that breaks when `foo-next-thing' is renamed to `foo-forward'.
>> And even if that never happens, it still complicates `foobar-mode-map',
>> which now has a binding for `foo-next-thing', which isn't actually
>> necessary because an identical binding exists in the parent keymap
>> `foo-mode-map'.
>
> How common is this case?
When implementing an alternative set of key bindings across all of Emacs
that diverge from the "standard Emacs key bindings" a lot (up to the
scale of Vim but possibly not quite *that* drastically different), then
it might be needed for essentially every keymap.
> So your notion of "no binding at all" can also be described as something
> like "use the binding of the parent".
Yes. (Or the default binding, or ...)
remove(add(MAP KEY) KEY) == MAP
- Re: Moving kbd to subr.el, (continued)
- Re: Moving kbd to subr.el, Juri Linkov, 2021/10/19
- Making a key undefined again, Jonas Bernoulli, 2021/10/25
- RE: [External] : Making a key undefined again, Drew Adams, 2021/10/25
- Re: Making a key undefined again, Lars Ingebrigtsen, 2021/10/25
- Re: Making a key undefined again, Stefan Monnier, 2021/10/25
- Re: Making a key undefined again, Gregory Heytings, 2021/10/25
- Re: Making a key undefined again, Jonas Bernoulli, 2021/10/25
- Re: Making a key undefined again, Jonas Bernoulli, 2021/10/25
- Re: Making a key undefined again, Stefan Monnier, 2021/10/25
- Re: Making a key undefined again, Gregory Heytings, 2021/10/25
- Re: Making a key undefined again,
Jonas Bernoulli <=
- Re: Making a key undefined again, Stefan Monnier, 2021/10/26
- Re: Moving kbd to subr.el, Juri Linkov, 2021/10/18
- Re: Moving kbd to subr.el, Gregory Heytings, 2021/10/18
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/18
- Re: Moving kbd to subr.el, T.V Raman, 2021/10/17
- Re: Moving kbd to subr.el, Eli Zaretskii, 2021/10/18
- Re: Moving kbd to subr.el, Andreas Schwab, 2021/10/14
- Re: Moving kbd to subr.el, Stefan Kangas, 2021/10/14
- Re: Moving kbd to subr.el, Andreas Schwab, 2021/10/14
- Re: Moving kbd to subr.el, Lars Ingebrigtsen, 2021/10/14