evil-define-key is not restricted to the mode specified
lrustand opened this issue · comments
Issue type
- Bug report
Environment
Emacs version: 30.0.50
Operating System: Arch
Evil version: 1.15.0
Evil installation type: MELPA
Graphical/Terminal: Graphical
Tested in a make emacs
session (see CONTRIBUTING.md): No
Reproduction steps
- Start Emacs
- Try to bind something to some mode-map using
evil-define-key
:
(evil-define-key 'normal 'org-mode-map (kbd "J") 'some-command)
- Type
J
while in an org-mode buffer -> works. - Type
J
while in a different mode and buffer -> the binding is still active.
Expected behavior
I expect the key binding to only be active in the specified mode-map, here org-mode-map.
Actual behavior
The keybinding is active in any mode and buffer, not only the mode I specified in evil-define-key
.
Further notes
The second argument of evil-define-key
should be a keymap not a quoted symbol, see the docstring. This is admittedly ease to mix up. With a symbol, evil-define-minor-mode-key
will be called instead of evil-define-key*
.