Search code examples
emacsevil-modeminibuffer

Keep Emacs Evil from switching to normal mode when exiting minibuffer


I'm an evil Emacs user. However, I really only use the normal mode for fancy Vim style edits when I find them more convenient than regular Emacs commands. (Mostly fancy bulk editing/yanking/deleting). However, I'm also a huge user of the minibuffer (I do a lot of M-x with ido and flx so I can avoid remembering the more esoteric commands). When I do, evil switches to normal mode automatically after I exit. I find that very annoying/confusing. How can I get it to stop? (preferably in an elegant, non-hackish way).

Thanks, PythonNut

EDIT:

It appears that the switch to normal mode happens in all windows and in all frames.


Solution

  • I cannot reproduce your issue; maybe knowing your versions could help anyone to identify your issue. Can you reproduce your issue with "emacs -q" (plus adding evil to load-path)?

    Here is an approach to identify the evil (traditional English meaning) piece of code, if any, that is calling to evil-normal-state:

    (defadvice evil-normal-state (before debug-issue activate)
      (setq debug-on-error t)
      (inexisting-function-will-fail))
    

    Eval this just after setting a buffer in the evil-state you want it to be, then go to to the minibuffer with M-x. Is there an stacktrace?