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: 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: bug#78561: [PATCH] Add semantic linefeed support for paragraph filling
Date: Sun, 15 Jun 2025 19:28:44 +0300
> One option is setting a key binding, like this:
>
>   (keymap-global-set "C-c q" #'fill-paragraph-semlf)
>
> Then you can invoke the command placing the cursor within a paragraph
> and using 'C-c q' (or 'M-x fill-paragraph-semlf').

Unfortunately, additional keybindings is too much baggage to bear:
more keys to remember and type, etc.

>> (setq-local fill-paragraph-function 'fill-paragraph-semlf)
>
> This works.  However, the behavior of the usual key binding 'M-q'
> depends on the major-mode that is enabled.  For instance, `org-mode'
> binds 'M-q' to `org-fill-paragraph' and won't invoke
> 'fill-paragraph-semlf.  But placing the cursor within a paragraph a
> invoking `fill-paragraph' works.  On the flip side, other modes
> (e.g. `outline-mode' or `texinfo-mode') don't do that and you can use
> 'M-q' to invoke `fill-paragraph' and, thus, `fill-paragraph-semlf'
> normally.

I tried to add to .dir-locals.el:

  ((org-mode . ((fill-paragraph-function . fill-paragraph-semlf))))

and it works nicely.  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'.

Although it's strange that 'fill-region-as-paragraph-semlf'
doesn't keep empty lines between paragraphs like 'fill-region' does.




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.