The great org-mode has a fast way to jump between headings in an org file; M-x org-goto
or C-c C-j
. This doesn't work with evil mode that well.
If I am on evil normal mode in an org file, C-c C-j
gets me the org-goto
interface alright but I stay in normal mode. The same happens if I'm in insert mode. Even when I'm in Emacs state.
It is after the invocation of C-c C-j
when I have to manually intervene and jump into Emacs state by myself in order to have the functionality work as intended. When I'm finished there, I stay in Emacs state, which I do not desire.
I had these two obvious tries with the machinery but evil ignores both methods. I'm in normal mode, no matter what.
;; No go
(defun progo-org-goto ()
(interactive)
(call-interactively 'evil-emacs-state)
(call-interactively 'org-goto))
;; no go; but the advice did run.
;; also tried "after"
(defadvice org-goto (before goto-advice activate)
(message "adviced goto")
(call-interactively 'evil-emacs-state))
So what kind of magic do I have to perform to have evil change to Emacs state during the org-goto
and then return to normal mode afterwards?