all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution.
Date: Thu, 2 Mar 2017 22:28:22 +0000	[thread overview]
Message-ID: <20170302222822.GB946@acm> (raw)
In-Reply-To: <20170228202720.GC2248@acm>

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	other threads:[~2017-03-02 22:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 13:53 Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution Alan Mackenzie
2017-02-25 19:42 ` Stefan Monnier
2017-02-25 21:22   ` Alan Mackenzie
2017-02-26  2:32     ` Stefan Monnier
2017-02-26 12:06       ` Alan Mackenzie
2017-02-26 12:24         ` Yuri Khan
2017-02-26 16:10           ` Alan Mackenzie
2017-02-26 13:47         ` Stefan Monnier
2017-02-26 16:37           ` Alan Mackenzie
2017-02-27  4:05             ` Stefan Monnier
2017-02-27 19:05               ` Alan Mackenzie
2017-02-27 20:52                 ` Stefan Monnier
2017-02-27 23:22                   ` Stefan Monnier
2017-02-27 23:48                     ` Dmitry Gutov
2017-02-28 18:58                   ` Alan Mackenzie
2017-02-28 19:09                     ` Stefan Monnier
2017-02-28 20:27                       ` Alan Mackenzie
2017-03-02 22:28                         ` Alan Mackenzie [this message]
2017-03-03 12:47 ` Filipp Gunbin
2017-03-04 19:41 ` Tom Tromey
2017-03-24 23:41   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170302222822.GB946@acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.