unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: rms@gnu.org
Cc: 61091@debbugs.gnu.org
Subject: bug#61091: 30.0.50; y-or-n-p clobbers match data
Date: Fri, 27 Jan 2023 09:52:43 +0200	[thread overview]
Message-ID: <83bkmkct2s.fsf@gnu.org> (raw)
In-Reply-To: <E1pLFzC-0005XT-NR@fencepost.gnu.org> (message from Richard Stallman on Thu, 26 Jan 2023 23:05:10 -0500)

> From: Richard Stallman <rms@gnu.org>
> Date: Thu, 26 Jan 2023 23:05:10 -0500
> 
> I find in some of my personal code that calls to y-or-n-p
> clobber the match data.  That code worked ok when I first wrote it,
> and for several years after that.  Putting (save-match-data...)
> around the call to y-or-n-p seems to fix it.
> 
> Did some recent change cause y-or-n-p to do searches
> and not save the match data?

y-or-n-p originally was implemented in C and was relatively simple.
Since then it was moved to Lisp and became a monster, see subr.el.  It
is anyone's guess where in that code we clobber the match data.  Given
a test case, we could debug and find what does this, but is it really
worth our while?  In general, Lisp programs should not rely on any
function not to clobber match data, unless that function is documented
to preserve match data.





  reply	other threads:[~2023-01-27  7:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  4:05 bug#61091: 30.0.50; y-or-n-p clobbers match data Richard Stallman
2023-01-27  7:52 ` Eli Zaretskii [this message]
2023-01-27 14:38   ` Michael Heerdegen
2023-01-27 15:00     ` Eli Zaretskii
2023-01-29  5:18   ` Richard Stallman
2023-01-29  6:40     ` Eli Zaretskii
2023-02-04  5:15       ` Richard Stallman
2023-02-04  8:16         ` 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=83bkmkct2s.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=61091@debbugs.gnu.org \
    --cc=rms@gnu.org \
    /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).