From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#36136: syntax-ppss fails to invalidate its cache on changes to syntax-table text properties Date: Sat, 8 Jun 2019 13:17:24 +0000 Message-ID: <20190608131724.GA4643@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="85517"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: 36136@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 08 15:18:30 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hZbEs-000M82-5l for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Jun 2019 15:18:30 +0200 Original-Received: from localhost ([::1]:58432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZbEr-0006cb-34 for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Jun 2019 09:18:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54041) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZbEV-0006ZN-Lj for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:18:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZbET-0003GB-Dz for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:18:07 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39473) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZbEQ-0003EL-4R for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hZbEP-0006xP-Ui for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jun 2019 13:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36136 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.155999987226722 (code B ref -1); Sat, 08 Jun 2019 13:18:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Jun 2019 13:17:52 +0000 Original-Received: from localhost ([127.0.0.1]:53016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hZbEF-0006wv-NB for submit@debbugs.gnu.org; Sat, 08 Jun 2019 09:17:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hZbEE-0006wo-1F for submit@debbugs.gnu.org; Sat, 08 Jun 2019 09:17:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53934) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZbEB-0006WW-Op for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:17:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZbE9-00033Q-QZ for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:17:47 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:51289 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hZbE6-0002un-0n for bug-gnu-emacs@gnu.org; Sat, 08 Jun 2019 09:17:43 -0400 Original-Received: (qmail 62602 invoked by uid 3782); 8 Jun 2019 13:17:25 -0000 Original-Received: from acm.muc.de (p2E5D5C7B.dip0.t-ipconnect.de [46.93.92.123]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 08 Jun 2019 15:17:24 +0200 Original-Received: (qmail 5207 invoked by uid 1000); 8 Jun 2019 13:17:24 -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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:160238 Archived-At: Hello, Emacs. The syntax-ppss cache is not invalidated when syntax-table text properties are set or cleared. This is because the invalidation function, syntax-ppss-flush-cache is invoked only as a before-change function, but typical (?all) syntax-table property changes happen when before-change-functions is inactive. This is a bug. In my debugging of a CC Mode scenario, a buffer change causes a syntax-table text property change at an earlier part of the buffer. This is to do with the change making previously non-matching C++ raw string identifiers match up. Font lock follows the syntax-ppss state, which spuriously records that the end part of the buffer is still in a string. Hence the non-string part of the buffer is still fontified with font-lock-string-face. Suggested fix: the functions set_properties, add_properties, remove_properties in textprop.c should check for changes to, specifically, syntax-table properties. When these changes are detected, a hook called something like syntax-table-props-change-alert-hook should be called (with some appropriate position parameters, tbd). syntax-ppss-flush-cache will be added to this hook. -- Alan Mackenzie (Nuremberg, Germany).