changeset 16331:32a51f7ba384

(set_properties, add_properties, remove_properties): Don't call modify_region or signal_after_change here. (Fset_text_properties, Fadd_text_properties, Fremove_text_properties): Call them here when appropriate.
author Richard M. Stallman <rms@gnu.org>
date Wed, 25 Sep 1996 08:01:52 +0000
parents e4d9d77012bc
children be25bd9150e8
files src/textprop.c
diffstat 1 files changed, 40 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/textprop.c	Wed Sep 25 08:00:39 1996 +0000
+++ b/src/textprop.c	Wed Sep 25 08:01:52 1996 +0000
@@ -299,14 +299,9 @@
 	if (! EQ (property_value (properties, XCONS (sym)->car),
 		  XCONS (value)->car))
 	  {
-	    modify_region (XBUFFER (object),
-			   interval->position,
-			   interval->position + LENGTH (interval));
 	    record_property_change (interval->position, LENGTH (interval),
 				    XCONS (sym)->car, XCONS (value)->car,
 				    object);
-	    signal_after_change (interval->position, LENGTH (interval),
-				 LENGTH (interval));
 	  }
 
       /* For each new property that has no value at all in the old plist,
@@ -316,14 +311,9 @@
 	   sym = XCONS (value)->cdr)
 	if (EQ (property_value (interval->plist, XCONS (sym)->car), Qunbound))
 	  {
-	    modify_region (XBUFFER (object),
-			   interval->position,
-			   interval->position + LENGTH (interval));
 	    record_property_change (interval->position, LENGTH (interval),
 				    XCONS (sym)->car, Qnil,
 				    object);
-	    signal_after_change (interval->position, LENGTH (interval),
-				 LENGTH (interval));
 	  }
     }
 
@@ -386,12 +376,8 @@
 	    /* Record this change in the buffer, for undo purposes.  */
 	    if (BUFFERP (object))
 	      {
-		modify_region (XBUFFER (object),
-			       i->position,
-			       i->position + LENGTH (i));
 		record_property_change (i->position, LENGTH (i),
 					sym1, Fcar (this_cdr), object);
-		signal_after_change (i->position, LENGTH (i), LENGTH (i));
 	      }
 
 	    /* I's property has a different value -- change it */
@@ -405,12 +391,8 @@
 	  /* Record this change in the buffer, for undo purposes.  */
 	  if (BUFFERP (object))
 	    {
-	      modify_region (XBUFFER (object),
-			     i->position,
-			     i->position + LENGTH (i));
 	      record_property_change (i->position, LENGTH (i),
 				      sym1, Qnil, object);
-	      signal_after_change (i->position, LENGTH (i), LENGTH (i));
 	    }
 	  i->plist = Fcons (sym1, Fcons (val1, i->plist));
 	  changed++;
@@ -446,13 +428,9 @@
 	{
 	  if (BUFFERP (object))
 	    {
-	      modify_region (XBUFFER (object),
-			     i->position,
-			     i->position + LENGTH (i));
 	      record_property_change (i->position, LENGTH (i),
 				      sym, Fcar (Fcdr (current_plist)),
 				      object);
-	      signal_after_change (i->position, LENGTH (i), LENGTH (i));
 	    }
 
 	  current_plist = Fcdr (Fcdr (current_plist));
@@ -469,12 +447,8 @@
 	    {
 	      if (BUFFERP (object))
 		{
-		  modify_region (XBUFFER (object),
-				 i->position,
-				 i->position + LENGTH (i));
 		  record_property_change (i->position, LENGTH (i),
 					  sym, Fcar (Fcdr (this)), object);
-		  signal_after_change (i->position, LENGTH (i), LENGTH (i));
 		}
 
 	      Fsetcdr (Fcdr (tail2), Fcdr (Fcdr (this)));
@@ -897,6 +871,8 @@
 	}
     }
 
