emacs-devel
[Top][All Lists]
Advanced

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

Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text prope


From: Andreas Röhler
Subject: Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]
Date: Sun, 13 Mar 2016 15:56:22 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Icedove/38.5.0



On 12.03.2016 21:45, Alan Mackenzie wrote:

Needed or not: it's impossible. The idea of a cache WRT to comments
can't work. Every insert may start a new multiline-comment at pos 1. How
a cache will detect that?  The results of syntax-ppss are hardly
predictable.
The way it's done is that on any buffer change, the cache beyond the
point of the change is marked as stale in some way.  Any function
needing to use the cache first checks that the "stale position" is
beyond where it needs the cache for, and if it isn't, recalculates the
cache for the buffer between "stale position" and point.

Have a look at the documentation for `before-change-functions' and
`after-change-functions' sometime.  Marking the cache as stale is one of
the things they are used for.

There are quite a few caches which work like this.  Font-locking works
like this, too.


Ahh, see, cool solution. My apologies to Stefan, assume he deserves the credits here.



reply via email to

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