changeset 5169:d040c1a8ccbe

(graft_intervals_into_buffer): New arg LENGTH. If source has no intervals, set dest properties to nil.
author Richard M. Stallman <rms@gnu.org>
date Thu, 25 Nov 1993 06:28:03 +0000
parents b30763a185e9
children feee1e8ab9ad
files src/intervals.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/intervals.c	Thu Nov 25 06:26:39 1993 +0000
+++ b/src/intervals.c	Thu Nov 25 06:28:03 1993 +0000
@@ -1221,6 +1221,7 @@
 #endif
 
 /* Insert the intervals of SOURCE into BUFFER at POSITION.
+   LENGTH is the length of the text in SOURCE.
 
    This is used in insdel.c when inserting Lisp_Strings into the
    buffer.  The text corresponding to SOURCE is already in the buffer
@@ -1228,7 +1229,8 @@
    belonging to the string being inserted; intervals are never
    shared.
 
-   If the inserted text had no intervals associated, this function
+   If the inserted text had no intervals associated, and we don't
+   want to inherit the surrounding text's properties, this function
    simply returns -- offset_intervals should handle placing the
    text in the correct interval, depending on the sticky bits.
 
@@ -1253,9 +1255,9 @@
    text...  */
 
 void
-graft_intervals_into_buffer (source, position, buffer, inherit)
+graft_intervals_into_buffer (source, position, length, buffer, inherit)
      INTERVAL source;
-     int position;
+     int position, length;
      struct buffer *buffer;
      int inherit;
 {
@@ -1266,7 +1268,17 @@
   /* If the new text has no properties, it becomes part of whatever
      interval it was inserted into.  */
   if (NULL_INTERVAL_P (source))
-    return;
+    {
+      Lisp_Object buf;
+      if (!inherit)
+	{
+	  XSET (buf, Lisp_Buffer, buffer);
+	  Fset_text_properties (make_number (position),
+				make_number (position + length),
+				Qnil, buf);
+	}
+      return;
+    }
 
   if (NULL_INTERVAL_P (tree))
     {