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

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

bug#61091: 30.0.50; y-or-n-p clobbers match data


From: Eli Zaretskii
Subject: bug#61091: 30.0.50; y-or-n-p clobbers match data
Date: Fri, 27 Jan 2023 09:52:43 +0200

> 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 via email to

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