Gnus development mailing list
 help / color / mirror / Atom feed
From: Hrvoje Niksic <hniksic@xemacs.org>
Subject: XEmacs-friendly version of message-strip-forbidden-properties
Date: Wed, 23 Feb 2005 21:11:29 +0100	[thread overview]
Message-ID: <874qg382a6.fsf@xemacs.org> (raw)

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)))))



             reply	other threads:[~2005-02-23 20:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-23 20:11 Hrvoje Niksic [this message]
2005-02-24 22:35 ` Katsumi Yamaoka

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874qg382a6.fsf@xemacs.org \
    --to=hniksic@xemacs.org \
    /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.
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 NNTP newsgroup(s).