diff src/textprop.c @ 16339:abcd50093b4e

(Fset_text_properties, Fadd_text_properties) (Fremove_text_properties): Call modify_region and signal_after_change only for buffers, not for strings.
author Richard M. Stallman <rms@gnu.org>
date Thu, 26 Sep 1996 03:48:10 +0000
parents 32a51f7ba384
children 38c158927e6f
line wrap: on
line diff
--- a/src/textprop.c	Thu Sep 26 03:43:31 1996 +0000
+++ b/src/textprop.c	Thu Sep 26 03:48:10 1996 +0000
@@ -871,7 +871,8 @@
 	}
     }
 
-  modify_region (XBUFFER (object), XINT (start), XINT (end));
+  if (BUFFERP (object))
+    modify_region (XBUFFER (object), XINT (start), XINT (end));
 
   /* We are at the beginning of interval I, with LEN chars to scan.  */
   for (;;)
@@ -888,8 +889,9 @@
 
 	  if (interval_has_all_properties (properties, i))
 	    {
-	      signal_after_change (XINT (start), XINT (end) - XINT (start),
-				   XINT (end) - XINT (start));
+	      if (BUFFERP (object))
+		signal_after_change (XINT (start), XINT (end) - XINT (start),
+				     XINT (end) - XINT (start));
 
 	      return modified ? Qt : Qnil;
 	    }
@@ -897,8 +899,9 @@
 	  if (LENGTH (i) == len)
 	    {
 	      add_properties (properties, i, object);
-	      signal_after_change (XINT (start), XINT (end) - XINT (start),
-				   XINT (end) - XINT (start));
+	      if (BUFFERP (object))
+		signal_after_change (XINT (start), XINT (end) - XINT (start),
+				     XINT (end) - XINT (start));
 	      return Qt;
 	    }
 
@@ -907,8 +910,9 @@
 	  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));
+	  if (BUFFERP (object))
+	    signal_after_change (XINT (start), XINT (end) - XINT (start),
+				 XINT (end) - XINT (start));
 	  return Qt;
 	}
 
@@ -968,10 +972,7 @@
       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;
     }
 
@@ -997,7 +998,8 @@
   s = XINT (start);
   len = XINT (end) - s;
 
-  modify_region (XBUFFER (object), XINT (start), XINT (end));
+  if (BUFFERP (object))
+    modify_region (XBUFFER (object), XINT (start), XINT (end));
 
   if (i->position != s)
     {
@@ -1009,8 +1011,9 @@
 	  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));
+	  if (BUFFERP (object))
+	    signal_after_change (XINT (start), XINT (end) - XINT (start),
+				 XINT (end) - XINT (start));
 
 	  return Qt;
 	}
@@ -1019,8 +1022,9 @@
 
       if (LENGTH (i) == len)
 	{
-	  signal_after_change (XINT (start), XINT (end) - XINT (start),
-			       XINT (end) - XINT (start));
+	  if (BUFFERP (object))
+	    signal_after_change (XINT (start), XINT (end) - XINT (start),
+				 XINT (end) - XINT (start));
 
 	  return Qt;
 	}
@@ -1047,8 +1051,9 @@
 	  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));
+	  if (BUFFERP (object))
+	    signal_after_change (XINT (start), XINT (end) - XINT (start),
+				 XINT (end) - XINT (start));
 	  return Qt;
 	}
 
@@ -1066,8 +1071,9 @@
       i = next_interval (i);
     }
 
-  signal_after_change (XINT (start), XINT (end) - XINT (start),
-		       XINT (end) - XINT (start));
+  if (BUFFERP (object))
+    signal_after_change (XINT (start), XINT (end) - XINT (start),
+			 XINT (end) - XINT (start));
   return Qt;
 }
 
@@ -1118,7 +1124,8 @@
 	}
     }
 
-  modify_region (XBUFFER (object), XINT (start), XINT (end));
+  if (BUFFERP (object))
+    modify_region (XBUFFER (object), XINT (start), XINT (end));
 
   /* We are at the beginning of an interval, with len to scan */
   for (;;)
@@ -1134,8 +1141,9 @@
 	  if (LENGTH (i) == len)
 	    {
 	      remove_properties (properties, i, object);
-	      signal_after_change (XINT (start), XINT (end) - XINT (start),
-				   XINT (end) - XINT (start));
+	      if (BUFFERP (object))
+		signal_after_change (XINT (start), XINT (end) - XINT (start),
+				     XINT (end) - XINT (start));
 	      return Qt;
 	    }
 
@@ -1144,8 +1152,9 @@
 	  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));
+	  if (BUFFERP (object))
+	    signal_after_change (XINT (start), XINT (end) - XINT (start),
+				 XINT (end) - XINT (start));
 	  return Qt;
 	}