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: Re: unexpected result with keymap inheritance
Date: Wed, 23 Nov 2016 11:16:39 +0100	[thread overview]
Message-ID: <20161123101639.7v7y2xslyvkkg6uo@doriath.local> (raw)
In-Reply-To: <jwvy40bf1co.fsf-monnier+gmane.emacs.help@gnu.org>

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
unbind-key.

Cheers.



  parent reply	other threads:[~2016-11-23 10:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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é [this message]
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=20161123101639.7v7y2xslyvkkg6uo@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.