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

From: Ihor Radchenko <[email-masked]>
Date: Fri, 27 Jun 2025 18:37:02 +0000

Stefan Monnier <[email-masked]> writes:

> 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. With the proposed new
`fill-region-as-paragraph-function', it will still be ignored, AFAIU.
What I am asking is a way for major modes to customize boundaries even
when use-hard-newlines is non-nil.

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
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>