changeset 6591:60f70854e73f

(verify_overlay_modification): Copy TAIL before a hook, in case the hook recenters the overlay lists.
author Richard M. Stallman <rms@gnu.org>
date Wed, 30 Mar 1994 06:32:54 +0000
parents 2c66255e9469
children 9a76406c9f98
files src/buffer.c
diffstat 1 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/buffer.c	Wed Mar 30 05:23:18 1994 +0000
+++ b/src/buffer.c	Wed Mar 30 06:32:54 1994 +0000
@@ -2044,19 +2044,32 @@
       if (XFASTINT (end) == startpos && insertion)
 	{
 	  prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      /* Copy TAIL in case the hook recenters the overlay lists.  */
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
       if (XFASTINT (start) == endpos && insertion)
 	{
 	  prop = Foverlay_get (overlay, Qinsert_behind_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
       if (insertion
 	  ? (XFASTINT (start) > startpos && XFASTINT (end) < endpos)
 	  : (XFASTINT (start) >= startpos && XFASTINT (end) <= endpos))
 	{
 	  prop = Foverlay_get (overlay, Qmodification_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
     }
 
@@ -2078,19 +2091,31 @@
       if (XFASTINT (end) == startpos && insertion)
 	{
 	  prop = Foverlay_get (overlay, Qinsert_in_front_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
       if (XFASTINT (start) == endpos && insertion)
 	{
 	  prop = Foverlay_get (overlay, Qinsert_behind_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
       if (insertion
 	  ? (XFASTINT (start) > startpos && XFASTINT (end) < endpos)
 	  : (XFASTINT (start) >= startpos && XFASTINT (end) <= endpos))
 	{
 	  prop = Foverlay_get (overlay, Qmodification_hooks);
-	  call_overlay_mod_hooks (prop, overlay, start, end);
+	  if (!NILP (prop))
+	    {
+	      tail = Fcopy_sequence (tail);
+	      call_overlay_mod_hooks (prop, overlay, start, end);
+	    }
 	}
     }
 }