[Top][All Lists]

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

Re: fill-paragraph ill designed

From: Andreas Röhler
Subject: Re: fill-paragraph ill designed
Date: Tue, 25 Aug 2015 11:50:03 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Am 25.08.2015 um 11:05 schrieb Tassilo Horn:
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.

Yeah, but that's unhappy. Where the global fill-paragraph should know from, what's needed in a special mode, what special modes want to do with strings?

Other way around: any fill-paragraph-function is free to check for region as done here.

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

That's completely up to the mode how to proceed then. There too many unforseen cases - just keep the way free, keep Emacs expandable.

   (2) `fill-paragraph' can't specify any special behavior for the case
       where the region is active.

If it's all up to fill-paragraph-function, global fill-paragraph would be out of the way.

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




reply via email to

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