Subject: Re: bug#2499: 23.0.91; syntax-ppss / beginning-of-defun not saving match data

From: "Tobias C. Rittweiler" <[email-masked]>
Date: Tue, 03 Mar 2009 21:50:45 +0100

Stefan Monnier <[email-masked]> writes:

> > > >   (i) `beginning-of-defun' is allowed to not save match data. If so,
> > > >       please document it.
> > >
> > > 99.9% of the functions are allowed to not save match data.  
> >
> > Oh, I didn't know that! I thought the policy was the other way
> > around. (Perhaps 34.6, The Match Data, should make this policy more
> > explicit. If so, and you say so, I'll prepare a patch.)
>
> Patch welcome.

Attached.

  -T.

Index: doc/lispref/searching.texi
===================================================================
RCS file: /sources/emacs/emacs/doc/lispref/searching.texi,v
retrieving revision 1.11
diff -u -r1.11 searching.texi
--- doc/lispref/searching.texi	8 Jan 2009 05:29:01 -0000	1.11
+++ doc/lispref/searching.texi	3 Mar 2009 20:48:30 -0000
@@ -1204,6 +1204,12 @@
 can't avoid another intervening search, you must save and restore the
 match data around it, to prevent it from being overwritten.
 
+  Notice that all functions are allowed to overwrite the match data
+unless they're explicitly documented not to do so. A consequence is that
+functions that are run implictly in the background (@pxref{Timers}, and
+@ref{Idle Timers}) should likely save and restore the match data
+explicitly.
+
 @menu
 * Replacing Match::	  Replacing a substring that was matched.
 * Simple Match Data::     Accessing single items of match data,