# HG changeset patch # User Richard M. Stallman # Date 754051139 0 # Node ID ddee29e260d26877513f1043f8e6e3467e3e1a5d # Parent d48d18e2031692a295d773008fd92cdf8bcd4fa2 (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. diff -r d48d18e20316 -r ddee29e260d2 src/editfns.c --- a/src/editfns.c Tue Nov 23 10:09:44 1993 +0000 +++ b/src/editfns.c Tue Nov 23 10:38:59 1993 +0000 @@ -890,7 +890,7 @@ make_buffer_string (start, end) int start, end; { - Lisp_Object result; + Lisp_Object result, tem; if (start < GPT && GPT < end) move_gap (start); @@ -898,8 +898,12 @@ 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); + tem = Fnext_property_change (make_number (start), Qnil, make_number (end)); + +#ifdef USE_TEXT_PROPERTIES + if (XINT (tem) != end) + copy_intervals_to_string (result, current_buffer, start, end - start); +#endif return result; } @@ -991,7 +995,7 @@ /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ graft_intervals_into_buffer (copy_intervals (bp->intervals, start, len), - opoint, bp, 0); + opoint, len, current_buffer, 0); return Qnil; } @@ -1127,6 +1131,7 @@ Lisp_Object start, end, fromchar, tochar, noundo; { register int pos, stop, look; + int changed = 0; validate_region (&start, &end); CHECK_NUMBER (fromchar, 2); @@ -1136,7 +1141,6 @@ stop = XINT (end); look = XINT (fromchar); - modify_region (current_buffer, pos, stop); if (! NILP (noundo)) { if (MODIFF - 1 == current_buffer->save_modified) @@ -1149,15 +1153,23 @@ { if (FETCH_CHAR (pos) == look) { + if (! changed) + { + modify_region (current_buffer, XINT (start), stop); + changed = 1; + } + if (NILP (noundo)) record_change (pos, 1); FETCH_CHAR (pos) = XINT (tochar); - if (NILP (noundo)) - signal_after_change (pos, 1, 1); } pos++; } + if (changed) + signal_after_change (XINT (start), + stop - XINT (start), stop - XINT (start)); + return Qnil; }