From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59896 Path: main.gmane.org!not-for-mail From: Hrvoje Niksic Newsgroups: gmane.emacs.gnus.general Subject: XEmacs-friendly version of message-strip-forbidden-properties Date: Wed, 23 Feb 2005 21:11:29 +0100 Message-ID: <874qg382a6.fsf@xemacs.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109264715 31566 80.91.229.2 (24 Feb 2005 17:05:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 24 Feb 2005 17:05:15 +0000 (UTC) Original-X-From: ding-owner+M8437@lists.math.uh.edu Thu Feb 24 18:05:14 2005 Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by ciao.gmane.org with esmtp (Exim 4.43) id 1D4MQE-0002rV-8P for ding-account@gmane.org; Thu, 24 Feb 2005 18:05:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1D4MSp-0002oY-00; Thu, 24 Feb 2005 11:07:47 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1D42rE-0001Kn-00 for ding@lists.math.uh.edu; Wed, 23 Feb 2005 14:11:40 -0600 Original-Received: from quimby.gnus.org ([80.91.224.244]) by util2.math.uh.edu with esmtp (Exim 4.30) id 1D42rB-00074H-8E for ding@lists.math.uh.edu; Wed, 23 Feb 2005 14:11:37 -0600 Original-Received: from ls401.htnet.hr ([195.29.150.2]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1D42rA-0004Cc-00 for ; Wed, 23 Feb 2005 21:11:36 +0100 Original-Received: from ls401.htnet.hr (localhost.localdomain [127.0.0.1]) by ls401.htnet.hr (0.0.0/8.12.10) with ESMTP id j1NKBVw9019942 for ; Wed, 23 Feb 2005 21:11:31 +0100 Original-Received: from localhost.localdomain (83-131-12-97.adsl.net.t-com.hr [83.131.12.97]) by ls401.htnet.hr (0.0.0/8.12.10) with ESMTP id j1NKBUIT019937 for ; Wed, 23 Feb 2005 21:11:31 +0100 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 0A39238000B; Wed, 23 Feb 2005 21:11:30 +0100 (CET) Original-To: ding@gnus.org User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Corporate Culture, linux) Original-X-Trace: ls401.htnet.hr 1109189491 29367 83.131.12.97 (Wed, 23 Feb 2005 21:11:31 +0100) X-Spam-Score: -4.9 (----) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu X-MailScanner-From: ding-owner+m8437@lists.math.uh.edu X-MailScanner-To: ding-account@gmane.org Xref: main.gmane.org gmane.emacs.gnus.general:59896 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59896 Some time ago I noticed that inserting largeish chunks of text (e.g. with C-x i) was quite slow in message buffers. I traced the slowness to after-change-functions set by message, namely message-strip-forbidden-properties. Leaving aside my personal thoughts on whether this approach to removing forbidden properties is necessary or even desirable, I noticed that the function iterates the inserted region char by char and calls text property functions on each character. This cannot be fast when inserting regions containing thousands of characters. This is a version for XEmacs that explicitly iterates over extents in the inserted region and therefore takes time proportional to the number of extents therein (typically none, but in any case much smaller than the number of characters). With this inserting very large files is again fast. This function should probably be placed in messagexmas, if you agree. (defun message-strip-forbidden-properties (begin end &optional old-length) "Strip forbidden properties between BEGIN and END, ignoring the third arg. This function is intended to be called from `after-change-functions'. See also `message-forbidden-properties'." (when (and message-strip-special-text-properties (message-tamago-not-in-use-p begin)) (let ((plist message-forbidden-properties)) (while plist (map-extents (lambda (extent ignored) (set-extent-property extent (car plist) nil) nil) nil begin end nil nil (car plist)) (pop plist) (pop plist)))))