From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings Date: Sat, 16 Dec 2023 14:47:46 +0200 Message-ID: <83le9umhzh.fsf@gnu.org> References: <66A741A1-38B8-40C9-BE84-AF99F74A079F@gmail.com> <838r6vm3dj.fsf@gnu.org> <9bfc5e6f-3612-115f-a59d-35ad629bdf9e@gutov.dev> <83v89qcfsb.fsf@gnu.org> <9B8C904A-3729-44AF-82F7-3BEA849F46D0@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12837"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67262@debbugs.gnu.org, jdtsmith@gmail.com To: casouri@gmail.com, Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 16 13:49:25 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rEU6e-0003BG-3a for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Dec 2023 13:49:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rEU6J-0001tv-Kx; Sat, 16 Dec 2023 07:49:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rEU6H-0001nG-MR for bug-gnu-emacs@gnu.org; Sat, 16 Dec 2023 07:49:01 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rEU6H-0004LY-As for bug-gnu-emacs@gnu.org; Sat, 16 Dec 2023 07:49:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rEU6H-00078o-S1 for bug-gnu-emacs@gnu.org; Sat, 16 Dec 2023 07:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Dec 2023 12:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67262 X-GNU-PR-Package: emacs Original-Received: via spool by 67262-submit@debbugs.gnu.org id=B67262.170273089427212 (code B ref 67262); Sat, 16 Dec 2023 12:49:01 +0000 Original-Received: (at 67262) by debbugs.gnu.org; 16 Dec 2023 12:48:14 +0000 Original-Received: from localhost ([127.0.0.1]:54156 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEU5W-00074l-3j for submit@debbugs.gnu.org; Sat, 16 Dec 2023 07:48:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEU5U-00073v-5d for 67262@debbugs.gnu.org; Sat, 16 Dec 2023 07:48:12 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rEU5N-0004Fq-QG; Sat, 16 Dec 2023 07:48:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GxuGdMDMa7aQ5+Mq+qkIArA6E11Ae9F4I3diGCz3EY4=; b=VrYavt4rJpo+ zwWwHad75kadlHLmEr7rRMCTWjfsb9pAtsl+puloGiX9e5E4rn9JxltsaGnoOCzJjqVVOrtf+Sjp3 XkBvfyv6AtcGirciwqQ+DJhe4N0ltjwTYI5leChYVqhZLNCsSz/Gzr2zAAvJi0LLlGA93KFb4Im7h 40rG9L06UOtC277kPph/ny25XFFyWWVfT8MndMlmtUfcKB8yGj5gM+RK9FDzbDGm8sLDahH9ajCX5 Vms7Wz+jI1yT0JeNDugLf1IIrgy22MCAP81sZ5nJ+NqC1NZ+YtMa+qlSn/JYmmPc0Xz/51AHYlEgW aAQ36o3YjxZ7+bzA2XmZqw==; In-Reply-To: (message from Dmitry Gutov on Tue, 12 Dec 2023 23:55:43 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276328 Archived-At: How should we make progress with this bug? I'd like to fix it before Emacs 29.2 is released. > Date: Tue, 12 Dec 2023 23:55:43 +0200 > Cc: 67262@debbugs.gnu.org > From: Dmitry Gutov > > On 12/12/2023 10:32, Yuan Fu wrote: > > >> syntax-ppss-flush-cache is called by edits (and by the re-parse). It > >> seems like it will be odd to have execution the other way around > >> and/or add some hook into it which would call the re-parse and extend > >> the region to be invalidated. > >> > >> syntax-propertize could have another hook added, yes. Or an advice. > >> > >> But it seems better to reuse some of the existing hooks, such as > >> syntax-propertize-extend-region-functions. It treesit.c provided a way > >> to fetch the newly-invalidated region, the treesit-major-mode-setup > >> could add a new function to syntax-propertize-extend-region-functions > >> which would invoke that feature. But even now it can instantiate the > >> parse, which would call treesit-force-reparse internally, and then > >> collect the info from the callbacks. > > syntax-propertize-extend-region-functions looks perfect. We just need to > > force a reparse in it and the notifier will do the rest. > >> > >> And yet another way - is to extend the region to be propertized from > >> inside the major mode's syntax-propertize-function, invalidating some > >> earlier entries too. The main problem with that, I think, is that > >> every ts mode will have to repeat that trick. And that authors would > >> have to know to do that. How to make that easier and more obvious, is > >> a question. > >> > >> Finally, if I'm right that bug#66732 has a similar cause, then a > >> shared solution that can be reused by syntax and font-lock (or > >> preferably just fix both in the same place) would be ideal. > >> > >>> I'm not quite sure about how do we cause this re-parse. The > >>> straightforward approach would be calling treesit-force-reparse[1] in > >>> syntax-propertize/syntax-ppss-flush-cache. But ideally I'd like to > >>> keep tree-sitter transparent for syntax.el. Maybe we can add a hook > >>> in syntax-propertize/syntax-ppss-flush-cache. > >>> > >>> [1] This function doesn't exist yet, but it's easy to define in lisp. > >> > >> treesit-parser-root-node calls it anyway and does little else, so we > >> could get by with just using it. > >> > > Yep. > > For the casual observer: I posted a solution using the above method in > comments to bug#66732 yesterday. >