[Top][All Lists]

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

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

From: Alan Mackenzie
Subject: Re: Problems with syntax-ppss: Was [... Apply `comment-depth' text properties when calling `back_comment'.]
Date: Sat, 12 Mar 2016 20:45:06 +0000
User-agent: Mutt/1.5.24 (2015-08-30)

Hello, Andreas.

On Sat, Mar 12, 2016 at 09:19:54PM +0100, Andreas Röhler wrote:

> On 11.03.2016 13:08, Alan Mackenzie wrote:
> > Hello, Andreas.

> > On Fri, Mar 11, 2016 at 08:27:17AM +0100, Andreas Röhler wrote:

> > I disagree about the need to fix syntax-ppss - medium level functions
> > should be rigorous and determinate.

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

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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