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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; replace-regexp-in-string documentation does not mention it
 saves match data
Date: Fri, 25 Aug 2023 15:16:29 +0200
Not sure about this one, maybe I have overlooked something ...

The Emacs Lisp manual says:

   Notice that all functions are allowed to overwrite the match data
   unless they’re explicitly documented not to do so.

And in particular function `replace-regexp-in-string' could be
assumed to modify the match data, but it uses an explicit call to
`save-match-data' to not do so.

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?




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.