4

I have the following in my init.el, and it does a great job of automatically disabling evil in certain emacs modes:

(dolist (mode '(git-rebase-mode
        flycheck-error-list-mode
        inf-ruby-mode
        term-mode))
  (add-to-list 'evil-emacs-state-modes mode))

However, this will not work for help-mode, which is frustrating, as help-mode has some great keybindings I'd like to take advantage of. I've also tried this: (add-to-list 'evil-emacs-state-modes 'help-mode), but it didn't work either.

How can I turn off evil in help-mode?

Drew
  • 75,699
  • 9
  • 109
  • 225
achalk
  • 579
  • 4
  • 16

1 Answers1

13

The reason this fails is because help-mode is in evil-motion-state-modes by default, adding it to evil-emacs-state-modes will therefore not have the desired effect as Evil looks it up in evil-motion-state-modes first to determine the initial state.

The correct way to change the initial state of a mode is by using evil-set-initial-state:

(evil-set-initial-state 'help-mode 'emacs)

This helper function ensures that a given mode cannot be in more than one of the evil-*-state-modes variables. Alternatively customize every initial state variable to hold the correct modes and make sure you're not introducing any duplicates.

wasamasa
  • 21,803
  • 1
  • 65
  • 97