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: Thu, 13 Jun 2019 17:31:19 -0400 Message-ID: References: <20190608131724.GA4643@ACM> <20190609183912.GA17965@ACM> <20190612101503.GA4587@ACM> <20190613122150.GA25866@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="109837"; 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 Thu Jun 13 23:43:00 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 1hbXUp-000SLp-Ib for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 23:42:59 +0200 Original-Received: from localhost ([::1]:45876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbXUo-00089h-JV for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jun 2019 17:42:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50816) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbXKF-0006w5-WF for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 17:32:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbXKE-000235-NY for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 17:32:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50935) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbXKE-000230-Gg for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 17:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbXKE-0008T1-B0 for bug-gnu-emacs@gnu.org; Thu, 13 Jun 2019 17:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jun 2019 21:32:02 +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.156046149332504 (code B ref 36136); Thu, 13 Jun 2019 21:32:02 +0000 Original-Received: (at 36136) by debbugs.gnu.org; 13 Jun 2019 21:31:33 +0000 Original-Received: from localhost ([127.0.0.1]:36246 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbXJk-0008SC-KU for submit@debbugs.gnu.org; Thu, 13 Jun 2019 17:31:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36962) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hbXJi-0008Rw-19 for 36136@debbugs.gnu.org; Thu, 13 Jun 2019 17:31:31 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 81CEE4437E4; Thu, 13 Jun 2019 17:31:23 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 25AFD4437DE; Thu, 13 Jun 2019 17:31:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1560461482; bh=4g0Gi+DA5U+PkQVDvXgy/qS1IX13U/zSjkmNuwTY26E=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PYfSxtzAoIMO+pDX6lGCQ97NzX975dYfRwj8VVBTDEjxeAcC4gx+L4JzMydMv7FG8 2bjbR3U+iJ8zg5+Gf7J/TkuQoXfNgiVbKmac3dcp5Mcv7ndE82DFm4up8HJNTdReXt tugv2nKt/46kVuumTQl6RMeSwI7LzxRiZ+tAr2+9pbv9Uo4B/nPSWOl1kmLhfGpN8t BKlvNjUZoV17oeVshDDmjp5yX9xbz+rbkkkQXLUxINfJ5lxmRhwgl+1KKvA49KPI7y L3fKHNqWd4ono+DN5eqkoAIm8JJ6EMq30rUF40M5+ExCGmdkHHThGJ0th7cykMJM42 gJvkZ3FaeELKA== Original-Received: from alfajor (cm-84.215.66.78.getinternet.no [84.215.66.78]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 83842120892; Thu, 13 Jun 2019 17:31:21 -0400 (EDT) In-Reply-To: <20190613122150.GA25866@ACM> (Alan Mackenzie's message of "Thu, 13 Jun 2019 12:21:50 +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:160529 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. > CC Mode has to call that function all the time, without any scare > quotes. IIUC the end of your message, you did find another spot where to call syntax-ppss-flush-cache, making it much less problematic, right? > The root of the problem is the implicit assumption made by syntax-ppss > that programs would never set syntax-table properties. This assumption > doesn't hold. AFAIK CC-mode is the only exception nowadays. >> But I also agree that it shouldn't prevent us from looking for >> better solutions. > > What about my idea of giving a "no inhibit" property to functions on > before/after-change-functions? I'm not convinced this won't introduce more problems than it intends to fix (it seems that it will likely lead to the subsequent introduction of a `no-really-I-do-mean-inhibit-all-this-time` etc...). > But, as already said, I shouldn't have to do this. I agree that it would be nice to invalidate the cache in a more "automatic" way. But it's a trade-off. Your new call to syntax-ppss-flush-cache brings the count of calls that we could eliminate this way to 3 (one of those being obsolete since 24.1 should likely disappear soon). That's still not very many. And those calls are pretty efficient I think compared to the more general code which catches every text-property change to see if it happens to change the `syntax-table` property. So the current situation is not ideal conceptually, but it's more efficient than the alternative both in terms of run-time complexity and in terms of code size. It's actually a pretty good deal. Especially since even with a more automatic approach, there'd still be other places where we need to call it manually anyway (e.g. fortran-line-length). Stefan