aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Hansen2006-04-20 11:36:50 +0000
committerLars Hansen2006-04-20 11:36:50 +0000
commit9b17c9f5cdfc45a72ee1e0341520826d11560d84 (patch)
treeb81f489e32e8064d00c7d70c8020a0c57412b67f /src
parentee546279bc288ecb30921b3875f7c04be17519b2 (diff)
downloademacs-9b17c9f5cdfc45a72ee1e0341520826d11560d84.tar.gz
emacs-9b17c9f5cdfc45a72ee1e0341520826d11560d84.zip
(Fremove_list_of_text_properties): Ensure
modify_region is called only when buffer is modified and that signal_after_change is allways called in that case.
Diffstat (limited to 'src')
-rw-r--r--src/textprop.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/textprop.c b/src/textprop.c
index 65823d9fa3f..e2f9c531735 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1602,10 +1602,12 @@ Return t if any property was actually removed, nil otherwise. */)
1602 } 1602 }
1603 } 1603 }
1604 1604
1605 if (BUFFERP (object)) 1605 /* We are at the beginning of an interval, with len to scan.
1606 modify_region (XBUFFER (object), XINT (start), XINT (end)); 1606 The flag `modified' records if changes have been made.
1607 1607 When object is a buffer, we must call modify_region before changes are
1608 /* We are at the beginning of an interval, with len to scan */ 1608 made and signal_after_change when we are done.
1609 We call modify_region before calling remove_properties iff modified == 0,
1610 and we call signal_after_change before returning iff modified != 0. */
1609 for (;;) 1611 for (;;)
1610 { 1612 {
1611 if (i == 0) 1613 if (i == 0)
@@ -1614,10 +1616,20 @@ Return t if any property was actually removed, nil otherwise. */)
1614 if (LENGTH (i) >= len) 1616 if (LENGTH (i) >= len)
1615 { 1617 {
1616 if (! interval_has_some_properties_list (properties, i)) 1618 if (! interval_has_some_properties_list (properties, i))
1617 return modified ? Qt : Qnil; 1619 if (modified)
1620 {
1621 if (BUFFERP (object))
1622 signal_after_change (XINT (start), XINT (end) - XINT (start),
1623 XINT (end) - XINT (start));
1624 return Qt;
1625 }
1626 else
1627 return Qnil;
1618 1628
1619 if (LENGTH (i) == len) 1629 if (LENGTH (i) == len)
1620 { 1630 {
1631 if (!modified && BUFFERP (object))
1632 modify_region (XBUFFER (object), XINT (start), XINT (end));
1621 remove_properties (Qnil, properties, i, object); 1633 remove_properties (Qnil, properties, i, object);
1622 if (BUFFERP (object)) 1634 if (BUFFERP (object))
1623 signal_after_change (XINT (start), XINT (end) - XINT (start), 1635 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1629,6 +1641,8 @@ Return t if any property was actually removed, nil otherwise. */)
1629 unchanged = i; 1641 unchanged = i;
1630 i = split_interval_left (i, len); 1642 i = split_interval_left (i, len);
1631 copy_properties (unchanged, i); 1643 copy_properties (unchanged, i);
1644 if (!modified && BUFFERP (object))
1645 modify_region (XBUFFER (object), XINT (start), XINT (end));
1632 remove_properties (Qnil, properties, i, object); 1646 remove_properties (Qnil, properties, i, object);
1633 if (BUFFERP (object)) 1647 if (BUFFERP (object))
1634 signal_after_change (XINT (start), XINT (end) - XINT (start), 1648 signal_after_change (XINT (start), XINT (end) - XINT (start),
@@ -1636,8 +1650,14 @@ Return t if any property was actually removed, nil otherwise. */)
1636 return Qt; 1650 return Qt;
1637 } 1651 }
1638 1652
1653 if (interval_has_some_properties_list (properties, i))
1654 {
1655 if (!modified && BUFFERP (object))
1656 modify_region (XBUFFER (object), XINT (start), XINT (end));
1657 remove_properties (Qnil, properties, i, object);
1658 modified = 1;
1659 }
1639 len -= LENGTH (i); 1660 len -= LENGTH (i);
1640 modified += remove_properties (Qnil, properties, i, object);
1641 i = next_interval (i); 1661 i = next_interval (i);
1642 } 1662 }
1643} 1663}