Ihor Radchenko [2026-07-11 12:22:29] wrote: > Stefan Monnier <[email protected]> writes: >>> 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. > > But the fill-paragraph-function has no idea about assumptions made by > the callers.
Yup: `fill-paragraph-function` (FPF) is usually the caller of `fill-region-as-paragraph` (FRAP) so FPF the one that bears the responsability of making sure what they pass to FRAP is indeed something FPF considers a pargraph. > It needs to operate with its own assumption about paragraph > syntax. Yup. Tho it usually delegates that task to `fill-forward-paragraph-function`. > So, if the region it is called on happens to contradict that ?? AFAIK, you're talking about FPF, here, but FPF is never called on a region (as opposed to `fill-region` or FRAP): it operates on "the paragraph around point" and is in charge of deciding what are the boundaries of that paragraph. > So, in other words, it only joins the paragraphs on blank lines that > are either empty or only contain spaces (no tabs!). Page breaks and > tabs will remain separators and we may end up with multiple paragraph > after filling region "as paragraph". That depends on many things (e.g. the definition of paragraph), but yes, the above can happen. Tho it can also happen that FRAP turns ^L and TABs into spaces, or it can also happens to that it keeps them as-they-are but that they they do not separate paragraphs. === Stefan
