all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* unexpected result with keymap inheritance
@ 2016-11-21  0:28 Ernest Adrogué
  2016-11-21 14:12 ` Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Ernest Adrogué @ 2016-11-21  0:28 UTC (permalink / raw)
  To: help-gnu-emacs

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.



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: unexpected result with keymap inheritance
@ 2016-11-23  5:43 Edward Flanigan
  2016-11-23  9:05 ` Alex Kost
  0 siblings, 1 reply; 16+ messages in thread
From: Edward Flanigan @ 2016-11-23  5:43 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

I use unbind-key quite a bit. It is in bind-key.el from the external "use-package"

(unbind-key "C-'"     org-mode-map)        ;; org-cycle-agenda-files


See if that fits your use case.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-11-24  2:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-21  0:28 unexpected result with keymap inheritance Ernest Adrogué
2016-11-21 14:12 ` 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

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.