all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ernest Adrogué" <nfdisco@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: unexpected result with keymap inheritance
Date: Mon, 21 Nov 2016 01:28:38 +0100	[thread overview]
Message-ID: <20161121002838.rkoniry5n6aemrzt@doriath.local> (raw)

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?

Cheers.



             reply	other threads:[~2016-11-21  0:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21  0:28 Ernest Adrogué [this message]
2016-11-21 14:12 ` unexpected result with keymap inheritance Stefan Monnier
2016-11-21 17:12   ` Alex Kost
2016-11-22  2:55     ` Stefan Monnier
2016-11-22 19:07       ` Alex Kost
2016-11-23  1:12         ` Stefan Monnier
2016-11-23  9:51           ` Alex Kost
2016-11-23 13:42             ` Stefan Monnier
2016-11-23 21:23               ` Alex Kost
2016-11-24  2:20                 ` Stefan Huchler
2016-11-23 10:16           ` Ernest Adrogué
2016-11-23 15:02             ` Stefan Monnier
2016-11-22  0:30   ` Ernest Adrogué
  -- strict thread matches above, loose matches on Subject: below --
2016-11-23  5:43 Edward Flanigan
2016-11-23  9:05 ` Alex Kost
2016-11-23 14:47   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121002838.rkoniry5n6aemrzt@doriath.local \
    --to=nfdisco@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.