From: Lars Hansen <lists@soem.dk>
Cc: rudalics@gmx.at
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 [thread overview]
Message-ID: <444141FF.9000007@soem.dk> (raw)
In-Reply-To: <443ADE3B.7000800@soem.dk>
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
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.
[-- Attachment #2: textprop.diff --]
[-- Type: text/x-patch, Size: 2152 bytes --]
*** 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);
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2006-04-15 18:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-10 22:37 before-change-functions called twice at yank Lars Hansen
2006-04-11 6:58 ` martin rudalics
2006-04-11 7:23 ` Lars Hansen
2006-04-15 18:57 ` Lars Hansen [this message]
2006-04-17 0:56 ` Bugs in remove-list-of-text-properties and a patch [WAS: before-change-functions called twice at yank] Richard Stallman
2006-04-17 8:51 ` Lars Hansen
[not found] ` <44435682.4050409@soem.dk>
2006-04-18 1:42 ` Richard Stallman
2006-04-20 11:46 ` Lars Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=444141FF.9000007@soem.dk \
--to=lists@soem.dk \
--cc=rudalics@gmx.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).