[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bugs in remove-list-of-text-properties and a patch [WAS: before-change-f
From: |
Lars Hansen |
Subject: |
Bugs in remove-list-of-text-properties and a patch [WAS: before-change-functions called twice at yank] |
Date: |
Sat, 15 Apr 2006 20:57:03 +0200 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20051002) |
remove-list-of-text-properties may run before-change-functions without
running after-change-functions. The attached patch fixes the problem.
The patch ensures that before-change-functions and
after-change-functions are not run at all when no changes are done.
If there are no objections, I will install in about a week.
*** textprop.c.~1.145.~ 2006-04-15 18:10:14.000000000 +0200
--- textprop.c 2006-04-15 20:46:19.116514478 +0200
***************
*** 1602,1610 ****
}
}
- if (BUFFERP (object))
- modify_region (XBUFFER (object), XINT (start), XINT (end));
-
/* We are at the beginning of an interval, with len to scan */
for (;;)
{
--- 1602,1607 ----
***************
*** 1614,1623 ****
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties_list (properties, i))
! return modified ? Qt : Qnil;
if (LENGTH (i) == len)
{
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
--- 1611,1630 ----
if (LENGTH (i) >= len)
{
if (! interval_has_some_properties_list (properties, i))
! if (modified)
! {
! if (BUFFERP (object))
! signal_after_change (XINT (start), XINT (end) - XINT (start),
! XINT (end) - XINT (start));
! return Qt;
! }
! else
! return Qnil;
if (LENGTH (i) == len)
{
+ if (!modified && BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
***************
*** 1629,1634 ****
--- 1636,1643 ----
unchanged = i;
i = split_interval_left (i, len);
copy_properties (unchanged, i);
+ if (!modified && BUFFERP (object))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
remove_properties (Qnil, properties, i, object);
if (BUFFERP (object))
signal_after_change (XINT (start), XINT (end) - XINT (start),
***************
*** 1636,1641 ****
--- 1645,1653 ----
return Qt;
}
+ if (!modified && BUFFERP (object)
+ && interval_has_some_properties_list (properties, i))
+ modify_region (XBUFFER (object), XINT (start), XINT (end));
len -= LENGTH (i);
modified += remove_properties (Qnil, properties, i, object);
i = next_interval (i);