diff options
| author | Richard M. Stallman | 1993-11-23 10:38:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-23 10:38:59 +0000 |
| commit | 60b96ee7a3b21d041b261c2b44b9c2be23b1810f (patch) | |
| tree | c0e3987c93dd550f2c682ed0afcb296e87544086 /src | |
| parent | d2cad97da6baeac455736dc3096cfe021b297206 (diff) | |
| download | emacs-60b96ee7a3b21d041b261c2b44b9c2be23b1810f.tar.gz emacs-60b96ee7a3b21d041b261c2b44b9c2be23b1810f.zip | |
(make_buffer_string): Don't copy intervals
if we don't really have any properties.
(Finsert_buffer_substring):
Pass graft_intervals_into_buffer the current buffer.
Pass it the extra arg LENGTH.
(Fsubst_char_in_region): Call modify_region only if
a change has to be made. Call signal_after_change just once, at end.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/editfns.c b/src/editfns.c index c091f00210f..de8d167191b 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -890,7 +890,7 @@ Lisp_Object | |||
| 890 | make_buffer_string (start, end) | 890 | make_buffer_string (start, end) |
| 891 | int start, end; | 891 | int start, end; |
| 892 | { | 892 | { |
| 893 | Lisp_Object result; | 893 | Lisp_Object result, tem; |
| 894 | 894 | ||
| 895 | if (start < GPT && GPT < end) | 895 | if (start < GPT && GPT < end) |
| 896 | move_gap (start); | 896 | move_gap (start); |
| @@ -898,8 +898,12 @@ make_buffer_string (start, end) | |||
| 898 | result = make_uninit_string (end - start); | 898 | result = make_uninit_string (end - start); |
| 899 | bcopy (&FETCH_CHAR (start), XSTRING (result)->data, end - start); | 899 | bcopy (&FETCH_CHAR (start), XSTRING (result)->data, end - start); |
| 900 | 900 | ||
| 901 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | 901 | tem = Fnext_property_change (make_number (start), Qnil, make_number (end)); |
| 902 | copy_intervals_to_string (result, current_buffer, start, end - start); | 902 | |
| 903 | #ifdef USE_TEXT_PROPERTIES | ||
| 904 | if (XINT (tem) != end) | ||
| 905 | copy_intervals_to_string (result, current_buffer, start, end - start); | ||
| 906 | #endif | ||
| 903 | 907 | ||
| 904 | return result; | 908 | return result; |
| 905 | } | 909 | } |
| @@ -991,7 +995,7 @@ They default to the beginning and the end of BUFFER.") | |||
| 991 | 995 | ||
| 992 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | 996 | /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ |
| 993 | graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), | 997 | graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), |
| 994 | opoint, bp, 0); | 998 | opoint, len, current_buffer, 0); |
| 995 | 999 | ||
| 996 | return Qnil; | 1000 | return Qnil; |
| 997 | } | 1001 | } |
| @@ -1127,6 +1131,7 @@ and don't mark the buffer as really changed.") | |||
| 1127 | Lisp_Object start, end, fromchar, tochar, noundo; | 1131 | Lisp_Object start, end, fromchar, tochar, noundo; |
| 1128 | { | 1132 | { |
| 1129 | register int pos, stop, look; | 1133 | register int pos, stop, look; |
| 1134 | int changed = 0; | ||
| 1130 | 1135 | ||
| 1131 | validate_region (&start, &end); | 1136 | validate_region (&start, &end); |
| 1132 | CHECK_NUMBER (fromchar, 2); | 1137 | CHECK_NUMBER (fromchar, 2); |
| @@ -1136,7 +1141,6 @@ and don't mark the buffer as really changed.") | |||
| 1136 | stop = XINT (end); | 1141 | stop = XINT (end); |
| 1137 | look = XINT (fromchar); | 1142 | look = XINT (fromchar); |
| 1138 | 1143 | ||
| 1139 | modify_region (current_buffer, pos, stop); | ||
| 1140 | if (! NILP (noundo)) | 1144 | if (! NILP (noundo)) |
| 1141 | { | 1145 | { |
| 1142 | if (MODIFF - 1 == current_buffer->save_modified) | 1146 | if (MODIFF - 1 == current_buffer->save_modified) |
| @@ -1149,15 +1153,23 @@ and don't mark the buffer as really changed.") | |||
| 1149 | { | 1153 | { |
| 1150 | if (FETCH_CHAR (pos) == look) | 1154 | if (FETCH_CHAR (pos) == look) |
| 1151 | { | 1155 | { |
| 1156 | if (! changed) | ||
| 1157 | { | ||
| 1158 | modify_region (current_buffer, XINT (start), stop); | ||
| 1159 | changed = 1; | ||
| 1160 | } | ||
| 1161 | |||
| 1152 | if (NILP (noundo)) | 1162 | if (NILP (noundo)) |
| 1153 | record_change (pos, 1); | 1163 | record_change (pos, 1); |
| 1154 | FETCH_CHAR (pos) = XINT (tochar); | 1164 | FETCH_CHAR (pos) = XINT (tochar); |
| 1155 | if (NILP (noundo)) | ||
| 1156 | signal_after_change (pos, 1, 1); | ||
| 1157 | } | 1165 | } |
| 1158 | pos++; | 1166 | pos++; |
| 1159 | } | 1167 | } |
| 1160 | 1168 | ||
| 1169 | if (changed) | ||
| 1170 | signal_after_change (XINT (start), | ||
| 1171 | stop - XINT (start), stop - XINT (start)); | ||
| 1172 | |||
| 1161 | return Qnil; | 1173 | return Qnil; |
| 1162 | } | 1174 | } |
| 1163 | 1175 | ||