`evil-define-key' for minor mode does not take effect until a state transition
- Dominant language
- Emacs Lisp
- Stars
- 3.9k
- Forks
- 307
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported by: **Anonymous**
----------------------------------------
Unit test. (you can change flyspell to any toggleble minor mode)
(require 'flyspell)
(evil-define-key 'normal flyspell-mode-map [f5]
(lambda () (interactive) (message "Hey")))
In *scratch* buffer
M-x: flyspell-mode
press F5, key is not bound.
press i then esc, key is now bound
This is a problem because evil is enabled from find-file-hook. before major mode specific hooks are called. If major mode specific hooks enable any minor modes, evil is already initialized, and it does not see those minor modes until a state transition is made, so any bindings for them are in-active
Tested with
GNU Emacs 24.3.1 (x86_64-suse-linux-gnu, X toolkit, Xaw scroll bars) of 2013-05-26 on momoland
Evil from git 8f07f5b0b1fc888428b913e14944e89a0341e7b5
----------------------------------------
- Bitbucket: https://bitbucket.org/lyro/evil/issue/301
Contributor guide
Research direction
Reproduce the report in an Emacs *scratch* buffer using flyspell-mode and the evil-define-key example. Start by tracing Evil's minor-mode key initialization and how it is refreshed during a state transition. Done means the F5 binding works immediately after enabling flyspell-mode, without entering and leaving insert state, with a regression test covering that sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp
- Domain
- desktop, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100