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, 23 Dec 2023 11:52:11 +0200 Message-ID: <83edfddz5g.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> <83le9umhzh.fsf@gnu.org> <6b009ad5-2a09-f4e5-8ebe-8a7744692473@gutov.dev> <2C8AF27C-596F-4F7B-879C-9EB7497C45D1@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3614"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, 67262@debbugs.gnu.org, jdtsmith@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 23 10:53:14 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 1rGygz-0000jj-H8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Dec 2023 10:53:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGygj-0001o5-VX; Sat, 23 Dec 2023 04:52:57 -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 1rGygj-0001ns-2W for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:52:57 -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 1rGygi-0000mD-NQ for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:52:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGygn-00062p-Q8 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 04:53: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, 23 Dec 2023 09:53: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.170332515423196 (code B ref 67262); Sat, 23 Dec 2023 09:53:01 +0000 Original-Received: (at 67262) by debbugs.gnu.org; 23 Dec 2023 09:52:34 +0000 Original-Received: from localhost ([127.0.0.1]:48612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGygL-000622-JA for submit@debbugs.gnu.org; Sat, 23 Dec 2023 04:52:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39310) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGygJ-00061o-0e for 67262@debbugs.gnu.org; Sat, 23 Dec 2023 04:52:31 -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 1rGyg8-0000ds-Ha; Sat, 23 Dec 2023 04:52:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=AoOd8idIzwu9HglK8XD+ICqYI4V5sPie76uVm4B+/fE=; b=jkOXMOp7RxPLr2Po3VE4 Dnrr4OPQV6WJcWhLF6c1ubIYNJYQRanVbffKY+Vyt1PNCgCLNX9zjCDieDwwyexg05y2HDyaAAA/4 ScaZBQ0fysAse1FTfi7JXXhWH15vr1NGVTTK+baWwbd5HMOM7z4MuwDFUgFbRWtV+/fzY5rD3mUnG yHSoNEHgeLpJKUOxMkBdjwF0RPQjXVcfvdcXMFPAjyWRAS8/3+W3de+hxKalzxWLa9y/dS0mE8NiW UUP/XmVbqtKlzCSd0pfzv6e2z/UomZM28LIhdn3LO9V/U/dH+b4p3kXKlF3fLgun/zC/l1G/13DNs hMGHcM2JmpUWLQ==; In-Reply-To: (message from Dmitry Gutov on Sun, 17 Dec 2023 15:46:29 +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:276723 Archived-At: Ping! Can we please make further progress here to resolve this issue? > Date: Sun, 17 Dec 2023 15:46:29 +0200 > Cc: Eli Zaretskii , JD Smith , > 67262@debbugs.gnu.org > From: Dmitry Gutov > > On 17/12/2023 01:36, Yuan Fu wrote: > > How do you think of this patch? This extends the patch in bug#66732, and adds correct text property to the quotes (I think). > > I do believe the common pattern should be followed here: a > syntax-propertize-function and a call to syntax-ppss-flush-cache to > invalidate when appropriate. See my patch in this bug for reference. > > The reasons are performance (deferring work) and keeping state > management logic in one place. > > With your patch in particular, try this: > > 1. Type """foo -- no text properties. > 2. Add """. Check the 3rd and 4th quote characters with 'C-u C-x ='. > Both should have the (15) 'syntax-table' text property applied. > 4. Backspace. Syntax highlighting changes -- the string is not > highlighted now (that's good, I guess). But both 3rd and 4th quote chars > retain the text property. (python-info-triple-quoted-string-p) still > returns the same value, and, more importantly, (syntax-ppss) does too. > 5. Backspace 2 more times (the text in the buffer is now '"""foo'). The > 4th quote is gone now, but the 3rd still has the text property. > > (nth 3 (syntax-ppss)) still returns t, and > (python-info-triple-quoted-string-p) still returns the same value. > > On steps 1 and 5 the buffer contents are the same, but the syntax-table > properties are different. > > > It doesn’t handle the case of “””””” (no content inside the quotes), but I think that’s fine? > > It might be important for some callers of > (python-info-triple-quoted-string-p). But it should be pretty easy to > fix, now or later. >