>>> fill-region-as-paragraph is an interactive function.
>>> It is very strange for me that calling it interactively requires the
>>> user to select region within a single paragraph and nothing
>>> else.
>> I think even the above statement is the result of a misunderstanding:
>> the region passed to `fill-region-as-paragraph` can be *anything*.
>> It should just correspond to what the user wants to treat as
>> a single paragraph.  IOW, it's used specifically when the "builtin"
>> notion of paragraph doesn't match what the user needs.
>
> But earlier you said that
>
> "it's the responsibility of the caller to make sure the region is indeed a 
> fillable paragraph"
>
> Either these two statements contradict each other or I am missing something.

By "make sure the region is indeed a fillable paragraph" I meant that
it's the responsibility of the callers to make sure that *they* consider
it as a fillable paragraph.

>> What behavior would you find more intuitive?
>> IOW, how would you change its behavior to make it more intuitive?
> Given that I do not quite understand the intended API and behavior, I
> have no clue what would be more intuitive. I just don't understand the
> current design well enough.

I don't know how else to describe it... OK, here's another try.
The basic behavior of `fill-region-as-paragraph` is roughly:

    (subst-char-in-region BEG END ?\n ?\s)
    (goto-char BEG)
    (while (progn (forward-char fill-column)
                  (< (point) END))
      (insert "\n"))

Except it makes sure to insert the space only at appropriate places,
counts columns instead of chars, takes care of `fill-prefix`, compacts
sequences of whitespace into a single space, etc...

Does that make sense?


=== Stefan


Reply via email to