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


Message #106 received at 78561 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Roi Martin <jroi.martin <at> gmail.com>
Cc: eliz <at> gnu.org, monnier <at> iro.umontreal.ca, 78561 <at> debbugs.gnu.org
Subject: Re: bug#78561: [PATCH] Add semantic linefeed support for paragraph
 filling
Date: Mon, 16 Jun 2025 19:36:01 +0300
>> I tried to add to .dir-locals.el:
>>
>>   ((org-mode . ((fill-paragraph-function . fill-paragraph-semlf))))
>>
>> and it works nicely.
>
> That's interesting.  If I create an org-mode buffer and set
> `fill-paragraph-function' with:
>
>   (setq-local fill-paragraph-function #'fill-paragraph-semlf)
>
> Invoking `org-fill-paragraph' (bound to 'M-q') does not fill the
> paragraph using semantic linefeeds.  However, `fill-paragraph' does.
>
> I'll have to dig more into it.

Sorry, I added the following line to my config long ago,
and forgot about it:

  ;; Revert 'M-q' hijacked by org-mode:
  (define-key org-mode-map (vector 'remap 'fill-paragraph) nil)

>> With one exception that it fails on the active region.
>>
>> But we could add a new variable, e.g. 'fill-region-function'
>> that will be possible to customize to 'fill-region-as-paragraph-semlf'.
>
> Check these sub-threads,
>
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-05/msg01088.html
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2025-06/msg00920.html
>
> Maybe it is time to move the discussion to emacs-devel?

Probably better to create a new feature request on bug-gnu-emacs.

>> Although it's strange that 'fill-region-as-paragraph-semlf'
>> doesn't keep empty lines between paragraphs like 'fill-region' does.
>
> `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 see that you already mentioned it earlier.

Another variant is to add a new argument `region' to `fill-paragraph-semlf'.
But the problem is that `fill-paragraph' doesn't forward its argument 
`region' to `fill-paragraph-function', i.e. there is

  (funcall function justify)

instead of

  (funcall function justify region)




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.