I'm trying to indent my code in org src blocks, but it only works when evil-mode is disabled. I have set this variables for org-mode:

(setq org-src-preserve-indentation t
      org-src-tab-acts-natively t
      org-src-fontify-natively t)

Now, in a org buffer, when I have a code like this:

#+BEGIN_SRC python
if True:


and press TAB right below the if, emacs idents my code properly. But, if I enable evil-mode, it just doesn't work, even if I call org-cycle manually.

Both with and without evil-mode TAB is bound to org-cycle. The following picture shows the binding without evil: without evil

and with evil-mode enabled: with evil

My Emacs is version 25.3, and I've already tried emacs -q, so it's probably not related to my setup. I'm aware I can use C-c ' to edit in another window, I'd prefer to do it in the org buffer.

  • Please verify what actually gets called by using F1 k and include the output in your question. – wasamasa Mar 6 '18 at 22:52
  • @wasamasa I already checked. As I mentioned, it happens even if I invoke org-cycle manually. – Jesse Mar 7 '18 at 0:09
  • We can only guess what's wrong unless you include the information what ends up being called instead. Besides, why would org-cycle indent? Look up what should be called by checking F1 k TAB in that block with Evil deactivated. – wasamasa Mar 7 '18 at 6:41
  • When evil-mode is disabled, invoking org-cycle manually works indents as intended. If, then, I enable evil-mode and invoke org-cycle again, it doesn't indent anymore. I already checked, and both with and without evil TAB points to org-cycle. – Jesse Mar 7 '18 at 11:42
  • 1
    @SFbay007 I gave on this issue for now and started using only org-edit-special. I've set up some quick bindings for evil so I can come and go fast enough, though it would be great if there was an actual solution for this. – Jesse Dec 28 '18 at 20:05

Your Answer

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

Browse other questions tagged or ask your own question.