aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Blandy <[email protected]>1993-05-14 14:43:30 +0000
committerJim Blandy <[email protected]>1993-05-14 14:43:30 +0000
commit04a759c81b944287c3a826eed57ee56a3bea5c03 (patch)
tree02784ac68d6821607065eb037f3e97dadc8ec13b /src
parent6c523803b30c3d41a21ce36fbfb0437bf6ce68e5 (diff)
The text property routines can now modify buffers other
than the current one. * insdel.c (modify_region): New argument BUFFER. Select that buffer while we prepare for the modification, and switch back when we're done. * textprop.c (add_properties, remove_properties): Pass the buffer being modified as the first argument to modify_region. * editfns.c (Fsubst_char_in_region, Ftranslate_region): Pass the current_buffer as the first argument to modify_region. * casefiddle.c (casify_region): Same.
Diffstat (limited to 'src')
-rw-r--r--src/casefiddle.c4
-rw-r--r--src/editfns.c4
-rw-r--r--src/insdel.c15
-rw-r--r--src/textprop.c12
4 files changed, 26 insertions, 9 deletions
diff --git a/src/casefiddle.c b/src/casefiddle.c
index d496ffdf6d..ca5127d548 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -117,8 +117,8 @@ casify_region (flag, b, e)
return;
validate_region (&b, &e);
- modify_region (XFASTINT (b), XFASTINT (e));
- record_change (XFASTINT (b), XFASTINT (e) - XFASTINT (b));
+ modify_region (current_buffer, XFASTINT (b), XFASTINT (e));
+ record_change (current_buffer, XFASTINT (b), XFASTINT (e) - XFASTINT (b));
for (i = XFASTINT (b); i < XFASTINT (e); i++)
{
diff --git a/src/editfns.c b/src/editfns.c
index 7b3db6203d..86d292f297 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1001,7 +1001,7 @@ and don't mark the buffer as really changed.")
stop = XINT (end);
look = XINT (fromchar);
- modify_region (pos, stop);
+ modify_region (current_buffer, pos, stop);
if (! NILP (noundo))
{
if (MODIFF - 1 == current_buffer->save_modified)
@@ -1051,7 +1051,7 @@ for the character with code N. Returns the number of characters changed.")
pos = XINT (start);
stop = XINT (end);
- modify_region (pos, stop);
+ modify_region (current_buffer, pos, stop);
cnt = 0;
for (; pos < stop; ++pos)
diff --git a/src/insdel.c b/src/insdel.c
index a1b3b1ff11..9d2572bfe6 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -473,9 +473,19 @@ del_range (from, to)
signal_after_change (from, numdel, 0);
}
-modify_region (start, end)
+/* Call this if you're about to change the region of BUFFER from START
+ to END. This checks the read-only properties of the region, calls
+ the necessary modification hooks, and warns the next redisplay that
+ it should pay attention to that area. */
+modify_region (buffer, start, end)
+ struct buffer *buffer;
int start, end;
{
+ struct buffer *old_buffer = current_buffer;
+
+ if (buffer != old_buffer)
+ set_buffer_internal (buffer);
+
prepare_to_modify_buffer (start, end);
if (start - 1 < beg_unchanged || unchanged_modified == MODIFF)
@@ -484,6 +494,9 @@ modify_region (start, end)
|| unchanged_modified == MODIFF)
end_unchanged = Z - end;
MODIFF++;
+
+ if (buffer != old_buffer)
+ set_buffer_internal (old_buffer);
}
/* Check that it is okay to modify the buffer between START and END.
diff --git a/src/textprop.c b/src/textprop.c
index db618c7e4c..e651cbf243 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -312,7 +312,8 @@ add_properties (plist, i, object)
{
record_property_change (i->position, LENGTH (i),
sym1, Fcar (this_cdr), object);
- modify_region (make_number (i->position),
+ modify_region (XBUFFER (object),
+ make_number (i->position),
make_number (i->position + LENGTH (i)));
}
@@ -329,7 +330,8 @@ add_properties (plist, i, object)
{
record_property_change (i->position, LENGTH (i),
sym1, Qnil, object);
- modify_region (make_number (i->position),
+ modify_region (XBUFFER (object),
+ make_number (i->position),
make_number (i->position + LENGTH (i)));
}
i->plist = Fcons (sym1, Fcons (val1, i->plist));
@@ -367,7 +369,8 @@ remove_properties (plist, i, object)
record_property_change (i->position, LENGTH (i),
sym, Fcar (Fcdr (current_plist)),
object);
- modify_region (make_number (i->position),
+ modify_region (XBUFFER (object),
+ make_number (i->position),
make_number (i->position + LENGTH (i)));
}
@@ -386,7 +389,8 @@ remove_properties (plist, i, object)
{
record_property_change (i->position, LENGTH (i),
sym, Fcar (Fcdr (this)), object);
- modify_region (make_number (i->position),
+ modify_region (XBUFFER (object),
+ make_number (i->position),
make_number (i->position + LENGTH (i)));
}