GNU bug report logs - #65536
30.0.50; replace-regexp-in-string documentation does not mention it saves match data

Previous Next

Package: emacs;

Reported by: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>

Date: Fri, 25 Aug 2023 13:18:01 UTC

Severity: normal

Tags: notabug, wontfix

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 65536 <at> debbugs.gnu.org (full text, mbox):

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65536 <at> debbugs.gnu.org, Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>,
 Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: bug#65536: 30.0.50; replace-regexp-in-string documentation does
 not mention it saves match data
Date: Sat, 26 Aug 2023 06:24:55 +0000
Eli Zaretskii <eliz <at> gnu.org> 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>




This bug report was last modified 1 year and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.