From: Richard M. Stallman Date: Sat, 21 Mar 1998 02:57:08 +0000 (+0000) Subject: (make_buffer_string_both): New function. X-Git-Tag: emacs-20.3~1839 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88441c8eb8fab886944322aa94ae799ba92c8193;p=emacs.git (make_buffer_string_both): New function. (make_buffer_string): Use make_buffer_string_both. --- diff --git a/src/editfns.c b/src/editfns.c index 1a72bf02929..226035d5362 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1445,10 +1445,34 @@ make_buffer_string (start, end, props) int start, end; int props; { - Lisp_Object result, tem, tem1; int start_byte = CHAR_TO_BYTE (start); int end_byte = CHAR_TO_BYTE (end); + return make_buffer_string_both (start, start_byte, end, end_byte, props); +} + +/* Return a Lisp_String containing the text of the current buffer from + START / START_BYTE to END / END_BYTE. + + If text properties are in use and the current buffer + has properties in the range specified, the resulting string will also + have them, if PROPS is nonzero. + + 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 + compacted. make_string has no way of knowing that the data has + been moved, and thus copies the wrong data into the string. This + 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_both (start, start_byte, end, end_byte, props) + int start, start_byte, end, end_byte; + int props; +{ + Lisp_Object result, tem, tem1; + if (start < GPT && GPT < end) move_gap (start);