Subject: Re: bug#78561: [PATCH] Add semantic linefeed support for paragraph filling

From: Roi Martin <[email-masked]>
Date: Mon, 16 Jun 2025 12:32:23 +0200

Juri Linkov <[email-masked]> writes:

> I tried to add to .dir-locals.el:
>
>   ((org-mode . ((fill-paragraph-function . fill-paragraph-semlf))))
>
> and it works nicely.

That's interesting.  If I create an org-mode buffer and set
`fill-paragraph-function' with:

  (setq-local fill-paragraph-function #'fill-paragraph-semlf)

Invoking `org-fill-paragraph' (bound to 'M-q') does not fill the
paragraph using semantic linefeeds.  However, `fill-paragraph' does.

I'll have to dig more into it.

> With one exception that it fails on the active region.
>
> But we could add a new variable, e.g. 'fill-region-function'
> that will be possible to customize to 'fill-region-as-paragraph-semlf'.

Check these sub-threads,

https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-05/msg01088.html
https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-06/msg00920.html

Maybe it is time to move the discussion to emacs-devel?

> Although it's strange that 'fill-region-as-paragraph-semlf'
> doesn't keep empty lines between paragraphs like 'fill-region' does.

`fill-region-as-paragraph-semlf' is analogous to
`fill-region-as-paragraph', so it removes any paragraph breaks in the
region and extra newlines at the end, and fills lines within the region.

        Roi