Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Setting (setq org-src-tab-acts-natively t) in your init file should allow you to use the tab key to indent correctly with a single keystroke instead of pressing spacebar four times (which it sounds like is your current situation), but I have not yet found a way to get automatic/electric indentation in org source blocks. Commented Dec 17, 2015 at 19:18
  • 1
    What the guy in the video does as far as I can tell (and what I do) is use org-edit-special (C-c ') to open the source block in a buffer in the language's mode where everything should work as expected, and then use C-c' again to go back to your org buffer. Commented Dec 17, 2015 at 19:27
  • I was hoping there might be a better, more convenient way. That video is now more that 2 years old. There are options (variables) to set in your unit file to deal with indentation in src snippets, but they only seem to alter how the snippets are exported. For example: (setq org-edit-src-content-indentation 4) - meaning 4 spaces before the #+begin_src in e.g. AucTex output. Commented Dec 17, 2015 at 19:39