From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#68445: [PATCH] Problem with python--treesit-syntax-propertize Date: Sun, 21 Jan 2024 23:47:39 +0900 Message-ID: References: Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17639"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: 68445@debbugs.gnu.org To: Yuan Fu , Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 21 15:48:26 2024 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 1rRZ7Z-0004Ms-C0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Jan 2024 15:48:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRZ7C-0005M0-QL; Sun, 21 Jan 2024 09:48:02 -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 1rRZ79-0005Ld-5W for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 09:47:59 -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 1rRZ78-0004MQ-TK for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 09:47:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rRZ7C-0003id-1R for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 09:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Jan 2024 14:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68445 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68445-submit@debbugs.gnu.org id=B68445.170584847114224 (code B ref 68445); Sun, 21 Jan 2024 14:48:01 +0000 Original-Received: (at 68445) by debbugs.gnu.org; 21 Jan 2024 14:47:51 +0000 Original-Received: from localhost ([127.0.0.1]:36869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRZ70-0003hJ-LI for submit@debbugs.gnu.org; Sun, 21 Jan 2024 09:47:50 -0500 Original-Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:56501) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRZ6w-0003gR-H5 for 68445@debbugs.gnu.org; Sun, 21 Jan 2024 09:47:50 -0500 Original-Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6dbd146c76cso52818b3a.0 for <68445@debbugs.gnu.org>; Sun, 21 Jan 2024 06:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705848457; x=1706453257; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=zfNT3bPr7baTScT0CFRAPq983vSt6Yqe5SXiRBtv/UU=; b=ZR+4laNRl/+KjRtzU6HK6ATK9LSNR2O1JkV1WEiJ9DwglRXX/Sn59dYBnTS3CybSDi jRRoV8vev99skY2IplNexIM0a2MpoLjTNLHVXRN9XKCRYOn2lxeZ6uHmgCfQpYPCfqou FWoam6Vtn/+sCL4H4y02GmSxJnTuodcuUXOviVNgXLwv/VHNfuV1z4CLqZbHTj27diWD JUsS6FtfCIpmWfk6ZJRM7lp+AvvQmAzFCLqDcIvYMWs15AtVtrMnV5IEC3skEG8foD2l w0fuUY5+V3F95bRoAwOPXfCfMjSDigNW2OKNfRwTLiIPEcsYiS7EwPtxQ4ew+DF4eyeU 4kLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705848457; x=1706453257; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zfNT3bPr7baTScT0CFRAPq983vSt6Yqe5SXiRBtv/UU=; b=JFSw0yiK/d54ZLqI/IX1fheEZjCwiRgEYcRTxXcsfle0jxpwD4kiaSa/mxPPSzc2LN XHxKRlfhYVNQP7nPTWUoQTJCnYA0vZjd57WrhkHnIcWWQbbsfU1N2tbO43ucE6H1pQO4 OT/KH+GJ+nqEPCjBPWd1xwqsT4BqX+T4PCJxtOcxJD2PHst0NGxOp5Vp/z3GupvSFfbC sNhT0aX0g326cC6ZqB9qUz/rezKkC9P6L1x0cpVtNdenR9UVow5DITUI51vr8+hke2Ay RNU5Y8DLAslbA3DA0+KeVZGLiedcefk0G4n/NcaCysUdWnRIHK6xLRszLUKUYcwRXkuv zMgA== X-Gm-Message-State: AOJu0Yy//RBWwtOQxUXiIVUEAGWxy466xOlYvlAnwU9RY53k4FlYeIUU th+1WLBaPZzMlh9KONHz5TdsCHq1Foozb2dMkLIIdpJpIPqS63lA X-Google-Smtp-Source: AGHT+IHgX/ymikiRe0bHr4ZNMX5TtmV3Olp61bj+41a/9YKkvCadXXAdJj1/FzaVz/4Fk8DSNHDd7w== X-Received: by 2002:a05:6a20:144a:b0:19a:2bda:7273 with SMTP id a10-20020a056a20144a00b0019a2bda7273mr962766pzi.84.1705848456909; Sun, 21 Jan 2024 06:47:36 -0800 (PST) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id az2-20020a170902a58200b001d73adf350asm1616251plb.56.2024.01.21.06.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 06:47:36 -0800 (PST) In-Reply-To: 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:278676 Archived-At: I am resending my mail, as I made a mistake in X-Debbugs-CC. I wrote: > Hi, > > I found a problem with python--treesit-syntax-propertize recently > introduced by the Bug#67977 patch. > > 1. emacs -Q > 2. Open a file in python-ts-mode with the following contents: > > #+begin_src python > """Docstring. > > test. > """ > S = """string.""" > #+end_src > > 3. Locate the point on the third line. > 4. M-q > 5. An empty line will be inserted. > 6. M-q > 7. The string literal on the last line will be split as follows: > > S = "" > > "string.""" > > This problem does not occur in python-mode. > > The direct cause of this problem is that the string-delimiter property > set in the docstring is removed. python--treesit-syntax-propertize is > called to set the property, but it fails to set it properly. Here is > the trace of python--treesit-syntax-propertize from step 4 above. > > ====================================================================== > 1 -> (python--treesit-syntax-propertize 1 45) > 1 <- python--treesit-syntax-propertize: nil > ====================================================================== > 1 -> (python--treesit-syntax-propertize 16 45) > 1 <- python--treesit-syntax-propertize: nil > > python--treesit-syntax-propertize is called with argument START 16. > This is the position inside the docstring. > > It seems to me that python--treesit-syntax-propertize assumes that the > START argument is outside the triple-quoted string. So one solution > might be to change START to the start of the string if it is within a > string, as in the attached patch. However, I'm not sure this is the > right approach. Should we use > syntax-propertize-extend-region-functions? > > -- > In GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, X toolkit, cairo > version 1.16.0, Xaw scroll bars) of 2024-01-13 built on ubuntu > Repository revision: 106cd9aafe8248ef91d7e89161adc5f912ea54eb > Repository branch: master > System Description: Ubuntu 22.04.3 LTS I appreciate your comments.