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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: JD Smith <jdtsmith <at> gmail.com>
Subject: bug#67262: closed (Re: bug#67262: python-ts-mode cannot identify
 triple-quoted-strings)
Date: Sun, 24 Dec 2023 03:11:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#67262: python-ts-mode cannot identify triple-quoted-strings

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 67262 <at> debbugs.gnu.org.

-- 
67262: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67262
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67262-done <at> debbugs.gnu.org,
 JD Smith <jdtsmith <at> gmail.com>
Subject: Re: bug#67262: python-ts-mode cannot identify triple-quoted-strings
Date: Sat, 23 Dec 2023 19:10:05 -0800

> On Dec 23, 2023, at 4:45 PM, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> 
> On 24/12/2023 01:51, Yuan Fu wrote:
>> Something like this? IMHO the code is easier to understand without the syntax-propertize-rules.
> 
> Sure, fine with me.
> 
>> +    (while (search-forward "\"\"\"" end t)+            (put-text-property (1- start) start
> 
> I think we also should support the triple-single-quotes, like python-syntax-propertize-function does.
> 
>> +                               'syntax-table (string-to-syntax "| "))
>> +            (put-text-property end (min (1+ end) (point-max))
>> +                               'syntax-table (string-to-syntax "| "))))))))
> 
> The spaces after "|" seem unnecessary.

Thanks, fixed those things and pushed to emacs-29.

Yuan
[Message part 3 (message/rfc822, inline)]
From: JD Smith <jdtsmith <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: python-ts-mode cannot identify triple-quoted-strings
Date: Sat, 18 Nov 2023 10:52:05 -0500
[Message part 4 (text/plain, inline)]
Inside this triple-quoted string, in a python buffer:

a = """This is a test"""

python-mode yields (python-info-triple-quoted-string-p)=t, whereas python-ts-mode gives nil, defeating the fancy doc string folding both modes implement.

The reason seems to be that (syntax-ppss) returns something different in position 3 (which is "non-nil if inside a string”) between these modes: 

t for python-mode (which signals a triple quote)
 ?34=" in python-ts-mode 

If you first load python-mode, then load python-ts-mode, the syntax parse becomes equal between the modes, and this bug vanishes.  

python.el v0.28, Emacs v29.1
[Message part 5 (text/html, inline)]

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

Previous Next


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