aboutsummaryrefslogtreecommitdiffstats
path: root/src/textprop.c
diff options
context:
space:
mode:
authorDmitry Antipov <[email protected]>2012-12-03 18:13:06 +0400
committerDmitry Antipov <[email protected]>2012-12-03 18:13:06 +0400
commit20edc1c9edbb8c896df0a54769a4da825017de22 (patch)
tree5c431923887d8e48a1e932c4540f9aa48c611504 /src/textprop.c
parent62c2e5ed3a9c991cef2594b44afc74893f6ce26b (diff)
* lisp.h (modify_region): Rename to...
(modify_region_1): ...new prototype. * textprop.c (modify_region): Now static. Adjust users. * insdel.c (modify_region): Rename to... (modify_region_1): ...new function to work with current buffer. Adjust comment and users. Use true and false for boolean arg.
Diffstat (limited to 'src/textprop.c')
-rw-r--r--src/textprop.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 379eafb73f..1ce44ad60a 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -85,8 +85,18 @@ text_read_only (Lisp_Object propval)
xsignal0 (Qtext_read_only);
}
+/* Prepare to modify the region of BUFFER from START to END. */
+
+static void
+modify_region (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
+{
+ struct buffer *buf = XBUFFER (buffer), *old = current_buffer;
+
+ set_buffer_internal (buf);
+ modify_region_1 (XINT (start), XINT (end), true);
+ set_buffer_internal (old);
+}
-
/* Extract the interval at the position pointed to by BEGIN from
OBJECT, a string or buffer. Additionally, check that the positions
pointed to by BEGIN and END are within the bounds of OBJECT, and
@@ -1164,7 +1174,7 @@ Return t if any property value actually changed, nil otherwise. */)
}
if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
/* We are at the beginning of interval I, with LEN chars to scan. */
for (;;)
@@ -1302,7 +1312,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties,
}
if (BUFFERP (object) && !NILP (coherent_change_p))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
set_text_properties_1 (start, end, properties, object, i);
@@ -1451,7 +1461,7 @@ Use `set-text-properties' if you want to remove all text properties. */)
}
if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
/* We are at the beginning of an interval, with len to scan */
for (;;)
@@ -1565,7 +1575,7 @@ Return t if any property was actually removed, nil otherwise. */)
else if (LENGTH (i) == len)
{
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1578,7 +1588,7 @@ Return t if any property was actually removed, nil otherwise. */)
i = split_interval_left (i, len);
copy_properties (unchanged, i);
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1589,7 +1599,7 @@ Return t if any property was actually removed, nil otherwise. */)
if (interval_has_some_properties_list (properties, i))
{
if (!modified && BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end), 1);
+ modify_region (object, start, end);
remove_properties (Qnil, properties, i, object);
modified = 1;
}