From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Syntax ambiguities in narrowed buffers and multiple major modes: a proposed solution. Date: Thu, 2 Mar 2017 22:28:22 +0000 Message-ID: <20170302222822.GB946@acm> References: <20170226120656.GA3811@acm> <20170226163724.GD3811@acm> <20170227190558.GA2921@acm> <20170228185834.GA2248@acm> <20170228202720.GC2248@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1488493743 31841 195.159.176.226 (2 Mar 2017 22:29:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Mar 2017 22:29:03 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 02 23:28:58 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjZDT-0007bd-Jg for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 23:28:55 +0100 Original-Received: from localhost ([::1]:55006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjZDZ-00087T-PX for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 17:29:01 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjZDT-00087O-Ul for emacs-devel@gnu.org; Thu, 02 Mar 2017 17:28:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjZDQ-0005pI-Oz for emacs-devel@gnu.org; Thu, 02 Mar 2017 17:28:55 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:42510 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cjZDQ-0005oW-Iy for emacs-devel@gnu.org; Thu, 02 Mar 2017 17:28:52 -0500 Original-Received: (qmail 85731 invoked by uid 3782); 2 Mar 2017 22:28:48 -0000 Original-Received: from acm.muc.de (p548C6F2E.dip0.t-ipconnect.de [84.140.111.46]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 02 Mar 2017 23:28:48 +0100 Original-Received: (qmail 3322 invoked by uid 1000); 2 Mar 2017 22:28:22 -0000 Content-Disposition: inline In-Reply-To: <20170228202720.GC2248@acm> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212720 Archived-At: 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).