Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding a key in lisp-mode-map with evil-define-key can bind it in emacs-lisp-mode-map #709

Closed
TheBB opened this issue Sep 8, 2016 · 4 comments

Comments

@TheBB
Copy link
Member

TheBB commented Sep 8, 2016

Originally reported by: Anonymous


Because the evil-get-auxiliary-map used in evil-define-key* doesn't set ignore-parent to a non-nil value, using evil-define-key with lisp-mode-map can actually end up binding the keys in lisp-mode-shared-map. This results in key bindings specified for lisp-mode-map ending up in emacs-lisp-mode-map.

This behavior doesn't seem very intuitive to me. Are there a lot of cases where having ignore-parent as nil here makes more sense? If not, I think it would be better to set it to t in evil-define-key*. Otherwise, it could potentially be nice to add a disclaimer in the docstring that the parent keymap could end up being used.


@noctuid
Copy link
Contributor

noctuid commented Nov 22, 2017

Is there any opposition to this? If not, this is a very simple change, and I'd be happy to make a pull request if it would be accepted. It's really annoying to, for example, bind a key in image-mode-map, have that same key end up being bound in message-mode-map, and then manually have to put evil-get-auxiliary-map beforehand in my config to prevent this. I've had this problem with several other keymaps as well.

@wasamasa
Copy link
Member

No objection here. I recall a more recent ticket about the same issue where I asked for clarification, if I find it again I'd close it in favor of this one.

noctuid added a commit to noctuid/evil that referenced this issue Nov 23, 2017
If the parent keymap already has an auxiliary keymap, ignore it. For
example, if the user attempted to bind a key in emacs-lisp-mode-map
before this commit, evil-define-key* could define the key in the
corresponding auxiliary keymap in lisp-shared-mode-map instead of
creating a new auxiliary keymap in emacs-lisp-mode-map. This resulted in
keys bound in emacs-lisp-mode-map with evil-define-key potentially being
bound in other keymaps that inherit from lisp-shared-mode-map (e.g.
lisp-mode-map).

Addresses emacs-evil#709.
noctuid added a commit to noctuid/evil that referenced this issue Nov 23, 2017
If the parent keymap already has an auxiliary keymap, ignore it. For
example, if the user attempted to bind a key in emacs-lisp-mode-map
before this commit, evil-define-key* could define the key in the
corresponding auxiliary keymap in lisp-shared-mode-map instead of
creating a new auxiliary keymap in emacs-lisp-mode-map. This resulted in
keys bound in emacs-lisp-mode-map with evil-define-key potentially being
bound in other keymaps that inherit from lisp-shared-mode-map (e.g.
lisp-mode-map).

Addresses emacs-evil#709.
@noctuid
Copy link
Contributor

noctuid commented Dec 17, 2017

This can be closed now.

@wasamasa
Copy link
Member

OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants