[Top][All Lists]

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

Re: unexpected result with keymap inheritance

From: Stefan Monnier
Subject: Re: unexpected result with keymap inheritance
Date: Wed, 23 Nov 2016 10:02:51 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> (unbind-key ido-common-completion-map [(control ?p)])
> where unbind-key is a function that removes any reference to a key from the
> given map.

unbind-key would be bad name since after the call (lookup-key
ido-common-completion-map [?\C-p]) would still return a binding.

I.e. there are two ways to under "the map", one includes the parent and
the other doesn't.  So, in order to avoid confusion, the name should be
clear regardless of how you look at the map.

I don't have good ideas for a name, tho: remove-key-from-child and
reveal/expose-parent-binding is the best I could come up with so far.

Another option is to use something like

    (define-key <map> <key> :get-from-parent)

Side note:  A keymap can be composed of other keymaps, so it can be an
object of the form (keymap MAP1 MAP2 . PARENT).  In that case, a nil
binding in MAP1 does not hide another binding in MAP2, but does hide
a binding in PARENT.  With a special :get-from-parent binding, we could
get the exact opposite: a :get-from-parent binding in MAP1 could hide
a binding in MAP2 and reveal a binding in PARENT, whereas the most
obvious implementation of reveal-parent-binding would probably mean that
after it, both bindings in MAP2 and in PARENT would be exposed.


reply via email to

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