From 74d6d8c5d61de07aa8c3b7f2284863ab69ad8e14 Mon Sep 17 00:00:00 2001 From: Joseph Arceneaux Date: Thu, 1 Oct 1992 00:56:11 +0000 Subject: * editfns.c (make_buffer_string): Call copy_intervals_to_string(). (Finsert_buffer_substring): Call graft_intervals_into_buffer(). #include "intervals.h". --- src/editfns.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/editfns.c b/src/editfns.c index cf7efd5a95..7c2b562a13 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -27,6 +27,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif #include "lisp.h" +#include "intervals.h" #include "buffer.h" #include "window.h" @@ -700,7 +701,9 @@ Both arguments are required.") /* 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 @@ Both arguments are required.") 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 @@ make_buffer_string (start, end) 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 @@ They default to the beginning and the end of BUFFER.") (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 @@ They default to the beginning and the end of BUFFER.") } 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 @@ They default to the beginning and the end of BUFFER.") 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 @@ They default to the beginning and the end of BUFFER.") 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; } -- cgit v1.2.3