emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fill-paragraph ill designed


From: Tassilo Horn
Subject: Re: fill-paragraph ill designed
Date: Wed, 26 Aug 2015 09:08:41 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

Andreas Röhler <address@hidden> writes:

>> There is a lot of ugliness in the way fill-paragraph works, but
>> developing a replacement that works ok in practice is harder than it
>> looks.  I recall a time that we tried.
>
> What would prevent switching the clauses as suggested?

IMO, it makes completely sense that `fill-paragraph' delegates to
`fill-region' if the region is active so that not every mode-specific
`fill-paragraph-function' has to do that on its own.

What I think is wrong is the way `fill-region' works right now.  Why
doesn't it move over the paragraphs in the active region using
`fill-forward-paragraph' (which can be defined mode-specific using
`fill-forward-paragraph-function'), and then call
`fill-paragraph-function' on each paragraph?

The current behavior is ok when there is no `fill-paragraph-function',
but if there is, then it should be used.

That would allow mode authors to define a custom
`fill-paragraph-function' (and a `fill-forward-paragraph-function' if
needed), and then multi-paragraph filling would just work.

If there are good reasons for the way it is currently implemented, then
the docs should at least document how a mode author should implement
region/multi-paragraph filling.  The function
`LaTeX-fill-forward-paragraph' in my previous mail seems to work, but it
relies on completely undocumented behavior:

  (1) `fill-forward-paragraph-function' only speaks of moving over
      paragraphs, but `LaTeX-fill-forward-paragraph' fills while moving.
  (2) `LaTeX-fill-forward-paragraph' also moves point one char more than
      required in order not to trap into the last `fill-region'
      condition which would call `fill-region-as-paragraph' and then
      destroy the correct filling again.

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]