From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.bugs Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings Date: Sat, 18 Nov 2023 12:18:02 -0500 Message-ID: References: <66A741A1-38B8-40C9-BE84-AF99F74A079F@gmail.com> <838r6vm3dj.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_46145E57-47AD-416E-AD39-436D1147BD68" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10338"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67262@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 18 18:19:24 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 1r4Oya-0002Sh-7m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Nov 2023 18:19:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4OyG-0000rk-5z; Sat, 18 Nov 2023 12:19:04 -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 1r4OyD-0000rZ-Sj for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 12:19: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 1r4OyD-0002uE-Ka for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 12:19:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4OyE-0006TU-Fu for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 12:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: JD Smith Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Nov 2023 17:19:02 +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.170032790424809 (code B ref 67262); Sat, 18 Nov 2023 17:19:02 +0000 Original-Received: (at 67262) by debbugs.gnu.org; 18 Nov 2023 17:18:24 +0000 Original-Received: from localhost ([127.0.0.1]:49447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4Oxb-0006S5-QH for submit@debbugs.gnu.org; Sat, 18 Nov 2023 12:18:24 -0500 Original-Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]:51636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4OxY-0006Rr-NL for 67262@debbugs.gnu.org; Sat, 18 Nov 2023 12:18:22 -0500 Original-Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-41cc56255e3so18514071cf.3 for <67262@debbugs.gnu.org>; Sat, 18 Nov 2023 09:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700327894; x=1700932694; darn=debbugs.gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=mtuERcL1BAErYeklFADqdJ9vFPj+BsbUkr1Zx3qZZqc=; b=aetLCvz1qiYYEuUVxdC75yKreKEzQxGLwajowRLXfc3BVUfoSu7kC89MLLb2KGrMA0 zMlZqUy//t2a8if7JH8sa6u2L0ZqWiC1fKlZFIFYYyPeyA8+NSInXxgFsX8RSCISo5i9 S8ZdWzGkeITDlkXrTX/GkIk3fawvfnjD9VRY/C+On1VqSmdQfaF+mYMgZgJXtm3sMZic jAYOo22FGwd26/+Av6kOlyTzn+nisTkDPsMBCFXZHACBMeRWFuuUbPZBHcRwwD9MID2f 0O0glodXJcU/do6s49F/7z/fNUnVoOCuZh4dmRyvLUbazGlGgzq217/Bz1knYaWoEmOz 4XTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700327894; x=1700932694; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mtuERcL1BAErYeklFADqdJ9vFPj+BsbUkr1Zx3qZZqc=; b=dqC32K0+YQquf4GKh0358gdLeKm3Ct7u4uBZEiHMZfiga32voR9ENOmvoJJpJMY6Fn t7E7dRFHaINVMBtYvXXPM3FT6MOpp6GSX/nhIGmpNE9y8mL9qiWngWzBYTbyfVafTLsT S1MF7Up0Rukd4ewWPXCj7g45QJGTmOzywf8rzzXGmQfVBqU3LhomEGhWsgjcxvXBTu8W 1rYdYpuKuPRbjuim2Vb2lxP4awcIfY24k7fjigcGgRBVcZPu4noHDJkrY4Y7ED7LyE2u X2y7/qRml643WZCKRAyqPKUitr/CnNm3SlsK8S+Qzp5ApXKbXACpp48AWIg9oA3Vx/f/ fLQw== X-Gm-Message-State: AOJu0Yxqb0W2apUZe0Y1MzwsB8rhLUHXvYrjz+lDQgGEq+KWUmb7aiNT LcZVPeYfV+fV8Oc1L1kRiYo= X-Google-Smtp-Source: AGHT+IGHUcO2aFV/Cy2Vg2OfJ+2XYS3kDwK5TdWnTi44NCRo+u0+KnVjEzuHoT5Y5D94Q3qAsu2drA== X-Received: by 2002:ac8:7fcf:0:b0:41e:288a:d99e with SMTP id b15-20020ac87fcf000000b0041e288ad99emr4151380qtk.39.1700327894205; Sat, 18 Nov 2023 09:18:14 -0800 (PST) Original-Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net. [24.53.187.34]) by smtp.gmail.com with ESMTPSA id df25-20020a05622a0ed900b00419c39dd28fsm1400170qtb.20.2023.11.18.09.18.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 09:18:13 -0800 (PST) In-Reply-To: <838r6vm3dj.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.700.6) 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:274563 Archived-At: --Apple-Mail=_46145E57-47AD-416E-AD39-436D1147BD68 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 18, 2023, at 11:29 AM, Eli Zaretskii wrote: >=20 >> From: JD Smith >> Date: Sat, 18 Nov 2023 10:52:05 -0500 >>=20 >> Inside this triple-quoted string, in a python buffer: >>=20 >> a =3D """This is a test""" >>=20 >> python-mode yields (python-info-triple-quoted-string-p)=3Dt, whereas = python-ts-mode gives nil, >=20 > 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=E2=80=99s `syntax-propertize-function' that is not = being setup. =46rom a buffer in `python-ts-mode', this reenables = triple-quote recognition: (progn=20 (setq-local syntax-propertize-function = python-syntax-propertize-function)=20 (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.= --Apple-Mail=_46145E57-47AD-416E-AD39-436D1147BD68 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Nov = 18, 2023, at 11:29 AM, Eli Zaretskii <eliz@gnu.org> = wrote:

From: JD Smith = <jdtsmith@gmail.com>
Date: Sat, 18 Nov 2023 10:52:05 = -0500

Inside this triple-quoted string, in a python = buffer:

a =3D """This is a test"""

python-mode yields = (python-info-triple-quoted-string-p)=3Dt, 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=E2=80=99= s `syntax-propertize-function' that is not being setup.  =46rom 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.= --Apple-Mail=_46145E57-47AD-416E-AD39-436D1147BD68--