From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#36136: [PATCH]: Re: bug#36136: syntax-ppss fails to invalidate its cache on changes to syntax-table text properties Date: Wed, 12 Jun 2019 06:54:25 -0400 Message-ID: References: <20190608131724.GA4643@ACM> <20190609183912.GA17965@ACM> <20190612101503.GA4587@ACM> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="169532"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 36136@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 12 13:15:31 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 1hb1E0-000hrS-Ka for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Jun 2019 13:15:29 +0200 Original-Received: from localhost ([::1]:58896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb1Dz-0006LO-Ib for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Jun 2019 07:15:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60503) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hb0uF-0001Wf-IZ for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 06:55:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hb0uE-0005DW-9V for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 06:55:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47229) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hb0uE-0005DP-0a for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 06:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hb0uD-0007En-Sk for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 06:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Jun 2019 10:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36136 X-GNU-PR-Package: emacs Original-Received: via spool by 36136-submit@debbugs.gnu.org id=B36136.156033688027776 (code B ref 36136); Wed, 12 Jun 2019 10:55:01 +0000 Original-Received: (at 36136) by debbugs.gnu.org; 12 Jun 2019 10:54:40 +0000 Original-Received: from localhost ([127.0.0.1]:60773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb0tp-0007Ds-PU for submit@debbugs.gnu.org; Wed, 12 Jun 2019 06:54:38 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11419) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hb0tn-0007Da-BG for 36136@debbugs.gnu.org; Wed, 12 Jun 2019 06:54:36 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A9E1810089B; Wed, 12 Jun 2019 06:54:29 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 568301007B5; Wed, 12 Jun 2019 06:54:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1560336868; bh=q5Ha3AAJBxalW4hnix1VLaHETx+EUyiF3Kia8Oem7ec=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=RBu71Pxl5pB+wDd2uDacTBhcfwGNsdycZ56Q64typ6vUA3iqsTv+7fvOM5Cq6MKct GUKAbsuWdSkAjv+L2nnJNetir8NGSTjf4SN8go+0yF6V4UPheq4yyDxL5LbebiK9Rq bPSVZyi6hX82i5Iwy6hwJGOYtN4/HBYmTL+ycKxQb8FrCVEjiuHvPooPRw94M94wm8 /025yjWLmQ79vf7y9y12pwXnnri8wZE5S+fNLaJ24cBG4TD2ZVM5aMGNXVKVTwmJoy vazKHdfxVxnptf6WXW7GwxEyQcTIWqVdYfNH6Ex6Rbtq8ToxjnkbPK0IIR8zRUBA+H DHACe7Mz711/g== Original-Received: from alfajor (cm-84.215.66.78.getinternet.no [84.215.66.78]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B0F7A120C58; Wed, 12 Jun 2019 06:54:27 -0400 (EDT) In-Reply-To: <20190612101503.GA4587@ACM> (Alan Mackenzie's message of "Wed, 12 Jun 2019 10:15:03 +0000") 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:160427 Archived-At: >> Hmm... I'm not too fond of adding ad-hoc support for specific >> text-properties in (set_properties, add_properties, remove_properties). > Neither am I, particularly. But the whole point of syntax-ppss, surely, > is that it should work automatically, without users having to call > syntax-ppss-flush-cache all the time. `grep` seems to argue that "all the time" is an over statement. I see the following uses in Emacs's bundled files: - one call in lisp/elec-pair.el [ I think this one would likely be better handled some other way (e.g. by setting syntax-ppss-table), tho I haven't looked hard enough to have a firm opinion yet ]. - in before-change-functions, of course. - one call from syntax-propertize. - one call in font-lock-apply-syntactic-highlight (this is part of the font-lock-syntactic-keywords functionality marked obsolete in 24.1). - one call in fortran-line-length (not because the buffer is changed, but because the syntax-propertize-function is changed). Of these, only the one in syntax-propertize and the one in font-lock-apply-syntactic-highlight would be made unnecessary by your patch. I see a few more calls in the elpa.git files, but none of them seems affected either. > It will probably not make a great deal of difference either way. Buffer > changes are frequent in Emacs, and so are calls to syntax-ppss in many > major modes. That's also my impression (which is why I haven't bothered to make syntax-ppss-flush-cache lazy like your patch does, even tho I've been tempted to several times). > Well, for CC Mode I'm going to have to do that anyway, since Emacs-26.x > and earlier are already out there and aren't going to change. Indeed. [ unless you decide to make CC-mode use syntax-propertize, of course ;-) ] But I also agree that it shouldn't prevent us from looking for better solutions. > This is going to be tedious and error prone. I don't see why. Usually a single call does the trick (as seen above: either in the function that sets the syntax-table property, or in the function that takes care of refreshing things in response to a buffer modification). Stefan