GNU bug report logs - #78561
[PATCH] Add semantic linefeed support for paragraph filling

Previous Next

Package: emacs;

Reported by: Roi Martin <jroi.martin <at> gmail.com>

Date: Fri, 23 May 2025 09:59:02 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Roi Martin <jroi.martin <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Ihor Radchenko <yantar92 <at> posteo.net>, eliz <at> gnu.org, 78561 <at> debbugs.gnu.org
Subject: bug#78561: [PATCH] Add semantic linefeed support for paragraph filling
Date: Tue, 17 Jun 2025 08:49:36 +0200
Juri Linkov <juri <at> linkov.net> writes:

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

If I'm not wrong, `fill-region' calls `fill-region-as-paragraph'
internally,

  (defun fill-region (from to &optional justify nosqueeze to-eop)
    ;; ...
  	    (setq fill-pfx
  		  (fill-region-as-paragraph (point) end justify nosqueeze))
    ;; ...
      fill-pfx))

And `fill-paragraph' calls `fill-region' if Transient Mark mode is
enabled and the mark is active.

So, the idea is to define a new variable
`fill-region-as-paragraph-function' so `fill-region' uses this variable
instead of calling `fill-region-as-paragraph' directly.

Stefan, I'll send a new patch to support this.  I'll also modify
`fill-paragraph-semlf' to respect the `fill-paragraph-function' protocol
(i.e. return t).

        Roi




This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.