diff options
Diffstat (limited to 'src/textprop.c')
| -rw-r--r-- | src/textprop.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/textprop.c b/src/textprop.c index 379eafb73f7..1ce44ad60ac 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -85,8 +85,18 @@ text_read_only (Lisp_Object propval) | |||
| 85 | xsignal0 (Qtext_read_only); | 85 | xsignal0 (Qtext_read_only); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /* Prepare to modify the region of BUFFER from START to END. */ | ||
| 89 | |||
| 90 | static void | ||
| 91 | modify_region (Lisp_Object buffer, Lisp_Object start, Lisp_Object end) | ||
| 92 | { | ||
| 93 | struct buffer *buf = XBUFFER (buffer), *old = current_buffer; | ||
| 94 | |||
| 95 | set_buffer_internal (buf); | ||
| 96 | modify_region_1 (XINT (start), XINT (end), true); | ||
| 97 | set_buffer_internal (old); | ||
| 98 | } | ||
| 88 | 99 | ||
| 89 | |||
| 90 | /* Extract the interval at the position pointed to by BEGIN from | 100 | /* Extract the interval at the position pointed to by BEGIN from |
| 91 | OBJECT, a string or buffer. Additionally, check that the positions | 101 | OBJECT, a string or buffer. Additionally, check that the positions |
| 92 | pointed to by BEGIN and END are within the bounds of OBJECT, and | 102 | 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. */) | |||
| 1164 | } | 1174 | } |
| 1165 | 1175 | ||
| 1166 | if (BUFFERP (object)) | 1176 | if (BUFFERP (object)) |
| 1167 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1177 | modify_region (object, start, end); |
| 1168 | 1178 | ||
| 1169 | /* We are at the beginning of interval I, with LEN chars to scan. */ | 1179 | /* We are at the beginning of interval I, with LEN chars to scan. */ |
| 1170 | for (;;) | 1180 | for (;;) |
| @@ -1302,7 +1312,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties, | |||
| 1302 | } | 1312 | } |
| 1303 | 1313 | ||
| 1304 | if (BUFFERP (object) && !NILP (coherent_change_p)) | 1314 | if (BUFFERP (object) && !NILP (coherent_change_p)) |
| 1305 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1315 | modify_region (object, start, end); |
| 1306 | 1316 | ||
| 1307 | set_text_properties_1 (start, end, properties, object, i); | 1317 | set_text_properties_1 (start, end, properties, object, i); |
| 1308 | 1318 | ||
| @@ -1451,7 +1461,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1451 | } | 1461 | } |
| 1452 | 1462 | ||
| 1453 | if (BUFFERP (object)) | 1463 | if (BUFFERP (object)) |
| 1454 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1464 | modify_region (object, start, end); |
| 1455 | 1465 | ||
| 1456 | /* We are at the beginning of an interval, with len to scan */ | 1466 | /* We are at the beginning of an interval, with len to scan */ |
| 1457 | for (;;) | 1467 | for (;;) |
| @@ -1565,7 +1575,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1565 | else if (LENGTH (i) == len) | 1575 | else if (LENGTH (i) == len) |
| 1566 | { | 1576 | { |
| 1567 | if (!modified && BUFFERP (object)) | 1577 | if (!modified && BUFFERP (object)) |
| 1568 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1578 | modify_region (object, start, end); |
| 1569 | remove_properties (Qnil, properties, i, object); | 1579 | remove_properties (Qnil, properties, i, object); |
| 1570 | if (BUFFERP (object)) | 1580 | if (BUFFERP (object)) |
| 1571 | signal_after_change (XINT (start), XINT (end) - XINT (start), | 1581 | signal_after_change (XINT (start), XINT (end) - XINT (start), |
| @@ -1578,7 +1588,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1578 | i = split_interval_left (i, len); | 1588 | i = split_interval_left (i, len); |
| 1579 | copy_properties (unchanged, i); | 1589 | copy_properties (unchanged, i); |
| 1580 | if (!modified && BUFFERP (object)) | 1590 | if (!modified && BUFFERP (object)) |
| 1581 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1591 | modify_region (object, start, end); |
| 1582 | remove_properties (Qnil, properties, i, object); | 1592 | remove_properties (Qnil, properties, i, object); |
| 1583 | if (BUFFERP (object)) | 1593 | if (BUFFERP (object)) |
| 1584 | signal_after_change (XINT (start), XINT (end) - XINT (start), | 1594 | signal_after_change (XINT (start), XINT (end) - XINT (start), |
| @@ -1589,7 +1599,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1589 | if (interval_has_some_properties_list (properties, i)) | 1599 | if (interval_has_some_properties_list (properties, i)) |
| 1590 | { | 1600 | { |
| 1591 | if (!modified && BUFFERP (object)) | 1601 | if (!modified && BUFFERP (object)) |
| 1592 | modify_region (XBUFFER (object), XINT (start), XINT (end), 1); | 1602 | modify_region (object, start, end); |
| 1593 | remove_properties (Qnil, properties, i, object); | 1603 | remove_properties (Qnil, properties, i, object); |
| 1594 | modified = 1; | 1604 | modified = 1; |
| 1595 | } | 1605 | } |