Max Nikulin <maniku...@gmail.com> writes: > On 11/03/2023 17:38, Ihor Radchenko wrote: >> >> Newlines are tricky. They may or may not be significant. >> For example, in CJK paragraphs, newlines are to be stripped. >> >> I think that a reasonable thing to do could be not adding newlines if >> the previous object is a plain string ending with a newline. > > It is in agreement with my expectation that the fix should not be > LaTeX-specific. That is why I raised the issue in this thread.
I still think that the issue with removing a lone object in a line is LaTeX specific. >> This is latex-specific. >> See the attached tentative fix. > >> Reported-by: Max Nikulin <maniku...@gmail.com> >> Link: https://orgmode.org/list/tufdb6$11h2$1...@ciao.gmane.io > > and Max Nikulin to emacs-orgmode. Re: Comments break up a paragraph when > writing one-setence-per-line. Sun, 3 Oct 2021 18:34:10 +0700. > https://list.orgmode.org/sjc4fk$76r$1...@ciao.gmane.io > > .... > I have realized that the following is a kind of pitfall in Org syntax: > > #+macro: comment > Another > {{{comment(Paragraph separator! Do you expect it?)}}} > paragraph. I do not consider that a bug. Macros can insert anything, all the way to headings - users who use the macros are expected to know what they are doing. >> + (replace-regexp-in-string >> + (rx (1+ (0+ space) "\n")) "\n" >> + contents)) > > What I do not like with this regexp is that it matches every newline > character, not only blank lines: > > (replace-regexp-in-string > (rx (1+ (0+ space) "\n")) "[n]" > "a \nb") > "a[n]b" > > If you still believe that a fix should be for LaTeX only then I would > consider extra "\n": (rx "\n" (1+ (0+ space) "\n")) Applied, onto main. With your amendment. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=3d04af382 -- 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>