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: JD Smith <jdtsmith <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 67262 <at> debbugs.gnu.org
Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings
Date: Sat, 18 Nov 2023 12:18:02 -0500
[Message part 1 (text/plain, inline)]

> On Nov 18, 2023, at 11:29 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> From: JD Smith <jdtsmith <at> gmail.com>
>> Date: Sat, 18 Nov 2023 10:52:05 -0500
>> 
>> 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,
> 
> Can you figure out which part of python-mode's initialization makes
> the above work correctly, and why?  Then we could discuss whether
> moving that part into python-base-mode is TRT.

I took a look. It’s `syntax-propertize-function' that is not being setup.  From a buffer in `python-ts-mode', this reenables triple-quote recognition:

(progn 
  (setq-local syntax-propertize-function python-syntax-propertize-function) 
  (syntax-ppss-flush-cache (point-min)))

Note that `python-syntax-propertize-function' mentions `python-syntax-stringify', which scans the syntax for triple quotes and marks their 'syntax-table.  I am not sure whether this was an oversight, or was omitted purposefully from the body of python-ts-mode.
[Message part 2 (text/html, inline)]

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.