From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#67262: python-ts-mode cannot identify triple-quoted-strings Date: Sat, 23 Dec 2023 15:51:24 -0800 Message-ID: <90B31D18-7607-4D37-A6B4-5CFE3C4F40A9@gmail.com> References: <66A741A1-38B8-40C9-BE84-AF99F74A079F@gmail.com> <838r6vm3dj.fsf@gnu.org> <9bfc5e6f-3612-115f-a59d-35ad629bdf9e@gutov.dev> <83v89qcfsb.fsf@gnu.org> <9B8C904A-3729-44AF-82F7-3BEA849F46D0@gmail.com> <83le9umhzh.fsf@gnu.org> <6b009ad5-2a09-f4e5-8ebe-8a7744692473@gutov.dev> <2C8AF27C-596F-4F7B-879C-9EB7497C45D1@gmail.com> <83edfddz5g.fsf@gnu.org> <4E036F58-8190-42BF-A6EC-7967BE3921B2@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_D8CD5540-69D1-4FB6-9893-862CD26E285C" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5048"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 67262@debbugs.gnu.org, JD Smith To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 24 00:52:21 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 1rHBn3-00016W-Jf for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Dec 2023 00:52:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rHBmh-0008HC-2a; Sat, 23 Dec 2023 18:51:59 -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 1rHBmf-0008Go-KZ for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 18:51:57 -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 1rHBme-0002yK-QQ for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 18:51:57 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rHBmj-0006OB-UH for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2023 18:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2023 23:52:01 +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.170337551524544 (code B ref 67262); Sat, 23 Dec 2023 23:52:01 +0000 Original-Received: (at 67262) by debbugs.gnu.org; 23 Dec 2023 23:51:55 +0000 Original-Received: from localhost ([127.0.0.1]:51461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHBmc-0006Nm-I4 for submit@debbugs.gnu.org; Sat, 23 Dec 2023 18:51:54 -0500 Original-Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:59707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rHBmZ-0006NY-Rp for 67262@debbugs.gnu.org; Sat, 23 Dec 2023 18:51:53 -0500 Original-Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6d9af1f12d5so254584b3a.3 for <67262@debbugs.gnu.org>; Sat, 23 Dec 2023 15:51:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703375500; x=1703980300; 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=yuv4AsMl3xPAFYo5rItr/JCdeN4/301FZHSMojP3Gc4=; b=YVpUBgDb47nsU6/hidBdyOwHUzpI/9mTzI56uF2pF2MKt0bv6Baz2e+y5lSuqKjCte ju83a2mux9/OPplmIPh/JuW+92uAnBAGZ5AJqu1zPhxHXJTqTxWoUe70qpo6X2rvEbFq g/E0eBYAwqVD27dMCgY/rT00Eq1uBAUXKlDGceXQjCZNfn+8wmchcwCTMoRh2SVnERHi 0u4G1fJ1CTwBYyioRWeYv7gZkfpoW82HtFOnR+dGEQKm8+WIXCkmanFXoUEfR1nbeIgY 1UuX0NlhHsZUevfSJnpTyOT/aJbayVCWxOjIZaKFM0ZD3xWwEd6ATmLGnmIUGxoe8GBz gHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703375500; x=1703980300; 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=yuv4AsMl3xPAFYo5rItr/JCdeN4/301FZHSMojP3Gc4=; b=ABUqbeo5RrbcTzCGav+CXuliX96DhWovH7Tjl7RgE5My0jLsFgp7YoDTKMyB03YRao pXLWa8Ut2nSsvVvaf9qUawmpOT43Hr9GuEmaog4i8l4oGGWC+spiI60DMKzNgSfLO6mm F8M8GA6p5EnBGAJV2ZfTGUhLyV2gnuBnoX1Q2PTEHqqyPzMtnsN2H/q6Ob/xIyEOYC1S CVmHBwTO44KFno+BhL0adNeKpfUNY2YFV7IbOP0wayoHDkVOFaAFwlItVh8B9dThf909 ELGQqTXXqMebGiafSNuN8OBk0zPHV8p0nZU4w8kh5RKV5mLCofilmksn9Qs2caKWDK50 zbnQ== X-Gm-Message-State: AOJu0Yyu2sZg4z5ZuvLEOPQ/pjYaCLuC89KjLTkdD2djePBveuRI78KO F059YS8avozAYX0gWHlsTuU= X-Google-Smtp-Source: AGHT+IEDK1+HaA4g1VgAjNlKkK+ELSxPHKg5ObQy7B0N0hPNODYXa4tKh4LSSD35/lP/0zAceldncA== X-Received: by 2002:aa7:8003:0:b0:6d2:66a3:64ee with SMTP id j3-20020aa78003000000b006d266a364eemr3955120pfi.47.1703375500106; Sat, 23 Dec 2023 15:51:40 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id d6-20020a056a00198600b006d93afd243asm5534768pfl.72.2023.12.23.15.51.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 Dec 2023 15:51:39 -0800 (PST) In-Reply-To: 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:276776 Archived-At: --Apple-Mail=_D8CD5540-69D1-4FB6-9893-862CD26E285C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Dec 23, 2023, at 1:01 PM, Dmitry Gutov wrote: >=20 > On 23/12/2023 20:03, Yuan Fu wrote: >>> On Dec 23, 2023, at 1:52 AM, Eli Zaretskii wrote: >>>=20 >>> Ping! Can we please make further progress here to resolve this = issue? >> Once we merge the fix for bug#66732, we can proceed on this. I have a = patch for this bug too. >=20 > FWIW, I suggest using the first half of the patch attached to = https://debbugs.gnu.org/67262#23 >=20 > Only adjusting the positions to add the property to the "inner" pair = of quotes rather than the outer one (to match python-mode). Something like this? IMHO the code is easier to understand without the = syntax-propertize-rules. Yuan --Apple-Mail=_D8CD5540-69D1-4FB6-9893-862CD26E285C Content-Disposition: attachment; filename=python-syntax.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="python-syntax.patch" Content-Transfer-Encoding: quoted-printable =46rom=201a54e754074e7785d853d5821811d37fa837165c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Sat,=20= 23=20Dec=202023=2015:49:32=20-0800=0ASubject:=20[PATCH]=20Fix=20= python-ts-mode=20triple=20quote=20syntax=20(bug#67262)=0A=0A*=20= lisp/progmodes/python.el=20(python--treesit-syntax-propertize):=20New=20= function.=0A(python-ts-mode):=20Activate=20= python--treesit-syntax-propertize.=0A---=0A=20lisp/progmodes/python.el=20= |=2017=20+++++++++++++++++=0A=201=20file=20changed,=2017=20insertions(+)=0A= =0Adiff=20--git=20a/lisp/progmodes/python.el=20= b/lisp/progmodes/python.el=0Aindex=207c5c20608bd..7d2db64a988=20100644=0A= ---=20a/lisp/progmodes/python.el=0A+++=20b/lisp/progmodes/python.el=0A@@=20= -1228,6=20+1228,21=20@@=20python--treesit-fontify-variable=0A=20=20=20=20= =20=20(treesit-node-start=20node)=20(treesit-node-end=20node)=0A=20=20=20= =20=20=20'font-lock-variable-use-face=20override=20start=20end)))=0A=20=0A= +(defun=20python--treesit-syntax-propertize=20(start=20end)=0A+=20=20= "Propertize=20triple-quote=20strings=20between=20START=20and=20END."=0A+=20= =20(save-excursion=0A+=20=20=20=20(goto-char=20start)=0A+=20=20=20=20= (while=20(search-forward=20"\"\"\""=20end=20t)=0A+=20=20=20=20=20=20(let=20= ((node=20(treesit-node-at=20(point))))=0A+=20=20=20=20=20=20=20=20;;=20= The=20triple=20quotes=20surround=20a=20non-empty=20string.=0A+=20=20=20=20= =20=20=20=20(when=20(equal=20(treesit-node-type=20node)=20= "string_content")=0A+=20=20=20=20=20=20=20=20=20=20(let=20((start=20= (treesit-node-start=20node))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20(end=20(treesit-node-end=20node)))=0A+=20=20=20=20=20=20=20=20=20=20= =20=20(put-text-property=20(1-=20start)=20start=0A+=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= 'syntax-table=20(string-to-syntax=20"|=20"))=0A+=20=20=20=20=20=20=20=20=20= =20=20=20(put-text-property=20end=20(min=20(1+=20end)=20(point-max))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20'syntax-table=20(string-to-syntax=20"|=20"))))))))=0A+=0A=20= =0C=0A=20;;;=20Indentation=0A=20=0A@@=20-6729,6=20+6744,8=20@@=20= python-ts-mode=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= #'python--treesit-defun-name)=0A=20=20=20=20=20= (treesit-major-mode-setup)=0A=20=0A+=20=20=20=20(setq-local=20= syntax-propertize-function=20#'python--treesit-syntax-propertize)=0A+=0A=20= =20=20=20=20(python-skeleton-add-menu-items)=0A=20=0A=20=20=20=20=20= (when=20python-indent-guess-indent-offset=0A--=20=0A2.41.0=0A=0A= --Apple-Mail=_D8CD5540-69D1-4FB6-9893-862CD26E285C--