From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel 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 Message-ID: <20160312204506.GB10781@acm.fritz.box> References: <20160309104900.GA3948@acm.fritz.box> <20160309141930.GC3948@acm.fritz.box> <20160309193758.GH3948@acm.fritz.box> <20160310130156.GA4831@acm.fritz.box> <56E27355.4000707@online.de> <20160311120808.GA2888@acm.fritz.box> <56E479EA.5010306@online.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1457815365 28095 80.91.229.3 (12 Mar 2016 20:42:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Mar 2016 20:42:45 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas =?iso-8859-1?Q?R=F6hler?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 12 21:42:36 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aeqMt-0000t5-1h for ged-emacs-devel@m.gmane.org; Sat, 12 Mar 2016 21:42:35 +0100 Original-Received: from localhost ([::1]:33357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeqMs-0005v5-Ff for ged-emacs-devel@m.gmane.org; Sat, 12 Mar 2016 15:42:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeqMp-0005un-31 for emacs-devel@gnu.org; Sat, 12 Mar 2016 15:42:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aeqMl-0005Gl-Sd for emacs-devel@gnu.org; Sat, 12 Mar 2016 15:42:31 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:39962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aeqMl-0005Gh-Jc for emacs-devel@gnu.org; Sat, 12 Mar 2016 15:42:27 -0500 Original-Received: (qmail 27251 invoked by uid 3782); 12 Mar 2016 20:42:26 -0000 Original-Received: from acm.muc.de (p548A446C.dip0.t-ipconnect.de [84.138.68.108]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 12 Mar 2016 21:42:25 +0100 Original-Received: (qmail 18584 invoked by uid 1000); 12 Mar 2016 20:45:06 -0000 Content-Disposition: inline In-Reply-To: <56E479EA.5010306@online.de> User-Agent: Mutt/1.5.24 (2015-08-30) 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 X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201551 Archived-At: 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).