wolf writes: > Reproduction steps: > 1. Have org-mode and yaml-mode installed. > 2. C-x C-f /tmp/x.org RET > 3. Type in: > > #+begin_src yaml > a: > b: > c: > d: > #+end_src > > After each line, press RET to go to the next one. RET is bound to org-return. > Notice that when you press RET after `c:', emacs will insert a TAB character, > instead of expected 8 spaces. Confirmed. This is caused by `org-src--contents-for-write-back' not adjusting blank line indentation in some cases. The attached diff will fix the issue, but git log reveals that the whole thing is fragile - we adjusted code in this area multiple times with a number of tricky special cases: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e1c49af76 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=70e65a202 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=ee0fd1ec3 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=70e65a202 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=857ae366b https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=91236a3db https://orgmode.org/list/0f961d3b-a4ef-fbbf-ab16-7ff1af8b2070@gmail.com https://orgmode.org/list/5DCBAF63-0E88-44AC-B892-1260F37E7E00@manicmind.earth CCing Bastien and Sébastien, the authors of the previous commits in this area. I feel that the whole approach we use now with preserve-fl, use-tabs?, and preserve-blank-line is overcomplicated. Maybe someone can explain why we need all these special cases? The code does not reveal a whole lot.