unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rustand.lars@gmail.com, 68418@debbugs.gnu.org, salutis@me.com
Subject: bug#68418: refill-mode interferes with org-mode headlines
Date: Sat, 13 Jan 2024 19:13:56 +0000	[thread overview]
Message-ID: <87r0ilt5aj.fsf@localhost> (raw)
In-Reply-To: <83v87xf47s.fsf@gnu.org>

Eli Zaretskii <eliz@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>





  reply	other threads:[~2024-01-13 19:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 20:18 bug#68418: refill-mode interferes with org-mode headlines Lars Rustand
2024-01-13  8:19 ` Eli Zaretskii
2024-01-13  9:01   ` Lars Rustand
2024-01-13  9:16     ` Eli Zaretskii
2024-01-27  8:55       ` Eli Zaretskii
2024-01-13 13:28   ` Ihor Radchenko
2024-01-13 13:43     ` Eli Zaretskii
2024-01-13 13:56       ` Ihor Radchenko
2024-01-13 15:13         ` Eli Zaretskii
2024-01-13 15:26           ` Ihor Radchenko
2024-01-13 15:57             ` Eli Zaretskii
2024-01-13 18:37               ` Ihor Radchenko
2024-01-13 19:00                 ` Eli Zaretskii
2024-01-13 19:13                   ` Ihor Radchenko [this message]
2024-01-13 19:21                     ` Eli Zaretskii
2024-01-13 19:33                       ` Ihor Radchenko
2024-01-13 19:57                         ` Eli Zaretskii
2024-01-13 20:11                           ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0ilt5aj.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=68418@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=rustand.lars@gmail.com \
    --cc=salutis@me.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).