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

From: Stefan Monnier <[email-masked]>
Date: Fri, 27 Jun 2025 16:26:55 -0400

>> If you want to pay attention to hard-newlines, yet also pay attention to
>> other "paragraph separator hints", then hopefully
>> `fill-paragraph-forward-function` can do the trick.  E.g. I can't see
>> any reason why Org couldn't set `fill-paragraph-forward-function` to
>> a function which uses both regexps and the `hard` text-property to
>> determine paragraph boundaries.
>
> This is simple. fill-region has
>
> (if use-hard-newlines
> 	    (progn ...)
> 	  (fill-forward-paragraph 1)
> 	  (setq end (min max (point)))
> 	  (fill-forward-paragraph -1))
>
> So, `fill-forward-paragraph-function' is currently ignored when
> use-hard-newlines is non-nil.

Duh, right.

> What I am asking is a way for major modes to customize boundaries even
> when use-hard-newlines is non-nil.

I have the impression that The Right Thing would be  for `fill-region`
to always use `fill-forward-paragraph`, and then for the default value
of `fill-forward-paragraph` to check `use-hard-newlines`.

I haven't looked at the code to make sure The Right Thing is compatible
with The Real World, tho.

        Stefan