changeset 1285:d50533e23dff

* editfns.c (make_buffer_string): Call copy_intervals_to_string(). (Finsert_buffer_substring): Call graft_intervals_into_buffer(). #include "intervals.h".
author Joseph Arceneaux <jla@gnu.org>
date Thu, 01 Oct 1992 00:56:11 +0000
parents 4742a5797146
children fbd402838d8d
files src/editfns.c
diffstat 1 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Thu Oct 01 00:56:11 1992 +0000
+++ b/src/editfns.c	Thu Oct 01 00:56:11 1992 +0000
@@ -27,6 +27,7 @@
 #endif
 
 #include "lisp.h"
+#include "intervals.h"
 #include "buffer.h"
 #include "window.h"
 
@@ -700,7 +701,9 @@
 /* Making strings from buffer contents.  */
 
 /* Return a Lisp_String containing the text of the current buffer from
-   START to END.
+   START to END.  If text properties are in use and the current buffer
+   has properties in the range specifed, the resulting string will also
+   have them.
 
    We don't want to use plain old make_string here, because it calls
    make_uninit_string, which can cause the buffer arena to be
@@ -709,6 +712,7 @@
    doesn't effect most of the other users of make_string, so it should
    be left as is.  But we should use this function when conjuring
    buffer substrings.  */
+
 Lisp_Object
 make_buffer_string (start, end)
      int start, end;
@@ -721,6 +725,9 @@
   result = make_uninit_string (end - start);
   bcopy (&FETCH_CHAR (start), XSTRING (result)->data, end - start);
 
+  /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
+  copy_intervals_to_string (result, current_buffer, start, end - start);
+
   return result;
 }
 
@@ -756,7 +763,7 @@
   (buf, b, e)
      Lisp_Object buf, b, e;
 {
-  register int beg, end, exch;
+  register int beg, end, temp, len, opoint, start;
   register struct buffer *bp;
 
   buf = Fget_buffer (buf);
@@ -778,7 +785,7 @@
     }
 
   if (beg > end)
-    exch = beg, beg = end, end = exch;
+    temp = beg, beg = end, end = temp;
 
   /* Move the gap or create enough gap in the current buffer.  */
 
@@ -787,6 +794,10 @@
   if (GAP_SIZE < end - beg)
     make_gap (end - beg - GAP_SIZE);
 
+  len = end - beg;
+  start = beg;
+  opoint = point;
+
   if (!(BUF_BEGV (bp) <= beg
 	&& beg <= end
         && end <= BUF_ZV (bp)))
@@ -802,6 +813,10 @@
   if (beg < end)
     insert (BUF_CHAR_ADDRESS (bp, beg), end - beg);
 
+  /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */
+  graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len),
+			       opoint, bp);
+
   return Qnil;
 }