bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65536: 30.0.50; replace-regexp-in-string documentation does not ment


From: Eli Zaretskii
Subject: bug#65536: 30.0.50; replace-regexp-in-string documentation does not mention it saves match data
Date: Sat, 26 Aug 2023 09:09:11 +0300

> Date: Fri, 25 Aug 2023 18:56:15 +0200
> From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
> Cc: 65536@debbugs.gnu.org
> 
> On 2023-08-25  17:26, Jens Schmidt wrote:
> > On 2023-08-25  16:18, Eli Zaretskii wrote:
> >>> Date: Fri, 25 Aug 2023 15:16:29 +0200
> >>> From:  Jens Schmidt via "Bug reports for GNU Emacs,
> >>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> > 
> >>> Maybe this should be explicitly documented in its doc string and/or
> >>> the Emacs Lisp manual ((elisp) Search and Replace) so that users of
> >>> the function can rely on that fact?
> >>
> >> Is it important to promise never to clobber match-data in this
> >> function?
> > 
> > Not sure whether the following is convincing enough ...
> 
> OTOH, I just found the following in the doc string of
> `save-match-data', which means that `replace-regexp-in-string'
> is actually not "convention-conforming":
> 
>   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.

Stefan, WDYT?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]