Subject: bug#68418: refill-mode interferes with org-mode headlines

From: Eli Zaretskii <[email-masked]>
Date: Sat, 13 Jan 2024 21:00:55 +0200

> From: Ihor Radchenko <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Sat, 13 Jan 2024 18:37:23 +0000
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > I mean the problem with refill-mode that you described in
> >
> >   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68418#19
> >
> > 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.