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: Fixing bug #22983 (syntax-ppss is broken) Date: Wed, 8 Feb 2017 21:03:57 +0000 Message-ID: <20170208210357.GA9444@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1486587877 4278 195.159.176.226 (8 Feb 2017 21:04:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 8 Feb 2017 21:04:37 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 08 22:04:34 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 1cbZPm-0000uL-2I for ged-emacs-devel@m.gmane.org; Wed, 08 Feb 2017 22:04:34 +0100 Original-Received: from localhost ([::1]:33196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbZPr-0004LF-N8 for ged-emacs-devel@m.gmane.org; Wed, 08 Feb 2017 16:04:39 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cbZPc-0004FS-Uq for emacs-devel@gnu.org; Wed, 08 Feb 2017 16:04:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cbZPY-0000RM-V4 for emacs-devel@gnu.org; Wed, 08 Feb 2017 16:04:24 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:24223 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cbZPY-0000Nn-Lo for emacs-devel@gnu.org; Wed, 08 Feb 2017 16:04:20 -0500 Original-Received: (qmail 61574 invoked by uid 3782); 8 Feb 2017 21:04:17 -0000 Original-Received: from acm.muc.de (p548C76FB.dip0.t-ipconnect.de [84.140.118.251]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 08 Feb 2017 22:04:17 +0100 Original-Received: (qmail 10141 invoked by uid 1000); 8 Feb 2017 21:03:57 -0000 Content-Disposition: inline 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:212150 Archived-At: Hello, Emacs. Just an idea to throw around. syntax-ppss is broken. It tends to return false results when the buffer is narrowed, and its invalidation routines are not comprehensive enough - for example, invalidation doesn't happen when a new syntax table is selected, or syntax-table text properties are applied to a buffer. Examining the use made of syntax-ppss in Emacs, out of ~180 instances, there are only a handful which deal with anything other than comments and strings. Perhaps 10 - 20. Stefan and Dmitry have objected to the comment-cache branch on the grounds it "duplicates" the syntax-ppss cache. Well, how about abandoning the problematic syntax-ppss and using the comment-cache cache in its place? comment-cache features rock solid cache invalidation. Also, comment-cache is faster than syntax-ppss (a lookup of a text property compared with a linerar list search followed by a parse-partial-sexp over up to 20,000 characters). So this strategy would speed Emacs up somewhat. That would just leave the aforementioned handful of cases to be hand coded. Then we could deprecate syntax-ppss and remove it at a future release. :-) -- Alan Mackenzie (Nuremberg, Germany).