# HG changeset patch # User Richard M. Stallman # Date 785478678 0 # Node ID 6b8e51b286c6df16e083e62451d27f5235183f79 # Parent 07c7351976b42eca9b47f43e9ed3d05ee155cc91 Filters and sentinels now save match data themselves. diff -r 07c7351976b4 -r 6b8e51b286c6 lispref/searching.texi --- a/lispref/searching.texi Tue Nov 22 03:22:43 1994 +0000 +++ b/lispref/searching.texi Tue Nov 22 04:31:18 1994 +0000 @@ -1106,15 +1106,10 @@ @node Saving Match Data @subsection Saving and Restoring the Match Data - All asynchronous process functions (filters and sentinels) and -functions that use @code{recursive-edit} should save and restore the -match data if they do a search or if they let the user type arbitrary -commands. Saving the match data is useful in other cases as -well---whenever you want to access the match data resulting from an -earlier search, notwithstanding another intervening search. - - This example shows the problem that can arise if you fail to -attend to this requirement: + When you call a function that may do a search, you may need to save +and restore the match data around that call, if you want to preserve the +match data from an earlier search for later use. Here is an example +that shows the problem that arises if you fail to save the match data: @example @group @@ -1127,13 +1122,11 @@ @end group @end example - In Emacs versions 19 and later, you can save and restore the match -data with @code{save-match-data}: + You can save and restore the match data with @code{save-match-data}: @defspec save-match-data body@dots{} This special form executes @var{body}, saving and restoring the match -data around it. This is useful if you wish to do a search without -altering the match data that resulted from an earlier search. +data around it. @end defspec You can use @code{set-match-data} together with @code{match-data} to @@ -1149,6 +1142,10 @@ @end group @end example + Emacs automatically saves and restores the match data when it runs +process filter functions (@pxref{Filter Functions}) and process +sentinels (@pxref{Sentinels}). + @ignore Here is a function which restores the match data provided the buffer associated with it still exists.