aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1993-11-23 10:38:59 +0000
committerRichard M. Stallman <[email protected]>1993-11-23 10:38:59 +0000
commit60b96ee7a3b21d041b261c2b44b9c2be23b1810f (patch)
treec0e3987c93dd550f2c682ed0afcb296e87544086 /src/editfns.c
parentd2cad97da6baeac455736dc3096cfe021b297206 (diff)
(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/editfns.c')
-rw-r--r--src/editfns.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/editfns.c b/src/editfns.c
index c091f00210..de8d167191 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -890,7 +890,7 @@ Lisp_Object
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 @@ 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);
+ 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 @@ They default to the beginning and the end of BUFFER.")
/* 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 @@ and don't mark the buffer as really changed.")
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 @@ and don't mark the buffer as really changed.")
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 @@ and don't mark the buffer as really changed.")
{
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;
}