emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `make-overlay' very slow


From: Stefan Monnier
Subject: Re: `make-overlay' very slow
Date: Sat, 11 Apr 2009 08:51:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

> I did that (see attachment for reference), and it really works at a
> reasonable speed.

Good.

> However, it is the completely wrong concept since
> it sets the `modified' flag and stores undo information,

Yes, you need to wrap the call to > add-text-properties (actually the
whole loop, preferably) in something like

   (let ((buffer-file-name nil) ;; To prevent locking/unlocking the file.
         (buffer-undo-list t)
         (modified (buffer-modified-p)))
     (unwind-protect
         (...)
       (restore-modified-p modified)))

We definitely need to add a macro for it.

> and it fails with modes which use the `invisible' and
> `intangible' properties.

Since these properties are not used very often, it's probably bearable,
but yes, there is a risk of interference.

> So here's my item to the Emacs wishlist: Improve speed of
> (make-overlay) and related functions to be as fast as setting
> text properties.

Yes, that would be great.  But note that it's not just `make-overlay':
every time we make a modification to the buffer, we have to update the
position of all the overlays (and markers) after point.  So, yes,
a better data-structure for overlays (and markers) would be very welcome.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]