Subject: Re: bug#27926: 25.2; Let arg REGION-NONCONTIGUOUS-P do more

From: Stefan Kangas <[email-masked]>
Date: Sat, 15 Mar 2025 05:16:08 -0700

Drew Adams <[email-masked]> writes:

> In `replace.el', some replacment commands now accept optional arg
> REGION-NONCONTIGUOUS-P, to allow replacement over the rectangular region
> (really, over any list of dotted position pairs (START . END)).
>
> Currently the arg is just a Boolean.  Please consider changing
> the behavior of the commands in this way:
>
> Let non-nil continue to mean the same thing: respect limits such as
> those that are returned by the value of `region-extract-function'.
> But allow two particular non-nil values to control that behavior in
> different ways, instead of requiring that code use
> `region-extract-function':
>
>   * A function as arg value would mean use what that function returns
>     instead of applying the function that is the value of
>     `region-extract-function' to `bounds' and using what that returns.
>     This can be handy in some contexts, just as binding
>     `region-extract-function' can be handy in other contexts.
>
>   * A non-function (i.e., non-lambda) list as arg value would be
>     expected to have the form of a value that `region-extract-function'
>     applied to `bounds' returns, and it would be used directly, instead
>     of invoking `region-extract-function' to get the list of zone limits.
>     This can be handy in still other contexts, where the limits might
>     already be available - no need to bind `region-extract-function' to
>     a function like (lambda (_ignore) THE-KNOWN-LIMITS).

What is the use case here?  Please show some example code before and
after making this change, and explain (as briefly as humanly possibly)
what are the benefits of making the above change.

It is hard to consider this in its current form.

Thanks.