Sébastien Miquel <sebastien.miq...@posteo.eu> writes: > Ihor Radchenko writes: >> But why do we need to avoid indenting empty lines? > > In the following link, Greg Minshal argues for preserving empty lines: > https://list.orgmode.org/725763.1632663...@apollo2.minshall.org/T/
Thanks for the reference! I can see that non-empty blank line below might be annoying for some users. \t#+begin_src lang \t line1 \t line2 ^\t $ \t#+end_src However, I do not see why Org should clear blank lines created by the lang-mode itself \t#+begin_src lang \t line1: \t \tline2: ^\t \t\t$ \t#+end_src If source code in the edit buffer contains non-empty blank lines, it is not Org's responsibility to clear them. In fact, it will go against possible user settings! So, I agree that we should not indent empty lines. However, I do not agree that we should not indent non-empty blank lines. --- The code in your patch is confusing, considering the above considerations. > - (setq org-src--preserve-blank-line preserve-blank-line) > + (setq org-src--indent-current-empty-line (and blank-line > + (not empty-line))) Here, you have a variable named "empty-line" set when (not empty-line). ?? Also, > (while (not (eobp)) > - (skip-chars-forward " \t") > - (when (or (not (eolp)) ; not a blank > line > - (and (eq (point) (marker-position marker)) ; current line > + (when (or (not (eolp)) ; not an empty line > + ;; If the current line is empty, we may > + ;; want to indent it. > + (and (eq (point) (marker-position marker)) > preserve-blank-line)) > (insert indent-str)) > (forward-line))) removed `skip-chars-forward' call, so the loop will always check every bol and (not (eolp)) will be t for every line, except ^$. Then, considering that preserve-blank-line is set when (not empty-line), your second condition will never trigger. I feel that something is fishy in the logic. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>