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 04:37:25 -0400 Message-ID: References: <20190608131724.GA4643@ACM> <20190609183912.GA17965@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="256244"; 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 10:38:35 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 1haym9-0014Vv-NV for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Jun 2019 10:38:34 +0200 Original-Received: from localhost ([::1]:57592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haym8-00027u-GH for geb-bug-gnu-emacs@m.gmane.org; Wed, 12 Jun 2019 04:38:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56534) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1haylf-0001d9-Q5 for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 04:38:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hayle-0003pg-L5 for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 04:38:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hayle-0003pa-F4 for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 04:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hayle-0002RD-B6 for bug-gnu-emacs@gnu.org; Wed, 12 Jun 2019 04:38: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: Wed, 12 Jun 2019 08:38: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.15603286619326 (code B ref 36136); Wed, 12 Jun 2019 08:38:02 +0000 Original-Received: (at 36136) by debbugs.gnu.org; 12 Jun 2019 08:37:41 +0000 Original-Received: from localhost ([127.0.0.1]:60650 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1haylI-0002QL-QR for submit@debbugs.gnu.org; Wed, 12 Jun 2019 04:37:41 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:21165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1haylG-0002Q1-3L for 36136@debbugs.gnu.org; Wed, 12 Jun 2019 04:37:39 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AAB754436D8; Wed, 12 Jun 2019 04:37:31 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 663D64436D6; Wed, 12 Jun 2019 04:37:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1560328650; bh=daD8pdCXNnOhdII0PUuxwI9/WAIPIU/LDcq4AJhXjXM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=J/6FWBwk07CQROYfvVRm+/w/FMsSxRMDtWxc0r1JBWqLAFW2rj3XLVryDHlo3stvQ IuEFGEk1nDWYpiWPsziwRkJGJEX6iOnGWtCy23vZtHsRA3PfZ27IopoffL5iRrpl8r EU26SOqDhVgr6ug+xoJx8DYPUL8QfqoFpryU6xYfiYl4fWnNJqpxWBrEfnffynxvyD 9Pmr6Ri7otmPLFKaJvrChChf3jnWhZX+L35PaBkW0mFEhXS0D0iG10k4ug01OmdsB3 OcM11u+iQbgCox0gq5DjujKHvGTcsdVARQL8fRR2vVY0JJ3bdgmF6fsN7+bM25CCXc JfQ2ZVn8NMkPg== Original-Received: from alfajor (109-74-184-110.biz.static.gigbone.net [109.74.184.110]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7769C12036E; Wed, 12 Jun 2019 04:37:29 -0400 (EDT) In-Reply-To: <20190609183912.GA17965@ACM> (Alan Mackenzie's message of "Sun, 9 Jun 2019 18:39:12 +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:160421 Archived-At: > The following patch is simpler than my first proposal, following > feedback from Eli. It works for me. > > Stefan, could you look at this, please? Here I am. > * src/textprop.c (syntax-propertize--done): New buffer local variable. > (set_properties, add_properties, remove_properties): when a syntax-table text > property is being changed, reduce syntax-propertize--done to the buffer > position. Hmm... I'm not too fond of adding ad-hoc support for specific text-properties in (set_properties, add_properties, remove_properties). > * lisp/emacs-lisp/syntax.el (syntax-ppss--trim-cache): New function extracted > from syntax-ppss-flush-cache. > (syntax-ppss-flush-cache): Now only modifies syntax-propertize--done and > syntax-ppss--done. > (syntax-ppss): Calls syntax-ppss--trim-cache and sets syntax-propertize--done. This part looks OK. I'm not sure if making the cache-flushing more lazy will be a win overall: it speeds up buffer modifications at the cost of slowing down syntax-ppss. To get back to the original problem: > 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. That's why it doesn't have "--" in its name: if you don't want to use syntax-propertize then you'll probably have to call that function by hand. I consider it as perfectly acceptable. Stefan