Reputation: 17537
Emacs' fine org-mode has CODE and EXAMPLE blocks that are easily edited in a proper major mode using C-c '
. But for quick alterations and minor edits one might prefer editing the block inline without opening new popup windows for a two-second operations.
Of course org lets you do that but the automatic indentations are off radar while editing inline like that. Where and what should I hack to make org's indentation logic to act like default dumb autoindentation (ie. copy the indent level of the previous line) while the cursor is in a code block?
#+BEGIN_SRC python
def foo():
return 42
#+END_SRC
#+BEGIN_EXAMPLE
Oh my
hh
#+END_EXAMPLE
If the cursor was at the end of the line containing hh
, pressing C-j
would get me a new line with the same indentation as the previous one.
Upvotes: 3
Views: 965
Reputation: 4516
The following allows me to edit (and indent) code "inline" without ever going to the indirect buffers (except for M-q on comments, which did work and does not anymore).
;; same effect for `tab' as in the language major mode buffer
(setq org-src-tab-acts-natively t)
Upvotes: 3