[Top][All Lists]

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

Re: Syntax ambiguities in narrowed buffers and multiple major modes: a p

From: Alan Mackenzie
Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution.
Date: Thu, 2 Mar 2017 22:28:22 +0000
User-agent: Mutt/1.7.2 (2016-11-26)

Hello, Stefan.

On Tue, Feb 28, 2017 at 20:27:20 +0000, Alan Mackenzie wrote:
> On Tue, Feb 28, 2017 at 14:09:54 -0500, Stefan Monnier wrote:

[ .... ]

> > > OK.  But any time the current syntax-table is changed, the cache becomes
> > > invalid.  For such operations, there really needs to be a means of
> > > isolating the cache from the syntactic operations, and vice versa.

> > That's right.  But I think it's important to be able to *temporarily*
> > invalidate the cache (so as soon as you leave the with-syntax-table,
> > the old cache is reinstated).

> I agree with you here.  I'll be thinking about it.

How about the following proposal: we introduce the notion of
@dfn{indirect text properties}.  We give the symbol 'syntax-table a
property 'indirect-text-property (or possibly some better name) whose
value is a symbol 'foo (not necessarily interned).

Any access, read or write, to a syntax-table text property would find
the 'indirect-text-property property, and read or write the 'foo text
property instead.  This checking of 'indirect-text-propery would,
naturally, be done in the C code for text properties, not in Lisp.

In our use case, when we need *temporarily* to invalidate the cache, we
would simply change the 'indirect-text-property property on
'syntax-table to 'foo-temp.  When we've finished using it, we swap back,
possibly with garbage collection tricks of some sort, to make sure the
'foo-temp text properties were cleared from the buffer.

What do you think?

> >         Stefan

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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