all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alex Kost <alezost@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: unexpected result with keymap inheritance
Date: Wed, 23 Nov 2016 08:42:42 -0500	[thread overview]
Message-ID: <jwvmvgq1fps.fsf-monnier+Inbox@gnu.org> (raw)
In-Reply-To: <87fumicynb.fsf@gmail.com> (Alex Kost's message of "Wed, 23 Nov 2016 12:51:20 +0300")

> Now what I want is just to remove "o" and "u" from
> 'very-special-mode-map', so that my keys from 'special-mode-map' will
> take precedence, but I can't do it, as with this:

I see, yes, that makes sense.  I suggest you `M-x report-emacs-bug` and
ask for this feature.

> I will get "<key> is undefined", so I have to bind my keys to the same
> commands in this new map again:
>
>   (define-key very-special-mode-map (kbd "o") 'backward-char)
>   (define-key very-special-mode-map (kbd "u") 'forward-char)

That's the obvious workaround, yes.  It's not that terrible, but I agree
it's less satisfactory.

Another approach if you want these `o` and `u` bindings to apply in
every special-mode buffer, is to do

    (defvar my-special-mode-bindings-map
        (let ((map (make-sparse-keymap)))
          (define-key map (kbd "o") 'backward-char)
          (define-key map (kbd "u") 'forward-char)
          map))

    (define-minor-mode my-special-mode-bindings "Docstring")

    (add-hook 'special-mode-hook #'my-special-mode-bindings)

so you don't have to go through every derivative of special-mode which
rebinds those keys and unbind them in their map.


        Stefan



  reply	other threads:[~2016-11-23 13:42 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 [this message]
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=jwvmvgq1fps.fsf-monnier+Inbox@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=alezost@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.