GNU bug report logs - #68418
refill-mode interferes with org-mode headlines

Previous Next

Package: emacs;

Reported by: Lars Rustand <rustand.lars <at> gmail.com>

Date: Sat, 13 Jan 2024 07:14:02 UTC

Severity: normal

Merged with 52778

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rustand.lars <at> gmail.com, 68418 <at> debbugs.gnu.org, salutis <at> me.com
Subject: bug#68418: refill-mode interferes with org-mode headlines
Date: Sat, 13 Jan 2024 19:13:56 +0000
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > Is it possible to fix that by some improvements to
>> > fill-forward-paragraph-function used by Org?
>> 
>> I doubt so. The only idea that is coming to my mind is to make Org
>> mode's `fill-forward-paragraph-function' not move anywhere when not on
>> paragraph - this will prevent refill-mode from filling anything but Org
>> paragraphs.
>
> Is the problem in your example what fill-forward-paragraph-function
> does, or is the problem elsewhere in refill-fill-paragraph-at and/or
> refill-post-command-function?  IOW, can you tell which part(s) of
> refill.el fail to DTRT in an Org buffer?  I don't know enough about
> all the peculiarities of the Org format to tell what should be fixed
> in that case, let alone how.

AFAIU, the problem is in

(if use-hard-newlines
		    (fill-region oend end arg)
		  (fill-region-as-paragraph oend end arg))

Both `fill-region' and `fill-region-as-paragraph' do not respect
`fill-paragraph-function' and always act the same once the region
boundaries are identified regardless of the major mode.

`fill-region-as-paragraph' does not respect it as per docstring and
refill mode should probably not call `fill-region-as-paragraph'. The
branching for `use-hard-newlines' should belong to text-mode, IMHO.

`fill-region' does not respect `fill-paragraph-function' for the reasons
I do not understand.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




This bug report was last modified 1 year and 140 days ago.

Previous Next


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