Skip to content

`evil-define-key' for minor mode does not take effect until a state transition #301

Open
@TheBB

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


Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions