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#75422: 30.0.93; [PATCH] forward-sexp and backward-sexp jump outside of comments in tsx-ts-mode Date: Tue, 7 Jan 2025 18:29:25 -0800 Message-ID: <07F33B09-D0C4-4C6A-8F80-10E2173D92FF@gmail.com> References: <87ldvmjz7o.fsf@mail.linkov.net> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38779"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Kohei Tsuruta , Eli Zaretskii , 75422@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 08 03:30:23 2025 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 1tVLpv-0009uE-C1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2025 03:30:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVLpl-0006lC-Lh; Tue, 07 Jan 2025 21:30:13 -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 1tVLpb-0006f3-0H for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:30:06 -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 1tVLpa-0002e8-M6 for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:30:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=NIvL41o5VPg+68DWttt6lgEMAPj/X0f5bYx9lSgrYZc=; b=VcJPNNUXN6DWd7WeVXCak7kQk4kpF59uqnSNXK4rZFy/jVprDpA5N58NhrXDMDKp6sFT9I8NTKGPP55LYrja4iJchC6nEq2bTJf5N8+PWOArB5jyRICjnwo+haKWbJ+mS2utvBjYZ5boXhdhORqo7TJFruIgtw8ibM3f862PtFGhPEfLKmDhA8lw6SKDjd5N6gMA9Ghx1ydzB3F3Gs+w6uYsMC9WDbZxcAhCQonPjX2SMMvjFUCos2VdeAwlwmBG0dP4unsD17iMHrod2uuOMtIarnIOyZVqAREuOB12OtfPlsEJT/HKicrRG+vImv3MaAomWt5Rje9q9pMQNyqpGw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVLpa-0006O6-FB for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 21:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jan 2025 02:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75422 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 75422-submit@debbugs.gnu.org id=B75422.173630338724509 (code B ref 75422); Wed, 08 Jan 2025 02:30:02 +0000 Original-Received: (at 75422) by debbugs.gnu.org; 8 Jan 2025 02:29:47 +0000 Original-Received: from localhost ([127.0.0.1]:45390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVLpK-0006NF-Pq for submit@debbugs.gnu.org; Tue, 07 Jan 2025 21:29:47 -0500 Original-Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:54420) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tVLpH-0006My-KM for 75422@debbugs.gnu.org; Tue, 07 Jan 2025 21:29:44 -0500 Original-Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2f43d17b0e3so24260130a91.0 for <75422@debbugs.gnu.org>; Tue, 07 Jan 2025 18:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736303377; x=1736908177; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NIvL41o5VPg+68DWttt6lgEMAPj/X0f5bYx9lSgrYZc=; b=ko2vsjBo+JkR9Aqet+iAD6hO1t81JkgbZCwTthpVOuJrS1lQPYHp0uNfbUYxaxtCJT bn19rzU2HDLB0w1QX3oHN8elqD5uEoWXztJ2Wv6xcb739bZ3b9MiBzld1R3xkF9NoFzY vkq6wFvEKc8o1Ek5uJ1eU26gQpRaEwC67XcPObK5PCLRweEyLtTyMBrypcnRwFX0J9lq 9L5kkl7gh1J8x1jIjzXKLe9r6uuEhKljkNZekAVOEQC/6g2Dqxot+BA3JoPhZNuUsJcr ZS/lCeE/TYzAkKUDv2i+k4VmoThp87Ufxga2godxFplMrOm6P+R/LyBK2VG6tsOmeecx ntvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303377; x=1736908177; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NIvL41o5VPg+68DWttt6lgEMAPj/X0f5bYx9lSgrYZc=; b=Dy6JYc8NK0PW0THdtp/1snMulz3lia4vsuDk8N62/kn8pWyMd3nsBSNO1SEmZ0JPVt ZO4QD7Ac93bA645/r4tacHOgnFQW/jCPSltNdfEKMwCRk1LuANzCEQM8XJVS3OEQV/Ge F2PLPuAtYmjNQvs42Pu/7P8XpCWz42gGUUO4Mh8cjNX7nlwYwB4i+2KgTmJqBHzKSqQr Xp/7ZbJs3dN5eFK4TIAiFhgeUFJuqg2g06b3bonH7LxE97BKltsC4L6G+tuaRZf3T92W p6W/Lvsx6vXr9YuP/oakAGX0jS5NvUXv4xEM5cAf6WuhGLAp6aLakG42e/OVUtzVycNm 5R/w== X-Forwarded-Encrypted: i=1; AJvYcCXmxZksSy9IHfbjopLLGI8vj1tYb3gejxwVQtGMNJA5aBBO6/BN/W1BvQgxi8lCRdLBnSvEyg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyPhmEy09rFkUfBpiB4hZFGwfK1fZ0XKKgXu9jWMWOjGgoM9Uqs 24swnSuINcR6FRClYvjVhAH3sWGC5RrTMdddMF5XY2HS/3LvRpQa X-Gm-Gg: ASbGncvhKN7pAG+l+0Y5i+MD6AT7t9cs41YsAF1kq03bB17vs/9LauB4NSnpUy/1gRh qzfDThgwKdYNalamIIHP6HlJvOkurJMJmgRMOdn+qFVzncvQc6G2n4heZIaNX6xKqqWJviBmiiR kZ0fP+ZjJu9Dcf5n310amkqKlPOuBTOAxNw1T3cj8zxGr1D8t8nAljtfkUaxKSwtSOTvF6rvbya JCHYru0q5P4uyfXcGOOP1bOwRN/45TWpYfAXaR4SONX3ZzT9MPPXzBDoUpAMR19Z7pGxX0evs6w Yc+y X-Google-Smtp-Source: AGHT+IEFpaaM911gHa8CpIzfnYg4BpgO2Ou1yJ7NqqAxFg6Yb+ZXQThQziu/QJkXshsjzaVsExiw1Q== X-Received: by 2002:a17:90b:5686:b0:2ee:df70:1ff3 with SMTP id 98e67ed59e1d1-2f548e4d0a7mr1972899a91.0.1736303377419; Tue, 07 Jan 2025 18:29:37 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:715c:1de9:341d:f41d]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f54a2ab6bfsm289315a91.24.2025.01.07.18.29.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2025 18:29:36 -0800 (PST) In-Reply-To: <87ldvmjz7o.fsf@mail.linkov.net> X-Mailer: Apple Mail (2.3776.700.51) 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:298751 Archived-At: > On Jan 7, 2025, at 9:44=E2=80=AFAM, Juri Linkov = wrote: >=20 >> Steps to reproduce >> - emacs -Q test.tsx >> - (tsx-ts-mode) >> - Move point at the end of the comment at line 3 >> - (backward-sexp) >>=20 >> The expected point position after (backward-sexp) is = "treesit-thing-|settings" >> or at least stay inside of the comment line, however, point moves to = the >> beginning of "Hello". >> Likewise, if you C-x C-e at the end of the comment line, it evaluates = "Hello". >>=20 >> --- test.tsx (| is point) --- >> export const App =3D () =3D> { >> const greeting =3D "Hello" >> // treesit-thing-settings| >> return <>{greeting} >> } >> --- END test.tsx --- >>=20 >> It happens because tsx-ts-mode doesn't recognize comments. In >> typescript-ts-base-mode, treesit-thing-settings is set to have "text" = as >> a thing for typescript but it's missing in tsx-ts-mode when it's set = for >> tsx. >=20 > Thanks for the report. This is fixed in Emacs 31. >=20 > However, maybe Yuan will agree to add this small fix to Emacs 30? >=20 >> diff --git a/lisp/progmodes/typescript-ts-mode.el = b/lisp/progmodes/typescript-ts-mode.el >> index 4a38d1da596..0ffcb144771 100644 >> --- a/lisp/progmodes/typescript-ts-mode.el >> +++ b/lisp/progmodes/typescript-ts-mode.el >> @@ -564,7 +564,9 @@ tsx-ts-mode >> (sentence ,(regexp-opt >> (append = typescript-ts-mode--sentence-nodes >> '("jsx_element" >> - = "jsx_self_closing_element"))))))) >> + = "jsx_self_closing_element")))) >> + (text ,(regexp-opt '("comment" >> + "template_string")))))) I think it=E2=80=99s fine. Though it=E2=80=99s for Eli to decide. Yuan=