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 10:52:05 -0500 Message-ID: <66A741A1-38B8-40C9-BE84-AF99F74A079F@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_90D71A41-AA9E-4CF7-95B2-67A477C0C181" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39402"; mail-complaints-to="usenet@ciao.gmane.io" To: 67262@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 18 16:53:13 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 1r4NdB-000A65-DV for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Nov 2023 16: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 1r4Nd2-0003mG-Tt; Sat, 18 Nov 2023 10:53: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 1r4Ncz-0003lh-W9 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 10:53:02 -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 1r4Ncz-00082q-Ny for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 10:53:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r4Nd0-000417-J0 for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 10:53: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 15:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67262 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170032275415398 (code B ref -1); Sat, 18 Nov 2023 15:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Nov 2023 15:52:34 +0000 Original-Received: from localhost ([127.0.0.1]:49331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4NcX-00040I-M1 for submit@debbugs.gnu.org; Sat, 18 Nov 2023 10:52:33 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:52300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r4NcT-0003zs-6f for submit@debbugs.gnu.org; Sat, 18 Nov 2023 10:52:31 -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 1r4NcM-0003HX-IQ for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 10:52:22 -0500 Original-Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4NcK-0007xQ-UQ for bug-gnu-emacs@gnu.org; Sat, 18 Nov 2023 10:52:22 -0500 Original-Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3b2e72fe47fso2049381b6e.1 for ; Sat, 18 Nov 2023 07:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700322738; x=1700927538; darn=gnu.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=4UbjX5EVUORu93hsIT4MXdL9at4+ArZnoNRFkCC7jSY=; b=mLOwcl5FKFTOA695G8eoNv+NQ56J28JPx3pyDA0F8/fuqDlACmdcxV3NE2CBHovgab wOfGkYcKsUsugj3mm/rU03LnIPJVFoUGDZIZco9j6RbTVafc/tsIXLuXWtCDxTDVUGhd RVlQvfxmzN7aNAKmzoOswNCS+ccmFOG2LsIRvEqCVBig5Dp17j7IasP/bX1imwliyPSR Lt0454RH3MIYmO+i9c9gqS4RSc9jxSWilMh/xkRzEErJYLMeDesFnXFdczYbIaeUckOQ 0goJQaTrN1Gnk5N1rZjVR48ek2yHKGvL93RWCIZckCZqbuC7WxU6aq5AzB+g1LJBMpXK 0cNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700322738; x=1700927538; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4UbjX5EVUORu93hsIT4MXdL9at4+ArZnoNRFkCC7jSY=; b=WMsPCMfXtRpbd0g9GG2+j9bHl9EbfQzfAXpChiRAzCRZOyIwEh4uiIxWviqiYiS8Nc qqtj58giyBbHUI9WnWo+aTwfg174oCbrYKHzUZSRpX5yqRrHndZRtWBW6lbYnm37He9J oU4uyAZ9FqKWUj6j5AcwAPMHtgHTUFOJrXNP/0sEleSz94iP56XK+quaMpiaK0QsJJFV kd248GSr6p0AKFlrFTLKHT4y+BIQjwO68QIWWoGwPF6xUXsmNjtCJJffoGBMMjlHFboN 5uEApwv94fT9IxDfLnOolPehHN91cyD0YMvnbDt2SVq+DlWyAazKwTvdC2dZOoXgoYo7 Docg== X-Gm-Message-State: AOJu0YyshBQraK2r6WOZzkpTOlumwLF05Uic5umCgQ0uUo2WbhfKpGg5 kskrGbf7taM9iE1uhVlOKOfKl/UQYSY= X-Google-Smtp-Source: AGHT+IHzxGgNjHEsWfvUzKoGU0eRTqpr75MvBFUpbCwvZ5uuYzXNihR0vuk2RnxPnMScv01zF77Y2w== X-Received: by 2002:a05:6808:17:b0:3a3:b39d:a8bf with SMTP id u23-20020a056808001700b003a3b39da8bfmr3001984oic.45.1700322738112; Sat, 18 Nov 2023 07:52:18 -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 sn1-20020a05620a948100b00770f2a690a8sm1383453qkn.53.2023.11.18.07.52.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Nov 2023 07:52:16 -0800 (PST) X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=2607:f8b0:4864:20::229; envelope-from=jdtsmith@gmail.com; helo=mail-oi1-x229.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:274556 Archived-At: --Apple-Mail=_90D71A41-AA9E-4CF7-95B2-67A477C0C181 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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, 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=E2=80=9D) between these = modes:=20 t for python-mode (which signals a triple quote) ?34=3D" in python-ts-mode=20 If you first load python-mode, then load python-ts-mode, the syntax = parse becomes equal between the modes, and this bug vanishes. =20 python.el v0.28, Emacs v29.1= --Apple-Mail=_90D71A41-AA9E-4CF7-95B2-67A477C0C181 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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, 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=E2=80=9D) between these = modes: 

  • t = for python-mode (which signals a triple quote)
  •  ?34=3D" 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
= --Apple-Mail=_90D71A41-AA9E-4CF7-95B2-67A477C0C181--