Gnus development mailing list
 help / color / mirror / Atom feed
* XEmacs-friendly version of message-strip-forbidden-properties
@ 2005-02-23 20:11 Hrvoje Niksic
  2005-02-24 22:35 ` Katsumi Yamaoka
  0 siblings, 1 reply; 2+ messages in thread
From: Hrvoje Niksic @ 2005-02-23 20:11 UTC (permalink / 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)))))



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: XEmacs-friendly version of message-strip-forbidden-properties
  2005-02-23 20:11 XEmacs-friendly version of message-strip-forbidden-properties Hrvoje Niksic
@ 2005-02-24 22:35 ` Katsumi Yamaoka
  0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2005-02-24 22:35 UTC (permalink / raw)


>>>>> In <874qg382a6.fsf@xemacs.org> Hrvoje Niksic wrote:

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

You are talking about Gnus v5.10.x or v5.11, aren't you?  In the
most recent Gnus CVS, it has been much simplified as follows:

(defun message-strip-forbidden-properties (begin end &optional old-length)
  "[...]"
  (when (and message-strip-special-text-properties
	     (message-tamago-not-in-use-p begin))
    (let ((buffer-read-only nil)
	  (inhibit-read-only t))
      (remove-text-properties begin end message-forbidden-properties))))

It was done, following Romain Francoise's change of the way to
hide headers according to message-hidden-headers.  I think it
might be faster to use extent functions in XEmacs, though.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-24 22:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-23 20:11 XEmacs-friendly version of message-strip-forbidden-properties Hrvoje Niksic
2005-02-24 22:35 ` Katsumi Yamaoka

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