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

From: Ihor Radchenko <[email-masked]>
Date: Sun, 22 Jun 2025 06:44:21 +0000

Stefan Monnier <[email-masked]> writes:

>> I think that `fill-region-as-paragraph-function' is a step in the right
>> direction. What is left is handling `use-hard-newlines'. Currently, Org
>> mode ignores it as the concept of hard newlines is not compatible with
>> Org mode syntax and its notion of paragraphs. So, we probably need to
>> have a way to bypass that branch in `fill-paragraph' or find some way to
>> handle hard newlines that is compatible with Org mode and then Emacs
>> introduce a new customization for Org to plug into.
>
> I don't understand: `use-hard-newlines` is nil by default and org mode
> doesn't seem to set it, so those users who set it ... get what they deserve?

"what they deserve" is not nice to users. There is some usefulness to a
proper Org-specific hard newline support. See
https://list.orgmode.org/orgmode/[email-masked]/
(specifically, item 2).

What i am asking about is providing some way in `fill-region' to control
how hard newlines are handled for major modes.  Not just making it call
Roi's `fill-region-as-paragraph-function` instead of
`fill-region-as-paragraph'.

-- 
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>