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'.
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