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

From: Po Lu <[email-masked]>
Date: Sun, 16 Mar 2025 16:01:18 +0800

Drew Adams <[email-masked]> writes:

>> 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.
>
> Sorry, but I don't think it is. I'd completely forgotten about this
> request, but reading it now I find it 100% clear. Please take the time
> to read it carefully, as I took the time to specify it carefully.
> Thx.

I agree.  It is simply a request that these parameters to replacement
commands should accept alternative means of extracting non-contiguous
regions, whether functions equivalent to `region-extract-function' (but
otherwise than from the said variable), or by accepting the list of a
non-contiguous region's segments directly.