1

I use evil-mode (specifically in spacemacs) working in org-mode documents. Many times, after evaling code via C-c C-c or exporting via C-c C-e, I find myself saving via C-x C-s (old habits die hard). I then examine output and come back to the document only mangle it because I'm still insert mode.

Added complication: I'm on a chromebook, and I use emacs in a xiwi window, and I tried (add-hook 'focus-out-hook (lambda () (interactive) (evil-normal-state t))), but clicking out of the xiwi window into a chromeos window doesn't register the focus-out. :-/

Is there a hook I can plug into so that if I save, I invoke emacs-normal-state?

Thanks!

1

Yes there is, after-save-hook. Note that you don't need to call functions following the minor mode conventions with an argument from code to enable something, this allows you to drop the lambda:

(add-hook 'after-save-hook 'evil-normal-state)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.