Sébastien Miquel,
> If I try your original examples with `emacs -q' I do not get extra > whitespace in the org src buffer. Those two spaces in the original org > buffer -- that are due to `org-edit-src-content-indentation' -- are > removed in the org src buffer. If you do not find it to be the case, > then I'm missing something. i apologize, i think i described the problem badly. the problem i saw is not extra spaces in the Org Src buffer; it is the appearance of the extra spaces in the original .org file after closing (C-c ') the Org Src buffer that i see as problematic. > Anyway, here's a patch that cleans up blank lines, except the current > one. It preserves the fix for the original issue. thanks. my trivial test shows this works *except* in the particular case where, when closing the Org Src buffer, `point` is on an empty line. in this case, that one empty line is given extra spaces. if i try my test with : Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/) i do not see the extra spaces in the .org file. the test src block is ---- #+BEGIN_SRC bash echo hello, world echo 23 #+END_SRC ---- (modulo any e-mail mangling). again, thanks. Greg