[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: |
Tue, 25 Aug 2015 11:05:37 +0200 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
Andreas Röhler <address@hidden> writes:
> There are many issues, uncertain/unsound decisions inside this piece
> of code.
>
> Let's start with fill-paragraph-function.
>
> If fill-paragraph-function is set, it must be assumed a valid function
> and be used.
That's not what the documentation says:
,----[ C-h f fill-paragraph RET ]
| fill-paragraph is an interactive compiled Lisp function in ‘fill.el’.
|
| [...]
|
| The REGION argument is non-nil if called interactively; in that
| case, if Transient Mark mode is enabled and the mark is active,
| call ‘fill-region’ to fill each of the paragraphs in the active
| region, instead of just filling the current paragraph.
`----
So if there is an active region, `fill-paragraph' just calls
`fill-region', and then the `fill-paragraph-function' is irrelevant.
> So it must precede that clause:
>
> (and region transient-mark-mode mark-active
If `fill-paragraph' would call `fill-paragraph-function' also in this
case, then there are two options:
(1) `fill-paragraph's documentation stays what it is, and then every
`fill-paragraph-function' ever going to be defined has to handle
the active region case and call `fill-region'.
(2) `fill-paragraph' can't specify any special behavior for the case
where the region is active. It might just say that it itself
behaves differently with an active region when f-p-f is nil.
Option (1) is useless, and option (2) is confusing and might lead to
inconsistent behavior, e.g., in some modes `M-q' with an active region
fills the region (because f-p-f is nil or a function which considers the
active region case) and in some other modes it just fills the current
paragraph (because f-p-f is set to some function which doesn't consider
the active region case).
Bye,
Tassilo
Re: fill-paragraph ill designed, Stefan Monnier, 2015/08/25