I have a weird behavior in org-mode
. When I create a source block, pressing RET
indents the current and all previous lines with 2 spaces, resulting in something like
#+begin_src bash :results output
a=0
b=1
c=2
#+end_src
No "manual" indentation was applied, it all came from pressing RET
after each line.
I do not have this behavior if I press C-j
instead instead of RET
.
I also do not have it if I start Emacs with the -Q
option, but I disabled all my org-mode
configuration and had the same results, so I am not sure what is causing it.
emacs -Q
and the built-in org-versionOrg mode version 9.4.3 (release_9.4.3 @ /usr/local/share/emacs/27.1.90/lisp/org/)
. It is clearly a bug. You can setorg-src-preserve-indentation
tot
as a workaround with the caveat that the content of source blocks is no longer indented.https://orgmode.org/mepla/
. I think that when I runemacs -Q
I fall into the default org-mode from emacs 27.1, so the bug is not present. Hopefully someone has already filed a bug report. But for now your suggested workaround works great! Thanks again!(electric-indent-mode -1)
? Emacs decided to turn this mode on by default, which effectively swapped keysC-j
andRET
. Many of us turned this mode off as soon as Emacs turned it on by default.