]> code.delx.au - gnu-emacs/blobdiff - src/search.c
Merge from emacs--devo--0
[gnu-emacs] / src / search.c
index aff998b154b8286d6f178d25c459c6297e71a010..2060abda6d7f284bdda925bcea53b48cf7eba42c 100644 (file)
@@ -2942,11 +2942,15 @@ Return value is undefined if the last search failed.  */)
   return reuse;
 }
 
-/* Internal usage only:
-   If RESEAT is `evaporate', put the markers back on the free list
-   immediately.  No other references to the markers must exist in this case,
-   so it is used only internally on the unwind stack and save-match-data from
-   Lisp.  */
+/* We used to have an internal use variant of `reseat' described as:
+
+      If RESEAT is `evaporate', put the markers back on the free list
+      immediately.  No other references to the markers must exist in this
+      case, so it is used only internally on the unwind stack and
+      save-match-data from Lisp.
+
+   But it was ill-conceived: those supposedly-internal markers get exposed via
+   the undo-list, so freeing them here is unsafe.  */
 
 DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0,
        doc: /* Set internal data on last search match from elements of LIST.
@@ -3031,10 +3035,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
 
            if (!NILP (reseat) && MARKERP (m))
              {
-               if (EQ (reseat, Qevaporate))
-                 free_marker (m);
-               else
-                 unchain_marker (XMARKER (m));
+               unchain_marker (XMARKER (m));
                XSETCAR (list, Qnil);
              }
 
@@ -3052,10 +3053,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
 
            if (!NILP (reseat) && MARKERP (m))
              {
-               if (EQ (reseat, Qevaporate))
-                 free_marker (m);
-               else
-                 unchain_marker (XMARKER (m));
+               unchain_marker (XMARKER (m));
                XSETCAR (list, Qnil);
              }
          }
@@ -3119,8 +3117,8 @@ static Lisp_Object
 unwind_set_match_data (list)
      Lisp_Object list;
 {
-  /* It is safe to free (evaporate) the markers immediately.  */
-  return Fset_match_data (list, Qevaporate);
+  /* It is NOT ALWAYS safe to free (evaporate) the markers immediately.  */
+  return Fset_match_data (list, Qt);
 }
 
 /* Called to unwind protect the match data.  */
@@ -3219,9 +3217,10 @@ A value of nil (which is the normal value) means treat spaces literally.  */);
 
   DEFVAR_LISP ("inhibit-changing-match-data", &Vinhibit_changing_match_data,
       doc: /* Internal use only.
-If non-nil, the match data will not be changed during call to searching or
-matching functions, such as `looking-at', `string-match', `re-search-forward'
-etc.  */);
+If non-nil, the primitive searching and matching functions
+such as `looking-at', `string-match', `re-search-forward', etc.,
+do not set the match data.  The proper way to use this variable
+is to bind it with `let' around a small expression.  */);
   Vinhibit_changing_match_data = Qnil;
 
   defsubr (&Slooking_at);