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

From: Juri Linkov <[email-masked]>
Date: Tue, 17 Jun 2025 09:25:11 +0300

>>   ;; Revert 'M-q' hijacked by org-mode:
>>   (define-key org-mode-map (vector 'remap 'fill-paragraph) nil)
>
> Maybe it deserves a bug report?  Looking at the code, I can't see a good
> reason for this hijacking.  Maybe it's just a left over from old code.

Cc-ing Ihor for the definite answer, but I suppose 'org-fill-paragraph'
still exists because it needs the argument 'region', whereas 'fill-paragraph'
calls 'fill-paragraph-function' only with 'justify', not 'region'.

>>> `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.
>>
>> Then maybe we need another function `fill-region-semlf'.
>
> I expect it would make more sense to introduce
> a `fill-region-as-paragraph-function`, so `fill-region` will DTRT after
> you set that var to `fill-region-as-paragraph-semlf`.  Instead of having
> to reinvent/duplicate the code of `fill-region` in a new
> `fill-region-semlf`.

AFAIS, they have a significant difference: `fill-region-as-paragraph`
merges all selected paragraphs into one paragraph, but `fill-region`
formats each paragraph separately, keeping separators (empty lines)
between them.