Óscar Fuentes <ofv <at> wanadoo.es> writes:
Another approach is to advice `call-interactively'. Again, untested code:
(defvar maybe-enter-insert-mode-commands '(org-insert-heading) "List of commands that trigger insert mode.")
(defun maybe-enter-insert-mode (command &rest args) (when (memq command maybe-enter-insert-mode-commands) (evil-insert-state nil)))
(advice-add 'call-interactively :after 'maybe-enter-insert-mode)
Be warned that this method is quite gross. If your Emacs starts behaving strangely, the code above can be the cause.
Thank you so much, Oscar. The above method is working great so far. I was thinking of adapting your code for other purposes, but I am concerned about your warning. What are the potential problems with this code? Thanks again. -- For other readers, I think the last line is missing a hash and should be: (advice-add 'call-interactively :after #'maybe-enter-insert-mode)