GNU bug report logs - #67262
python-ts-mode cannot identify triple-quoted-strings

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Sat, 18 Nov 2023 15:53:02 UTC

Severity: normal

Merged with 67394

Found in version 29.1.90

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #67 received at 67262 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: casouri <at> gmail.com, 67262 <at> debbugs.gnu.org, jdtsmith <at> gmail.com
Subject: Re: bug#67262: python-ts-mode cannot identify triple-quoted-strings
Date: Sat, 23 Dec 2023 11:52:11 +0200
Ping!  Can we please make further progress here to resolve this issue?

> Date: Sun, 17 Dec 2023 15:46:29 +0200
> Cc: Eli Zaretskii <eliz <at> gnu.org>, JD Smith <jdtsmith <at> gmail.com>,
>  67262 <at> debbugs.gnu.org
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> 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.
> 




This bug report was last modified 1 year and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.