[Top][All Lists]

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

Re: unexpected result with keymap inheritance

From: Ernest Adrogué
Subject: Re: unexpected result with keymap inheritance
Date: Wed, 23 Nov 2016 11:16:39 +0100
User-agent: NeoMutt/20161014 (1.7.1)

2016-11-22, 20:12 (-0500); Stefan Monnier escriu:
> Do you have a more concrete description of when you want to do that?

Suppose you do

(let ((map minibuffer-local-map))
  (define-key map [(control ?p)] 'previous-history-element)
  (define-key map [(control ?n)] 'next-history-element))

Now, ido defines its own map that inherits from minibuffer-local-map.  In
this map, C-p is bound to ido-toggle-prefix, so one thing you may want to do
is move ido-toggle-prefix to another key, so that it stops shadowing your
C-p binding.  Therefore you would do

(define-key ido-common-completion-map [(control ?o)] 'ido-toggle-prefix)
(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.

Without unbind-key, you have to define the same binding in both maps, which
can be inconvenient if later you decide to change it.  It's not
super-annoying but in my opinion it would be nice to have a function like


reply via email to

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