Subject: Re: bug#76313: New function `replace-region`

From: Tassilo Horn <[email-masked]>
Date: Mon, 31 Mar 2025 21:48:54 +0200

Eli Zaretskii <[email-masked]> writes:

>> I think that's a very good point.  Stefan's `replace-region` can be
>> use to replace text with some arbitrary other text with predictable
>> positioning of point.
>
> And the same cannot be done by calling replace-region-contents with
> MAX-SECS of zero?  If not, why not?

It certainly can.  I just think the difference in intended use-case and
behavior justify separate functions.

A replace-region function can be used in many places and is easy to
document.  The complexities of replace-region-contents which leak into
its signature and docstring are justified only in very few situations.

If replace-region-contents should do both jobs, quick and careful
replacements, it's hard to document.  Either you start with the quick
variant and have to say that MAX-SECS should be 0 (why? and why that
strange name?), or you start with the careful variant and append that a
MAX-SECS of 0 makes everything you've read until now meaningless.  And
that the frequently useful quick variant requires one explicit argument
more than the seldomly needed careful variant is a bit odd, too.

Bye,
Tassilo