[Top][All Lists]

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

unexpected result with keymap inheritance

From: Ernest Adrogué
Subject: unexpected result with keymap inheritance
Date: Mon, 21 Nov 2016 01:28:38 +0100
User-agent: NeoMutt/20161014 (1.7.1)

Hi there,

when I remove a binding from a child keymap that is shadowing a binding from
its parent keymap, the resulting binding for the key is not the one in the
parent keymap but the binding from the parent's parent keymap:

(setq parent-map (make-sparse-keymap))
(setq child-map (make-sparse-keymap))
(set-keymap-parent parent-map global-map)
(set-keymap-parent child-map parent-map)
(define-key parent-map [?a] 'backward-char)
(use-local-map child-map)
(key-binding [?a])
=> backward-char
(define-key child-map [?a] 'forward-char)
(key-binding [?a])
=> forward-char
(define-key child-map [?a] nil)
(key-binding [?a])
=> self-insert-command

I thought the last line would evaluate to backward-char.  Is this how it's
supposed to work or is it some kind of bug?


reply via email to

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