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 #97 received at 78561 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Roi Martin <jroi.martin <at> gmail.com>,
 Ihor Radchenko <yantar92 <at> posteo.net>
Cc: monnier <at> iro.umontreal.ca, 78561 <at> debbugs.gnu.org, juri <at> linkov.net
Subject: Re: bug#78561: [PATCH] Add semantic linefeed support for paragraph
 filling
Date: Mon, 16 Jun 2025 13:51:55 +0300
> From: Roi Martin <jroi.martin <at> gmail.com>
> Cc: juri <at> linkov.net, 78561 <at> debbugs.gnu.org
> Date: Mon, 16 Jun 2025 12:14:46 +0200
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Then, what's better?  Should we remove the following paragraph from the
> >> doc string of `fill-paragraph-semlf'?
> >> 
> >>   You can use this function as the value of ‘fill-paragraph-function’, so
> >>   ‘fill-paragraph’ and other filling commands will use it.
> >> 
> >> Or should we return t in `fill-paragraph-semlf'?
> >
> > I don't know.  Is returning fill-prefix useful in some important cases?
> 
> That's hard to say until we decide how to "wire" the semantic-linefeed
> functions with the generic functions already provided by fill.el.  For
> instance, coming back to some of the comments done by Stefan,
> 
> - How do we fill the paragraphs within the active region?  Should we add
>   a new `fill-region-function' variable and provide a
>   `fill-region-semlf' function?  Should we have a way to tell fill.el to
>   use a custom `fill-region-as-paragraph' function?
> - How do we change how major modes fill a paragraph or a region?  For
>   instance, in the case of org-mode, how do we combine org-mode's
>   fill-paragraph logic with semantic linefeeds?  Should the major mode
>   be in charge of providing this feature leveraging the existing
>   semantic-linefeed functions?  Should the user change a set of hooks?
>   What if the major mode already sets this hooks?

The active region case should be supported, IMO.  As for other modes,
what modes could usefully make use of this kind of region-filling?
Org mode might be the only one, but in that case it's something for
Org developers to chime in; I added Ihor to the discussion.

> Besides that, `fill-paragraph-semlf' calls `fill-forward-paragraph'
> internally, so it already takes into account what the major mode defines
> as paragraph.  And, `fill-region-as-paragraph-semlf' calls
> `fill-region-as-paragraph' internally, so if we add a hook to customize
> this function, it would take that into account.

Right.

> I guess the safest call for now is to provide `fill-paragraph-semlf' and
> `fill-region-as-paragraph-semlf' as commands that users or major modes
> can call directly.

That's what we currently do, right?

> What do you think?  Sorry, but I'm still wrapping my head around all the
> nuances of the filling code and how major modes make use of it.

I'd love to hear Stefan and Ihor to chime in and express their views.




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.