+  modify_region (XBUFFER (object), XINT (start), XINT (end));
+
   /* We are at the beginning of interval I, with LEN chars to scan.  */
   for (;;)
     {
@@ -911,11 +887,18 @@
 	  UNGCPRO;
 
 	  if (interval_has_all_properties (properties, i))
-	    return modified ? Qt : Qnil;
+	    {
+	      signal_after_change (XINT (start), XINT (end) - XINT (start),
+				   XINT (end) - XINT (start));
+
+	      return modified ? Qt : Qnil;
+	    }
 
 	  if (LENGTH (i) == len)
 	    {
 	      add_properties (properties, i, object);
+	      signal_after_change (XINT (start), XINT (end) - XINT (start),
+				   XINT (end) - XINT (start));
 	      return Qt;
 	    }
 
@@ -924,6 +907,8 @@
 	  i = split_interval_left (unchanged, len);
 	  copy_properties (unchanged, i);
 	  add_properties (properties, i, object);
+	  signal_after_change (XINT (start), XINT (end) - XINT (start),
+			       XINT (end) - XINT (start));
 	  return Qt;
 	}
 
@@ -964,6 +949,7 @@
   register INTERVAL prev_changed = NULL_INTERVAL;
   register int s, len;
   Lisp_Object ostart, oend;
+  int have_modified = 0;
 
   ostart = start;
   oend = end;
@@ -979,7 +965,13 @@
       && XFASTINT (start) == 0
       && XFASTINT (end) == XSTRING (object)->size)
     {
+      if (! XSTRING (object)->intervals)
+	return Qt;
+
+      modify_region (XBUFFER (object), XINT (start), XINT (end));
       XSTRING (object)->intervals = 0;
+      signal_after_change (XINT (start), XINT (end) - XINT (start),
+			   XINT (end) - XINT (start));
       return Qt;
     }
 
@@ -1005,6 +997,8 @@
   s = XINT (start);
   len = XINT (end) - s;
 
+  modify_region (XBUFFER (object), XINT (start), XINT (end));
+
   if (i->position != s)
     {
       unchanged = i;
@@ -1015,13 +1009,21 @@
 	  copy_properties (unchanged, i);
 	  i = split_interval_left (i, len);
 	  set_properties (properties, i, object);
+	  signal_after_change (XINT (start), XINT (end) - XINT (start),
+			       XINT (end) - XINT (start));
+
 	  return Qt;
 	}
 
       set_properties (properties, i, object);
 
       if (LENGTH (i) == len)
-	return Qt;
+	{
+	  signal_after_change (XINT (start), XINT (end) - XINT (start),
+			       XINT (end) - XINT (start));
+
+	  return Qt;
+	}
 
       prev_changed = i;
       len -= LENGTH (i);
@@ -1045,6 +1047,8 @@
 	  set_properties (properties, i, object);
 	  if (!NULL_INTERVAL_P (prev_changed))
 	    merge_interval_left (i);
+	  signal_after_change (XINT (start), XINT (end) - XINT (start),
+			       XINT (end) - XINT (start));
 	  return Qt;
 	}
 
@@ -1062,6 +1066,8 @@
       i = next_interval (i);
     }
 
+  signal_after_change (XINT (start), XINT (end) - XINT (start),
+		       XINT (end) - XINT (start));
   return Qt;
 }
 
@@ -1112,6 +1118,8 @@
 	}
     }
 
+  modify_region (XBUFFER (object), XINT (start), XINT (end));
+
   /* We are at the beginning of an interval, with len to scan */
   for (;;)
     {
@@ -1126,6 +1134,8 @@
 	  if (LENGTH (i) == len)
 	    {
 	      remove_properties (properties, i, object);
+	      signal_after_change (XINT (start), XINT (end) - XINT (start),
+				   XINT (end) - XINT (start));
 	      return Qt;
 	    }
 
@@ -1134,6 +1144,8 @@
 	  i = split_interval_left (i, len);
 	  copy_properties (unchanged, i);
 	  remove_properties (properties, i, object);
+	  signal_after_change (XINT (start), XINT (end) - XINT (start),
+			       XINT (end) - XINT (start));
 	  return Qt;
 	}