diff options
| author | Richard M. Stallman | 1998-03-21 02:57:08 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-21 02:57:08 +0000 |
| commit | 88441c8eb8fab886944322aa94ae799ba92c8193 (patch) | |
| tree | 88111dc6f489515cea339c5f1174ec16c291f83a | |
| parent | a42fefa844ef2028cc00beb2bfc9f0a3571254f1 (diff) | |
| download | emacs-88441c8eb8fab886944322aa94ae799ba92c8193.tar.gz emacs-88441c8eb8fab886944322aa94ae799ba92c8193.zip | |
(make_buffer_string_both): New function.
(make_buffer_string): Use make_buffer_string_both.
| -rw-r--r-- | src/editfns.c | 26 |
1 files changed, 25 insertions, 1 deletions
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) | |||
| 1445 | int start, end; | 1445 | int start, end; |
| 1446 | int props; | 1446 | int props; |
| 1447 | { | 1447 | { |
| 1448 | Lisp_Object result, tem, tem1; | ||
| 1449 | int start_byte = CHAR_TO_BYTE (start); | 1448 | int start_byte = CHAR_TO_BYTE (start); |
| 1450 | int end_byte = CHAR_TO_BYTE (end); | 1449 | int end_byte = CHAR_TO_BYTE (end); |
| 1451 | 1450 | ||
| 1451 | return make_buffer_string_both (start, start_byte, end, end_byte, props); | ||
| 1452 | } | ||
| 1453 | |||
| 1454 | /* Return a Lisp_String containing the text of the current buffer from | ||
| 1455 | START / START_BYTE to END / END_BYTE. | ||
| 1456 | |||
| 1457 | If text properties are in use and the current buffer | ||
| 1458 | has properties in the range specified, the resulting string will also | ||
| 1459 | have them, if PROPS is nonzero. | ||
| 1460 | |||
| 1461 | We don't want to use plain old make_string here, because it calls | ||
| 1462 | make_uninit_string, which can cause the buffer arena to be | ||
| 1463 | compacted. make_string has no way of knowing that the data has | ||
| 1464 | been moved, and thus copies the wrong data into the string. This | ||
| 1465 | doesn't effect most of the other users of make_string, so it should | ||
| 1466 | be left as is. But we should use this function when conjuring | ||
| 1467 | buffer substrings. */ | ||
| 1468 | |||
| 1469 | Lisp_Object | ||
| 1470 | make_buffer_string_both (start, start_byte, end, end_byte, props) | ||
| 1471 | int start, start_byte, end, end_byte; | ||
| 1472 | int props; | ||
| 1473 | { | ||
| 1474 | Lisp_Object result, tem, tem1; | ||
| 1475 | |||
| 1452 | if (start < GPT && GPT < end) | 1476 | if (start < GPT && GPT < end) |
| 1453 | move_gap (start); | 1477 | move_gap (start); |
| 1454 | 1478 | ||