Subject: Re: bug#65536: 30.0.50; replace-regexp-in-string documentation does not mention it saves match data

From: Ihor Radchenko <[email-masked]>
Date: Sat, 26 Aug 2023 06:24:55 +0000

Eli Zaretskii <[email-masked]> writes:

>>   NOTE: The convention in Elisp is that any function, except for a few
>>   exceptions like car/assoc/+/goto-char, can clobber the match data,
>>   so ‘save-match-data’ should normally be used to save *your* match data
>>   rather than your caller’s match data.
>> 
>> The final decision is yours ...
>
> I think it's okay to leave things as they are.

I can share some experience from me dropping some `save-match-data' from
Org parser - I had to fight the consequences, as a lot of Org's own
code implicitly assumed that match data is saved, which caused huge
number of tests to fail. Fixing this was not fun, although I was able to
do it because that particular function had a history modifying match
data in the past and only relatively recent code additions were
affected.

If something like `replace-regexp-in-string' suddenly changes its
behaviour (even undocumented), I expect issues in third-party code.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>