unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jens Schmidt <jschmidt4gnu@vodafonemail.de>,
	Stefan Kangas <stefankangas@gmail.com>
Cc: 65536@debbugs.gnu.org
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	[thread overview]
Message-ID: <83il92mj20.fsf@gnu.org> (raw)
In-Reply-To: <baff0ddc-0cc5-c07a-4428-85d4b6193f4d@vodafonemail.de> (message from Jens Schmidt on Fri, 25 Aug 2023 18:56:15 +0200)

> 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	other threads:[~2023-08-26  6:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 13:16 bug#65536: 30.0.50; replace-regexp-in-string documentation does not mention it saves match data Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-25 14:18 ` Eli Zaretskii
2023-08-25 15:26   ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-25 16:56     ` Jens Schmidt via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-26  6:09       ` Eli Zaretskii [this message]
2023-08-26  6:24         ` Ihor Radchenko
2023-08-26  8:40         ` Stefan Kangas
2023-08-26  9:09           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83il92mj20.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=65536@debbugs.gnu.org \
    --cc=jschmidt4gnu@vodafonemail.de \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).