Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 21 Aug 2026 15:06:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 21 11:06:54 2026
Received: from localhost ([127.0.0.1]:46685 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wxQpZ-0002R5-La
for submit <at> debbugs.gnu.org; Fri, 21 Aug 2026 11:06:53 -0400
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:49426)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>)
id 1wxQpX-0002QB-Av; Fri, 21 Aug 2026 11:06:51 -0400
Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4hRNtr0ttTzMlDr;
Fri, 21 Aug 2026 17:06:44 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1787324804;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=KEjdCC6satOvDcfvp+rYc48YEVmWQ7FmSezZQhIk72o=;
b=Pe2iSTiOH6tfjnfo8JP34vELyhDkAEQEoh7BoxQenOi4MrYBtOmSylwxm+aLMDag3rHkdi
H2WXJqvSgKR8XzwSNa5it0jBr4WPu48DmInHLxP7ZCuwrg0ibjhWalH6UgqefPZclim112
AmDfXk7BhlNT+CRVawRPB+iePy6Im73MYcFKJzuXPpamtVqFEd1fLhMUHnK0wb7bm7+OB9
cN9TFF3PsxSYV6qJhB1+NdKjAPx3ZE+gDbnIZN+iwVkbf121JBBzG6xp2WdqtEhH4wcZ46
J6EP/KNc+uRCTsZocfrS0UIDaAWJ/lHir5sgP5dlQYd6RsrISE6WSQ/aesRAWg==
From: Juri Linkov <juri@HIDDEN>
To: Sean Whitton <spwhitton@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <874igno95p.fsf@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN>
<86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN>
<874ihgdad1.fsf@HIDDEN>
<87mrujz2dd.fsf@HIDDEN>
<33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
<87fr0akq61.fsf@HIDDEN> <86se492a83.fsf@HIDDEN>
<874igno95p.fsf@HIDDEN>
Date: Fri, 21 Aug 2026 18:05:38 +0300
Message-ID: <878q5zh5tp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN,
casouri@HIDDEN, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
fixed 80837 31.1.rc1
close 80837 32.0.50
thanks
>>> >> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
>>> >> since uncommenting is a frequent operation. If a small fix
>>> >> for treesit-forward-comment is still unfeasible, then at least
>>> >> we need to disable the 'comment' thing for c-ts-mode
>>> >> in the release branch:
>>> >>
>>> >> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
>>> >> index 5f064716a89..3efbee6f8a7 100644
>>> >> --- a/lisp/progmodes/c-ts-mode.el
>>> >> +++ b/lisp/progmodes/c-ts-mode.el
>>> >> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
>>> >> "goto_statement"
>>> >> "case_statement")))
>>> >> (text ,(regexp-opt '("comment"
>>> >> - "raw_string_literal")))
>>> >> - (comment "comment"))
>>> >> + "raw_string_literal"))))
>>> >> "`treesit-thing-settings' for both C and C++.")
>>> >
>>> > Actually this makes a lot of sense. I don’t think we are missing anything
>>> > by not using tree-sitter for the comment thing, forward/backward-comment
>>> > already works perfectly fine without it. We can also add a comment to
>>> > explain why we leave the comment thing out for c-ts-mode in the release
>>> > version.
>>>
>>> Eli and Sean, is this change ok to install on the release branch?
>>
>> I don't mind, but please wait for Sean to respond.
>
> Yes, I think this is okay.
Thanks for confirming, so now pushed with a comment, and closed.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 21 Aug 2026 14:11:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Aug 21 10:11:55 2026
Received: from localhost ([127.0.0.1]:59545 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wxPyN-0007mp-IR
for submit <at> debbugs.gnu.org; Fri, 21 Aug 2026 10:11:55 -0400
Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]:55123)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>)
id 1wxPyL-0007mZ-5F
for 80837 <at> debbugs.gnu.org; Fri, 21 Aug 2026 10:11:53 -0400
Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46])
by mailfout.phl.internal (Postfix) with ESMTP id 0356BEC01AE;
Fri, 21 Aug 2026 10:11:48 -0400 (EDT)
Received: from phl-frontend-03 ([10.202.2.162])
by phl-compute-06.internal (MEProxy); Fri, 21 Aug 2026 10:11:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name;
h=cc:cc:content-transfer-encoding:content-type:content-type
:date:date:from:from:in-reply-to:in-reply-to:message-id
:mime-version:references:reply-to:subject:subject:to:to; s=fm2;
t=1787321507; x=1787407907; bh=4S6i/pmXHto9+xe/zqilnJ9ld30Jnao9
daDMQRlnMxg=; b=PyyN5NBLxxp26DyXcqXXB4PJcH3PDZKWarramkBHR9Y3QHHS
ETgh+WCBXdqXalurdDVY6Vr7c1OD5rYYR6CHBNEKgUqfCXbavN2NIoRm86uLZQf3
sJd7z6rniU2ZzjT9gfodmvWg+9T8jn3JMvJCkEnBQJVTvw4PP9uTsmqJrbSpYiq5
fojoy2zpyhsSrsWhAM8SpR5bdh01b+Cx84XU/VECJABV97lFgJNFdAb/Pc/a9D+I
REcn4YJrGeR/quWd6KLNv/3dijget8gezlbu1t1kZseXahke7Oqw6FhelLcSi7Yc
BYlBszCtHQ5k7vcPKawLsplhHXldfOwKZBe6dw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:cc:content-transfer-encoding
:content-type:content-type:date:date:feedback-id:feedback-id
:from:from:in-reply-to:in-reply-to:message-id:mime-version
:references:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1787321507; x=
1787407907; bh=4S6i/pmXHto9+xe/zqilnJ9ld30Jnao9daDMQRlnMxg=; b=U
sBfYFBETz1CbTGkmgDCv/BVYRUprKN025m/AxQIMDliRTKSV0tghIN+MNtez4G/O
CFcEa5dgj32gbgzbo1N5ENU5bY/nakjzR/rr0AG9SS3hQlXkByVURkxXRuGnMuon
fZyV+Azj/qlfMimHB1nvH5vGJjHlt7XSc0txEzn6GSp3Ph8br/2pNsyna+LMNElK
A3yG/ux4E4NKyHJWBHajh2poRcqUVaM0e8OMfH1rH1DAi9x1HMhUpe2WE+S4/HS6
tj/yLjFBnVINUwnhyBL+EB/JnxJyJnyZQoWpFR0l4pyobmp5D3WlJwLHOC6BfAi+
U/Mxg27PCAi4nfzT58W5Q==
X-ME-Sender: <xms:o1yIavHA_1AXaK1nr99dY3Xo3-HvWHET9rl7aNPazvAuVFGeuZPAjw>
<xme:o1yIalocVwR7_kAbzfsFt96FiyCMfKHhHz4OjGwtyIkd4U0X8S91o30CwlOgJ5_z8
nGAwXNHxPz5AmRo3uClC6eOlSuI9NAzEJ1WJEY2ExS9fIEWmXmEKVlN>
X-ME-Received: <xmr:o1yIaoa9_bFtCHDTnPhjcrn_NvtsvpnpsXJi2psMNhJFAf4pkCSQv1hbQHGJ-tK4-bJ8fxsvjOlDkPtyMNHgF2LKTf4H7jCncA>
X-ME-Proxy-Cause: dmFkZTGYYGQtyGyaK/ZHicVQ2fnoopdBk3y6H+Iq4toxkk3yPi36JqdTRHeWVAA+F66kmk
wrwuK136Cn7xgHtqTAh0sUg4rRFeaPQfQaCQUob6G3ltpNBdO/vVIkmJWyCMH0h34aH9hg
PwvspOKLPxpA/v7IoVW8R+VaDPsOE75RnvhDsMA7g6vTmWyadVttcDjXp/X3ZLQav4yZA0
GXcfcxAO7pqmlf9yE0Zk3EvqrfUVt+QzfVH56g24Gbe1CVTBZ1eG/al50T7NEV/4gY5w61
ySks5ay9VO03SsOQtZD/dnpesfpJ8FbHozo9x6SUUK5WGGOdStbsFDTHg+pwtNdaWiGufC
cYAy16SIp4z59EJjrlOEA6ULNMLZB5HyeMezvGuhx1zd+OgUZP6pSf4qgbhSSRkIuT2egX
2KrFngFVaz+D2YxMEruFn6yk33vk8RdQ/rWwIJqMNbEAkCpjorf/vhMfanGvgzBjczsEw9
dKf1IHCvEs9WnWX3AogE3K58ytec7WA1xKPnywfj+f+H+anI+IrolHsN+8WNwRiKi6UPuR
hFZMi1JloBVsZD9Ioi9SVtbpWME+MPU8bRgQgN47p4YHfogShZsX/xNSzY271KURe9a5Ww
xutq75AJf5qOhIY7otBTcSmdR05xI5wR3vAow9seJUmlQPPqAifA36b9I0gQ
X-ME-Proxy: <xmx:o1yIauU0CDxPnCcdruNvkVjDbhTRRUL0t5PEX_9oaK20OSWwk-V8Aw>
<xmx:o1yIah-6KFb8hsGqYzETjH1wXlJAiWuSSgV2XxWQNBc5HqhWxLuE1w>
<xmx:o1yIan8d8buA-FNy4HH3wRSkKOxMByBFtgAM-VHz9NmtiFr3ktCW0Q>
<xmx:o1yIahSFgeR6pYfPsHghK7F2ElBbr7TziYos9RgegsX1ZcUGRpY-SQ>
<xmx:o1yIajsvYJk-qo04gZ8ZpTD9gD2ebKX6n0WBhBvSY2SwI3IQqlhAULah>
Feedback-ID: i62564b17:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
21 Aug 2026 10:11:47 -0400 (EDT)
Received: by athena.silentflame.com (Postfix, from userid 1000)
id 3D653280E24; Fri, 21 Aug 2026 15:11:46 +0100 (BST)
From: Sean Whitton <spwhitton@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>, Juri Linkov <juri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <86se492a83.fsf@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN>
<87mrujz2dd.fsf@HIDDEN>
<33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
<87fr0akq61.fsf@HIDDEN> <86se492a83.fsf@HIDDEN>
Date: Fri, 21 Aug 2026 15:11:46 +0100
Message-ID: <874igno95p.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, casouri@HIDDEN, bozhidar@HIDDEN,
monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
Eli Zaretskii [19/Aug 10:15pm +03] wrote:
>> >> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
>> >> since uncommenting is a frequent operation. If a small fix
>> >> for treesit-forward-comment is still unfeasible, then at least
>> >> we need to disable the 'comment' thing for c-ts-mode
>> >> in the release branch:
>> >>=20
>> >> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
>> >> index 5f064716a89..3efbee6f8a7 100644
>> >> --- a/lisp/progmodes/c-ts-mode.el
>> >> +++ b/lisp/progmodes/c-ts-mode.el
>> >> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
>> >> "goto_statement"
>> >> "case_statement")))
>> >> (text ,(regexp-opt '("comment"
>> >> - "raw_string_literal")))
>> >> - (comment "comment"))
>> >> + "raw_string_literal"))))
>> >> "`treesit-thing-settings' for both C and C++.")
>> >
>> > Actually this makes a lot of sense. I don=E2=80=99t think we are missi=
ng anything
>> > by not using tree-sitter for the comment thing, forward/backward-comme=
nt
>> > already works perfectly fine without it. We can also add a comment to
>> > explain why we leave the comment thing out for c-ts-mode in the release
>> > version.
>>=20
>> Eli and Sean, is this change ok to install on the release branch?
>
> I don't mind, but please wait for Sean to respond.
Yes, I think this is okay.
--=20
Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 19 Aug 2026 19:15:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 19 15:15:21 2026
Received: from localhost ([127.0.0.1]:39288 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wwlku-0006t9-Vm
for submit <at> debbugs.gnu.org; Wed, 19 Aug 2026 15:15:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47428)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wwlkr-0006sK-P5
for 80837 <at> debbugs.gnu.org; Wed, 19 Aug 2026 15:15:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1wwlkl-0002tn-IX; Wed, 19 Aug 2026 15:15:11 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=mGHRNziEjxAoYgx2/PpbyuWMMyMKc8CMe5noI62FsdI=; b=Y65nVs302lHWDnGBKZjb
iXJXf0QfkHKFsayvN+OZ3JIyGlvax6jAtHGPS5BC6vVJP3a36DEzfhV418Zku1ohjPEbDi++3Ee6f
m+MMmfjzM5zC5McNHikbsqtDPGRFkc772wFjNN8BX3WD+g/iFvk5eL2OSyba6bgfC7hhoDpAnF4y9
9vPxPyzGfnkhy3bOAdsWBxjUix6SX4Q9Jy390yAcndhf9A8TfreR8yEIjETfIOx5o+wvbp6lo2quH
RSdoKPtaUrpIm7APm/QW7b6EPmgQBTO7gZUl/G9FOjNPmIVCYi+GbMNmDC2SHTGakkBguBmFOYxSR
HHU+iQqqHk0lRg==;
Date: Wed, 19 Aug 2026 22:15:08 +0300
Message-Id: <86se492a83.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-Reply-To: <87fr0akq61.fsf@HIDDEN> (message from Juri Linkov on
Wed, 19 Aug 2026 19:53:26 +0300)
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN>
<86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN>
<874ihgdad1.fsf@HIDDEN>
<87mrujz2dd.fsf@HIDDEN>
<33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
<87fr0akq61.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, casouri@HIDDEN, bozhidar@HIDDEN,
monnier@HIDDEN, spwhitton@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
> From: Juri Linkov <juri@HIDDEN>
> Cc: Sean Whitton <spwhitton@HIDDEN>, 80837 <at> debbugs.gnu.org, Eli
> Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN, monnier@HIDDEN
> Date: Wed, 19 Aug 2026 19:53:26 +0300
>
> >>>> I'm very sorry to reopen it, but we still have the same problem
> >>>> in the emacs-31 release branch. For example, try in c-ts-mode to
> >>>> uncomment a comment, and it leaves the trailing */ comment endings.
> >>>
> >>> I'm not sure this is important enough to block the release, but we can
> >>> at least discuss whether we think there is a possible small,
> >>> non-invasive for the emacs-31 branch. Yuan, sorry to go back and forth
> >>> so many times here, but do you think there is a way to do it less
> >>> invasively?
> >>
> >> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
> >> since uncommenting is a frequent operation. If a small fix
> >> for treesit-forward-comment is still unfeasible, then at least
> >> we need to disable the 'comment' thing for c-ts-mode
> >> in the release branch:
> >>
> >> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
> >> index 5f064716a89..3efbee6f8a7 100644
> >> --- a/lisp/progmodes/c-ts-mode.el
> >> +++ b/lisp/progmodes/c-ts-mode.el
> >> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
> >> "goto_statement"
> >> "case_statement")))
> >> (text ,(regexp-opt '("comment"
> >> - "raw_string_literal")))
> >> - (comment "comment"))
> >> + "raw_string_literal"))))
> >> "`treesit-thing-settings' for both C and C++.")
> >
> > Actually this makes a lot of sense. I don’t think we are missing anything
> > by not using tree-sitter for the comment thing, forward/backward-comment
> > already works perfectly fine without it. We can also add a comment to
> > explain why we leave the comment thing out for c-ts-mode in the release
> > version.
>
> Eli and Sean, is this change ok to install on the release branch?
I don't mind, but please wait for Sean to respond.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 19 Aug 2026 17:05:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 19 13:05:17 2026
Received: from localhost ([127.0.0.1]:38332 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wwjj3-0006JX-Cl
for submit <at> debbugs.gnu.org; Wed, 19 Aug 2026 13:05:17 -0400
Received: from mout-p-202.mailbox.org ([80.241.56.172]:43678)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wwjj1-0006JB-6N
for 80837 <at> debbugs.gnu.org; Wed, 19 Aug 2026 13:05:15 -0400
Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4hQCcM3X0lzMlHP;
Wed, 19 Aug 2026 19:05:07 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1787159107;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=4rVyOrOQYcM+sZNNSyJ4xyVb9pklfra+gaFgPYP38pU=;
b=F8LkBRtEUXfF2aXrMQu1OkUbKRSMcrR2SpSkyodPi8b0Yp8KQ4awgJ87pCCqR9hB5wOPTK
5xfyxJhtkJaIFjYLlmYsNcm8tDqziKf1tNgAODq34Tp5SfUcn2IqrX6lRJNUXkWvQ/x5u9
zgAs3Ii0p4yIa9ysKfOPSUjaJm6SN1YHO5Ia1fdFt0sSgtuXjlZ8q0FgHGrz6D+uIn6uib
cxmY2MgRCaS1e7/iJybXx7sHW9re9vYpLOcYnIUWQpeuM/GzIapJUC18SQOX+zmzOhQb0t
bYvw89GvfHP7lW8PU5XFwV9IxzFKR2FXz5g/YWi9ousxOsnqHLxATCC8yFf7Ug==
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN>
<86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN>
<874ihgdad1.fsf@HIDDEN>
<87mrujz2dd.fsf@HIDDEN>
<33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
Date: Wed, 19 Aug 2026 19:53:26 +0300
Message-ID: <87fr0akq61.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN,
monnier@HIDDEN, Sean Whitton <spwhitton@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>>>> I'm very sorry to reopen it, but we still have the same problem
>>>> in the emacs-31 release branch. For example, try in c-ts-mode to
>>>> uncomment a comment, and it leaves the trailing */ comment endings.
>>>
>>> I'm not sure this is important enough to block the release, but we can
>>> at least discuss whether we think there is a possible small,
>>> non-invasive for the emacs-31 branch. Yuan, sorry to go back and forth
>>> so many times here, but do you think there is a way to do it less
>>> invasively?
>>
>> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
>> since uncommenting is a frequent operation. If a small fix
>> for treesit-forward-comment is still unfeasible, then at least
>> we need to disable the 'comment' thing for c-ts-mode
>> in the release branch:
>>
>> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
>> index 5f064716a89..3efbee6f8a7 100644
>> --- a/lisp/progmodes/c-ts-mode.el
>> +++ b/lisp/progmodes/c-ts-mode.el
>> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
>> "goto_statement"
>> "case_statement")))
>> (text ,(regexp-opt '("comment"
>> - "raw_string_literal")))
>> - (comment "comment"))
>> + "raw_string_literal"))))
>> "`treesit-thing-settings' for both C and C++.")
>
> Actually this makes a lot of sense. I don’t think we are missing anything
> by not using tree-sitter for the comment thing, forward/backward-comment
> already works perfectly fine without it. We can also add a comment to
> explain why we leave the comment thing out for c-ts-mode in the release
> version.
Eli and Sean, is this change ok to install on the release branch?
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 19 Aug 2026 05:46:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 19 01:46:42 2026
Received: from localhost ([127.0.0.1]:60779 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wwZ8M-00031f-AO
for submit <at> debbugs.gnu.org; Wed, 19 Aug 2026 01:46:42 -0400
Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:57659)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wwZ8J-00031K-TY
for 80837 <at> debbugs.gnu.org; Wed, 19 Aug 2026 01:46:40 -0400
Received: by mail-pl1-x62b.google.com with SMTP id
d9443c01a7336-2cfbbdfa60bso5093535ad.3
for <80837 <at> debbugs.gnu.org>; Tue, 18 Aug 2026 22:46:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1787118394; x=1787723194; darn=debbugs.gnu.org;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:content-type:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=3/qFc/cWVO1DR0eXMHCDCVyKDHmtE9CxC2Gfvf3OvMI=;
b=ZFSgN2RsG6Fzh4HYyWfJXSlL1yTMWYaIe89DlrJ+/3/L+QsxEXRepjF4ur+JpvtRRE
6pkyZ7VcAthJexSjWDpHCmSzroDP+i0Ar9K3HOsbLkZhdAwGPF3xIY4dFEZFTOMZKOad
j9NTwW8hSMcclt6ZC8sBdGFCHm/YV2E12WNtWGidyw1AQj1WYiyXMzuJBuJxkXghX0lB
u6PeARJ8g46hYwYc0FWhdkMkQk/+f7asiLejTENzmv4FnZsfScEH9LANIsjLjvcWNriK
1HeWRQDW18uGvXZ/c0PG4rWOlWi1Oj59eUxbZrf/TTnusgGOMqncygMeb0H6ICWnUtFq
h3xQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1787118394; x=1787723194;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:content-type:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=3/qFc/cWVO1DR0eXMHCDCVyKDHmtE9CxC2Gfvf3OvMI=;
b=XKd4LkrhCQl/2tjNRiln3/yLzbsZl0GXWjU+c0JWCTFiPojLr/NHStMY8q/F6cju8V
bXPX+ePGE1hrKjYvxvFJOkOjLTTuseHO6C6lNKOoPzDnZ6oKeqmcs+r/rGfZJPNdo0fZ
f+WyWV/AVbAbj6S2oNw168eYqXjdQAGiO5Zy1EjH56waJ1vIX9/iJeOe+keOYmp48T/V
PF3NX5QG3z+SS1en4s9DQC0UXAK9N/lUJjOZHxsIvp6SYra5w6lNk1Xon1+18tvtCNS5
qyQqYqduG9gWmae0MQDPthLlQtbtJJ1Xv9yASFO2IA5H2bFvG611TybcDINDy0hgUGwP
48qg==
X-Forwarded-Encrypted: i=1;
AHgh+Rrz/QJ3+LxDdAk4EYUXlWAGIAJ6Vte6YudQr0YTcBCiMuiBCmaNnQI5F3RVHW67Y3m6oS8O9w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxRS3VvExsbu0JvnsLUSHQ79XHA+8wg9Y1by/+EGUb53I9ocnpP
9k3mliwHSNuJOwnBzGrl96kE0E3vTASxw02KShpvEpp9T7M/HZjINkbH
X-Gm-Gg: AR+sD128+o2N6TjvkxRyU8gZIircozVTv/RBm9iI3i866DxT2jEzw+6uDkf6anxCX/L
aVHd9EmeqNV0MV2q7f9ayebf0VyIX95BayifpMhZR2tnxceV4QzO50LavAmE/8jxBIVmBli3Nns
kklCBsLG6f4LVNlmxr2ANMI1oPvDgb96B5XjAp8hb9UhKAWoSIPa6T//8K1ONHCpCTI5XauW7RP
ftjCvcxXgakqwK7s298pStCiruQZ/+Fm6CD/SkfelUddLPHP7pZGN2NJVVvPqAIXRdQDgkhPK9u
98eUu3pmPblimU6PW4342PpigM0xgtSaE69IJ7QGfaTJojtNzOYs794D7z4WievSf2qs93r/Y6I
cmS8zDNmfPcAhsYqCKHtoM8C5dU9nq6q7CKp8BRwI9TE6kOre5f/ICIpm38h0+eqT9f5dkhoTEB
o2X4dx1MN2kVeyRboEzI5qj5nEhVVKTim0NVoMXNT7nHhZnKdFlm49zj+99JhHDc3fx3P2UNPeh
Cx9ejsn7g==
X-Received: by 2002:a17:90b:2d05:b0:380:21b7:e727 with SMTP id
98e67ed59e1d1-39581470f03mr4134465a91.14.1787118393705;
Tue, 18 Aug 2026 22:46:33 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:39d9:69ca:a72e:a47])
by smtp.gmail.com with ESMTPSA id
a92af1059eb24-1416ad6060asm4715685c88.6.2026.08.18.22.46.30
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Tue, 18 Aug 2026 22:46:30 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <87mrujz2dd.fsf@HIDDEN>
Date: Tue, 18 Aug 2026 22:46:19 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <33F956E5-A7A4-4DEF-A0B3-FC2BF98FB52A@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN>
<87mrujz2dd.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN,
monnier@HIDDEN, Sean Whitton <spwhitton@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
> On Aug 18, 2026, at 11:53=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>>> I'm very sorry to reopen it, but we still have the same problem
>>> in the emacs-31 release branch. For example, try in c-ts-mode to
>>> uncomment a comment, and it leaves the trailing */ comment endings.
>>=20
>> I'm not sure this is important enough to block the release, but we =
can
>> at least discuss whether we think there is a possible small,
>> non-invasive for the emacs-31 branch. Yuan, sorry to go back and =
forth
>> so many times here, but do you think there is a way to do it less
>> invasively?
>=20
> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
> since uncommenting is a frequent operation. If a small fix
> for treesit-forward-comment is still unfeasible, then at least
> we need to disable the 'comment' thing for c-ts-mode
> in the release branch:
>=20
> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
> index 5f064716a89..3efbee6f8a7 100644
> --- a/lisp/progmodes/c-ts-mode.el
> +++ b/lisp/progmodes/c-ts-mode.el
> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
> "goto_statement"
> "case_statement")))
> (text ,(regexp-opt '("comment"
> - "raw_string_literal")))
> - (comment "comment"))
> + "raw_string_literal"))))
> "`treesit-thing-settings' for both C and C++.")
>=20
> ;;; Support for FOR_EACH_* macros
>=20
Actually this makes a lot of sense. I don=E2=80=99t think we are missing =
anything by not using tree-sitter for the comment thing, =
forward/backward-comment already works perfectly fine without it. We can =
also add a comment to explain why we leave the comment thing out for =
c-ts-mode in the release version.
Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 18 Aug 2026 18:58:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Aug 18 14:58:28 2026
Received: from localhost ([127.0.0.1]:55289 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wwP12-00089L-6x
for submit <at> debbugs.gnu.org; Tue, 18 Aug 2026 14:58:28 -0400
Received: from mout-p-103.mailbox.org ([80.241.56.161]:41882)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wwP0z-00088w-OP
for 80837 <at> debbugs.gnu.org; Tue, 18 Aug 2026 14:58:26 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org
[IPv6:2001:67c:2050:b231:465::202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4hPf9Q0m99zKmQ6;
Tue, 18 Aug 2026 20:58:18 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1787079498;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=/9H7xHrx0vF55Fzao7ohsbyuj3lB3toKTSlaGyG8kDE=;
b=tQctVIRyWX1UYfNSccbcjM3XNIiUuZUjrxWdGozgQ22e3s50H6kpYjpqQx0FJ9mq/sqjni
9WSiOewxmaQo3WtXv9CcbSzThp4DwEB0hzB8om3dr2YGo8fE1yYm0sBz+ePb7iIPo2kTiG
2zOMiZp0M/P4BaWCP9X+g0pC+KPR4dtTBVEFlKp9sqZF8XX22vy//SAIJXAZWqc9SNKfk/
8+vgUwL3//NTxCydtCatJu1toHoDTwIcQV+oMoiiTgAJw1nQR0q7uKmJ5rY2F2YQAqgEal
PtascErqOpyuYNZvtLNi3pzLSoh+myoUM+tYQaWFAKQKciDgPgEnozi776U1Kw==
Authentication-Results: outgoing_mbo_mout; dkim=none;
spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates
2001:67c:2050:b231:465::202 as permitted sender)
smtp.mailfrom=juri@HIDDEN
From: Juri Linkov <juri@HIDDEN>
To: Sean Whitton <spwhitton@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <874ihgdad1.fsf@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN>
<86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN>
<874ihgdad1.fsf@HIDDEN>
Date: Tue, 18 Aug 2026 21:53:50 +0300
Message-ID: <87mrujz2dd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Rspamd-Queue-Id: 4hPf9Q0m99zKmQ6
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>, bozhidar@HIDDEN,
Eli Zaretskii <eliz@HIDDEN>, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> I'm very sorry to reopen it, but we still have the same problem
>> in the emacs-31 release branch. For example, try in c-ts-mode to
>> uncomment a comment, and it leaves the trailing */ comment endings.
>
> I'm not sure this is important enough to block the release, but we can
> at least discuss whether we think there is a possible small,
> non-invasive for the emacs-31 branch. Yuan, sorry to go back and forth
> so many times here, but do you think there is a way to do it less
> invasively?
Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
since uncommenting is a frequent operation. If a small fix
for treesit-forward-comment is still unfeasible, then at least
we need to disable the 'comment' thing for c-ts-mode
in the release branch:
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 5f064716a89..3efbee6f8a7 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
"goto_statement"
"case_statement")))
(text ,(regexp-opt '("comment"
- "raw_string_literal")))
- (comment "comment"))
+ "raw_string_literal"))))
"`treesit-thing-settings' for both C and C++.")
;;; Support for FOR_EACH_* macros
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 6 Aug 2026 07:20:11 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 06 03:20:11 2026 Received: from localhost ([127.0.0.1]:60144 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wrsOg-000586-Mm for submit <at> debbugs.gnu.org; Thu, 06 Aug 2026 03:20:11 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:45534) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wrsOb-00052C-LG for 80837 <at> debbugs.gnu.org; Thu, 06 Aug 2026 03:20:08 -0400 Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-38dfe910e9dso1891478a91.3 for <80837 <at> debbugs.gnu.org>; Thu, 06 Aug 2026 00:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786000799; x=1786605599; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=LD4xARF0a/LgV8UfRl1XYoeuvv8sZspw/XBq2HXymfs=; b=sikFHHZz44CFd3XDAeVymKZHas9603mLet2qaBn46sYyfWO0JYaAb3UthxC4UGdKoc hd9Js9M9VKEOmbvtG4FXdzuKYg1xRXPTbFvLSqvdJQuOTivVEvM5Z44qaONyJwRiVR0D 3ZtIlTx/ASU42NO3VPNgGmzxR7LBWKFW4clsg2YcSiB0pe4oR10Yy848U6kZSu6BCB4t ax0j1yWW5LNHe1bdkWgWgoy5rJgW2VtR+LPiLyG+FXMeoxPSbXqai5fSYkMdE9gZaLEY eQz+f/0cKXh7ADGeX3loMTdAbHTp4wf3p6jXuPA6EB5z8WixXEm5r0HTqlTq/3kqCXW9 I7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786000799; x=1786605599; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LD4xARF0a/LgV8UfRl1XYoeuvv8sZspw/XBq2HXymfs=; b=DrfcR2xaawQTSOqkzLK6WuzpC2nfBzouAx+d4wIK9nvnSklTGv740WOS6uz+DuMwAJ 6ELr1CNZlfxmhboeGc5So1wFhMq/dq843HISwkinudxus7SatorHhyIlxjOvjsUzYSQ3 MhG5kIx7tf1/QhLiELfjDwDxxspF/oBw2uGQqctKGx5CXV2ICqQkDoRoA2SQ/LTEGrOW CgKfuBbj0TIieDDgscMdooB9EnNmiq/tOieDRPsPQRNK1h1tD5tQbtW5+LGCW4DMV2QO WZvPgtxHA5VduwVKfrqxWifZxC4K+aCkEdzPXSR6WsBGIxuhoYNTXNGBkDcM0fN0EUSh xWlQ== X-Forwarded-Encrypted: i=1; AHgh+Ro2+RWk46iOxDwoL832EvfQanfQlqf9xvqqROUvIktZlOV7ziCXX9HTe0Bug/T8Xg6X2ukUog==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yz8dFVxoBOLoW/JYSbH5ma7Zjz3vVcs0urO43QK1gk6bIrl3nS5 rFMJ2T0uHYe9PXWXNmRSvZ3qfeZ0VXHLMnplH1+3eDoS5IHExQ3da9iN X-Gm-Gg: AR+sD12e98pbRnIPPc351i64tsPPQFAEBBo8LWFeUcnepa8ksqwsXQcP24zFXkioAf7 TmodeajJ791tubjW0O3NMWX93VH4mgzX1ex/YuYsoHYW0EftQ00DOA7RJaDd2A0bhoY/kOPLVvz 276xg6y/wBRBx2Ysa758DtM5Zbb1fj0Y7fgNXywz0vPeNO1QEkboR/7WIf8SDPWbsYjvy7aeuEK RgcNg28xG9975nzgQyfBHy3K/7FL3rMpWlKyee7sLGrqBlS2rDp/xywv6uIpNqL/34AQxMlLnUu R54q63w0LiSVkjsEfuULal8ABo64nVeZOCRn/C4RgDAGfDLMjrIhVkiQfiet29U+XPxKGbwfTaG vZQxPdByp27E/UUV1dOZEnTdou/f60CUWFZH1Ltngfa97WJtymY58RwHe/pu4Ll+540SMIoDJJi +bgLBsM71uevxzt9G8dpn+5uG8VfbfjKOhi6WbhFk0KnbSV4P2My1eTSC7ZrsrRW3hmoFrIo6ZS jZKi45sdL9MCj6yH5bKdswLfSQACCXSHTFfkqw= X-Received: by 2002:a17:90a:da83:b0:38e:500:3975 with SMTP id 98e67ed59e1d1-3903c5d82a3mr12013122a91.18.1786000799351; Thu, 06 Aug 2026 00:19:59 -0700 (PDT) Received: from smtpclient.apple (c-69-181-167-48.hsd1.ca.comcast.net. [69.181.167.48]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39085e4b044sm952451a91.15.2026.08.06.00.19.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Aug 2026 00:19:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <jwvh5l8sl5a.fsf-monnier+emacs@HIDDEN> Date: Wed, 5 Aug 2026 22:53:03 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <FBABC333-8771-47BE-A92D-F1FDA3E07894@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> <87bjbnkqgu.fsf@HIDDEN> <E3969DA4-E018-44CF-903C-1DE6FA198769@HIDDEN> <jwvh5l8sl5a.fsf-monnier+emacs@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, Sean Whitton <spwhitton@HIDDEN>, bozhidar@HIDDEN, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Aug 5, 2026, at 7:27=E2=80=AFAM, Stefan Monnier = <monnier@HIDDEN> wrote: >=20 >>>> Also, I'm not sure we need the whole = `treesit--likely-line-comment-p`: >>>> can we just test if `comment-end` is nil instead? >>>=20 >>> Testing for an empty `comment-end` should work at least >>> for c-ts-more and lua-ts-mode where the comment thing is set. >>=20 >> I don=E2=80=99t think testing comment-end by itself makes sense. = Comment-end being >> nil doesn=E2=80=99t tell us anything about a comment. >=20 > It tells us that the default comment marker used for this mode is > that of a "line comment". It doesn't tell us that *this comment* uses > the same kind of comment starter, admittedly, but it's likely to give > the right answer is many cases. >=20 > We're talking about a quickfix that's not intended to fix the problem > 100% but only to reduce the occurrence of the problem with a minimum > impact on the code. It still feels a bit weird to me, since checking comment-start with = comment-end is strictly more accurate and isn=E2=80=99t that much more = code. And if you think about it, with just comment-end, if it=E2=80=99s = set, we assume all comments are block comments, then you=E2=80=99ll get = correct behavior for block comments which is already correct without any = changes, and still get the wrong behavior for line comments which this = change is intended to fix. If comment-end is not set, we get correct behavior for line comments, = and wrong behavior for block comments. PS Correct behavior means we move to the BOL of the next line when = forward-comment on line comment, and stay at the end of the comment for = block comments. Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 6 Aug 2026 07:20:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Aug 06 03:20:09 2026 Received: from localhost ([127.0.0.1]:60142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wrsOf-00056r-8i for submit <at> debbugs.gnu.org; Thu, 06 Aug 2026 03:20:09 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:45283) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wrsOb-00052D-LR for 80837 <at> debbugs.gnu.org; Thu, 06 Aug 2026 03:20:07 -0400 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-38f620399a0so1684171a91.2 for <80837 <at> debbugs.gnu.org>; Thu, 06 Aug 2026 00:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786000800; x=1786605600; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=LD4xARF0a/LgV8UfRl1XYoeuvv8sZspw/XBq2HXymfs=; b=Hvt8IfgP6Q30+MEKChYSQj/D0iKdvz0lUn40WDZpNC5Dq1BCktSp0AIdjrdSSDPzmn IvxlG2NVaIBIBOV2UKoribJ/mcAAopjyV3Mh8YAzKoj7EDOmmhfmG0znQB1+o3NROz7F 8TxIcDGC5RNjFM0yFcc51y5/O1GdMi3ZYDEJS2zwtB47ZcBZdfGRW1Qxcqu2yW7+1l0M VchNcFY0e4cHNOJ1sB2TC6UxKLr7icYZsvB4Qhnfd5yftdz95AMtg/4RbOXFWoJeU6sk yfRz5iW8najF737Sxhb/Ni8pUJRg2x4mC+ss0sl2PefMKR+lTh7ICTt26LGttXgsSDwN 2oRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786000800; x=1786605600; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LD4xARF0a/LgV8UfRl1XYoeuvv8sZspw/XBq2HXymfs=; b=cvIG1x1LtvbvjVJXVaiktQZRn/KWQvBFfaxWgmJ3b4I/cxccOihak21NgqqPCDOhaA xAY2cJYuXNoPKxp85H4ZLcscAaPH0XDzZjX2JEXvCTW3tz396J3/KiJ5RFUfykR8hUZ9 zNMT3DorFuqXLhukZK83f+hMH7lVFml2tRYoo7VSbanwXPyl5pKm/Ji47YUzQtT/kr3T pQsDfFPHj9UPlJVMxlSqGdycT0mE2sFHF32ZD5DQHQ7OjcrzscXhhFmdm1CkYq9KmOnm gYeeaQNbyW6CIKaEVIG0BCp3gamog0lq6R6QAsH8jqLeBkXkNWn7SQrdHwEhUS7gBnKR z5hA== X-Forwarded-Encrypted: i=1; AHgh+RozksCa+dQylpwShnOD7ToSpx1jJhkgbGfmow9byn89SWkhd+GPPc4fXB28Nji4j1RAxDJUgQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzDL6E/uLU5LwaLd6sUZvAujsi1xfNwxpqzIFunUtfBl99YsRQk zU4+co2RVp9/DeR7ZutFnPUa3TNpZ0tLmtlAKAE+UKMmOmgtfdTYYazv X-Gm-Gg: AR+sD13SIguvL4S6dykz6C4IcncwMTKjZcWxX4vSyj1RAGGdk+kz9RG6An/p5tTRkBL UqkCevAG0Y7wt4t8XEc9feQNQ5ePa8qIgE2P/dmL3hVo73hwDLVPIxiiJz6E1M4ZHVJOnd80cz1 5+xazjbVw2uC0WF84eO6CzqS92fynRsR+wqk20QeT/LZrb1HNS5HcDIQYOzB6+ELOtNyICzclgw 4rTAMkt7BWJwSk9YfEaU9MYuAIZ3n74T96q0Fyj8FTPbYa4TG5eK/s0DM+TTddy/jFRKYvNXK88 vmFPpVgRqklKSbcQTJAXx2RYWxSZugeAk+1k6LZW7Pj6lydUTvXXBqNdBZaKYem+tiFRk8E5nAQ xplj2AE0x3oc83qam+rSs/mco72IU+fYoiQ1AN5lOIqds1AdnG3YSES+p32hu7jzGcI+0nChBQA S2fR66faCgBSK4z0/XrD0/qDGHU01hHsledy4kIv5eUgORH9006cerxUIzYq2KGVW7ECWIHWpv/ reZI2PVCzx+YUI3Rn/ZOLJ7J2biOZpFaTgL9QY= X-Received: by 2002:a17:90b:1c84:b0:38f:1e1a:515e with SMTP id 98e67ed59e1d1-3903c5b1688mr11658662a91.14.1786000799577; Thu, 06 Aug 2026 00:19:59 -0700 (PDT) Received: from smtpclient.apple (c-69-181-167-48.hsd1.ca.comcast.net. [69.181.167.48]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39085c38f6bsm962828a91.0.2026.08.06.00.19.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Aug 2026 00:19:58 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <jwvh5l8sl5a.fsf-monnier+emacs@HIDDEN> Date: Wed, 5 Aug 2026 22:53:03 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <FBABC333-8771-47BE-A92D-F1FDA3E07894@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> <87bjbnkqgu.fsf@HIDDEN> <E3969DA4-E018-44CF-903C-1DE6FA198769@HIDDEN> <jwvh5l8sl5a.fsf-monnier+emacs@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, Sean Whitton <spwhitton@HIDDEN>, bozhidar@HIDDEN, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Aug 5, 2026, at 7:27=E2=80=AFAM, Stefan Monnier = <monnier@HIDDEN> wrote: >=20 >>>> Also, I'm not sure we need the whole = `treesit--likely-line-comment-p`: >>>> can we just test if `comment-end` is nil instead? >>>=20 >>> Testing for an empty `comment-end` should work at least >>> for c-ts-more and lua-ts-mode where the comment thing is set. >>=20 >> I don=E2=80=99t think testing comment-end by itself makes sense. = Comment-end being >> nil doesn=E2=80=99t tell us anything about a comment. >=20 > It tells us that the default comment marker used for this mode is > that of a "line comment". It doesn't tell us that *this comment* uses > the same kind of comment starter, admittedly, but it's likely to give > the right answer is many cases. >=20 > We're talking about a quickfix that's not intended to fix the problem > 100% but only to reduce the occurrence of the problem with a minimum > impact on the code. It still feels a bit weird to me, since checking comment-start with = comment-end is strictly more accurate and isn=E2=80=99t that much more = code. And if you think about it, with just comment-end, if it=E2=80=99s = set, we assume all comments are block comments, then you=E2=80=99ll get = correct behavior for block comments which is already correct without any = changes, and still get the wrong behavior for line comments which this = change is intended to fix. If comment-end is not set, we get correct behavior for line comments, = and wrong behavior for block comments. PS Correct behavior means we move to the BOL of the next line when = forward-comment on line comment, and stay at the end of the comment for = block comments. Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 5 Aug 2026 14:27:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 05 10:27:29 2026 Received: from localhost ([127.0.0.1]:51603 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wrcae-0003it-VI for submit <at> debbugs.gnu.org; Wed, 05 Aug 2026 10:27:29 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:50421) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1wrcac-0003ic-Pk for 80837 <at> debbugs.gnu.org; Wed, 05 Aug 2026 10:27:27 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 100FF4416FE; Wed, 05 Aug 2026 10:27:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1785940040; bh=ti7Q+QBhbM3kMB+LI6LNn40ykgBS8UZo1plbNYHzYtc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=QHu0xsHHiuEwcqrXEJdv0Su2AY0Z9kfnJN7MqRjCLpOei1xro2lRcm+SpdervddZd bVycDAaA+ldDZzJu+V2qW8e4ZUckbgA7hjflO8U0uX8QAZKPaqwTeoYFdxNiCRBtbU WCHJvbkNl4i5AK8LDZr6ELPkztRL5nwMt+o3kXxfGpeLaVXVTOM1KNZIKLRY7JaADQ qcubwq5oBGoym+c4Cy7Fqm/uIx40fA3FhammzniLOre86t9sO/j2aVuRIcvPFfiU+w 04oilUQ5FMW/kzlpnzVS5aK4tZqbRU1XBqg8sHB6p0dHk14xwiHe9y2zmAnKar/k90 s57O4Tqr92CbQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0E9E144167F; Wed, 05 Aug 2026 10:27:20 -0400 (EDT) Received: from pastel (104-195-207-192.cpe.teksavvy.com [104.195.207.192]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BEC4512056E; Wed, 5 Aug 2026 10:27:19 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <E3969DA4-E018-44CF-903C-1DE6FA198769@HIDDEN> Message-ID: <jwvh5l8sl5a.fsf-monnier+emacs@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> <87bjbnkqgu.fsf@HIDDEN> <E3969DA4-E018-44CF-903C-1DE6FA198769@HIDDEN> Date: Wed, 05 Aug 2026 10:27:19 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.145 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, Sean Whitton <spwhitton@HIDDEN>, bozhidar@HIDDEN, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) >>> Also, I'm not sure we need the whole `treesit--likely-line-comment-p`: >>> can we just test if `comment-end` is nil instead? >>=20 >> Testing for an empty `comment-end` should work at least >> for c-ts-more and lua-ts-mode where the comment thing is set. > > I don=E2=80=99t think testing comment-end by itself makes sense. Comment-= end being > nil doesn=E2=80=99t tell us anything about a comment. It tells us that the default comment marker used for this mode is that of a "line comment". It doesn't tell us that *this comment* uses the same kind of comment starter, admittedly, but it's likely to give the right answer is many cases. We're talking about a quickfix that's not intended to fix the problem 100% but only to reduce the occurrence of the problem with a minimum impact on the code. =3D=3D=3D Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 5 Aug 2026 04:10:02 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 05 00:10:02 2026 Received: from localhost ([127.0.0.1]:46510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wrSx7-0001mZ-TD for submit <at> debbugs.gnu.org; Wed, 05 Aug 2026 00:10:02 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:43368) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wrSx4-0001m7-S3 for 80837 <at> debbugs.gnu.org; Wed, 05 Aug 2026 00:09:59 -0400 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-38101f85591so1493232a91.1 for <80837 <at> debbugs.gnu.org>; Tue, 04 Aug 2026 21:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785902993; x=1786507793; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=oOe6nyR9q7kHIyVT269ndZjL5Q4vBy+LAgCWpf+GGEk=; b=cZeUmMBhfJkFMtvVhaFDq/aZdgKw7wD0rTgcGgtOMutrStSiHbFXBOV+F6gu1zOAAP JVV2P1BdTOq7Im8i6Occae2wNln+aQYpgeQSER9Ux5PuQWUXQpv2rtNfO4BnNn6Fh9XR UkXB/JfKsFlZclNuWuLmlsYrXpeEVuxwZCPSj0tELyyoJX8UvCEd1Vfu4MNqOGgUfHme CYI8miJ6bcDn6Uu81TnXV9yr/SCxzHftiwn0mbkO0LRP6WburyeuzAxl2J71qsUGnJXx JHWXlvdhAw0bjdSdaJfoLveNc7qQ+tr4T5aGUsWPEv98kTozyRSJ1RJlNXkkE6MKuVPr MNuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785902993; x=1786507793; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=oOe6nyR9q7kHIyVT269ndZjL5Q4vBy+LAgCWpf+GGEk=; b=T5M42YW7rvRPy6pbI4ibT1MvuvjAQvvQDeuA8ZUnxmDuGlIYCGBSjr+ducDx0vNARU V3nGUv7KcMYPBDKyEomSB8V/tWU0EG5eMMd+7yk62QX461s29NYvs7XhOPBqPliOiPoR PTnSWI6y54I/HIHdnXlb95l9L5tvaRh2Ul1/hLuDr+35xfQfVo4Is64ttUnH1ID5pS6D 5UqlWefTUOBtI7+oUObl1d9kcy3195dCY6+lgLDNzQq9lzwyIl9ngIfar4zIOqRegGCJ M74X7UTk1lquxtfetjSmLo77kL6RjB5loqziOMJpyobdbI3312RmY5CBaFBVPeWLkTQT KVEQ== X-Forwarded-Encrypted: i=1; AHgh+RrkBc1KfmpPNWVMrI/Tm3hp+QADpoy0UCxe12PTIJFhjwHE/m2nhXVeO5n8SOw/eRADjeztrQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Ywy/qhrW4NEhDdHgXyVfkeMjunHMTHJmGxoMqrpSxZlz8DRljQr 3QJpLPvE+BXIVb+7KRkoZ1HKvHRiewJse60Nfvoy32onClVsQ662/obT X-Gm-Gg: AR+sD1226+nrJvtdXSP57g+qgnA5BdNykKDn61JjqrB2VyYjBn0jdB+oEAMh/RJRM48 H64zHxg9YWZqbAqRw4IeeqAgOcBU/75v9aCk5G2EQyy5kdBjdL7z6XRo1BuBYbIMSz7ymHMYXnw 0BRZ5B9muzRbM2DyvvDi6jS4KYHs1vz0GqRWvX0Z0YoJZ2OLUyzBzs/lpmdgMStWCHXdQui7JaP 9i1SWQSGA8t21GsUGrUo/Oy3cvFQkDu8z8OUfB6xF3nrjagip3MNjrm2RaeUDDo1ftzlIbcGsKR pesqDb2AUK1PVAcw6TM+Ut864Qj3At2rXhTuZC5F0qU4tIBHpdUzh67Oo1y6FgSYLY9RLHe/q5L XhQb7CM5sKAs7N8l8cOIACm5H8pSesl7hXk8/16doF0A+VoKaHenMqu2+gSSPAr/F8jSsWknUb2 ecO0UPJANJRFUaq/6D73Zbo7x5XcjftkmNzUzxTOPPnno9Bh+HnsvUYDHJKRSqgKUClzuuhPM0w Oicji0XfUn277quP0TGug== X-Received: by 2002:a17:90b:2811:b0:38e:c1ba:4f94 with SMTP id 98e67ed59e1d1-38febf71086mr5169521a91.2.1785902992659; Tue, 04 Aug 2026 21:09:52 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c688:3880:8cef:90b4:ecad:99b8]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13fca50acddsm9162495c88.3.2026.08.04.21.09.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2026 21:09:52 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <87bjbnkqgu.fsf@HIDDEN> Date: Tue, 4 Aug 2026 21:09:40 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <E3969DA4-E018-44CF-903C-1DE6FA198769@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> <87bjbnkqgu.fsf@HIDDEN> To: Juri Linkov <juri@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN, Stefan Monnier <monnier@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) Sorry for the delay. > On Jul 31, 2026, at 10:24=E2=80=AFAM, Juri Linkov <juri@HIDDEN> = wrote: >=20 >>> -(defun treesit-forward-comment (&optional count) >>> +(defun treesit-forward-comment (count) >>=20 >> I'd refrain from including this part of the change. >=20 > I don't remember why I made this argument optional. > Probably by mistake because it was intended to have > the same signature as `forward-comment` where the > argument is not optional. So it would be nice to fix > this blunder before this function's first release. >=20 >> Also, I'm not sure we need the whole = `treesit--likely-line-comment-p`: >> can we just test if `comment-end` is nil instead? >=20 > Testing for an empty `comment-end` should work at least > for c-ts-more and lua-ts-mode where the comment thing is set. I don=E2=80=99t think testing comment-end by itself makes sense. = Comment-end being nil doesn=E2=80=99t tell us anything about a comment. = Comment-end only tells us whether we can use comment-start to = distinguish line and block comments, because if a major mode defines = comment-end, the corresponding comment start must be the beginning of a = block comment. Yuan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 31 Jul 2026 17:42:31 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 31 13:42:31 2026 Received: from localhost ([127.0.0.1]:44512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wprFf-0007tG-8K for submit <at> debbugs.gnu.org; Fri, 31 Jul 2026 13:42:31 -0400 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:41894) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wprFZ-0007si-R5 for 80837 <at> debbugs.gnu.org; Fri, 31 Jul 2026 13:42:26 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4hBYL24LJxzKv3X; Fri, 31 Jul 2026 19:42:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1785519738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vJ8lLffs49W9oBBeluQ4ePF5MHg+6Yo20xp8n/bpuyk=; b=ANq6kgiJxMdqlqDOdZmrLkvGG7tSr9vnAF4UuaixFrLvozCYd2cFZSqsST8a9zzcymn4Jj RUpwce6LiAGCsLH88hcs3Bqsxr4CFcLgax+3krPg5NspUc9HPEXXVkt2xLo0BJGmJ0eAiy AxiFd3gJf1BlMdzFJqjzLzLW6p6mAle53PH26sPxoTaOwkXRxoPPdBZOGCvX6CRkjizHB5 MUUcICdr7WFeDG8AK8YOKCD1i9guKat301IJ5TB59l40nbApd+VVMIFn/juh30c4CDw9fk pJ0uksDsCp26Sh+fCNmEsYELEEwnWS0xOmwZ0a0MxFcUy57wZGIat0Rg8SeI/w== From: Juri Linkov <juri@HIDDEN> To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> Date: Fri, 31 Jul 2026 20:24:17 +0300 Message-ID: <87bjbnkqgu.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>, bozhidar@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) >> -(defun treesit-forward-comment (&optional count) >> +(defun treesit-forward-comment (count) > > I'd refrain from including this part of the change. I don't remember why I made this argument optional. Probably by mistake because it was intended to have the same signature as `forward-comment` where the argument is not optional. So it would be nice to fix this blunder before this function's first release. > Also, I'm not sure we need the whole `treesit--likely-line-comment-p`: > can we just test if `comment-end` is nil instead? Testing for an empty `comment-end` should work at least for c-ts-more and lua-ts-mode where the comment thing is set.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 30 Jul 2026 20:23:36 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 30 16:23:36 2026 Received: from localhost ([127.0.0.1]:35026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wpXI0-0001cX-5f for submit <at> debbugs.gnu.org; Thu, 30 Jul 2026 16:23:36 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:9092) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1wpXHx-0001cH-LA for 80837 <at> debbugs.gnu.org; Thu, 30 Jul 2026 16:23:33 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E7D388098C; Thu, 30 Jul 2026 16:23:27 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1785443007; bh=3ZjZDoKZgDgokGjGtIbnPedPIgBM0RlC3R7EFqXOsVo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=iSw2JuWidX1n4QBOR4ApT3irW1lkVnY1vYPvt8TvNFwjLLFgkiAXRXazLgfAEXl+3 lFPxvDSqAK+IdceyrJdLnt/9uc+ynCS7DWCZnuC9mwnw2ugbzbq28XZ71tUOvPw7jZ VQ8HJUZbV27R3dDEoh59SiexjlD2cWeBRfBrAycG78gtc6MLDB5JAAFMv68u/pCHad aG45E/EknGfqPeDaBDFkFaQUe/gaVf/Oa95vJpl4jwv7GxwhDTiQ0CbRlT6eWXGd+N zHsjO/K3NmHMkH3bF06VRHLbaAmbZSsa+qIkmkmC+NOOCFQwihYCtdv8HMQT9jtlyj SBjqixUEjE2Cg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 56E30807C4; Thu, 30 Jul 2026 16:23:27 -0400 (EDT) Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 460091209CF; Thu, 30 Jul 2026 16:23:27 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Juri Linkov <juri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <87o6foxsz6.fsf@HIDDEN> Message-ID: <jwvbjbout6h.fsf-monnier+emacs@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> <874ihgdad1.fsf@HIDDEN> <87o6foxsz6.fsf@HIDDEN> Date: Thu, 30 Jul 2026 16:23:26 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.182 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>, bozhidar@HIDDEN, Eli Zaretskii <eliz@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > -(defun treesit-forward-comment (&optional count) > +(defun treesit-forward-comment (count) I'd refrain from including this part of the change. Also, I'm not sure we need the whole `treesit--likely-line-comment-p`: can we just test if `comment-end` is nil instead? === Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 30 Jul 2026 17:59:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 30 13:59:40 2026
Received: from localhost ([127.0.0.1]:34153 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wpV2i-0001yR-5R
for submit <at> debbugs.gnu.org; Thu, 30 Jul 2026 13:59:40 -0400
Received: from mout-p-101.mailbox.org ([80.241.56.151]:56490)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wpV2b-0001xc-J3
for 80837 <at> debbugs.gnu.org; Thu, 30 Jul 2026 13:59:34 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4h9xmF5hQ6z8v2J;
Thu, 30 Jul 2026 19:59:25 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1785434365;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=vIjbfGJ3zArIApgxwjH+dJk/NIn0JLwzsiarBuSllr4=;
b=nqUdJTq0pFgbwoTTr7r9EyABFrQ+6b7ndV3R6XtEvcm5bvw1nMi2qxNLQVrt2M8XGqUKR5
vXWUtGWmK0W6+dPiX9PTS1PsDHBBdDhMDeoKBO6ojPi7JuE/i7+N29vEWK9ZXI4MaLNZJg
g/Myvk2TU7suO47DFYN3OmpXzvs1eYXk4oxJaWLTY1O6jrAT67461Hcf6XzaT6xjllq/S2
pSRhbgK0JgPzFn29z0VMSb6uWqqDVo4MkpFZHsC811fJ2GEdxV2HJXuOS3/L5KvorCijZo
FeD9KpRmdA6o1gK6M3CeS6I7uFjhR25eweM0vi1qRftJNV+Zr1drhouBIsCWtg==
From: Juri Linkov <juri@HIDDEN>
To: Sean Whitton <spwhitton@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <874ihgdad1.fsf@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
<02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
<87o6gcussv.fsf@HIDDEN>
<88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN>
<87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN>
<87ldbdd9ma.fsf@HIDDEN>
<1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN>
<86y0fc31x9.fsf@HIDDEN>
<A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN>
<87fr119094.fsf@HIDDEN>
<874ihgdad1.fsf@HIDDEN>
Date: Thu, 30 Jul 2026 20:55:25 +0300
Message-ID: <87o6foxsz6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN>, bozhidar@HIDDEN,
Eli Zaretskii <eliz@HIDDEN>, monnier@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
--=-=-=
Content-Type: text/plain
>> I'm very sorry to reopen it, but we still have the same problem
>> in the emacs-31 release branch. For example, try in c-ts-mode to
>> uncomment a comment, and it leaves the trailing */ comment endings.
>
> I'm not sure this is important enough to block the release,
Ok, then I will not add it to the release blocking bug#81521.
> but we can at least discuss whether we think there is a possible small,
> non-invasive for the emacs-31 branch. Yuan, sorry to go back and forth
> so many times here, but do you think there is a way to do it less
> invasively?
I have tried to backport the commit fb5cf238a9d from master
to the release branch, but without adding the new variable,
and by retaining only code after the comment:
"Without `comment-start-line-regexp', it's kind of best-effort."
And can confirm that it fixes the problem.
Here is the patch that should be pushed to the release branch
where the commit author is Yuan:
--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=treesit--likely-line-comment-p.patch
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 7fa7df08194..d4c64bd9cba 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3764,7 +3764,18 @@ treesit-forward-sentence
(max (point-min) (previous-single-char-property-change
(point) 'treesit-parser)))))))
-(defun treesit-forward-comment (&optional count)
+(defun treesit--likely-line-comment-p (node)
+ "Return non-nil if NODE is likely a line comment."
+ (save-excursion
+ (goto-char (treesit-node-start node))
+ ;; Without `comment-start-line-regexp', it's kind of best-effort.
+ (and comment-start
+ ;; If `comment-end' is non-empty, `comment-start' must be
+ ;; paired with it.
+ (string-empty-p (string-trim (or comment-end "")))
+ (looking-at-p (regexp-quote (string-trim-right comment-start))))))
+
+(defun treesit-forward-comment (count)
"Tree-sitter `forward-comment-function' implementation.
COUNT is the same as in `forward-comment'."
@@ -3774,7 +3785,15 @@ treesit-forward-comment
(setq thing (treesit-thing-at (point) 'comment))
(if (and thing (eq (point) (treesit-node-start thing)))
(progn
- (goto-char (min (1+ (treesit-node-end thing)) (point-max)))
+ (goto-char (treesit-node-end thing))
+ ;; For line comments, go to the next line. This is
+ ;; important because a) for navigation convenience, and b)
+ ;; many functions expect `forward-comment' to behave this
+ ;; way (bug#80837).
+ (when (treesit--likely-line-comment-p thing)
+ (skip-chars-forward " \t")
+ (when (looking-at-p "\n")
+ (forward-char)))
(setq count (1- count)))
(setq count 0 res nil)))
(while (< count 0)
--=-=-=--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 30 Jul 2026 10:45:40 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 30 06:45:40 2026 Received: from localhost ([127.0.0.1]:58421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wpOGh-00020w-ST for submit <at> debbugs.gnu.org; Thu, 30 Jul 2026 06:45:40 -0400 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]:38647) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wpOGf-0001zp-K5 for 80837 <at> debbugs.gnu.org; Thu, 30 Jul 2026 06:45:39 -0400 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id DD0B91D000AB; Thu, 30 Jul 2026 06:45:31 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Thu, 30 Jul 2026 06:45:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1785408331; x=1785494731; bh=U7fYUVKpbk7MTxNSBs19KjtzKPIhyyIA NxZ11pC1yRg=; b=onfKJNLbFOD5nFN543Hxjn2f4XBvkbGldHKt91D+asOdvV/1 SVwJ93nOe/kmp6CWVW3CwpVCmqkhKbj/yGV0uIiq7hQekADXW0UTZbuk7upxXmpY NSKxXG+p/2h+Z5OTlhKQtVvUqDbDYPyrVapHQCM8ssbZ95LceRB8KcvhcmHTQzAL jGFZmPbs459Zi7GBjO7MZkYoibW0uX3HCJhnUkLYgl3Ll2iEvwXuO27nHpiT9oOQ PPucNO7dNYlFH1E8B8moq8Zw9IiJIEwzhve+80CZ6TJQfQc3A/8asxs3F9sBTknf dxkUVUgUMs4aMwJZfJhYTatcApcFLur+2DLOwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1785408331; x= 1785494731; bh=U7fYUVKpbk7MTxNSBs19KjtzKPIhyyIANxZ11pC1yRg=; b=N TX/5LIGRg6kbEGIMWmgJ9RzE6Xvx4q9Jsyk5/wipQIwtFonidOFcnsAevzHgh2ra Pp+oFL6H5gk0bvor3vKsEsWIC5b+4KJHBjt6EU1+uF7qZuZ5iPIIARtBmbqD8S1H 2fR6xRcEBULlAl9lPOemtL+Cswr1GD9FGxqqsuvwPfQEXrWJN0OWSqIkwWDfsnT1 hXaO0eXrI0yzCyUCEk1dhfbQeqixgJ8TQQiy5Vm+8800xp/LXnMLP5Z4r0fo9DjE aCLgA2trDs9A2g7azUF7c9bySueARPBGqxZGUCjLdZyY8sF3UTIyFjBNqsVMv4KJ 4fDslBNf2itiz2jstmkyQ== X-ME-Sender: <xms:SytrarWucJy-GIgEBzmmoF5KyCy3UrXEm1xShBcnAC_RuUgxIaDAsg> <xme:Sytras5wusHjtEJLMNiOQ23ZIAL3v50AR8lLouNn8nZETixHCtlHOjM9dHxpBCP9V sL3iqEv4d7Hn8fqnu4-2KD3yQs_m4TP8D_3Y6bP00mmWRSLPEEkcQ> X-ME-Received: <xmr:SytraurqGAYC3vV1fY8UF0zHF9tHmujawaCtbkttEQlDGgAh71hfZZKpQz4f6Y2n5tdI9j7OuRRi> X-ME-Proxy-Cause: dmFkZTFSpDJkj0iAz7wwKy6FEJ+il0QHZyeMGvbG1lZrQ3pfY3Sfn899UQttfMukZ902kH Fdb5Wjg/tr0UP7bHEUqtU91cXLZrSz2B8JdlIFOeFpsXBi9FG1QdCpHBLx/5O8a15nsgZj bLTW9s3DEUA+56M0bRbjstn7S5MN2pDlAOd9LsYs2rudccjSakx7C40MFKqq73LuMrJBrq Fm2wvkJI+K++9vOyysnRM9nqvCTZLgNCAUekUD6zkMP1qbE7KfsSQNsIr4iyYMRQU+NhKQ 0z0I8FJp84zVGsuPD3P7M5kToXrtcUIrzxe+1g7gHwEjCRJBmCu/xnMA6fybeYQCG2d+Nk BGuEvfVAns1h3j282oVEajl9YpGywRm/e9ihS7rdFwNigkZCDTp88a8UeZExTPMrn5fc1c txL7xNVKlLczpRlim3p/J7fxNXq9Jpo7blq19RNBqXbx7HFHYmwQOK09dxeRc+bLG1z4jI x0zVqdydR7UxkzxztwlDYtL9ia36/dd10OLAyiDNDuprDyXUyOJucF1J125JjZX3v4JOqg 82Sn3OWexMgAkTHgk38eGTHlwiKarqq9swfVzaKRpcJ20sKwqCMX6DC0XQQbC3ShnMRTGx FjAEdRZI+jbE5P5zfjgxZGuJNoxLrlC1coozXGQKw0vZUeo1ekofIwP87p7A X-ME-Proxy: <xmx:SytranlgkgZsY347U9wnrs2cQO26-sb5VdFeymtebWao2J8yDhjcaA> <xmx:SytraiNAlDrPaOy_z9YZAgsfuAte2fNkaFJcUvyQkgXgjNo-W6fQcA> <xmx:SytrajPF0JtoXP3HCuLBzMogCFFG-uCNstAJyVvD_qaYMgJ525DxGQ> <xmx:SytrarikV9mW15uxF0yHg7wHP93YC97Tr8q0-cxWV67G3oJ8YcBWZw> <xmx:Sytras6oD6ndj-vHv9sdvtJ3APyqeFEl9aPpgQZ0pEdVPSGh6JMldMSx> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 30 Jul 2026 06:45:31 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id 629577E7BB4; Thu, 30 Jul 2026 11:45:30 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Juri Linkov <juri@HIDDEN>, Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <87fr119094.fsf@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> <87fr119094.fsf@HIDDEN> Date: Thu, 30 Jul 2026 11:45:30 +0100 Message-ID: <874ihgdad1.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN, monnier@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Juri Linkov [29/Jul 8:45pm +03] wrote: > reopen 80837 > block 80837 by 31.1 > thanks > >>>>>>>>> I don't mind it being involved on master. >>>>>>>>> >>>>>>>>> Do you propose to install the patch you've just posted on emacs-= 31? >>>>>>>> >>>>>>>> Yes. >>>>>>> >>>>>>> To me this seems too involved for this stage of the freeze. >>>>>>> >>>>>>> What do you think, Eli? >>>>>> >>>>>> You mean, the patch in >>>>>> >>>>>> https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.ht= ml >>>>>> >>>>>> ? Definitely too large, and introducing a new variable on top of >>>>>> that. >>>>> >>>>> Right. We're in agreement. >>>> >>>> Cool, should I merge the patch to master then? >>> >>> Yes, please. >> >> Cool I pushed it, that should fix this report so I=E2=80=99m closing it. > > I'm very sorry to reopen it, but we still have the same problem > in the emacs-31 release branch. For example, try in c-ts-mode to > uncomment a comment, and it leaves the trailing */ comment endings. I'm not sure this is important enough to block the release, but we can at least discuss whether we think there is a possible small, non-invasive for the emacs-31 branch. Yuan, sorry to go back and forth so many times here, but do you think there is a way to do it less invasively? --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org.
Full text available.Received: (at 80837) by debbugs.gnu.org; 29 Jul 2026 17:57:22 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 29 13:57:22 2026 Received: from localhost ([127.0.0.1]:53431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wp8Wv-0001uC-Ve for submit <at> debbugs.gnu.org; Wed, 29 Jul 2026 13:57:22 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]:34546) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wp8Wn-0001tR-T2; Wed, 29 Jul 2026 13:57:15 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4h9Klz11xXzKv7K; Wed, 29 Jul 2026 19:57:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1785347823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+AGhXAPJRPhXI9mcwbq+9w2XGkVDokTJu3jILafekfE=; b=zE6ZK8J+v0Q/nDXyYZF3AIAzhkEd+VlXJK1iA+jxAqzAlVSgQgKI9SzNb4BXGwSwuvPVwc Hjb1NKk3QdhTMejwAqNtXcANIa0YAFvnIf/gAld7Z12KF4qD1TzkrJLQDfjMmsB46huXtM 1xwVrCnVqqbnLNfuPd6BLeG7dliNbR5roV3SzUVoOz7hucBfWGjkY9oQhxj1dD/gkY/fkf UH5HsvCt1nTtRlrejWyALMerA74Fag/pS35F/GnHTmpIzGo/ThIldmhJvl0o05u4ltQf9u 2oVfkE4gGVd3iKKdcTrdWk1TC2KgCzaNKX7qhfs6r6TFdddjhWkdZr0DY41rCg== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=juri@HIDDEN From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> Date: Wed, 29 Jul 2026 20:45:11 +0300 Message-ID: <87fr119094.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4h9Klz11xXzKv7K X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN, monnier@HIDDEN, spwhitton@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) reopen 80837 block 80837 by 31.1 thanks >>>>>>>> I don't mind it being involved on master. >>>>>>>> >>>>>>>> Do you propose to install the patch you've just posted on emacs-31? >>>>>>> >>>>>>> Yes. >>>>>> >>>>>> To me this seems too involved for this stage of the freeze. >>>>>> >>>>>> What do you think, Eli? >>>>> >>>>> You mean, the patch in >>>>> >>>>> https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html >>>>> >>>>> ? Definitely too large, and introducing a new variable on top of >>>>> that. >>>> >>>> Right. We're in agreement. >>> >>> Cool, should I merge the patch to master then? >> >> Yes, please. > > Cool I pushed it, that should fix this report so I’m closing it. I'm very sorry to reopen it, but we still have the same problem in the emacs-31 release branch. For example, try in c-ts-mode to uncomment a comment, and it leaves the trailing */ comment endings.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837-done) by debbugs.gnu.org; 25 Jul 2026 04:50:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 25 00:50:04 2026 Received: from localhost ([127.0.0.1]:45731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wnUKp-0000dG-RV for submit <at> debbugs.gnu.org; Sat, 25 Jul 2026 00:50:04 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:55300) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wnUKk-0000cW-9U for 80837-done <at> debbugs.gnu.org; Sat, 25 Jul 2026 00:50:00 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-c9b373d5af0so832362a12.2 for <80837-done <at> debbugs.gnu.org>; Fri, 24 Jul 2026 21:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784954992; x=1785559792; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=T7woz5WQx9twAyyXl48IZY+aoCqx/0V7z+stm2k8yfg=; b=qOTzkxcqtPhr0p5sxG65KgBPBusKKGlI0vUlTv3YyX3nYaUiXEkrihAeNtc3W3HT81 nfYKlOxi8dbGsv0XOnD4ImQQ5DSo91AZZ9JcK/iDcwDdepx+E3unBNOf6vjHNRyKzo5i f+xPQ6gBpL9OOPqWmnSt4SDmoeyIKSXViJFB6KqKLQJPKwLItwJLd9q7n2oZo4gAV3Fz ga/uGSfxYh5wWjiswaXpwP486mZQd/Vkcfnot7a4xybiB0pvxhJv/JJntmMsImI6FPB8 njfMnUkrAusiDF3Rlqo7UZtPAn4GjeF18KF0i/KdKWtmdKc228PXQ5TOA3B0VrN89coU Mk/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784954992; x=1785559792; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=T7woz5WQx9twAyyXl48IZY+aoCqx/0V7z+stm2k8yfg=; b=GNMvBR2OxCjlFXrSvXzxuHJrBClLt0en0qHDSTHFF67WfTPRVuI/jgErCvc5YhGhis Cd//gECm4pxkLUyN+c71pPf6gEoK8PLM2K0eVO4xjxVOrOdKCgIBvb6brWZ8jWBLuize T2TWrCASongw/x5UsCon+KwWMt9R/TsRgjXvLqZWWWeP1oscBjc7pj/LI6fkLY+ABuIF dxt4emnFOcwHJd+MVd+SDMfoYr9vCBhNp4R27HZ2KXe20FFNKhq8F82STmDJ5zS4YBOe N/mztQxK1dVgrpdI7nQZO7Qw/OL8ddn9IR1ejOFsrX2xhOLBqNpxE1jiX/eLPWMDWaS/ mNjQ== X-Forwarded-Encrypted: i=1; AHgh+RpTX78sV8VTBeZRhR0WBDecPQ9TKN7r71M2R/UVIJbWf/HmItG+Bfyar51tw19BDpMT6C67HjSHhqnM <at> debbugs.gnu.org X-Gm-Message-State: AOJu0Yz8/X4fsYpI/9HtguRNhCzHXLI4HlYdbkXjuvZHqyCKeArcnmIs 6eRLWTkuf3BSd6R04EWhCai8hIYBK45xeCiYqfYrONSP8LsptDoHE6zD X-Gm-Gg: AR+sD103MeswXyFrXGvMwRMukXl6B4du3eml8bFtmMimVrfiiDUugh6aj1ysNOWskTd Q+AJ1I4AAf3Ozx5PmffMahKeJJFfZXAkRGbNoS5XYra5u0YTUJdKoH+WwmD7ooioJxQh1+hFoXr 67V50UtzKd+wDqdXnb7o0aKfEZCDOygePnoYe0WgPBxWUE7oR8L5c+lrJtgtQ/S8BGXIRE3SVby FyT+UChC3T+atJwz0+9r/G6JmI618Nomd6UizTDq/fNGJUqlR24N3Ewln5gftwAZ1VgLqLvgFT5 pEKdqWRGlYlbxrFxK60P59WviHhEmvuV0/16ZPgRPKzWsia8RALp3cxteEVsaruSMZdGxZjI/E1 gzjagBChRiSOTJWEd83KrfuCMwldcYNsXwhe2ZMrnUxNNCevOk1UN6HTWHSScvc4WY5HRmMp5eb Zy27ZmU/z9jbTNtz83yzp+1LwuZPoaPY/mN8w= X-Received: by 2002:a05:6a20:1eaf:b0:3bf:e2dc:bc85 with SMTP id adf61e73a8af0-3c67df063f7mr1053778637.40.1784954991886; Fri, 24 Jul 2026 21:49:51 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c688:3880:ad58:12e0:3740:63bb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5cb670sm7242053eec.31.2026.07.24.21.49.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2026 21:49:51 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <86y0fc31x9.fsf@HIDDEN> Date: Fri, 24 Jul 2026 21:49:39 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837-done Cc: bozhidar@HIDDEN, juri@HIDDEN, 80837-done <at> debbugs.gnu.org, monnier@HIDDEN, spwhitton@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Jul 15, 2026, at 4:52=E2=80=AFAM, Eli Zaretskii <eliz@HIDDEN> = wrote: >=20 >> From: Yuan Fu <casouri@HIDDEN> >> Date: Tue, 14 Jul 2026 22:17:30 -0700 >> Cc: Eli Zaretskii <eliz@HIDDEN>, >> monnier@HIDDEN, >> juri@HIDDEN, >> 80837 <at> debbugs.gnu.org, >> bozhidar@HIDDEN >>=20 >>=20 >>=20 >>> On Jul 14, 2026, at 5:43=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >>>=20 >>> Eli Zaretskii [14/Jul 3:30pm +03] wrote: >>>>> From: Sean Whitton <spwhitton@HIDDEN> >>>>> Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov >>>>> <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov >>>>> <bozhidar@HIDDEN> >>>>> Date: Tue, 14 Jul 2026 12:32:18 +0100 >>>>>=20 >>>>> Yuan Fu [12/Jul 3:10pm -07] wrote: >>>>>>> On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >>>>>>>=20 >>>>>>> Yuan Fu [11/Jul 11:15am -07] wrote: >>>>>>>> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come = up with a >>>>>>>> regexp at all. The one you created is not bad at all! And since = Sean >>>>>>>> doesn=E2=80=99t like the patch getting more involved (me = neither), I changed >>>>>>>> it back and used this regexp. Thanks for the tech support ;) >>>>>>>=20 >>>>>>> I don't mind it being involved on master. >>>>>>>=20 >>>>>>> Do you propose to install the patch you've just posted on = emacs-31? >>>>>>=20 >>>>>> Yes. >>>>>=20 >>>>> To me this seems too involved for this stage of the freeze. >>>>>=20 >>>>> What do you think, Eli? >>>>=20 >>>> You mean, the patch in >>>>=20 >>>> = https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html >>>>=20 >>>> ? Definitely too large, and introducing a new variable on top of >>>> that. >>>=20 >>> Right. We're in agreement. >>=20 >> Cool, should I merge the patch to master then?=20 >=20 > Yes, please. Cool I pushed it, that should fix this report so I=E2=80=99m closing it. Yuan=
समीर सिंह Sameer Singh <lumarzeli30@HIDDEN>:Yuan Fu <casouri@HIDDEN>:Received: (at 80837-done) by debbugs.gnu.org; 25 Jul 2026 04:50:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 25 00:50:04 2026 Received: from localhost ([127.0.0.1]:45731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wnUKp-0000dG-RV for submit <at> debbugs.gnu.org; Sat, 25 Jul 2026 00:50:04 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:55300) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wnUKk-0000cW-9U for 80837-done <at> debbugs.gnu.org; Sat, 25 Jul 2026 00:50:00 -0400 Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-c9b373d5af0so832362a12.2 for <80837-done <at> debbugs.gnu.org>; Fri, 24 Jul 2026 21:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784954992; x=1785559792; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=T7woz5WQx9twAyyXl48IZY+aoCqx/0V7z+stm2k8yfg=; b=qOTzkxcqtPhr0p5sxG65KgBPBusKKGlI0vUlTv3YyX3nYaUiXEkrihAeNtc3W3HT81 nfYKlOxi8dbGsv0XOnD4ImQQ5DSo91AZZ9JcK/iDcwDdepx+E3unBNOf6vjHNRyKzo5i f+xPQ6gBpL9OOPqWmnSt4SDmoeyIKSXViJFB6KqKLQJPKwLItwJLd9q7n2oZo4gAV3Fz ga/uGSfxYh5wWjiswaXpwP486mZQd/Vkcfnot7a4xybiB0pvxhJv/JJntmMsImI6FPB8 njfMnUkrAusiDF3Rlqo7UZtPAn4GjeF18KF0i/KdKWtmdKc228PXQ5TOA3B0VrN89coU Mk/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784954992; x=1785559792; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=T7woz5WQx9twAyyXl48IZY+aoCqx/0V7z+stm2k8yfg=; b=GNMvBR2OxCjlFXrSvXzxuHJrBClLt0en0qHDSTHFF67WfTPRVuI/jgErCvc5YhGhis Cd//gECm4pxkLUyN+c71pPf6gEoK8PLM2K0eVO4xjxVOrOdKCgIBvb6brWZ8jWBLuize T2TWrCASongw/x5UsCon+KwWMt9R/TsRgjXvLqZWWWeP1oscBjc7pj/LI6fkLY+ABuIF dxt4emnFOcwHJd+MVd+SDMfoYr9vCBhNp4R27HZ2KXe20FFNKhq8F82STmDJ5zS4YBOe N/mztQxK1dVgrpdI7nQZO7Qw/OL8ddn9IR1ejOFsrX2xhOLBqNpxE1jiX/eLPWMDWaS/ mNjQ== X-Forwarded-Encrypted: i=1; AHgh+RpTX78sV8VTBeZRhR0WBDecPQ9TKN7r71M2R/UVIJbWf/HmItG+Bfyar51tw19BDpMT6C67HjSHhqnM <at> debbugs.gnu.org X-Gm-Message-State: AOJu0Yz8/X4fsYpI/9HtguRNhCzHXLI4HlYdbkXjuvZHqyCKeArcnmIs 6eRLWTkuf3BSd6R04EWhCai8hIYBK45xeCiYqfYrONSP8LsptDoHE6zD X-Gm-Gg: AR+sD103MeswXyFrXGvMwRMukXl6B4du3eml8bFtmMimVrfiiDUugh6aj1ysNOWskTd Q+AJ1I4AAf3Ozx5PmffMahKeJJFfZXAkRGbNoS5XYra5u0YTUJdKoH+WwmD7ooioJxQh1+hFoXr 67V50UtzKd+wDqdXnb7o0aKfEZCDOygePnoYe0WgPBxWUE7oR8L5c+lrJtgtQ/S8BGXIRE3SVby FyT+UChC3T+atJwz0+9r/G6JmI618Nomd6UizTDq/fNGJUqlR24N3Ewln5gftwAZ1VgLqLvgFT5 pEKdqWRGlYlbxrFxK60P59WviHhEmvuV0/16ZPgRPKzWsia8RALp3cxteEVsaruSMZdGxZjI/E1 gzjagBChRiSOTJWEd83KrfuCMwldcYNsXwhe2ZMrnUxNNCevOk1UN6HTWHSScvc4WY5HRmMp5eb Zy27ZmU/z9jbTNtz83yzp+1LwuZPoaPY/mN8w= X-Received: by 2002:a05:6a20:1eaf:b0:3bf:e2dc:bc85 with SMTP id adf61e73a8af0-3c67df063f7mr1053778637.40.1784954991886; Fri, 24 Jul 2026 21:49:51 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c688:3880:ad58:12e0:3740:63bb]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-314bc5cb670sm7242053eec.31.2026.07.24.21.49.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2026 21:49:51 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <86y0fc31x9.fsf@HIDDEN> Date: Fri, 24 Jul 2026 21:49:39 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <A8425DAD-499F-429C-B1C1-589E49F96A32@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> <86y0fc31x9.fsf@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837-done Cc: bozhidar@HIDDEN, juri@HIDDEN, 80837-done <at> debbugs.gnu.org, monnier@HIDDEN, spwhitton@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Jul 15, 2026, at 4:52=E2=80=AFAM, Eli Zaretskii <eliz@HIDDEN> = wrote: >=20 >> From: Yuan Fu <casouri@HIDDEN> >> Date: Tue, 14 Jul 2026 22:17:30 -0700 >> Cc: Eli Zaretskii <eliz@HIDDEN>, >> monnier@HIDDEN, >> juri@HIDDEN, >> 80837 <at> debbugs.gnu.org, >> bozhidar@HIDDEN >>=20 >>=20 >>=20 >>> On Jul 14, 2026, at 5:43=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >>>=20 >>> Eli Zaretskii [14/Jul 3:30pm +03] wrote: >>>>> From: Sean Whitton <spwhitton@HIDDEN> >>>>> Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov >>>>> <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov >>>>> <bozhidar@HIDDEN> >>>>> Date: Tue, 14 Jul 2026 12:32:18 +0100 >>>>>=20 >>>>> Yuan Fu [12/Jul 3:10pm -07] wrote: >>>>>>> On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >>>>>>>=20 >>>>>>> Yuan Fu [11/Jul 11:15am -07] wrote: >>>>>>>> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come = up with a >>>>>>>> regexp at all. The one you created is not bad at all! And since = Sean >>>>>>>> doesn=E2=80=99t like the patch getting more involved (me = neither), I changed >>>>>>>> it back and used this regexp. Thanks for the tech support ;) >>>>>>>=20 >>>>>>> I don't mind it being involved on master. >>>>>>>=20 >>>>>>> Do you propose to install the patch you've just posted on = emacs-31? >>>>>>=20 >>>>>> Yes. >>>>>=20 >>>>> To me this seems too involved for this stage of the freeze. >>>>>=20 >>>>> What do you think, Eli? >>>>=20 >>>> You mean, the patch in >>>>=20 >>>> = https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html >>>>=20 >>>> ? Definitely too large, and introducing a new variable on top of >>>> that. >>>=20 >>> Right. We're in agreement. >>=20 >> Cool, should I merge the patch to master then?=20 >=20 > Yes, please. Cool I pushed it, that should fix this report so I=E2=80=99m closing it. Yuan=
"Bozhidar Batsov" <bozhidar@HIDDEN>:Yuan Fu <casouri@HIDDEN>:Received: (at 80837) by debbugs.gnu.org; 15 Jul 2026 11:52:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 15 07:52:47 2026 Received: from localhost ([127.0.0.1]:48499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wjyAR-0005Nu-A5 for submit <at> debbugs.gnu.org; Wed, 15 Jul 2026 07:52:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33064) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wjyAP-0005Ne-42 for 80837 <at> debbugs.gnu.org; Wed, 15 Jul 2026 07:52:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1wjyAJ-0006bV-5l; Wed, 15 Jul 2026 07:52:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=9XkfLX181SkXBgWVzvlvlAhto776yugLM0yBY2x2rSU=; b=khydweY1c9mg9p43+dvz M+ZsUr97PXDRkYU9I4VY4RgMuY6FXN/rgZAeQnF6LDyIoH+EmfFcF9XkZhRfol1etevxKhy6t19dX NTtu2AVweXmpEZCMMADOrpBvZXsJ49TbX3WNO5v1LFIY+HugZR4obAPQ0Whwc7sWC6kGQn2ZCM2GU eE1WDotMZrMMY+xBKsl/Tg6PRW8BsXLz2TrwgNjBcnapIJMJpH8Jg+zqvTqaWy4KY5o+EVPQMDiBC s3kdq4gQDoI0E2u7YEVdo1xk6Cjs8Cg46DslGHdKXA2kyu/CBP0RQOxn9b+VtWwzLtMfz8Vq5KaRb t9oNzNxvoVwxUw==; Date: Wed, 15 Jul 2026 14:52:34 +0300 Message-Id: <86y0fc31x9.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Yuan Fu <casouri@HIDDEN> In-Reply-To: <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> (message from Yuan Fu on Tue, 14 Jul 2026 22:17:30 -0700) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, juri@HIDDEN, bozhidar@HIDDEN, monnier@HIDDEN, spwhitton@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Yuan Fu <casouri@HIDDEN> > Date: Tue, 14 Jul 2026 22:17:30 -0700 > Cc: Eli Zaretskii <eliz@HIDDEN>, > monnier@HIDDEN, > juri@HIDDEN, > 80837 <at> debbugs.gnu.org, > bozhidar@HIDDEN > > > > > On Jul 14, 2026, at 5:43 AM, Sean Whitton <spwhitton@HIDDEN> wrote: > > > > Eli Zaretskii [14/Jul 3:30pm +03] wrote: > >>> From: Sean Whitton <spwhitton@HIDDEN> > >>> Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov > >>> <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov > >>> <bozhidar@HIDDEN> > >>> Date: Tue, 14 Jul 2026 12:32:18 +0100 > >>> > >>> Yuan Fu [12/Jul 3:10pm -07] wrote: > >>>>> On Jul 12, 2026, at 8:33 AM, Sean Whitton <spwhitton@HIDDEN> wrote: > >>>>> > >>>>> Yuan Fu [11/Jul 11:15am -07] wrote: > >>>>>> Seems my regexp-fu is lacking, because I couldn’t come up with a > >>>>>> regexp at all. The one you created is not bad at all! And since Sean > >>>>>> doesn’t like the patch getting more involved (me neither), I changed > >>>>>> it back and used this regexp. Thanks for the tech support ;) > >>>>> > >>>>> I don't mind it being involved on master. > >>>>> > >>>>> Do you propose to install the patch you've just posted on emacs-31? > >>>> > >>>> Yes. > >>> > >>> To me this seems too involved for this stage of the freeze. > >>> > >>> What do you think, Eli? > >> > >> You mean, the patch in > >> > >> https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html > >> > >> ? Definitely too large, and introducing a new variable on top of > >> that. > > > > Right. We're in agreement. > > Cool, should I merge the patch to master then? Yes, please.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 15 Jul 2026 05:17:52 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 15 01:17:52 2026 Received: from localhost ([127.0.0.1]:46406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wjs0G-0001CW-DX for submit <at> debbugs.gnu.org; Wed, 15 Jul 2026 01:17:52 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:54676) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wjs0C-0001CH-Tj for 80837 <at> debbugs.gnu.org; Wed, 15 Jul 2026 01:17:50 -0400 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-ca7c1176317so3688911a12.1 for <80837 <at> debbugs.gnu.org>; Tue, 14 Jul 2026 22:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784092663; x=1784697463; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=/x/poyaFQd7RVyqDWttn8CH6x7nODNrWaXe8RHyBoSA=; b=keGfQLhmTVD/nGAlMFcrBKhQXr+fkmrv30LpDB6QRBv+TZ/8qF3XJ2tfslLVU9VZFk tDFGP9Ky9VsJ72ZitUwnEZgaq+pM+tQnpme6FipJkAC/pvTn4mAaK/DwaFbtBijMCM/e A7OyZQdcOLGsnujZrTYvflpWHGzB5xISCkjtFGbL0qdkUu6YNwPKFERpQkrdfLhRAc52 CQ4SE2ffjWaw1TSelFGhcjrSfZbAHCYe6P1t854f/jsc9/26gock4+XJtCvmspK2UIPu JJQiHtvsHQnQU/2or9p+Ub2CxEIh66hZ4w54fWHuRkiYCx2f0j0GTZiwy5YhZDWt1F/q 55Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784092663; x=1784697463; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=/x/poyaFQd7RVyqDWttn8CH6x7nODNrWaXe8RHyBoSA=; b=GDNf8uW6loWKWxeC3Q8z5SWRIIQz0XHI/+YUanFzzbC9teqOxZMdT2YQ2+DVYNae+q E7ECvpA2zdn+N6Fl70MZAxGuxpi8Mc/zf/ftBjNCct1kDKe7epOi17epjHe9UXPFLAF2 CAJhfkXwRZNyWQwl2Y7fscu9dI2NE8/RflmVGM+6dhM/pZMgUhXte7N+3Z5OM+JVQnpE hnSYoVEa6xGRmw4SbeZwNKFSDS3lC35mUt6FKqEkYnAWYUIGTyP9VMO3s/O/Kqj4nGug oGsGU50yVQagR4Vont98bW2vomhSUchmcFlz5PS6G6CjMNrx5/arFn7pjf7aySPYpvBK 73Ig== X-Forwarded-Encrypted: i=1; AHgh+Rog9KePn93ej/Q0JT5Le/r1lzdSytiV9OZE2Fgu038Az9Mok1dDFCBPc9W7EYR6UQj6x4qEEw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yzj9/Xf+JGfGSHMwhVwzQdV/trKf/nI5zwRe6L8v5n33h8LuDDH DLfMhiisWx9fs5D/4AJqPHo0y+nF80yZUjZlTIdSLiTk+KYp619Bl41W X-Gm-Gg: AfdE7clRsATFVYO0dh2mtqeH3FbyK13+qprLhSezh7BjOGuG7+OXRKNEes4lrkC8fsl 3THHr1F53CzSH23l/b3Bnn1XNEMqQdnILRlxU43fn1QewXBTBrKgjx2KikxumT39g+OTOa2+oNr KUUBDb0UX1cIBcvzSuAsLJJAnp0gXcXOpakQzxHBk+/P1hBALl28Ap604ub4Qh3/gniSSP3CtJ2 sIJ3zUaXv7v0++t2tDFmQ8queQhCEDFz/Keubf457dgC5BTfsELNRgmPxnZcAisvpiML8lELQ6Z mvYcH5Fxmu0cWKYgpXD9V7lO660K1WcDkppTBsXUX7cV77tJzzlJu9036LVawrF1VrLpzvIMD8a Mwf5rPNotcZGGwlTcqdp9bkAdC9hPzeQuzb9keuuWBFvDxWF+rRVOIICEZWD4bUMfI4kq9KFIoN i586prlqAwKzVLw5WBEVroxx5jAo+75IRUIwQ= X-Received: by 2002:a05:6a21:3998:b0:3c0:b9f6:96c4 with SMTP id adf61e73a8af0-3c36c349836mr1653776637.37.1784092662716; Tue, 14 Jul 2026 22:17:42 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c688:3880:59a5:e40e:7f23:ec5a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-311747f596asm86137860eec.2.2026.07.14.22.17.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jul 2026 22:17:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <87ldbdd9ma.fsf@HIDDEN> Date: Tue, 14 Jul 2026 22:17:30 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <1E89E8E4-0743-45ED-8D1C-4C091A142136@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> <87ldbdd9ma.fsf@HIDDEN> To: Sean Whitton <spwhitton@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, bozhidar@HIDDEN, monnier@HIDDEN, juri@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Jul 14, 2026, at 5:43=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >=20 > Eli Zaretskii [14/Jul 3:30pm +03] wrote: >>> From: Sean Whitton <spwhitton@HIDDEN> >>> Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov >>> <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov >>> <bozhidar@HIDDEN> >>> Date: Tue, 14 Jul 2026 12:32:18 +0100 >>>=20 >>> Yuan Fu [12/Jul 3:10pm -07] wrote: >>>>> On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >>>>>=20 >>>>> Yuan Fu [11/Jul 11:15am -07] wrote: >>>>>> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up = with a >>>>>> regexp at all. The one you created is not bad at all! And since = Sean >>>>>> doesn=E2=80=99t like the patch getting more involved (me = neither), I changed >>>>>> it back and used this regexp. Thanks for the tech support ;) >>>>>=20 >>>>> I don't mind it being involved on master. >>>>>=20 >>>>> Do you propose to install the patch you've just posted on = emacs-31? >>>>=20 >>>> Yes. >>>=20 >>> To me this seems too involved for this stage of the freeze. >>>=20 >>> What do you think, Eli? >>=20 >> You mean, the patch in >>=20 >> = https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html >>=20 >> ? Definitely too large, and introducing a new variable on top of >> that. >=20 > Right. We're in agreement. Cool, should I merge the patch to master then?=20 Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 14 Jul 2026 12:44:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 14 08:44:08 2026 Received: from localhost ([127.0.0.1]:39809 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wjcUa-0008O7-35 for submit <at> debbugs.gnu.org; Tue, 14 Jul 2026 08:44:08 -0400 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]:49087) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wjcUX-0008N3-3E for 80837 <at> debbugs.gnu.org; Tue, 14 Jul 2026 08:44:06 -0400 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id A85FA140003C; Tue, 14 Jul 2026 08:43:59 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Tue, 14 Jul 2026 08:43:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1784033039; x=1784119439; bh=5ssxjUS+OknBmyHHX2f4PXQ0ZLftgL1+ v8JGanUEXeA=; b=bKIi8HZxcSkwpwrozXWdO/YkVxKFrBsngVYry92ZzOz5UsQu Kbj157LFGOqGSC62TPe3Rq6tF42RpRFy+6lmiKE2PxYXFZMHMuc5mkc05eCBLqBd gyLZyq3AaqjDj16Jhk9NVnxf+JiWU576c7CBIuuLIr0qSURABJc3wQ9KifhQaw9Q ueHnS0WS/sYAZN57qBuEbY+zsGLP2Lr2Tw7Q+wLFSl0N0U7H2+tYXjGPbZqSwM/d LKQZa4LaodmQDSfVt6ZtapB6bv3eqMfo49Zjcj6l5CyFweZTaN2+XK68BHoB6yUt r37wlDfiGBXKuAfdnA8xPJSRjs2vOoPN/lMMZQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1784033039; x= 1784119439; bh=5ssxjUS+OknBmyHHX2f4PXQ0ZLftgL1+v8JGanUEXeA=; b=W Vi/GdgN0mvanaInAOTT6muGYOmAYeSdB19fQjOLl5f5Ji4SwHvih+39Qe3268ZHN 4FWhXsuMF46sL3AqHDbiXHZyW0ftAg7UXKEQVl3rDEXj7paWCDrxQdsYn0/Vd8N4 4yUfaxr5RT3Zv6rumMRmxmd9l98Bk/7EwlJTmWspdE7f4mgpAlhSneCWxWgEGjtY sHtqVQ3ZSAbqlKqnv06+26KjUNmUOO+fLt3OuPFv/cPLUw0QyAZM4kVOq9lcjUBo 0GQSo2DxcALUY0VBog8Ms/xy9KgGIE+1a8Z+zI0gfA8ncR5q6VlAUaOH1Ct67CZB laLdsOgxntRLOFR7Dcygg== X-ME-Sender: <xms:Dy9War0RSVbDZpfWTMkEzNYtA3f3cfctFf5llkDRAbnzw2o_LY5VcQ> <xme:Dy9WajbLNYfMmUAfMgihsrwlXkJ-nyacxzNszG1v_WY0SQWKR1lfgz2Uwj19IGicO hiYforlrpMVSI7Tg86cZUebvTsxbIFHiZo8Ln4bPyRQtCyCmDhwUIo> X-ME-Received: <xmr:Dy9WajLZt3aZy7u2Z49P2BeT35EsjdTD2c4fRoheQZb2GroV-J1GRkFyg5y3loP42NBOcBu7jaKP> X-ME-Proxy-Cause: dmFkZTFh0kyOGMdbVdL4+LutidiBD+uGSg3vLx+knAIW9LBRg3QLuVctRJdvV4JfOhMP5A JouxGcubqYJkOyiPzRAKYYluK0M5cGNs7aBPNpx7M8VNU28G7dPstrVr7GSFPDOfqpX+0f IsFNqJVe3YTtKDBUD3rOyauBi5F+1vz9WX22Xnaa1bbELo/83XhdEv+izRcHObvrmArvXh tGd/y6anJIJwWtN4vjQyrV3/CQWf16ZImDw43W79wN35NXM9Cn2SLhBjKWzHV63vo+ZygC q49UgxODxdOn2YaBUHTDGxpnYxxun0to7O/l8Ys8AdtFvlzCUUI1bzxBltsKe1FnPR4jhl Dy47V4mCxWlhqKG2a65CmXk+yLfgfAgzVV9CsJ+ZTB9PqdPmtKsTdhTHIpz6RvQMwNOJDh MDXwQ/z9ZtvveFLU/Jg2m0MofJLaY71Qjk9NH53W370K1QLnJpw2+dBPnKEzUtg8fUEmZx OeV8ZF6PKWGbDw6Ordw1/O8d4HGMfbK7CVVCVexz3Fcc8iqZXpZfnbNoIlBSjMsBlx1ygC RWNfdqZT9SrErjDBI8wCVDV07LEFt7upkVaM41itwF56zdknI9hU2FCyGtYryUc4XtF0DD UbKRHp0rmQzUtoIkCQZ8Q0GKemj6nwHe2a5PAaamdTjcbzPHy0a2SHq/gDiA X-ME-Proxy: <xmx:Dy9WaiGFst7v-ZTZ3ra7_YxPZCxyC7EjxIiD4x1M7737gkQM2gcW0w> <xmx:Dy9WaqvLEpzntlFB1Z8ML_xE65c0f2gqHW5K2dPO-bQPGUnGEhzyoA> <xmx:Dy9WahtebmHrVFHS0pSeBAYANzJLTFjKgrzcpePBHJfrPy5qTt-Kew> <xmx:Dy9WaoAvsrprWK54Dy4hNEw9mBo520jDXilGvZXI6T3rlegoRMXeVA> <xmx:Dy9WahanzZL2E6tjZft14d2nmj6zXhOfaLuTpZjhj5SZrscJIFVyqjqy> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jul 2026 08:43:58 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id B35657E7481; Tue, 14 Jul 2026 13:43:57 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <867bmxg3d0.fsf@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> <867bmxg3d0.fsf@HIDDEN> Date: Tue, 14 Jul 2026 13:43:57 +0100 Message-ID: <87ldbdd9ma.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, casouri@HIDDEN, bozhidar@HIDDEN, monnier@HIDDEN, juri@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Eli Zaretskii [14/Jul 3:30pm +03] wrote: >> From: Sean Whitton <spwhitton@HIDDEN> >> Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov >> <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov >> <bozhidar@HIDDEN> >> Date: Tue, 14 Jul 2026 12:32:18 +0100 >>=20 >> Yuan Fu [12/Jul 3:10pm -07] wrote: >> >> On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton <spwhitton@spwhitto= n.name> wrote: >> >> >> >> Yuan Fu [11/Jul 11:15am -07] wrote: >> >>> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up wi= th a >> >>> regexp at all. The one you created is not bad at all! And since Sean >> >>> doesn=E2=80=99t like the patch getting more involved (me neither), I= changed >> >>> it back and used this regexp. Thanks for the tech support ;) >> >> >> >> I don't mind it being involved on master. >> >> >> >> Do you propose to install the patch you've just posted on emacs-31? >> > >> > Yes. >>=20 >> To me this seems too involved for this stage of the freeze. >>=20 >> What do you think, Eli? > > You mean, the patch in > > https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html > > ? Definitely too large, and introducing a new variable on top of > that. Right. We're in agreement. --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 14 Jul 2026 12:31:04 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 14 08:31:04 2026 Received: from localhost ([127.0.0.1]:39712 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wjcHv-0006br-RU for submit <at> debbugs.gnu.org; Tue, 14 Jul 2026 08:31:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41590) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wjcHs-0006Za-BK for 80837 <at> debbugs.gnu.org; Tue, 14 Jul 2026 08:31:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1wjcHm-0005sX-As; Tue, 14 Jul 2026 08:30:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=/WxMVBoAoC9gUwNj9jxEO/KyqSBvatmeGPLVWUZH1jQ=; b=hJrbFpuRvYOdVF0cSJKo FJmqcqJdPRq4wkFAvOAj2G0TBliGksiAH6LrQUbCrC3pPcaUafuIDW5Oxh9HpqMv+jpe7YihnXdG2 YSvGte6eLdKjpOX+zK/BU2ViRpOuGfwxcWNwMOlgrh83cCTvQpBLQIA00abVUUiIzDitp00V96uDM WlP4rBsTsztWUe+vXcrIJbSZk7A8fI7WPHDRqS/QS6LYLQ5YY05Bkau4D7pNgGoL/toWrVDT9sP3y 68J3ZUMc1yfVcdLu4r8DJx/WqSKm4A/NUUjm5aEBn03antC1lyt4WMMso63esfN+N/tdhxtitXUS4 JdplALzCdkfgjQ==; Date: Tue, 14 Jul 2026 15:30:51 +0300 Message-Id: <867bmxg3d0.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Sean Whitton <spwhitton@HIDDEN> In-Reply-To: <87tsq1dcxp.fsf@HIDDEN> (message from Sean Whitton on Tue, 14 Jul 2026 12:32:18 +0100) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> <87tsq1dcxp.fsf@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, casouri@HIDDEN, bozhidar@HIDDEN, monnier@HIDDEN, juri@HIDDEN X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Sean Whitton <spwhitton@HIDDEN> > Cc: Stefan Monnier <monnier@HIDDEN>, Juri Linkov > <juri@HIDDEN>, 80837 <at> debbugs.gnu.org, Bozhidar Batsov > <bozhidar@HIDDEN> > Date: Tue, 14 Jul 2026 12:32:18 +0100 > > Yuan Fu [12/Jul 3:10pm -07] wrote: > >> On Jul 12, 2026, at 8:33 AM, Sean Whitton <spwhitton@HIDDEN> wrote: > >> > >> Yuan Fu [11/Jul 11:15am -07] wrote: > >>> Seems my regexp-fu is lacking, because I couldn’t come up with a > >>> regexp at all. The one you created is not bad at all! And since Sean > >>> doesn’t like the patch getting more involved (me neither), I changed > >>> it back and used this regexp. Thanks for the tech support ;) > >> > >> I don't mind it being involved on master. > >> > >> Do you propose to install the patch you've just posted on emacs-31? > > > > Yes. > > To me this seems too involved for this stage of the freeze. > > What do you think, Eli? You mean, the patch in https://lists.gnu.org/archive/html/bug-gnu-emacs/2026-07/msg00544.html ? Definitely too large, and introducing a new variable on top of that.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 14 Jul 2026 11:32:34 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 14 07:32:33 2026 Received: from localhost ([127.0.0.1]:39452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wjbNH-0000da-2R for submit <at> debbugs.gnu.org; Tue, 14 Jul 2026 07:32:33 -0400 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]:59251) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wjbNB-0000d9-K3 for 80837 <at> debbugs.gnu.org; Tue, 14 Jul 2026 07:32:27 -0400 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id EA1B61D00124; Tue, 14 Jul 2026 07:32:19 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 14 Jul 2026 07:32:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1784028739; x=1784115139; bh=sEeOQN/RGekC8xROSe3ukMnKmQsR4LwH NfnABS+BmHU=; b=uzm8b60oQCK7xDcXrx5jVDPi++HWpPn+7W/ErMv8XqwLfRUs UAb1d45fxMGANLRLarVDnHH9IeOxPIISEBtzB+xRmXhActN8ooacBuc4aTZ8yegU mWcKf82UVQ9emwc/Aygv5oK9rFieOnXflzPkyIyecgMWGO5eqUU6pEpivAoA3n9l twFEX+KzL4X/aA7B9AVXOMMPBq1U2DhqSw43MAmry7173wb0dyBtcH5yVEds8yb1 bKU5AwpHmbOs+UQy9SVUflMxzZxxcyd1EjCU7JiBKRtpMXkU960SxwzAWK1XZgXs KHZbKsgpLeRf2QsJFl+t4U27m26DiKhWp5+j7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1784028739; x= 1784115139; bh=sEeOQN/RGekC8xROSe3ukMnKmQsR4LwHNfnABS+BmHU=; b=C /hNj23t3rZ76uhyLXF4DkiHS62cE/RoTOwhEvOrx+efgpsyNHW+D3aL4ZpEJm0sI lBPROO8gEF2E89nqPs7YBwH5cEvgyAt/uYDJksACjyi45GTNdeUwwDxD4sUU/rIa CNbaIY1EGUrWoBQxaeHxJpEfgnIL1G0yep4r7hqwuGd6RuWa+LeXGEjQD7U2qMc9 P9cSY3CpmFXeuQrac6XJcDtQ3FIL7pYBrGK5DbpYCJNdCvJxPQ7JRlgJpe/ZlpUA 9YGbCx4jE3BKFkerOAiEVLPtwgO4y1+vwHYV30D19oItxeNlyJQ19i4o86buInFC Y0tuUFxfqaseta+PPzmmw== X-ME-Sender: <xms:Qx5WakqXEZVL9_TUlyIp9OGZCJCoXDuO5zha43_8-u1qj5j4GM1Upw> <xme:Qx5Waj9Wj86w4EvX35sn-ko8CeNYcwdcwr6ts9DfpHNq7RbwJ8tM7NtNaMP_rmPNs 3XQI-A1FTtRBxv_PHy-QqaiWkqeHyBYB8ll1IltPThWJbfVDE08DmU> X-ME-Received: <xmr:Qx5WagciDkXr7I7zdPx_yukAOi0fNuROW7msM-VSz3FaRpyX91y7TLvNV0E0tdLQtgIHb0rSv5ht> X-ME-Proxy-Cause: dmFkZTFEgW6sCNTXzje8mmNHSFlbTldM0B48cxiIPjtq8WBPovYq7Ezq3JnXv9unjc20uQ Or6mUza+HBVFLYhwmiwUaDlmI4aN/aD/zk+eRkOPDOQPnKHrKoJKE5E2Q/KnZLzB/TvK07 B6wxBoLqt7SI8eIWU4d7kh/1CY8/I9SSskdznlKrA8bhDU3V1MJ08pxTcNv+7B+S0pzVop 0sGr3tKHYvK4Ss5e5daBp0auRPRhKpKPx9akaujP+r9HAs0BCY0TsuLN8LQ7TZMun9TqFy DimZQJn0YsHxIrgTmXzYWtlDHWDYWYwjzszwnaUinVP0F6fLZ5JNb4rKQLcvHl5TygxztU P9cBFiM0qUUyXSSD8Fm9+yInYVLCqQgPrxnD48kkuYxtY+XmO2m+mb8civ2KaD4BYGQBYM OedHYgaZmzNSb5CKDVT4PVUk81+JlemSYCoVxDnWRL0JYLCylMXPadQ0wYdoUuS25Go6cD Fra1N0j0D342rp5miqEI2bi6oHS7nYWThAHBEYQ+KCaRuoz5nqo2jDOC68KZblpNwaJq5D RJzeOzB8f4+qda3moPGTpBBw7nxOhaE/nVG3hS5YAlgEWNZG1SFmpcOD2dw8P78qSFZgbb yN/j29tuH+OmRa5ShTvenVbSwL2OFdz21pxNi3ZvtQa9YwPNcDRxvqchOzjA X-ME-Proxy: <xmx:Qx5WatLlOhkOrr8zz6abAG6Agavt7C3oRgYtK_yapPbJbCX2b357EQ> <xmx:Qx5Wagj9LrAP424_H9Sitv67iJTrJ4-FTo-yx37zHCASKDoiIYuamw> <xmx:Qx5WarTwhG3wq15u7E4PrkzD_76k5Bdxl4rD3agGQtIkYbzo4IFANg> <xmx:Qx5WaqUQEPuTsF2vb9EtfO-izpzpY25WVGvnIKNokLNaz0pZMQTz3w> <xmx:Qx5War0TEW_CxEHsOga3-D6vwVtMAHRWlunV234qVULccug0q0Y2ZTn0> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 14 Jul 2026 07:32:19 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id 85F127E854F; Tue, 14 Jul 2026 12:32:18 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Yuan Fu <casouri@HIDDEN>, Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> Date: Tue, 14 Jul 2026 12:32:18 +0100 Message-ID: <87tsq1dcxp.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Yuan Fu [12/Jul 3:10pm -07] wrote: >> On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton <spwhitton@HIDDEN= ame> wrote: >> >> Yuan Fu [11/Jul 11:15am -07] wrote: >>> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up with a >>> regexp at all. The one you created is not bad at all! And since Sean >>> doesn=E2=80=99t like the patch getting more involved (me neither), I ch= anged >>> it back and used this regexp. Thanks for the tech support ;) >> >> I don't mind it being involved on master. >> >> Do you propose to install the patch you've just posted on emacs-31? > > Yes. To me this seems too involved for this stage of the freeze. What do you think, Eli? --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 12 Jul 2026 22:10:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 12 18:10:41 2026 Received: from localhost ([127.0.0.1]:55237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wj2Nk-0002SW-T3 for submit <at> debbugs.gnu.org; Sun, 12 Jul 2026 18:10:41 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:43305) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wj2Nh-0002S2-3Z for 80837 <at> debbugs.gnu.org; Sun, 12 Jul 2026 18:10:38 -0400 Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-caf707e3a70so136907a12.1 for <80837 <at> debbugs.gnu.org>; Sun, 12 Jul 2026 15:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783894231; x=1784499031; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=34Fqmkn2WCtKStGfqjuzLOADHMCsWAs6YY4npUzjg3k=; b=ejJHX8b86q2JnojBRPkKftk0PNthNo9/ajo53kpvmPfAgRHOI8aqZNBz8wtwUIGBKS N8/YNIujmxft64xOLhKcG/GY1ek1D/HumEfbl7UEhKEmhKSPj+rKn882Au7ufz/TOraV dERZB0qbvp/Qhp16YwumT5HHdg1u2YKQdovvShYjSP1XrZxTFRx0Zobq19om7ZKapvaX tK8LmD9ftDhLJv0RFD63CFWOYQmFSNLUIfdwL5bsNAh5yJb7MBqEdJMvmzukVKKM+Uwy 8RhvdXS9od2l+4bbj+mE7CP2VsswJskx/eRTwiXsRBCDiMarzIilU/EJJLoPkHeWFQ6M p+WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783894231; x=1784499031; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=34Fqmkn2WCtKStGfqjuzLOADHMCsWAs6YY4npUzjg3k=; b=U5vXBPHYvRtYLZK+cI6imkvX698KW7UKUQIrB+G8pKgJyXoTlJckHwYsHRcvZa7muF 0Ue5HHOv3MbywZWz6NRIN9vCc+GdM+5LOFkoL3xlIXsKAyCVWuUQRyAJUCqcNAK+w3c/ QZzvSkJb+WU909fRtFAukV1EXJV09219Rd07ONyqyr1SHLtR+zRVjEMpZJfhLhyYXZ5V eE2oaNusauma0tyPmPzAUX+VTZCEWTbX9TLEUXOwM6QTSyw4ekfPvD41JkM/lqStMeVA nVR7J9cAqGcFuZU1PRwQjp07tVnSoYxdakaNUZJwLE7RkGBQCKAeFLKQll5yhq4dwUu8 Zvpg== X-Forwarded-Encrypted: i=1; AHgh+RrLQZ8GR7Wi/rX9s3jgrHJWwL3b7c1TtmSzE0P9S++wHOen7Nwlp0o4/1EkpLZutpMqhgjM9w==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwLwe+Kynzug5uzWHM2KbISnvskb/R/17SUETOjLIMoP/Ak0ny/ T50i95VOjNoaxbLOtxJssTrGnyWo6ehIPBa+a2w1VHCfym7JEb2aJu2S X-Gm-Gg: AfdE7ckDEngH2dfGzQwVuuVzHtteLxNR8/qAWEUlI44qe5MgksYaPTAQfScFO+09GFy O+stMmw5U1DZlSPFtiTriNnmsB56J/5aQGmMMGE9tQFh+Qp5iy0jx9w1tDVEcvjeViz2tc48B2b V6g8mMdgicY3oxzV1v93wXQSO8sQr67R074wTIIrFPXb0RGIsXOpMj2asY8MXD5QRIwzb4qPoli 5sYxxgnOY9Kei9VfUGHWTPclqvYOXe/y3qNpOLePC9U9pulXXj11/PhUgyo0LefQZchqIdcNvy5 79wUEQKEOc6TD03dE8pOKNsHy5lFsjwYzXTynx2mvoA0PT8qiR5LpTqVi30EemfvmqiCLluyQ8W D+ZkS/GSot9ww7IfAkk5AIB85RSlpEsOiJLma37gliLvtZMms2PQnC7y1s3TQmru8A+sweFTsJj BgLHG2h6HRVLtZtdMCmLnC9IO8QdDsFCh+WWM= X-Received: by 2002:a17:90b:3d86:b0:36a:caf2:3815 with SMTP id 98e67ed59e1d1-38d15876f4amr12140379a91.15.1783894230692; Sun, 12 Jul 2026 15:10:30 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c688:3880:59a5:e40e:7f23:ec5a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3119d5cf176sm39063863eec.12.2026.07.12.15.10.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Jul 2026 15:10:30 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <87o6gcussv.fsf@HIDDEN> Date: Sun, 12 Jul 2026 15:10:18 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <88700A8E-0E46-4C3F-9E91-51D771A4C447@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> <87o6gcussv.fsf@HIDDEN> To: Sean Whitton <spwhitton@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Jul 12, 2026, at 8:33=E2=80=AFAM, Sean Whitton = <spwhitton@HIDDEN> wrote: >=20 > Yuan Fu [11/Jul 11:15am -07] wrote: >> Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up = with a >> regexp at all. The one you created is not bad at all! And since Sean >> doesn=E2=80=99t like the patch getting more involved (me neither), I = changed >> it back and used this regexp. Thanks for the tech support ;) >=20 > I don't mind it being involved on master. >=20 > Do you propose to install the patch you've just posted on emacs-31? Yes. Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 12 Jul 2026 15:33:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 12 11:33:14 2026 Received: from localhost ([127.0.0.1]:53178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wiwB8-0000co-4k for submit <at> debbugs.gnu.org; Sun, 12 Jul 2026 11:33:14 -0400 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]:33585) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wiwB6-0000cW-9M for 80837 <at> debbugs.gnu.org; Sun, 12 Jul 2026 11:33:13 -0400 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 67E9B7A00AF; Sun, 12 Jul 2026 11:33:06 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 12 Jul 2026 11:33:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1783870386; x=1783956786; bh=UMCKsysT+Wu8g7+YowJlpE7Jbpe+friJ WlqCx6qR/Wk=; b=mKQBfLKZ1UhnNzUz0gFQMZFPhJtRkWnKZMjwAJFlnIdNXaK2 513CxUWOBV99i3yGctCPd4NvsjZ3gOsqK6y494laHQSZYYSFEeEYZHJ7iOx/nwe2 bxXtEKUgu2Ml8wJqt0OEsbAJJjthB2k51oVmCjwA8T/7D3WgqORiJ2WJqc/hnT2y H6mhFtfEPOfZfJpFyP3OQew925gjNUIe7DowWhO3pF3mOgKu26fNHCkXbzPekNRv ZVLYpynx3pEcEKmfru7NPTWG2By67wIUIFoElWFwUAwPhjzVVV/fBD4fBq3dhTki eE2OOiG62lJNCzaJO9VbztSC7r0TeVgAcMLWEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1783870386; x= 1783956786; bh=UMCKsysT+Wu8g7+YowJlpE7Jbpe+friJWlqCx6qR/Wk=; b=U locCHKUvobRescwgX0JZc/ceWXKRbesiezWxWfEDDxZIf2n7GkO5Nip3fz3vPW08 4pDFqmFYOnDl82/l+UUAmlpYlhEM3SWq5PzdxwRxCUFJ6FGW8iLoV92woD6NHGlO lGdifY7elMKG6/W8551/fXiyn/BXce+vE4jvLqLYNANXQHBwNzqnupJmd/A0GevK Ue4kqW7Dc8OkNHB4Z2CWcMWoYDEbv815R7o9TpEug5ejBpEDDo7+CKAhHfDp8hMu 6Xecbu5VNcVW9VMJFe5c4za4vabzQCenIHRCfvuiWhBKYRmeR6mKNgeeg7M+B4ie YlNAH5TnQdLNux0cCGafw== X-ME-Sender: <xms:sbNTarRkQ8nmUkW_InIEYi5fIV5QNynq-sdJ7mglHC9kv8Ff6Ckm1w> <xme:sbNTap5VMWHmYpznaYtNHv4TuO403dvIRq_M85kUWp6K0NcFjbCj7i5SU4rOZAvgE EjjaAAxgzfVpctss0GVhNv_7o7Fwsv_ey1oNf9p8f0bTNSvafNuqvw> X-ME-Received: <xmr:sbNTav3BkarjYWthE-1V1BjfDJrsCPOAUJcYLGNvDbRhVFNnOvNJalCmR9RzlGdGebmx0XQHpt3jZL08iEszOmxEg5lIUQ> X-ME-Proxy-Cause: dmFkZTG0epi42zRRwKUJy2oKC6lZrKByN8EDY9n3Kt4pqCY752rLwtQBHfgKU1koUoJFuN AxQCKlovLfx9ewra4e6+dTm6XSiyCqTE5CHlznSQSxINMxI9XmeM/WvSxAYzutU6Jy2fco byAqtdDmd7p1FEDPo3BSnem3Tmw5plQzxxJJU7aaXzMUKtmjLzF8YvtihZkjy1rqFYzZAP hvtmRfSdevONP/RPaR8KyPuSX1MDg2Hj6kxI/m8JC3tCMOmNWXDNsa2VDo9qXoHFWANcKZ ubaeO1Xutq5lwjZYIM9ZxtQj5Uf2GcXoaqW5coAx2XJ9A+qQFk/h7M4bc9ZtqUF2O42dUm 27+GF4A9TEigSs4LMpvdXSd1Hm+pUBIzZs7oUD+oVUs5MLhSzj4wGL/7xr5agfVtl4kbtv 5IDzj8dc9o3V9Z9zn1TW1FJEHr+4ut355WcWVYdDtZA7gICIufHW0+bE75u/zsOPYRmJVX 4qU47auWqey82km7YqL2bk0Hxo8iKuj0bAsgHzArHRfnPkahHsarBX6hn2sC3Q9StIU5Yz 0CWT0lFoFzAmcyQaprTv2YHGJs30BcHBr7z82yg0Jvy+IBDYyNDzzt1HKORenUS9BafIwF o8b9dLu7DhNlEe9ov+vonFy9Poew2TQ/8ZbgzqNkz0rCc+ApNp+WBh8Nq/tg X-ME-Proxy: <xmx:sbNTasAuziWSCIpQE-mBsCO8crl5r6-z5uEkShe-DB4YKTkIjbMoZg> <xmx:sbNTaiOpO-cOYVSARAiRNYDDHHhB0tZ4pnoGbbmSCajflQEItIyGGw> <xmx:sbNTapbQY52SnPSen9cvt5HQnQuptETddNoU0uGJGDhr6AulOSpSpA> <xmx:sbNTapsDHPOfKBj4h0XDU1711r8fvMhJkdvq4dUurU0FIexSwlA9Ug> <xmx:srNTagkCH8UrltonWggb_qYcm-I8ZxnbwQ_5ptMysUpy1R1wws5E4l8r> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Jul 2026 11:33:05 -0400 (EDT) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id C1BC994075A; Sun, 12 Jul 2026 16:33:04 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Yuan Fu <casouri@HIDDEN>, Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN> <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN> Date: Sun, 12 Jul 2026 16:33:04 +0100 Message-ID: <87o6gcussv.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Yuan Fu [11/Jul 11:15am -07] wrote: > Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up with a > regexp at all. The one you created is not bad at all! And since Sean > doesn=E2=80=99t like the patch getting more involved (me neither), I chan= ged > it back and used this regexp. Thanks for the tech support ;) I don't mind it being involved on master. Do you propose to install the patch you've just posted on emacs-31? --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 11 Jul 2026 18:16:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 11 14:16:14 2026
Received: from localhost ([127.0.0.1]:44531 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wicFH-0002bn-WE
for submit <at> debbugs.gnu.org; Sat, 11 Jul 2026 14:16:14 -0400
Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:53448)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wicFD-0002aQ-6q
for 80837 <at> debbugs.gnu.org; Sat, 11 Jul 2026 14:16:09 -0400
Received: by mail-pl1-x62d.google.com with SMTP id
d9443c01a7336-2ceab75934dso4394995ad.2
for <80837 <at> debbugs.gnu.org>; Sat, 11 Jul 2026 11:16:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1783793761; x=1784398561; darn=debbugs.gnu.org;
h=references:to:cc:in-reply-to:date:subject:mime-version:content-type
:message-id:from:from:to:cc:subject:date:message-id:reply-to
:content-type; bh=lEZXk8c9kaIF3nTflzlIUQ37KELCSYUGwSBBtfE/fcc=;
b=bIvdAbiDveLtGsGpq696WDu5Rg7SmAtaTZL8MzqTJ7jCaejZG+aR/dXutL6aRnyqdQ
IPUpJnF/5eylB+zHppk1W/DvuWkBRc9unahpceh8k+ngT/RA34J0uUbjEr5KpdY3e4Dx
hJDj67YFUw12BS+Sw3WR9Hr3uSyfC8/fFG8Y0mPIdRUj4TOBkr30LtINAFHep/QfiEP4
sdfYLvrtvTU4NLMmq+6V0fRkZlrblhSHI7GZ5tVzvEpk9cEoHvfgSUUqoxRCVMvermVV
yqJ3uL/NjMSKohlGdDzk7QmbrS4yMylegPaeOgTL3gNbyiPEsOUKjFx27ogKsFSva7cG
6juQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1783793761; x=1784398561;
h=references:to:cc:in-reply-to:date:subject:mime-version:content-type
:message-id:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=lEZXk8c9kaIF3nTflzlIUQ37KELCSYUGwSBBtfE/fcc=;
b=IX7YlAa+Pz+P984RKqIPvh9VjuVrbWl8ADxAYuUso7tTIOCh0M+RaLFIcAaxD87KsU
JhAzqXHPeF0EMhsL8jba7H/f+jBFl5uDbsfUE9zmzH5A3khFlivbyEDM9KM9sENF0s43
8fWKs9cR3kZuavSjtuSY6KIQmsIhGUjaLoxvV90Ex4htenjfMfpwtow5zqjV3mIH4R37
+whNNhhV5D1GxGLULp0qP07Z6kDXnze6e9zKyFiUCY370k5ddRpOnYgXc68C0AVG6PEJ
UriAGLrVV9q03ltqYQBt7V7Q9XHxo+4upTq2R0JiCTUc7xQRwCkKGhhXte1oz9g6DzxU
RL1w==
X-Forwarded-Encrypted: i=1;
AHgh+Rq3TYeKAVYZc0WVYgyRJ/JA+Y7ZYafI5OFF/f2E28GDJ39ryMfHXR2KzZpnOOpN98dDdhejsw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxNM+1gS2jw9/Bf7x8f2TA2y/Vee0yDDTQI6+TKz/rUoMWK9bYF
r6j/wxRFo6wsK+5Z4KVmN/qOSVHke2+j2x7xC2qn9SVo7pf8PlOI/ljG
X-Gm-Gg: AfdE7cklXnuIn01vTWo2fo3Oe3BkCBV4bcUMxwwTkA7aNxNcG1bTTVL4OQGAO3RlpPC
IOYv/uI0FFsd6aHJvXncrvRYLMwXE9Iy8KqRBgmfjGiQaSrDvKjn1Cfh7EnIQVUYirFIKnRH5UX
h4YeW9AqNhh15JuHKaD6pUZMJgCmUau+DaucU7RC9ORW+8MA/7VfUJn+EgEVWiBlrT3IcWDzdKb
2SFWFa+UpLZP8VC5K03tjHN3RSPnWG4ct1wGED/6h7yXeLDhgqANv9/4pN1y6oTQwXeJzTWTk4P
nOqQR0DZ7Lm/maUryt0WO5Txs8sjhpb0gtdrFoqOKNsQvPiTjsme8fuERGUewRAAmjbLHDMP2yz
HTvjfOZoS+EKXlD78xnmRy2metAjK1LRG2oz8KcgdIsFQt6kkm+DVdgHzRoe+jTXC0V+rMvqMuv
BulOOFEyIZf9TPcWAy2S7VYJJ35hAfHStBYw==
X-Received: by 2002:a17:90b:2692:b0:38d:c834:24cf with SMTP id
98e67ed59e1d1-38dc83427afmr3292825a91.23.1783793760848;
Sat, 11 Jul 2026 11:16:00 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:d548:b67e:110a:7d5])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-311b00048a3sm24125031eec.5.2026.07.11.11.15.59
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Sat, 11 Jul 2026 11:15:59 -0700 (PDT)
From: Yuan Fu <casouri@HIDDEN>
Message-Id: <02A4434E-529F-41B8-A5B5-E8161F657A4E@HIDDEN>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_B226573F-AC93-4296-AA65-2759584B5A08"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
Date: Sat, 11 Jul 2026 11:15:48 -0700
In-Reply-To: <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
<jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Sean Whitton <spwhitton@HIDDEN>,
Bozhidar Batsov <bozhidar@HIDDEN>, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
--Apple-Mail=_B226573F-AC93-4296-AA65-2759584B5A08
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On Jul 6, 2026, at 2:00=E2=80=AFPM, Stefan Monnier =
<monnier@HIDDEN> wrote:
>=20
>> Lua=E2=80=99s block comment stars with =E2=80=94[[, so the line =
comment must match anything
>> that stars with =E2=80=94 but not =E2=80=94[[. That by itself isn=E2=80=
=99t too bad, but Lua=E2=80=99s block
>> comment can also be -[=3D[, and there can be any number of =3D in =
between the
>> two brackets.
>=20
> So that'd be
>=20
> "--\\(?:[^[]\\|\\[=3D*[^=3D[]\\)"
>=20
> It's kindof ugly, admittedly.
> A more general approach would be for the major mode to provide
> a function that returns the comment-end marker that matches the
> comment-starter at point (or maybe return a regexp in case the end can
> take several forms).
> Then instead of matching `comment-start-line-regexp` we'd call this
> function and check whether it returns (or matches) "\n" or
> something else.
Seems my regexp-fu is lacking, because I couldn=E2=80=99t come up with a =
regexp at all. The one you created is not bad at all! And since Sean =
doesn=E2=80=99t like the patch getting more involved (me neither), I =
changed it back and used this regexp. Thanks for the tech support ;)
Yuan
--Apple-Mail=_B226573F-AC93-4296-AA65-2759584B5A08
Content-Disposition: attachment;
filename=line-regexp.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="line-regexp.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=201d818d5e79e828738a6e6f4846b48df94d202e5a=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Wed,=20=
20=20May=202026=2000:00:21=20-0700=0ASubject:=20[PATCH]=20Add=20=
comment-start-line-regexp=20(bug#80837)=0A=0A*=20lisp/newcomment.el=20=
(comment-start-line-regexp):=20New=20variable.=0A*=20=
lisp/progmodes/c-ts-common.el:=0A(c-ts-common-line-comment-start-skip):=20=
New=20variable.=0A(c-ts-common-comment-setup):=0A*=20=
lisp/progmodes/cmake-ts-mode.el=20(cmake-ts-mode):=0A*=20=
lisp/progmodes/dockerfile-ts-mode.el=20(dockerfile-ts-mode):=0A*=20=
lisp/progmodes/elixir-ts-mode.el=20(elixir-ts-mode):=0A*=20=
lisp/progmodes/go-ts-mode.el=20(go-work-ts-mode):=0A*=20=
lisp/progmodes/json-ts-mode.el=20(json-ts-mode):=0A*=20=
lisp/progmodes/lua-ts-mode.el=20(lua-ts-mode):=0A*=20=
lisp/progmodes/python.el=20(python-base-mode):=0A*=20=
lisp/progmodes/ruby-mode.el=20(ruby-base-mode):=0A*=20=
lisp/progmodes/sh-script.el=20(sh-base-mode):=0A*=20=
lisp/textmodes/toml-ts-mode.el=20(toml-ts-mode):=0A*=20=
lisp/textmodes/yaml-ts-mode.el=20(yaml-ts-mode):=20Set=20the=20new=20=
variable.=0A*=20lisp/treesit.el=20(treesit--likely-line-comment-p):=20=
New=20function.=0A(treesit-forward-comment):=20Behave=20differently=20=
for=20line=20and=20block=20comment.=0A---=0A=20doc/emacs/programs.texi=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=206=20++++++=0A=20etc/NEWS=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=206=20++++++=0A=20lisp/newcomment.el=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20|=2011=20+++++++++++=0A=20=
lisp/progmodes/c-ts-common.el=20=20=20=20=20=20=20=20|=20=207=20+++++++=0A=
=20lisp/progmodes/cmake-ts-mode.el=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/dockerfile-ts-mode.el=20|=20=201=20+=0A=20=
lisp/progmodes/elixir-ts-mode.el=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/go-ts-mode.el=20=20=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/json-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/lua-ts-mode.el=20=20=20=20=20=20=20=20|=20=204=20++++=0A=20=
lisp/progmodes/python.el=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/ruby-mode.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/sh-script.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/textmodes/toml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=
=20lisp/textmodes/yaml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/treesit.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20|=2025=20++++++++++++++++++++++---=0A=2016=20files=20changed,=2066=20=
insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20=
a/doc/emacs/programs.texi=20b/doc/emacs/programs.texi=0Aindex=20=
7cf7b2ff96f..a6d1856a5af=20100644=0A---=20a/doc/emacs/programs.texi=0A=
+++=20b/doc/emacs/programs.texi=0A@@=20-1385,6=20+1385,12=20@@=20Options=20=
for=20Comments=0A=20include=20a=20@samp{\}=20in=20the=20string,=20which=20=
is=20needed=20to=20deny=20the=20first=0A=20star=20its=20special=20=
meaning=20in=20regexp=20syntax.=20=20@xref{Regexp=20Backslash}.)=0A=20=0A=
+@vindex=20comment-start-line-regexp=0A+=20=20Modes=20that=20support=20=
both=20line=20and=20block=20comments=20should=20also=20set=0A=
+@code{comment-start-line-regexp}=20to=20a=20regexp=20that=20matches=20=
only=20line=0A+comment=20starters.=20=20This=20Emacs=20distinguish=20=
between=20the=20two=20kinds=20of=0A+comments.=0A+=0A=20@vindex=20=
comment-start=0A=20@vindex=20comment-end=0A=20=20=20When=20a=20comment=20=
command=20makes=20a=20new=20comment,=20it=20inserts=20the=20value=20of=0A=
diff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20=
4609e9b6910..8e6655e9b54=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A=
@@=20-4638,6=20+4638,12=20@@=20concise=20way=20to=20update=20a=20=
symbol's=20'find-function-type-alist'=20property.=0A=20It=20can=20set=20=
comment-related=20variables=20such=20as=20'comment-start'=0A=20depending=20=
on=20the=20language=20under=20point.=0A=20=0A++++=0A+**=20New=20variable=20=
'comment-start-line-regexp'.=0A+Regexp=20matching=20the=20start=20of=20a=20=
line=20comment,=20as=20opposed=20to=20a=20block=0A+comment.=20=20Modes=20=
that=20support=20both=20line=20and=20block=20comments=20should=20set=0A=
+this=20so=20callers=20can=20distinguish=20the=20two.=0A+=0A=20+++=0A=20=
**=20'inhibit-message'=20can=20now=20inhibit=20clearing=20of=20the=20=
echo=20area.=0A=20Binding=20'inhibit-message'=20to=20a=20non-nil=20value=20=
will=20now=20suppress=20both=0Adiff=20--git=20a/lisp/newcomment.el=20=
b/lisp/newcomment.el=0Aindex=201f8a38b586e..76e23d29ecd=20100644=0A---=20=
a/lisp/newcomment.el=0A+++=20b/lisp/newcomment.el=0A@@=20-128,6=20=
+128,17=20@@=20comment-start-skip=0A=20;;;###autoload=0A=20(put=20=
'comment-start-skip=20'safe-local-variable=20'stringp)=0A=20=0A=
+;;;###autoload=0A+(defvar=20comment-start-line-regexp=20nil=0A+=20=20=
"Regexp=20matching=20the=20start=20of=20a=20line=20comment=20plus=20=
everything=20up=20to=20its=20body.=0A+=0A+Unlike=20`comment-start-skip',=20=
which=20matches=20the=20start=20of=20any=20comment,=0A+this=20regexp=20=
only=20matches=20start=20of=20line=20comments=20(as=20opposed=20to=20=
block=0A+comments).=20=20Combined,=20these=20two=20regexp=20can=20=
distinguish=20between=20line=0A+and=20block=20comments.")=0A=
+;;;###autoload=0A+(put=20'comment-start-line-regexp=20=
'safe-local-variable=20'stringp)=0A+=0A=20;;;###autoload=0A=20(defvar=20=
comment-end-skip=20nil=0A=20=20=20"Regexp=20to=20match=20the=20end=20of=20=
a=20comment=20plus=20everything=20back=20to=20its=20body.")=0Adiff=20=
--git=20a/lisp/progmodes/c-ts-common.el=20=
b/lisp/progmodes/c-ts-common.el=0Aindex=20d5e6b012fe7..d01cc41a2dc=20=
100644=0A---=20a/lisp/progmodes/c-ts-common.el=0A+++=20=
b/lisp/progmodes/c-ts-common.el=0A@@=20-60,6=20+60,11=20@@=20=
c-ts-common-comment-start-skip=0A=20=20=20=20=20=20=20(*=20(syntax=20=
whitespace)))=0A=20=20=20"The=20`comment-start-skip'=20used=20by=20=
`c-ts-common-comment-setup'.")=0A=20=0A+(defvar=20=
c-ts-common-line-comment-start-skip=0A+=20=20(rx=20(seq=20"/"=20(+=20=
"/"))=0A+=20=20=20=20=20=20(*=20(syntax=20whitespace)))=0A+=20=20"The=20=
`comment-start-skip'=20used=20by=20`c-ts-common-comment-setup'.")=0A+=0A=20=
(defun=20c-ts-common-looking-at-star=20(_n=20_p=20bol=20&rest=20_)=0A=20=20=
=20"A=20tree-sitter=20simple=20indent=20matcher.=0A=20Matches=20if=20=
there=20is=20a=20\"*\"=20after=20BOL."=0A@@=20-287,6=20+292,7=20@@=20=
c-ts-common-comment-setup=0A=20=20-=20`comment-start'=0A=20=20-=20=
`comment-end'=0A=20=20-=20`comment-start-skip'=0A+=20-=20=
`comment-start-line-regexp'=0A=20=20-=20`comment-end-skip'=0A=20=20-=20=
`adaptive-fill-mode'=0A=20=20-=20`adaptive-fill-first-line-regexp'=0A@@=20=
-298,6=20+304,7=20@@=20c-ts-common-comment-setup=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=
=20=20(setq-local=20comment-start-skip=20c-ts-common-comment-start-skip)=0A=
+=20=20(setq-local=20comment-start-line-regexp=20=
c-ts-common-line-comment-start-skip)=0A=20=20=20(setq-local=20=
comment-end-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx=20(*=20=
(syntax=20whitespace))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(group=20(or=20(syntax=20comment-end)=0Adiff=20--git=20=
a/lisp/progmodes/cmake-ts-mode.el=20b/lisp/progmodes/cmake-ts-mode.el=0A=
index=206abd92b5e1a..678f3b09678=20100644=0A---=20=
a/lisp/progmodes/cmake-ts-mode.el=0A+++=20=
b/lisp/progmodes/cmake-ts-mode.el=0A@@=20-229,6=20+229,7=20@@=20=
cmake-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20=20=
=20(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=0A=
=20=20=20=20=20;;=20Defuns.=0A=20=20=20=20=20(setq-local=20=
treesit-defun-type-regexp=20(rx=20(or=20"function"=20"macro")=0Adiff=20=
--git=20a/lisp/progmodes/dockerfile-ts-mode.el=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0Aindex=20=
b97ec89b99a..551bd1bcaee=20100644=0A---=20=
a/lisp/progmodes/dockerfile-ts-mode.el=0A+++=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0A@@=20-176,6=20+176,7=20@@=20=
dockerfile-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"#"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Imenu.=0A=20=20=20=20=20=
(setq-local=20treesit-simple-imenu-settings=0Adiff=20--git=20=
a/lisp/progmodes/elixir-ts-mode.el=20b/lisp/progmodes/elixir-ts-mode.el=0A=
index=209bda7f0046f..b040113b3dc=20100644=0A---=20=
a/lisp/progmodes/elixir-ts-mode.el=0A+++=20=
b/lisp/progmodes/elixir-ts-mode.el=0A@@=20-724,6=20+724,7=20@@=20=
elixir-ts-mode=0A=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=20=20=
(setq-local=20comment-start-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20comment-end=20"")=0A=20=20=20(setq-local=20=
comment-end-skip=0Adiff=20--git=20a/lisp/progmodes/go-ts-mode.el=20=
b/lisp/progmodes/go-ts-mode.el=0Aindex=208de6d0e0700..d7563c3bbf6=20=
100644=0A---=20a/lisp/progmodes/go-ts-mode.el=0A+++=20=
b/lisp/progmodes/go-ts-mode.el=0A@@=20-725,6=20+725,7=20@@=20=
go-work-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"//=20")=0A=
=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"//"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20=
(setq-local=20indent-tabs-mode=20t=0Adiff=20--git=20=
a/lisp/progmodes/json-ts-mode.el=20b/lisp/progmodes/json-ts-mode.el=0A=
index=209575eaf6cf0..b2ffccecd76=20100644=0A---=20=
a/lisp/progmodes/json-ts-mode.el=0A+++=20=
b/lisp/progmodes/json-ts-mode.el=0A@@=20-198,6=20+198,7=20@@=20=
json-ts-mode=0A=20=20=20;;=20Comments.=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-start-skip=20=
"\\(?://+\\|/\\*+\\)\\s=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20"//+\\s=20*")=0A=20=20=20(setq-local=20=
comment-end=20"")=0A=20=0A=20=20=20;;=20Electric=0Adiff=20--git=20=
a/lisp/progmodes/lua-ts-mode.el=20b/lisp/progmodes/lua-ts-mode.el=0A=
index=202963d5a96af..a9666c97788=20100644=0A---=20=
a/lisp/progmodes/lua-ts-mode.el=0A+++=20b/lisp/progmodes/lua-ts-mode.el=0A=
@@=20-683,6=20+683,10=20@@=20lua-ts-mode=0A=20=20=20=20=20;;=20Comments.=0A=
=20=20=20=20=20(setq-local=20comment-start=20"--")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20"--\\s-*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(rx=20(seq=20"--"=20(or=20(not=20(any=20"["))=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=20=
=20=20(seq=20"["=20(zero-or-more=20"=3D")=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=20=20=20=20=
=20=20=20=20(not=20(any=20"=3D[")))))))=0A=20=20=20=20=20(setq-local=20=
comment-end=20"")=0A=20=0A=20=20=20=20=20;;=20Pairs.=0Adiff=20--git=20=
a/lisp/progmodes/python.el=20b/lisp/progmodes/python.el=0Aindex=20=
86336979067..848b2c54d25=20100644=0A---=20a/lisp/progmodes/python.el=0A=
+++=20b/lisp/progmodes/python.el=0A@@=20-7343,6=20+7343,7=20@@=20=
python-base-mode=0A=20=0A=20=20=20(setq-local=20comment-start=20"#=20")=0A=
=20=20=20(setq-local=20comment-start-skip=20"#+\\s-*")=0A+=20=20=
(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=
=20=20(setq-local=20parse-sexp-lookup-properties=20t)=0A=20=20=20=
(setq-local=20parse-sexp-ignore-comments=20t)=0Adiff=20--git=20=
a/lisp/progmodes/ruby-mode.el=20b/lisp/progmodes/ruby-mode.el=0Aindex=20=
f2e38e0af46..ff33f0554ba=20100644=0A---=20a/lisp/progmodes/ruby-mode.el=0A=
+++=20b/lisp/progmodes/ruby-mode.el=0A@@=20-2693,6=20+2693,7=20@@=20=
ruby-base-mode=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=
(setq-local=20comment-column=20ruby-comment-column)=0A=20=20=20=
(setq-local=20comment-start-skip=20"#+=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20parse-sexp-ignore-comments=20t)=0A=20=20=20(setq-local=20=
parse-sexp-lookup-properties=20t)=0Adiff=20--git=20=
a/lisp/progmodes/sh-script.el=20b/lisp/progmodes/sh-script.el=0Aindex=20=
4d025eeb18d..0bcd8984354=20100644=0A---=20a/lisp/progmodes/sh-script.el=0A=
+++=20b/lisp/progmodes/sh-script.el=0A@@=20-1475,6=20+1475,7=20@@=20=
sh-base-mode=0A=20=20=20(setq-local=20paragraph-separate=20(concat=20=
paragraph-start=20"\\|#!/"))=0A=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20(setq-local=20comment-start-skip=20"#+[\t=20]*")=0A+=20=20=
(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=20=20=
(setq-local=20local-abbrev-table=20sh-mode-abbrev-table)=0A=20=20=20=
(setq-local=20comint-dynamic-complete-functions=0A=20=09=20=20=20=20=20=20=
sh-dynamic-complete-functions)=0Adiff=20--git=20=
a/lisp/textmodes/toml-ts-mode.el=20b/lisp/textmodes/toml-ts-mode.el=0A=
index=2063e3f60edd9..b121d8917d1=20100644=0A---=20=
a/lisp/textmodes/toml-ts-mode.el=0A+++=20=
b/lisp/textmodes/toml-ts-mode.el=0A@@=20-146,6=20+146,7=20@@=20=
toml-ts-mode=0A=20=20=20=20=20;;=20Comments=0A=20=20=20=20=20(setq-local=20=
comment-start=20"#=20")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=
+=20=20=20=20(setq-local=20comment-start-line-regexp=20"#+=20*")=0A=20=0A=
=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20(setq-local=20=
treesit-simple-indent-rules=20toml-ts-mode--indent-rules)=0Adiff=20--git=20=
a/lisp/textmodes/yaml-ts-mode.el=20b/lisp/textmodes/yaml-ts-mode.el=0A=
index=205afd4d2d111..bab0ba94c8c=20100644=0A---=20=
a/lisp/textmodes/yaml-ts-mode.el=0A+++=20=
b/lisp/textmodes/yaml-ts-mode.el=0A@@=20-271,6=20+271,7=20@@=20=
yaml-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20"#+=20*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=20=20=
;;=20Indentation.=0A=20=20=20=20=20(setq-local=20indent-tabs-mode=20nil)=0A=
diff=20--git=20a/lisp/treesit.el=20b/lisp/treesit.el=0Aindex=20=
5cef42ef454..d74ae311f98=20100644=0A---=20a/lisp/treesit.el=0A+++=20=
b/lisp/treesit.el=0A@@=20-3764,17=20+3764,36=20@@=20=
treesit-forward-sentence=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(max=20(point-min)=20=
(previous-single-char-property-change=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=20=20=20=20=20=
=20=20=20=20(point)=20'treesit-parser)))))))=0A=20=0A-(defun=20=
treesit-forward-comment=20(&optional=20count)=0A+(defun=20=
treesit--likely-line-comment-p=20(node)=0A+=20=20"Return=20non-nil=20if=20=
NODE=20is=20likely=20a=20line=20comment."=0A+=20=20(save-excursion=0A+=20=
=20=20=20(goto-char=20(treesit-node-start=20node))=0A+=20=20=20=20(if=20=
comment-start-line-regexp=0A+=20=20=20=20=20=20=20=20(looking-at-p=20=
comment-start-line-regexp)=0A+=20=20=20=20=20=20;;=20Heuristic:=20=
usually=20`comment-start'=20is=20set=20to=20the=20line=20comment=0A+=20=20=
=20=20=20=20;;=20start.=0A+=20=20=20=20=20=20(looking-at-p=20=
(string-trim-right=20comment-start)))))=0A+=0A+(defun=20=
treesit-forward-comment=20(count)=0A=20=20=20"Tree-sitter=20=
`forward-comment-function'=20implementation.=0A=20=0A=20COUNT=20is=20the=20=
same=20as=20in=20`forward-comment'."=0A-=20=20(let=20((res=20t)=20thing)=0A=
+=20=20(let=20((res=20t)=20thing=20line-comment-p)=0A=20=20=20=20=20=
(while=20(>=20count=200)=0A=20=20=20=20=20=20=20(skip-chars-forward=20"=20=
\t\n")=0A=20=20=20=20=20=20=20(setq=20thing=20(treesit-thing-at=20=
(point)=20'comment))=0A+=20=20=20=20=20=20(setq=20line-comment-p=20(and=20=
thing=20(treesit--likely-line-comment-p=20thing)))=0A=20=20=20=20=20=20=20=
(if=20(and=20thing=20(eq=20(point)=20(treesit-node-start=20thing)))=0A=20=
=20=20=20=20=20=20=20=20=20=20(progn=0A-=20=20=20=20=20=20=20=20=20=20=20=
=20(goto-char=20(min=20(1+=20(treesit-node-end=20thing))=20(point-max)))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(min=20=
(treesit-node-end=20thing)=20(point-max)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20;;=20For=20line=20comments,=20go=20to=20the=20next=20line.=20=20=
This=20is=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20important=20=
because=20a)=20for=20navigation=20convenience,=20and=20b)=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20;;=20many=20functions=20expect=20=
`forward-comment'=20to=20behave=20this=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20;;=20way=20(bug#80837).=0A+=20=20=20=20=20=20=20=20=20=20=20=20(when=20=
line-comment-p=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(skip-chars-forward=20"=20\t")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(when=20(looking-at=20"\n")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(forward-char)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20=
count=20(1-=20count)))=0A=20=20=20=20=20=20=20=20=20(setq=20count=200=20=
res=20nil)))=0A=20=20=20=20=20(while=20(<=20count=200)=0A--=20=0A2.39.5=20=
(Apple=20Git-154)=0A=0A=
--Apple-Mail=_B226573F-AC93-4296-AA65-2759584B5A08
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
--Apple-Mail=_B226573F-AC93-4296-AA65-2759584B5A08--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 6 Jul 2026 21:00:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 06 17:00:46 2026
Received: from localhost ([127.0.0.1]:56430 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wgqQn-0002XX-KC
for submit <at> debbugs.gnu.org; Mon, 06 Jul 2026 17:00:46 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60355)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
id 1wgqQj-0002WH-2s
for 80837 <at> debbugs.gnu.org; Mon, 06 Jul 2026 17:00:42 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5897A80932;
Mon, 06 Jul 2026 17:00:34 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
s=mail; t=1783371633;
bh=/smjkTupOAQZERnfqy1EC0E6llV/gvznPkLWazmW1QQ=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=VTbtoAglkjk2D4dU7AQRQogaeP639ccEmSaeMCkHZlTSnyxdhUFMe+I6BEhoR/KOD
Y3toD4YJVVd3wzmqvx+i033JlyCg9JX4nTSeKWAiW0UyBy7j3BdqmZvklkO9lBHVFI
RupwFrCEvwZk+tz4xyAbrpYJV7q4SW8oTHzN05XG/KH2N8N9tq3w2AKVGwJPr5dIUe
8viBQb26fjkSxIn27TRuaqgQRhpqJo4of/D8FTOBEq2CTj1QL1ZnKF6/7usxANV99u
31WZJlXxb0QGiCVJN5IoCwucKhdg/IqFktDG5cZba/h690xUbSVZ+qgH6qv/F+6fMh
ttJKXBdFw+PTg==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8E07E80644;
Mon, 06 Jul 2026 17:00:33 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6EEF112022E;
Mon, 6 Jul 2026 17:00:33 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
Message-ID: <jwv8q7nrg9c.fsf-monnier+emacs@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
<8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
Date: Mon, 06 Jul 2026 17:00:32 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results: 0
ALL_TRUSTED -1 Passed through trusted hosts only via SMTP
AWL 0.202 Adjusted score from AWL reputation of From: address
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DKIM_SIGNED 0.1 Message has a DKIM or DK signature,
not necessarily valid
DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
domain
DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
domain
X-SPAM-LEVEL:
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Sean Whitton <spwhitton@HIDDEN>,
Bozhidar Batsov <bozhidar@HIDDEN>, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> Lua=E2=80=99s block comment stars with =E2=80=94[[, so the line comment m=
ust match anything
> that stars with =E2=80=94 but not =E2=80=94[[. That by itself isn=E2=80=
=99t too bad, but Lua=E2=80=99s block
> comment can also be -[=3D[, and there can be any number of =3D in between=
the
> two brackets.
So that'd be
"--\\(?:[^[]\\|\\[=3D*[^=3D[]\\)"
It's kindof ugly, admittedly.
A more general approach would be for the major mode to provide
a function that returns the comment-end marker that matches the
comment-starter at point (or maybe return a regexp in case the end can
take several forms).
Then instead of matching `comment-start-line-regexp` we'd call this
function and check whether it returns (or matches) "\n" or
something else.
=3D=3D=3D Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 6 Jul 2026 15:29:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 06 11:29:36 2026 Received: from localhost ([127.0.0.1]:54739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wglGI-0000Zn-Ef for submit <at> debbugs.gnu.org; Mon, 06 Jul 2026 11:29:35 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]:40756) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wglGE-0000Y0-JU for 80837 <at> debbugs.gnu.org; Mon, 06 Jul 2026 11:29:32 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4gv7Z85HJWzKrrB; Mon, 06 Jul 2026 17:29:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1783351760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6xzQ5kAbMNoKkjEySNuK9NudtZBtWa9GiV0RACVCPCc=; b=Fh35iMqpjnjDyN//X+loA8fM+Ck3N47W/9fgJ5by5tgl7TMUgxFGMjGrIp/PuGPkDQWY/f yK2Q0b+8VUr6UUBY2/ywMZzG0wP1Gdz5XKJvY8ol3paAxgiYmJgU6IZILs2/6Y0+aFZKjZ MbJ/6dFWtVFEiTMTIdiiOcgmAQBdQw6bADx1aJAVaSx1AAIvD7daScHg04aR69ZqczZ5m7 PNmvX/mV4sTzCtlHCl+1FT89lZo76kMkK0G09/ZRMUSwYcJX6tJQndrVcRJghLLnHqOSgp lnJEzvOae7WbLmmb+KDoSLiHRQMrBQb/MxbpJP+1QcwqLoUaGTJv5toglgQ8Kw== From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> Date: Mon, 06 Jul 2026 18:20:19 +0300 Message-ID: <874iictaz4.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) >> --[[ >> This is a >> comment block. >> ]] > > Actually, looking at Lua’s block comment carefully, it’s really hard to > write a “line comment only” regexp. So I had to extend > comment-start-line-regexp to accept the (not BLOCK-COMMEN-REGEXP) > form. Given the narrow focus of comment-start-line-regexp, I hope that’s > fine. Maybe more clear would be to add a new variable, e.g. 'comment-start-block-regexp' in addition to 'comment-start-line-regexp'.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 6 Jul 2026 13:00:35 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 06 09:00:35 2026 Received: from localhost ([127.0.0.1]:53199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wgiw7-0001Ag-1x for submit <at> debbugs.gnu.org; Mon, 06 Jul 2026 09:00:35 -0400 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]:34617) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wgiw4-0001A5-Ke for 80837 <at> debbugs.gnu.org; Mon, 06 Jul 2026 09:00:33 -0400 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 2EF8B1D0011A; Mon, 6 Jul 2026 09:00:27 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Mon, 06 Jul 2026 09:00:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1783342827; x=1783429227; bh=k8AiY4MVxKLU8Y1BsXF7AHbYa/e2Asxs yTg6U6TODUw=; b=R25d7InrIphYlIWeV8Auy3PGHGzsr+M2cBu+GI496gFfNCGs wuLD6txtUFRKwcCH6JQH/CXFKLEuXEnNVSyMHNzylMPQZTO9cmudmnJbH5MOtaQf mkt9Anp5TYFwzKLb/80Nc1e4u6oSnR1FY8CpsXeut+RhMHZT7M1vRJtF7OsOGeFd 6m587H0JQHGnTYAFdx1MZMr1FQ5IqwnMXv96kKKhBDHkaYeqLUCudqe3NHYsmXRO icKHcoYhnpSYIDwxLii2aCqcr32Wr1/VU71obQMr/Ogn4SN4Tr78/qsnukYak38A h6RAVKlOCifHK479Ke+1pl01HzCEEmn3zppJMA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1783342827; x= 1783429227; bh=k8AiY4MVxKLU8Y1BsXF7AHbYa/e2AsxsyTg6U6TODUw=; b=W 6v6XPMmN3TY2g3mSx4T4GkHQE0W5ES6wnJc9s5lxhOEIDjWdliktOU9LPcjnRR4j Btx48ZJblEmi0JIa6c1GUiJ2K8ux9Ka7Wk0Um9PO56ul6OzA5Lj24WvCORT3RMpX l+hD1j3C9gDPbEMeY1T76TM0Kll7kd/ZMHmmMxXCR+aWVGrONbRjfoMlrpDHPiVN DJUSuX0AYzShHYrw3MGnQvvWAHXsLfjnjnbdOLc1aYqn0jd+eyC4T0mOCadIPFg3 aDJ0SUycCxO2DNbi08xyKh87cp5Ujd1weJBGadxZh+HpyP7Y+tVFwjGRaqdmjoMn foBmgdORHRq7pRx70x/mw== X-ME-Sender: <xms:6qZLamiFudxw-pjLnc7iWSno1G2FVcMFSxkfCkPbwFJkq7miXgWXnA> <xme:6qZLaohnWlpSJp_7nEBtxRb96Ifx10a2Sav6lb4L1ZFZaOhodsYjPmJ1A8SlylfyX 9S5AfVy0wc2xMY6Re6JLmgNeRzpOK5O0ANhjCdo3hZKHj_7FwR9FyeT> X-ME-Received: <xmr:6qZLauIB-Eck2JdkvmbCK2_8Af201EZ8EtCliXVjbjaQsmWbmSTKnYd9y0a5FPrBc7SlMGQ9qpWl> X-ME-Proxy-Cause: dmFkZTE+n0aIEDmCRGgSkyw/3lAsBwf94pCAxdxBuKTGkgq9hZfYPCz8dovxt366K/uU7/ cmGW6TAuj9UY6DAFMecRCcw3Uwpxbv3e0nEIldEX01UmlOeDNhhGPR2i8HvdnBUSGYCDOg 01n435Lhy3mdzPjBdaw72l0clFsIS6u7RqX7sOxWEZAFU2z0p+omIvBoMZok3E+O3sgW6p q+tO+hE3BDQ+IiZwZXt5mo9cuDSHrvV7LCizYjdx9zYIYs0XQGH4q1y0d3/j/hG4vx8oA3 uVoB8CC1D7h9xVZcM+sbsUCF083VxlOHZLmbJE5ThAMltXh6FCxLRq1VNMo7uuVSXig4Qo 3x5M01w3k54u2eAQ4TaZ1L0VmMyb35T5yh56Ud6QCRND3K4XugrKuE8Dcok0aCAk9AuxCc g0auhhXffbkaF/MBXQ9q+o06Toof9tXZd1zN9Vd4SqZUFH9XDI++h6NcHK27+Hrs+VHNm9 W2LA7V70x1OE236rbq1dA3bvfKcFlpbeuLARC+nkJhE4H7iKy1JW2aIfmyRPermzC+szXc s7+u9P1BKA+XtpIZeG2Aip8mx9LO12yuoDD0HI3yK693uHOX1zPyUAEkMeJIWyNmyZgcdE G9qikO6jLxdclF6RywLfXXdCSCxc92+thfG2fFuyFsavyCHsX8HcNbGaCSXw X-ME-Proxy: <xmx:6qZLavEynjLe7PK7sy4JMozH3sqSvcH27oITWyVILSvNbXYdKiI57Q> <xmx:6qZLaqR-hfkHtK7gzB3VxI_AcN6G8kGaBnpmWIH32wdNtMhTNh05JA> <xmx:6qZLajeFPxwKPdGBJK4AmmcMCP6flr42Z6XZe8kHn0l-rnt2brF23Q> <xmx:6qZLahp9MuIzPqAJ8D9qHe36P61GAFaAY4Mg2W-95pdfzQgBhJZLxw> <xmx:66ZLam1RRuKr52J4L7ukOs3BulHSMuH6mJvyeeYJ_B3B-uz5HdUY-el7> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Jul 2026 09:00:26 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id 756657E6A5C; Mon, 06 Jul 2026 14:00:25 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Yuan Fu <casouri@HIDDEN>, Juri Linkov <juri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> <87jyrbgbj0.fsf@HIDDEN> <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN> Date: Mon, 06 Jul 2026 14:00:25 +0100 Message-ID: <877bn88e8m.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Yuan Fu [06/Jul 12:56am -07] wrote: >> On Jul 3, 2026, at 11:42=E2=80=AFAM, Juri Linkov <juri@HIDDEN> wrote: >> >>> Cool, here=E2=80=99s the patch. I didn=E2=80=99t try to make use of th= is new variable >>> in newcomment.el. Only tree-sitter uses it right now. >> >> Shouldn't this patch be pushed to the release branch? >> Because currently uncomment-region is broken in c-ts-mode >> in Emacs 31. > > Right, let me address your comments first: > >> Would it be safer to use 'looking-at-p' here? >> > Changed to that. > >> Looking at e.g. test/lisp/progmodes/lua-ts-mode-resources/hide-show.lua >> we can see an example of block comments that will be matched >> by the line comment regex above: >> >> --[[ >> This is a >> comment block. >> ]] > > Actually, looking at Lua=E2=80=99s block comment carefully, it=E2=80=99s = really hard > to write a =E2=80=9Cline comment only=E2=80=9D regexp. So I had to extend > comment-start-line-regexp to accept the (not BLOCK-COMMEN-REGEXP) > form. Given the narrow focus of comment-start-line-regexp, I hope > that=E2=80=99s fine. > > Lua=E2=80=99s block comment stars with =E2=80=94[[, so the line comment m= ust match > anything that stars with =E2=80=94 but not =E2=80=94[[. That by itself is= n=E2=80=99t too bad, > but Lua=E2=80=99s block comment can also be -[=3D[, and there can be any = number > of =3D in between the two brackets. Your patch is now very involved. Can you come up with a hotfix for c-ts-mode on the release branch, perhaps, and leave the more general fix for master? --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 6 Jul 2026 07:56:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 06 03:56:42 2026
Received: from localhost ([127.0.0.1]:51200 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wgeC1-0003bU-RR
for submit <at> debbugs.gnu.org; Mon, 06 Jul 2026 03:56:42 -0400
Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:50312)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wgeBz-0003Zw-AU
for 80837 <at> debbugs.gnu.org; Mon, 06 Jul 2026 03:56:40 -0400
Received: by mail-pg1-x532.google.com with SMTP id
41be03b00d2f7-c9e2489e117so1396851a12.0
for <80837 <at> debbugs.gnu.org>; Mon, 06 Jul 2026 00:56:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1783324593; x=1783929393; 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=vIKP0eCuDr1mR4uFqxIEwqI+9FZtosn0+YFKJYUjitk=;
b=CMBo/sdBxjUAs5KMFQ3QQxnODYQUnKVXUSdc2IWBs8lpVGsP9GTZpDhCPwgkTwd0ai
/3SUhVbhy10H3Jz1onPZU5KrUDPguff0cF1GycRTVIx6OuTZOTgdWINVUmec1HC53xwQ
pEKwFtYNbTSPhWmQQpV5DsZRdwoUBnSm/t953oXzBsB872yQzyyKQe4TVt3pZF6ccWUy
6O/3hilVot8e+7yfy0xG9rlclbThrXPdxQ1nbATmfTH3vM+slyz15KV8gV4Yg3YynHp0
IVo3laVswUfnovbFbmgsxtgxARX58OxAjpkYrZBAMjYAI1x2FuO0YwkDbb0/jwuHJ53G
+Piw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1783324593; x=1783929393;
h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=vIKP0eCuDr1mR4uFqxIEwqI+9FZtosn0+YFKJYUjitk=;
b=pL5IncZIuH4xwXpn1bU4N8iqnqpVSLj3MPbSh9obthEdKeDa4Otqlsdraiarez/7FZ
TZDJRFP0qTM8IBTqLchlbxVAOjTfXb4AMLmf9co3Su0iv9pkS9OsP7FJgrstr4w0k50F
0ouYMtQFr5YTfYlAdOfOfgLwL1AoQi2pAbuaD0w0ozZzSq7lQsBtsdh5feRD46rm8CDz
CeFabBSlo+WfyU0e6c+iA3GGY8bwnwzJp7a/tUW4a4l73Pa9JiXI9MEXclnI9s4ONt9v
sw97/Hi0WuNCZc+dxGaaUJSpEOLW8N1RAGOJQx2CHJk9mUGEUHtGJJEg/KGStUrtMCb/
qqkg==
X-Forwarded-Encrypted: i=1;
AHgh+RoBvpOD3FGQrDfHdlWBnYP8XtOOSXMAObVuT+nPvDnSL5xo6T1yCW0MTksGrzWT+k8mv+Fqeg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Ywn0KocuiYeLmVnMDxS0PebmXrHJOM0omuvD1q6013YTPLNyw2P
I7xq6rRW8/mOSQJXLqGwJs+eOB2lE6b0HRBKVhjTx5r0ohE6LufM5yRR
X-Gm-Gg: AfdE7cn5uWuiUuQ2oVuSBgO3rF3u7vqQSPfzmH/+mQOvhJREBFVFsNcbTZdHKLRB31V
aErpmM95G75SI+tXz+A1WIDpgu+FQYP2Q34w4kasoghdCT424K4Wb/EOxjfrZzfGoYEOph1YoUU
v5aHU1Ekr2BuGS46RHT4iwRgpj5vQPamn00WbfJ1x/sVYPu5NY/lJYM9k3uktapcF8/4YT80cr6
zNrFfDKpToWAVFn7wtM/UBd7UZzPpO37WOZSI4QuHqAM7MGiWYmJye69PqzXbHI+ZYjxjCoVEw6
hirPILQ1f983iHe2aPqhR9oWcoPnbtBaEUSzecJ666vCgSPKwy0fnsx9zgIGn31/sVVaUtQp7Mv
nI2J2WR6lIY621OVy9Xj+xqq7cF1GKTa42uHtjZ5PPgTFM+Cr6TeaiWsyO91qkdWnftdm65Qnps
3wAQSzrgwKFfGgUL6a0CyIHNGXE+oHNOIewQ==
X-Received: by 2002:a05:6300:49:b0:3bf:8de9:c647 with SMTP id
adf61e73a8af0-3c03de3060amr10088492637.0.1783324592911;
Mon, 06 Jul 2026 00:56:32 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c688:3880:d548:b67e:110a:7d5])
by smtp.gmail.com with ESMTPSA id
41be03b00d2f7-c9e92b81be9sm5747969a12.30.2026.07.06.00.56.30
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Mon, 06 Jul 2026 00:56:31 -0700 (PDT)
From: Yuan Fu <casouri@HIDDEN>
Message-Id: <8D876121-B6A9-4AF6-BE56-E3F7F58F845F@HIDDEN>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_3B7F1AD7-B621-4EB1-B79C-2E505B0295CB"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
Date: Mon, 6 Jul 2026 00:56:20 -0700
In-Reply-To: <87jyrbgbj0.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
<2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
<87jyrbgbj0.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>,
Stefan Monnier <monnier@HIDDEN>,
Sean Whitton <spwhitton@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
--Apple-Mail=_3B7F1AD7-B621-4EB1-B79C-2E505B0295CB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On Jul 3, 2026, at 11:42=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>> Cool, here=E2=80=99s the patch. I didn=E2=80=99t try to make use of =
this new variable
>> in newcomment.el. Only tree-sitter uses it right now.
>=20
> Shouldn't this patch be pushed to the release branch?
> Because currently uncomment-region is broken in c-ts-mode
> in Emacs 31.
Right, let me address your comments first:
> Would it be safer to use 'looking-at-p' here?
>=20
Changed to that.
> Looking at e.g. =
test/lisp/progmodes/lua-ts-mode-resources/hide-show.lua
> we can see an example of block comments that will be matched
> by the line comment regex above:
>=20
> --[[
> This is a
> comment block.
> ]]
Actually, looking at Lua=E2=80=99s block comment carefully, it=E2=80=99s =
really hard to write a =E2=80=9Cline comment only=E2=80=9D regexp. So I =
had to extend comment-start-line-regexp to accept the (not =
BLOCK-COMMEN-REGEXP) form. Given the narrow focus of =
comment-start-line-regexp, I hope that=E2=80=99s fine.
Lua=E2=80=99s block comment stars with =E2=80=94[[, so the line comment =
must match anything that stars with =E2=80=94 but not =E2=80=94[[. That =
by itself isn=E2=80=99t too bad, but Lua=E2=80=99s block comment can =
also be -[=3D[, and there can be any number of =3D in between the two =
brackets.
Yuan
--Apple-Mail=_3B7F1AD7-B621-4EB1-B79C-2E505B0295CB
Content-Disposition: attachment;
filename=line-regexp.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="line-regexp.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=205b7691f9d32c08901b10e257b1397a4d82011b70=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Wed,=20=
20=20May=202026=2000:00:21=20-0700=0ASubject:=20[PATCH]=20Add=20=
comment-start-line-regexp=20(bug#80837)=0A=0A*=20lisp/newcomment.el=20=
(comment-start-line-regexp):=20New=20variable.=0A*=20=
lisp/progmodes/c-ts-common.el:=0A(c-ts-common-line-comment-start-skip):=20=
New=20variable.=0A(c-ts-common-comment-setup):=0A*=20=
lisp/progmodes/cmake-ts-mode.el=20(cmake-ts-mode):=0A*=20=
lisp/progmodes/dockerfile-ts-mode.el=20(dockerfile-ts-mode):=0A*=20=
lisp/progmodes/elixir-ts-mode.el=20(elixir-ts-mode):=0A*=20=
lisp/progmodes/go-ts-mode.el=20(go-work-ts-mode):=0A*=20=
lisp/progmodes/json-ts-mode.el=20(json-ts-mode):=0A*=20=
lisp/progmodes/lua-ts-mode.el=20(lua-ts-mode):=0A*=20=
lisp/progmodes/python.el=20(python-base-mode):=0A*=20=
lisp/progmodes/ruby-mode.el=20(ruby-base-mode):=0A*=20=
lisp/progmodes/sh-script.el=20(sh-base-mode):=0A*=20=
lisp/textmodes/toml-ts-mode.el=20(toml-ts-mode):=0A*=20=
lisp/textmodes/yaml-ts-mode.el=20(yaml-ts-mode):=20Set=20the=20new=20=
variable.=0A*=20lisp/treesit.el=20(treesit--likely-line-comment-p):=20=
New=20function.=0A(treesit-forward-comment):=20Behave=20differently=20=
for=20line=20and=20block=20comment.=0A---=0A=20doc/emacs/programs.texi=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20|=2010=20++++++++++=0A=20etc/NEWS=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=206=20++++++=0A=20lisp/newcomment.el=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20|=2021=20+++++++++++++++++++++=0A=20=
lisp/progmodes/c-ts-common.el=20=20=20=20=20=20=20=20|=20=207=20+++++++=0A=
=20lisp/progmodes/cmake-ts-mode.el=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/dockerfile-ts-mode.el=20|=20=201=20+=0A=20=
lisp/progmodes/elixir-ts-mode.el=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/go-ts-mode.el=20=20=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/json-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/lua-ts-mode.el=20=20=20=20=20=20=20=20|=20=202=20++=0A=20=
lisp/progmodes/python.el=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/ruby-mode.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/sh-script.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/textmodes/toml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=
=20lisp/textmodes/yaml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/treesit.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20|=2027=20++++++++++++++++++++++++---=0A=2016=20files=20changed,=20=
80=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20=
a/doc/emacs/programs.texi=20b/doc/emacs/programs.texi=0Aindex=20=
7cf7b2ff96f..1124a507878=20100644=0A---=20a/doc/emacs/programs.texi=0A=
+++=20b/doc/emacs/programs.texi=0A@@=20-1385,6=20+1385,16=20@@=20Options=20=
for=20Comments=0A=20include=20a=20@samp{\}=20in=20the=20string,=20which=20=
is=20needed=20to=20deny=20the=20first=0A=20star=20its=20special=20=
meaning=20in=20regexp=20syntax.=20=20@xref{Regexp=20Backslash}.)=0A=20=0A=
+@vindex=20comment-start-line-regexp=0A+=20=20Modes=20that=20support=20=
both=20line=20and=20block=20comments=20should=20also=20set=0A=
+@code{comment-start-line-regexp}=20to=20a=20regexp=20that=20matches=20=
only=20line=0A+comment=20starters.=20=20Thus=20Emacs=20can=20distinguish=20=
between=20the=20two=20kinds=20of=0A+comments.=0A+=0A+For=20certain=20=
languages,=20the=20start=20of=20a=20block=20comment=20is=20easier=20to=20=
express=0A+in=20regexp=20than=20that=20of=20a=20line=20comment.=20=20=
Therefore,=20the=20value=20of=20this=0A+variable=20can=20also=20be=20=
@code{@w{(not=20@var{block-start-regexp})}}.=0A+=0A=20@vindex=20=
comment-start=0A=20@vindex=20comment-end=0A=20=20=20When=20a=20comment=20=
command=20makes=20a=20new=20comment,=20it=20inserts=20the=20value=20of=0A=
diff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20=
4609e9b6910..8e6655e9b54=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A=
@@=20-4638,6=20+4638,12=20@@=20concise=20way=20to=20update=20a=20=
symbol's=20'find-function-type-alist'=20property.=0A=20It=20can=20set=20=
comment-related=20variables=20such=20as=20'comment-start'=0A=20depending=20=
on=20the=20language=20under=20point.=0A=20=0A++++=0A+**=20New=20variable=20=
'comment-start-line-regexp'.=0A+Regexp=20matching=20the=20start=20of=20a=20=
line=20comment,=20as=20opposed=20to=20a=20block=0A+comment.=20=20Modes=20=
that=20support=20both=20line=20and=20block=20comments=20should=20set=0A=
+this=20so=20callers=20can=20distinguish=20the=20two.=0A+=0A=20+++=0A=20=
**=20'inhibit-message'=20can=20now=20inhibit=20clearing=20of=20the=20=
echo=20area.=0A=20Binding=20'inhibit-message'=20to=20a=20non-nil=20value=20=
will=20now=20suppress=20both=0Adiff=20--git=20a/lisp/newcomment.el=20=
b/lisp/newcomment.el=0Aindex=201f8a38b586e..9b0574ae1db=20100644=0A---=20=
a/lisp/newcomment.el=0A+++=20b/lisp/newcomment.el=0A@@=20-128,6=20=
+128,27=20@@=20comment-start-skip=0A=20;;;###autoload=0A=20(put=20=
'comment-start-skip=20'safe-local-variable=20'stringp)=0A=20=0A=
+;;;###autoload=0A+(defvar=20comment-start-line-regexp=20nil=0A+=20=20=
"Regexp=20matching=20the=20start=20of=20a=20line=20comment=20plus=20=
everything=20up=20to=20its=20body.=0A+=0A+Unlike=20`comment-start-skip',=20=
which=20matches=20the=20start=20of=20any=20comment,=0A+this=20regexp=20=
only=20matches=20start=20of=20line=20comments=20(as=20opposed=20to=20=
block=0A+comments).=20=20Combined,=20these=20two=20regexp=20can=20=
distinguish=20between=20line=0A+and=20block=20comments.=0A+=0A+When=20=
it's=20easier=20to=20define=20the=20start=20of=20a=20block=20comment,=20=
the=20value=20of=0A+this=20variable=20can=20also=20be=0A+=0A+=20=20=20=20=
(not=20BLOCK-COMMENT-REGEXP).")=0A+;;;###autoload=0A+(put=20=
'comment-start-line-regexp=20'safe-local-variable=0A+=20=20=20=20=20=
(lambda=20(var)=0A+=20=20=20=20=20=20=20(or=20(stringp=20var)=0A+=20=20=20=
=20=20=20=20=20=20=20=20(and=20(consp=20var)=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(eq=20(car=20var)=20'not)=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20(stringp=20(cadr=20var))))))=0A+=0A=20=
;;;###autoload=0A=20(defvar=20comment-end-skip=20nil=0A=20=20=20"Regexp=20=
to=20match=20the=20end=20of=20a=20comment=20plus=20everything=20back=20=
to=20its=20body.")=0Adiff=20--git=20a/lisp/progmodes/c-ts-common.el=20=
b/lisp/progmodes/c-ts-common.el=0Aindex=20d5e6b012fe7..d01cc41a2dc=20=
100644=0A---=20a/lisp/progmodes/c-ts-common.el=0A+++=20=
b/lisp/progmodes/c-ts-common.el=0A@@=20-60,6=20+60,11=20@@=20=
c-ts-common-comment-start-skip=0A=20=20=20=20=20=20=20(*=20(syntax=20=
whitespace)))=0A=20=20=20"The=20`comment-start-skip'=20used=20by=20=
`c-ts-common-comment-setup'.")=0A=20=0A+(defvar=20=
c-ts-common-line-comment-start-skip=0A+=20=20(rx=20(seq=20"/"=20(+=20=
"/"))=0A+=20=20=20=20=20=20(*=20(syntax=20whitespace)))=0A+=20=20"The=20=
`comment-start-skip'=20used=20by=20`c-ts-common-comment-setup'.")=0A+=0A=20=
(defun=20c-ts-common-looking-at-star=20(_n=20_p=20bol=20&rest=20_)=0A=20=20=
=20"A=20tree-sitter=20simple=20indent=20matcher.=0A=20Matches=20if=20=
there=20is=20a=20\"*\"=20after=20BOL."=0A@@=20-287,6=20+292,7=20@@=20=
c-ts-common-comment-setup=0A=20=20-=20`comment-start'=0A=20=20-=20=
`comment-end'=0A=20=20-=20`comment-start-skip'=0A+=20-=20=
`comment-start-line-regexp'=0A=20=20-=20`comment-end-skip'=0A=20=20-=20=
`adaptive-fill-mode'=0A=20=20-=20`adaptive-fill-first-line-regexp'=0A@@=20=
-298,6=20+304,7=20@@=20c-ts-common-comment-setup=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=
=20=20(setq-local=20comment-start-skip=20c-ts-common-comment-start-skip)=0A=
+=20=20(setq-local=20comment-start-line-regexp=20=
c-ts-common-line-comment-start-skip)=0A=20=20=20(setq-local=20=
comment-end-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx=20(*=20=
(syntax=20whitespace))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(group=20(or=20(syntax=20comment-end)=0Adiff=20--git=20=
a/lisp/progmodes/cmake-ts-mode.el=20b/lisp/progmodes/cmake-ts-mode.el=0A=
index=206abd92b5e1a..678f3b09678=20100644=0A---=20=
a/lisp/progmodes/cmake-ts-mode.el=0A+++=20=
b/lisp/progmodes/cmake-ts-mode.el=0A@@=20-229,6=20+229,7=20@@=20=
cmake-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20=20=
=20(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=0A=
=20=20=20=20=20;;=20Defuns.=0A=20=20=20=20=20(setq-local=20=
treesit-defun-type-regexp=20(rx=20(or=20"function"=20"macro")=0Adiff=20=
--git=20a/lisp/progmodes/dockerfile-ts-mode.el=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0Aindex=20=
b97ec89b99a..551bd1bcaee=20100644=0A---=20=
a/lisp/progmodes/dockerfile-ts-mode.el=0A+++=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0A@@=20-176,6=20+176,7=20@@=20=
dockerfile-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"#"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Imenu.=0A=20=20=20=20=20=
(setq-local=20treesit-simple-imenu-settings=0Adiff=20--git=20=
a/lisp/progmodes/elixir-ts-mode.el=20b/lisp/progmodes/elixir-ts-mode.el=0A=
index=209bda7f0046f..b040113b3dc=20100644=0A---=20=
a/lisp/progmodes/elixir-ts-mode.el=0A+++=20=
b/lisp/progmodes/elixir-ts-mode.el=0A@@=20-724,6=20+724,7=20@@=20=
elixir-ts-mode=0A=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=20=20=
(setq-local=20comment-start-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20comment-end=20"")=0A=20=20=20(setq-local=20=
comment-end-skip=0Adiff=20--git=20a/lisp/progmodes/go-ts-mode.el=20=
b/lisp/progmodes/go-ts-mode.el=0Aindex=208de6d0e0700..d7563c3bbf6=20=
100644=0A---=20a/lisp/progmodes/go-ts-mode.el=0A+++=20=
b/lisp/progmodes/go-ts-mode.el=0A@@=20-725,6=20+725,7=20@@=20=
go-work-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"//=20")=0A=
=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"//"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20=
(setq-local=20indent-tabs-mode=20t=0Adiff=20--git=20=
a/lisp/progmodes/json-ts-mode.el=20b/lisp/progmodes/json-ts-mode.el=0A=
index=209575eaf6cf0..b2ffccecd76=20100644=0A---=20=
a/lisp/progmodes/json-ts-mode.el=0A+++=20=
b/lisp/progmodes/json-ts-mode.el=0A@@=20-198,6=20+198,7=20@@=20=
json-ts-mode=0A=20=20=20;;=20Comments.=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-start-skip=20=
"\\(?://+\\|/\\*+\\)\\s=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20"//+\\s=20*")=0A=20=20=20(setq-local=20=
comment-end=20"")=0A=20=0A=20=20=20;;=20Electric=0Adiff=20--git=20=
a/lisp/progmodes/lua-ts-mode.el=20b/lisp/progmodes/lua-ts-mode.el=0A=
index=202963d5a96af..8fea032bf7c=20100644=0A---=20=
a/lisp/progmodes/lua-ts-mode.el=0A+++=20b/lisp/progmodes/lua-ts-mode.el=0A=
@@=20-683,6=20+683,8=20@@=20lua-ts-mode=0A=20=20=20=20=20;;=20Comments.=0A=
=20=20=20=20=20(setq-local=20comment-start=20"--")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20"--\\s-*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20`(not=20,(rx=20"--"=20"["=20(*=20"=3D")=20"["=20(*=20(syntax=20=
whitespace)))))=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=0A=
=20=20=20=20=20;;=20Pairs.=0Adiff=20--git=20a/lisp/progmodes/python.el=20=
b/lisp/progmodes/python.el=0Aindex=2086336979067..848b2c54d25=20100644=0A=
---=20a/lisp/progmodes/python.el=0A+++=20b/lisp/progmodes/python.el=0A@@=20=
-7343,6=20+7343,7=20@@=20python-base-mode=0A=20=0A=20=20=20(setq-local=20=
comment-start=20"#=20")=0A=20=20=20(setq-local=20comment-start-skip=20=
"#+\\s-*")=0A+=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20(setq-local=20=
parse-sexp-lookup-properties=20t)=0A=20=20=20(setq-local=20=
parse-sexp-ignore-comments=20t)=0Adiff=20--git=20=
a/lisp/progmodes/ruby-mode.el=20b/lisp/progmodes/ruby-mode.el=0Aindex=20=
f2e38e0af46..ff33f0554ba=20100644=0A---=20a/lisp/progmodes/ruby-mode.el=0A=
+++=20b/lisp/progmodes/ruby-mode.el=0A@@=20-2693,6=20+2693,7=20@@=20=
ruby-base-mode=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=
(setq-local=20comment-column=20ruby-comment-column)=0A=20=20=20=
(setq-local=20comment-start-skip=20"#+=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20parse-sexp-ignore-comments=20t)=0A=20=20=20(setq-local=20=
parse-sexp-lookup-properties=20t)=0Adiff=20--git=20=
a/lisp/progmodes/sh-script.el=20b/lisp/progmodes/sh-script.el=0Aindex=20=
4d025eeb18d..0bcd8984354=20100644=0A---=20a/lisp/progmodes/sh-script.el=0A=
+++=20b/lisp/progmodes/sh-script.el=0A@@=20-1475,6=20+1475,7=20@@=20=
sh-base-mode=0A=20=20=20(setq-local=20paragraph-separate=20(concat=20=
paragraph-start=20"\\|#!/"))=0A=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20(setq-local=20comment-start-skip=20"#+[\t=20]*")=0A+=20=20=
(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=20=20=
(setq-local=20local-abbrev-table=20sh-mode-abbrev-table)=0A=20=20=20=
(setq-local=20comint-dynamic-complete-functions=0A=20=09=20=20=20=20=20=20=
sh-dynamic-complete-functions)=0Adiff=20--git=20=
a/lisp/textmodes/toml-ts-mode.el=20b/lisp/textmodes/toml-ts-mode.el=0A=
index=2063e3f60edd9..b121d8917d1=20100644=0A---=20=
a/lisp/textmodes/toml-ts-mode.el=0A+++=20=
b/lisp/textmodes/toml-ts-mode.el=0A@@=20-146,6=20+146,7=20@@=20=
toml-ts-mode=0A=20=20=20=20=20;;=20Comments=0A=20=20=20=20=20(setq-local=20=
comment-start=20"#=20")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=
+=20=20=20=20(setq-local=20comment-start-line-regexp=20"#+=20*")=0A=20=0A=
=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20(setq-local=20=
treesit-simple-indent-rules=20toml-ts-mode--indent-rules)=0Adiff=20--git=20=
a/lisp/textmodes/yaml-ts-mode.el=20b/lisp/textmodes/yaml-ts-mode.el=0A=
index=205afd4d2d111..bab0ba94c8c=20100644=0A---=20=
a/lisp/textmodes/yaml-ts-mode.el=0A+++=20=
b/lisp/textmodes/yaml-ts-mode.el=0A@@=20-271,6=20+271,7=20@@=20=
yaml-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20"#+=20*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=20=20=
;;=20Indentation.=0A=20=20=20=20=20(setq-local=20indent-tabs-mode=20nil)=0A=
diff=20--git=20a/lisp/treesit.el=20b/lisp/treesit.el=0Aindex=20=
5cef42ef454..afa23b6ae04=20100644=0A---=20a/lisp/treesit.el=0A+++=20=
b/lisp/treesit.el=0A@@=20-3764,17=20+3764,38=20@@=20=
treesit-forward-sentence=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(max=20(point-min)=20=
(previous-single-char-property-change=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=20=20=20=20=20=
=20=20=20=20(point)=20'treesit-parser)))))))=0A=20=0A-(defun=20=
treesit-forward-comment=20(&optional=20count)=0A+(defun=20=
treesit--likely-line-comment-p=20(node)=0A+=20=20"Return=20non-nil=20if=20=
NODE=20is=20likely=20a=20line=20comment."=0A+=20=20(save-excursion=0A+=20=
=20=20=20(goto-char=20(treesit-node-start=20node))=0A+=20=20=20=20(if=20=
comment-start-line-regexp=0A+=20=20=20=20=20=20=20=20(if=20(stringp=20=
comment-start-line-regexp)=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
(looking-at-p=20comment-start-line-regexp)=0A+=20=20=20=20=20=20=20=20=20=
=20(not=20(looking-at-p=20(nth=201=20comment-start-line-regexp))))=0A+=20=
=20=20=20=20=20;;=20Heuristic:=20usually=20`comment-start'=20is=20set=20=
to=20the=20line=20comment=0A+=20=20=20=20=20=20;;=20start.=0A+=20=20=20=20=
=20=20(looking-at-p=20(string-trim-right=20comment-start)))))=0A+=0A=
+(defun=20treesit-forward-comment=20(count)=0A=20=20=20"Tree-sitter=20=
`forward-comment-function'=20implementation.=0A=20=0A=20COUNT=20is=20the=20=
same=20as=20in=20`forward-comment'."=0A-=20=20(let=20((res=20t)=20thing)=0A=
+=20=20(let=20((res=20t)=20thing=20line-comment-p)=0A=20=20=20=20=20=
(while=20(>=20count=200)=0A=20=20=20=20=20=20=20(skip-chars-forward=20"=20=
\t\n")=0A=20=20=20=20=20=20=20(setq=20thing=20(treesit-thing-at=20=
(point)=20'comment))=0A+=20=20=20=20=20=20(setq=20line-comment-p=20(and=20=
thing=20(treesit--likely-line-comment-p=20thing)))=0A=20=20=20=20=20=20=20=
(if=20(and=20thing=20(eq=20(point)=20(treesit-node-start=20thing)))=0A=20=
=20=20=20=20=20=20=20=20=20=20(progn=0A-=20=20=20=20=20=20=20=20=20=20=20=
=20(goto-char=20(min=20(1+=20(treesit-node-end=20thing))=20(point-max)))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(min=20=
(treesit-node-end=20thing)=20(point-max)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20;;=20For=20line=20comments,=20go=20to=20the=20next=20line.=20=20=
This=20is=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20important=20=
because=20a)=20for=20navigation=20convenience,=20and=20b)=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20;;=20many=20functions=20expect=20=
`forward-comment'=20to=20behave=20this=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20;;=20way=20(bug#80837).=0A+=20=20=20=20=20=20=20=20=20=20=20=20(when=20=
line-comment-p=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(skip-chars-forward=20"=20\t")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(when=20(looking-at=20"\n")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(forward-char)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20=
count=20(1-=20count)))=0A=20=20=20=20=20=20=20=20=20(setq=20count=200=20=
res=20nil)))=0A=20=20=20=20=20(while=20(<=20count=200)=0A--=20=0A2.39.5=20=
(Apple=20Git-154)=0A=0A=
--Apple-Mail=_3B7F1AD7-B621-4EB1-B79C-2E505B0295CB--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 3 Jul 2026 18:43:53 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 03 14:43:52 2026 Received: from localhost ([127.0.0.1]:53064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wfire-0000qk-Cl for submit <at> debbugs.gnu.org; Fri, 03 Jul 2026 14:43:52 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]:49096) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wfirZ-0000pI-G1 for 80837 <at> debbugs.gnu.org; Fri, 03 Jul 2026 14:43:47 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4gsN1h4pZvz9vGY; Fri, 3 Jul 2026 20:43:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1783104216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P5/FQPeb8RxgmggOy46Ku5qril/DQFn8I4n498ZWU50=; b=WnH2JeNVoIJSHVUZS/TIkfyII/2gqF9n6oiH+3Wsr1RI4TDQz8RW8Komr8iyw4l9qAb51c IjkjwFxq7K/nhfRSQI9eu/eqbXJPePeILJ51X0W/8nF3VVY17jEBpybSpfssRz1YjXSbwK X33QQrsMGlJrRFVnMxicsm6NylJhB1qmdaUuvO99m6EeqhvPv1vEPbfE8GW4ECcT/CF9cO WFK6dD7Y5aYY1NI4cxE8ZjwL1Fb/IFo2pVJcgaacpgCxli4RQX/7tOcY212XDU6KY9Hag/ IGVMyCes/Kq4IM+fEiX7rg5U/SEwDu5Hh5CfSZ0McQV/CF0YMI7PmVPPS2f7Og== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=juri@HIDDEN From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Date: Fri, 03 Jul 2026 21:42:43 +0300 Message-ID: <87jyrbgbj0.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4gsN1h4pZvz9vGY X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) > Cool, here’s the patch. I didn’t try to make use of this new variable > in newcomment.el. Only tree-sitter uses it right now. Shouldn't this patch be pushed to the release branch? Because currently uncomment-region is broken in c-ts-mode in Emacs 31.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 24 May 2026 19:13:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 24 15:13:45 2026 Received: from localhost ([127.0.0.1]:38873 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wREGe-0005AS-Ev for submit <at> debbugs.gnu.org; Sun, 24 May 2026 15:13:44 -0400 Received: from mout-p-202.mailbox.org ([2001:67c:2050:0:465::202]:41738) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wREGc-00059q-D6 for 80837 <at> debbugs.gnu.org; Sun, 24 May 2026 15:13:43 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4gNpZg446fz9scX; Sun, 24 May 2026 21:13:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1779650011; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QApqNhQkSVwSxH6+gWZmPUHHDaQ8GYHPAUL3ijI4vhc=; b=mmzz1hX6mUYNiChvXnU25RNOgbT2mReDBGNYeXC2KiXFH8Gf+uAnLCpSEt08Bys4eV0izN jLaERc2AAVSH1oQ4bvj4lUROkqwdhMf2POq5F6wGFD3JNpUtethGVRO6X3cQ+itDjXNwwv HImRN6H+qNUG5KvrckgAwQTHz7KBLJ4qtgifQpIqV1sxfme5JIuNpqLb+OTPXKj40ZdVMn xYRZ5JDlznu4vpQoEyrs3TxvXdfKgMVqPQMskKRwDQ083r5958o6cOQXRwmEnlUa8c3gZb YOw+hz4mFoFNUru1X/zsPAanod/YnKKH133HaE8eWvHArYssehaBLyHgFuhaKg== From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Date: Sun, 24 May 2026 21:47:46 +0300 Message-ID: <87wlws8wk5.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) > heex-ts-mode doesn’t set comment-start-skip, anyone knows why? Probably because it was complicated to write the block comment regexp for <%!-- --%> and <%# %>. But AFAIK there are no line comments in heex. > @@ -683,6 +683,7 @@ lua-ts-mode > ;; Comments. > (setq-local comment-start "--") > (setq-local comment-start-skip "--\\s-*") > + (setq-local comment-start-line-regexp comment-start-skip) Looking at e.g. test/lisp/progmodes/lua-ts-mode-resources/hide-show.lua we can see an example of block comments that will be matched by the line comment regex above: --[[ This is a comment block. ]] > +(defun treesit--likely-line-comment-p (node) > + "Return non-nil if NODE is likely a line comment." > + (save-excursion > + (goto-char (treesit-node-start node)) > + (if comment-start-line-regexp > + (looking-at comment-start-line-regexp) > + ;; Heuristic: usually `comment-start' is set to the line comment > + ;; start. > + (looking-at (string-trim-right comment-start))))) Would it be safer to use 'looking-at-p' here?
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 24 May 2026 14:47:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 24 10:47:19 2026 Received: from localhost ([127.0.0.1]:36116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wRA6o-0001PA-8c for submit <at> debbugs.gnu.org; Sun, 24 May 2026 10:47:19 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60705) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1wRA6k-0001NZ-8T for 80837 <at> debbugs.gnu.org; Sun, 24 May 2026 10:47:15 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F011781C23; Sun, 24 May 2026 10:47:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1779634027; bh=E0ZwYBWHyoAXkZpm793BP3GAibkbbHeZfDfGGVpfCoo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=L5FLVniZ3Xm6SgHPBodSU4C/pw79FjGC13iz52Npeta3kdYJlW1vFk/ysnuHVrXbO wpJ9YQS2HPlHUK8G0NFFLm60wFYQr8uqp4A+VL3zWno0kPWb3j7gpZc2GLGp75u/83 7RtP6MzdxZ5wZSUtQXtuFXZ+S/FPXotnCGsWwmxj+lLwi3vwd+2utffylCFsF0zHQH E1gAbcHorOJYJaqOflQ7R9hJyABqHKVPG8sBZ0PZaevvpNZTj3qKdlPMfw3EdBhSoc RjWQ0fCcAos48sVN5lOQtQppS5p5nnphG+iYmNztG5WhFr9fljApG5wFuj9+27KhFr x/C8mCakmhorQ== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 29E2080539; Sun, 24 May 2026 10:47:07 -0400 (EDT) Received: from pastel (104-195-197-162.cpe.teksavvy.com [104.195.197.162]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E22AE1200C7; Sun, 24 May 2026 10:47:06 -0400 (EDT) From: Stefan Monnier <monnier@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Message-ID: <jwv8q98na5w.fsf-monnier+emacs@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Date: Sun, 24 May 2026 10:47:05 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.095 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>, Bozhidar Batsov <bozhidar@HIDDEN>, Sean Whitton <spwhitton@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Cool, here=E2=80=99s the patch. I didn=E2=80=99t try to make use of this = new variable in > newcomment.el. Only tree-sitter uses it right now. LGTM. Probably deserves a change in the ELisp manual as well. You might also want to document whether `comment-start-line-regexp` has to be a subset of `comment-start-skip` (i.e. if `comment-start-line-regexp` matches, can we assume that `comment-start-skip` would match as well and end at the same place). > heex-ts-mode doesn=E2=80=99t set comment-start-skip, anyone knows why? `comment-normalize-vars` sets `comment-start-skip` to a default value based on `comment-start` if it's not already set by the major mode, so maybe this default value is good enough. =3D=3D=3D Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 24 May 2026 10:13:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 24 06:13:25 2026 Received: from localhost ([127.0.0.1]:33174 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wR5pk-0003lz-DS for submit <at> debbugs.gnu.org; Sun, 24 May 2026 06:13:24 -0400 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]:56373) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wR5pg-0003kZ-J3 for 80837 <at> debbugs.gnu.org; Sun, 24 May 2026 06:13:22 -0400 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id E3B9E7A0048; Sun, 24 May 2026 06:13:14 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sun, 24 May 2026 06:13:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1779617594; x=1779703994; bh=KCINJOwQu30XBaVLIfZeiWnXuXgwOYlF fCyLNZf+uWI=; b=LR8MdeEnzpHMFcGPXmpg2qT7sP/ey4pvdf0hoDOorzUu+JpV Vza2Fg+IIy54roEs6kHq95q2YVF40SM4RNZhb2pLlJ+5joJmkio/Y8wrCfEFtQ6Q XP67nX6rzpZaah+rWum7bOM1Bev23AlKdmCa0BVMJtD66Ij4c+ZWKMQDLFlRxKgF 1VxbMah0854UEzy8hD1+LISXI2jF9x/Ytsbwu4yB7Tln0nqXQpPP2C5NeNde4DUZ es4f2tfFO0cNEqNVrzrdqPsNxniNrAdfOzGJqAEtFHYIqihn77z8IiKJaMw0W+/i FOd7LVtJm4O0CkGu4PkPc/w0ZA20Tsg3cKD+hg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1779617594; x= 1779703994; bh=KCINJOwQu30XBaVLIfZeiWnXuXgwOYlFfCyLNZf+uWI=; b=h mG5nyC2OX4vmq8f0qiW00Q6KEYM8qtytlQo2o+wWig0XMjnMCPPQoyeAPXrShQ1q apUW+mzYMM4QDPni8gnYN6BleVyBZ67situskOUQDOCJDS8mYjhuIxxbOJdY+gJr Ie6T+Dwjt4lyrEgv8+//bO+9jwv80Qg2eWGgzd53qL8A1w7DGE2yiyKktEmDjs7F FFRyk9aFWtnEvgl411nkEUgf4uD+vgzSB2eFCliTphnyn+p2HMZ1VkspHwzCTXko +mYFfcA+QBhyFyGZcF/tfzuzwb1fYhWCpWVQZXnsxKxuMOUDdURRNucKwQeScR5o qO6Bz0I3DjCsMu0Uy4FwA== X-ME-Sender: <xms:Os8SajCFN4WgSeOhfUvlL2Oq7BG_mUjt4mEKhj30RYtCQ2YXrOjyog> <xme:Os8SarD_LYhJCBISvSsl2Qxptcr19VhezN1KNJ7Ecs78nxej4WTAoh4AK7329DC96 dh0vjfA5brNpvqJf3bJSNhdTgqOgqNO7TaNNJy76WtlF2NxSLPi4EA> X-ME-Received: <xmr:Os8Sauq6o9qeRc4rjq_NlKOs5EHVfSStdwIPG7lpcfeEiQxUfjfv0pcSfbCm1netWws478EqdevAjtQdoztS3q4VC65WjA> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduheehieeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtgfesthhqtddttddtjeenucfhrhhomhepufgvrghnucgh hhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqeenuc ggtffrrghtthgvrhhnpeeuieelteekleejieetkeekfeeuuddtvdejgfekvdegkeevheeh gfegtefffedtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgdpnhgspghrtghp thhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghoiihhihgurghrse gsrghtshhovhdruggvvhdprhgtphhtthhopeektdekfeejseguvggssghughhsrdhgnhhu rdhorhhgpdhrtghpthhtoheptggrshhouhhrihesghhmrghilhdrtghomhdprhgtphhtth hopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthhopehj uhhriheslhhinhhkohhvrdhnvght X-ME-Proxy: <xmx:Os8SalkrWXHVDc25_hjbr79IKuyzkUUPZJ_7g-nMWuoq2DX-TTtkkA> <xmx:Os8SauyyLtrrWu4T2nsytZq8jQpDpPu6qQKF5xqhddzRRLYJQY5UKg> <xmx:Os8Sat93o2uTNBTgBMPudB8U0eezrFIdQ2QLok-h6B5xZbcw7KsqcA> <xmx:Os8SaqK-o95XIYLv2tjqgQWvL6gY8q5VEJ0Yk5QuhzEs7Mf1NfvH0A> <xmx:Os8SahTG_WxFkwElvXJ2HLcuj3z1BW_-fnbtuweeLiSEjFrX9U8YFTK9> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 24 May 2026 06:13:13 -0400 (EDT) Received: by melete.silentflame.com (Postfix, from userid 1000) id EC8527E66D2; Sun, 24 May 2026 11:13:12 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> <87a4tyqjda.fsf@HIDDEN> <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN> Date: Sun, 24 May 2026 11:13:12 +0100 Message-ID: <877bot5d53.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Yuan Fu [23/May 10:14pm -07] wrote: > Cool, here=E2=80=99s the patch. I didn=E2=80=99t try to make use of this = new variable > in newcomment.el. Only tree-sitter uses it right now. Thanks. I think that the patch is okay for emacs-31. Though I'd want to separately consider any changes to newcomment.el. However, I don't have an opinion on whether introducing a new defvar with these semantics is the right fix for the sort of issue raised in this bug report. I'd leave that assessment mostly to Stefan. --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 24 May 2026 05:15:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 24 01:15:00 2026
Received: from localhost ([127.0.0.1]:58648 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wR1Ay-0007r0-Cl
for submit <at> debbugs.gnu.org; Sun, 24 May 2026 01:15:00 -0400
Received: from mail-dy1-x132f.google.com ([2607:f8b0:4864:20::132f]:60597)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wR1Av-0007qr-Pz
for 80837 <at> debbugs.gnu.org; Sun, 24 May 2026 01:14:58 -0400
Received: by mail-dy1-x132f.google.com with SMTP id
5a478bee46e88-303dbfbec77so9910086eec.0
for <80837 <at> debbugs.gnu.org>; Sat, 23 May 2026 22:14:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1779599696; x=1780204496; 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=GOcI/EtOQZw3cRfVRVa/Zu+tCoGB2RBYG+PTyZuCHjI=;
b=OFcN3vE/cjgecVCBbKi/8rqqY1H3RwouCykCpa9n+MUY/cRLs5Sp04QO5Eghb4IyJm
OC4KisgiTQw1t2HXSvMoP2Z1Gdv3d6Rb2DzUQLI0ipIT9WPErB8msCX+v4Sz1Z1kXooq
k5gdV/TLLNJGWhjpjDl91iUlJqfyXEa/tTMWqRb7DRxdQnJ1RGBY8lzr9YRyOeCoHXaI
+5RNUcs+5dca4zRGEp4bCV5+WAsAl81vMIPwWwZcVQCUVKZzvBOYDig6iTkKLsAx23oH
wu2hbl+Kto9QY0yhWGYrr4hf0R0tLEuMVVa7+5j8ha0rT9LWITJS3kk6bhIGlRUl29O4
rrIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1779599696; x=1780204496;
h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=GOcI/EtOQZw3cRfVRVa/Zu+tCoGB2RBYG+PTyZuCHjI=;
b=L04Dfm8nlMGSW1Z6LEuY+T8T11XfEWPK/3hX+ZEkSiRxsEeKO+VwAGllAwp851e+sF
N2OGeisuUlYszsrE2byOg2WpxbmfjBr0XmKJNYx9M8+RPPhLxf7FYkD/Zq7Rx3V2eb/8
GnWkjDasDGpjmkA60ivQprZCASjiNjW7OdQ6ZdoixTFd3KNjRuY53JsPGYF8z4M1vAmj
RaQzLjntMzEhjqeoDeTfpOVHT2h++XqXf3t28pEnI0GXDCexul07BBdHml/dUliKDiP9
aSqAYjxNMSOh+NPAWCX8L2ugh9KnIrbuwhdBLrfMS8XC3nKtiIn0Qd68sCjBfixNwvyE
Kmsw==
X-Forwarded-Encrypted: i=1;
AFNElJ/4KCgm4ZGcl/vzuaJ4ZCOg/FnV+PO2BSjrK2Wa0vKhjxpOSB7F1o18s/4v15LrK+1h+ZIFYA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxtetDzflasWO8/zO15IWkWP1bAzGClmwH4VJq2tSTQ+7XY+XOZ
Qt50S+j5exwrYwxDjgRpN4o7c7TyqtyGdNzTT1EFZgDEoYAfRYI1aW8a
X-Gm-Gg: Acq92OEPrcX+a8TQlwGEylL2N+woCIt9JtwMPrvDGfwE/0jxi4QYcd36v0eNKfoUEJm
uK9e0GY7QxdTG7cifIBqM4U3v0cu4Kj7bvX9YkKEcSDDmPTCVUsj8KSymsb/UA6UVmnuLyjRa90
0Z7sXAeqg3eZVJmDaxX+JZM3Mn9m+0KDJDk6M6j0X3WVgRfuTP0Fz68KLuog5H+MS5QkNjtDV1w
aZ3zkxaQ9MlBMXtv+L0GKYubRnlydGNjlN58lGsSZTjbld+JIEhX9Nm2QGOLbCmnS4SdCjgmUz0
9kch+e4uR/PsYWgKf6zxVA8csYMtVp0d9ZJR6WIDtJ6/fXtDS2J6fnWKN8rzJEDzEFxnudioPya
JzdcTooybmTJbUMC0+FVHqYkfzDmMRrxdCw489KV01ruVDYoPdDl7rjkafbKhxWApKeDZgTpT4/
RqSRPxUVI1QR0X/UHLCrzx5BfrVqxyuVMax3oi5uMgSR6UHA==
X-Received: by 2002:a05:7301:608e:b0:2f2:b544:2fca with SMTP id
5a478bee46e88-304490e65femr4629407eec.33.1779599696220;
Sat, 23 May 2026 22:14:56 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c686:b320:34b5:5eba:c339:b60c])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-3045245d6aesm4605333eec.26.2026.05.23.22.14.55
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Sat, 23 May 2026 22:14:55 -0700 (PDT)
From: Yuan Fu <casouri@HIDDEN>
Message-Id: <2E022D11-2CF2-4C84-8DE1-5D7E619CC218@HIDDEN>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_8ED64252-6C65-4A93-8C36-2B7A888C1732"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
Date: Sat, 23 May 2026 22:14:44 -0700
In-Reply-To: <87a4tyqjda.fsf@HIDDEN>
To: Sean Whitton <spwhitton@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
<08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
<87a4tyqjda.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>,
Stefan Monnier <monnier@HIDDEN>, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
--Apple-Mail=_8ED64252-6C65-4A93-8C36-2B7A888C1732
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On May 17, 2026, at 6:02=E2=80=AFAM, Sean Whitton =
<spwhitton@HIDDEN> wrote:
>=20
> Yuan Fu [15/May 4:37pm -07] wrote:
>> Cool, I can comment-start-line-regexp and at least the built-in modes
>> will have accurate forward-comment.
>>=20
>> Ummm cc=E2=80=99ing Sean as well, shall we add this to emacs-31? =
Since it=E2=80=99s
>> needed to fix the forward-comment behavior for tree-sitter modes.
>=20
> I think I need to see the patch to think about it.
Cool, here=E2=80=99s the patch. I didn=E2=80=99t try to make use of this =
new variable in newcomment.el. Only tree-sitter uses it right now.
heex-ts-mode doesn=E2=80=99t set comment-start-skip, anyone knows why?
Yuan
--Apple-Mail=_8ED64252-6C65-4A93-8C36-2B7A888C1732
Content-Disposition: attachment;
filename=comment-start.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="comment-start.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=20f00f35908bb798029543c991236c2f1e0c6bcb30=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Wed,=20=
20=20May=202026=2000:00:21=20-0700=0ASubject:=20[PATCH]=20Add=20=
comment-start-line-regexp=20(bug#80837)=0A=0A*=20lisp/newcomment.el=20=
(comment-start-line-regexp):=20New=20variable.=0A*=20=
lisp/progmodes/c-ts-common.el:=0A(c-ts-common-line-comment-start-skip):=20=
New=20variable.=0A(c-ts-common-comment-setup):=0A*=20=
lisp/progmodes/cmake-ts-mode.el=20(cmake-ts-mode):=0A*=20=
lisp/progmodes/dockerfile-ts-mode.el=20(dockerfile-ts-mode):=0A*=20=
lisp/progmodes/elixir-ts-mode.el=20(elixir-ts-mode):=0A*=20=
lisp/progmodes/go-ts-mode.el=20(go-work-ts-mode):=0A*=20=
lisp/progmodes/json-ts-mode.el=20(json-ts-mode):=0A*=20=
lisp/progmodes/lua-ts-mode.el=20(lua-ts-mode):=0A*=20=
lisp/progmodes/python.el=20(python-base-mode):=0A*=20=
lisp/progmodes/ruby-mode.el=20(ruby-base-mode):=0A*=20=
lisp/progmodes/sh-script.el=20(sh-base-mode):=0A*=20=
lisp/textmodes/toml-ts-mode.el=20(toml-ts-mode):=0A*=20=
lisp/textmodes/yaml-ts-mode.el=20(yaml-ts-mode):=20Set=20the=20new=20=
variable.=0A*=20lisp/treesit.el=20(treesit--likely-line-comment-p):=20=
New=20function.=0A(treesit-forward-comment):=20Behave=20differently=20=
for=20line=20and=20block=20comment.=0A---=0A=20doc/emacs/programs.texi=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=206=20++++++=0A=20etc/NEWS=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=206=20++++++=0A=20lisp/newcomment.el=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20|=2011=20+++++++++++=0A=20=
lisp/progmodes/c-ts-common.el=20=20=20=20=20=20=20=20|=20=207=20+++++++=0A=
=20lisp/progmodes/cmake-ts-mode.el=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/dockerfile-ts-mode.el=20|=20=201=20+=0A=20=
lisp/progmodes/elixir-ts-mode.el=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/go-ts-mode.el=20=20=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/json-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/lua-ts-mode.el=20=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/progmodes/python.el=20=20=20=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/ruby-mode.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/progmodes/sh-script.el=20=20=20=20=20=20=20=20=20=20|=20=201=20=
+=0A=20lisp/textmodes/toml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=
=20lisp/textmodes/yaml-ts-mode.el=20=20=20=20=20=20=20|=20=201=20+=0A=20=
lisp/treesit.el=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20|=2025=20++++++++++++++++++++++---=0A=2016=20files=20changed,=2063=20=
insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20=
a/doc/emacs/programs.texi=20b/doc/emacs/programs.texi=0Aindex=20=
7cf7b2ff96f..a6d1856a5af=20100644=0A---=20a/doc/emacs/programs.texi=0A=
+++=20b/doc/emacs/programs.texi=0A@@=20-1385,6=20+1385,12=20@@=20Options=20=
for=20Comments=0A=20include=20a=20@samp{\}=20in=20the=20string,=20which=20=
is=20needed=20to=20deny=20the=20first=0A=20star=20its=20special=20=
meaning=20in=20regexp=20syntax.=20=20@xref{Regexp=20Backslash}.)=0A=20=0A=
+@vindex=20comment-start-line-regexp=0A+=20=20Modes=20that=20support=20=
both=20line=20and=20block=20comments=20should=20also=20set=0A=
+@code{comment-start-line-regexp}=20to=20a=20regexp=20that=20matches=20=
only=20line=0A+comment=20starters.=20=20This=20Emacs=20distinguish=20=
between=20the=20two=20kinds=20of=0A+comments.=0A+=0A=20@vindex=20=
comment-start=0A=20@vindex=20comment-end=0A=20=20=20When=20a=20comment=20=
command=20makes=20a=20new=20comment,=20it=20inserts=20the=20value=20of=0A=
diff=20--git=20a/etc/NEWS=20b/etc/NEWS=0Aindex=20=
a746ca7b1a3..a2aec288423=20100644=0A---=20a/etc/NEWS=0A+++=20b/etc/NEWS=0A=
@@=20-4500,6=20+4500,12=20@@=20concise=20way=20to=20update=20a=20=
symbol's=20'find-function-type-alist'=20property.=0A=20It=20can=20set=20=
comment-related=20variables=20such=20as=20'comment-start'=0A=20depending=20=
on=20the=20language=20under=20point.=0A=20=0A++++=0A+**=20New=20variable=20=
'comment-start-line-regexp'.=0A+Regexp=20matching=20the=20start=20of=20a=20=
line=20comment,=20as=20opposed=20to=20a=20block=0A+comment.=20=20Modes=20=
that=20support=20both=20line=20and=20block=20comments=20should=20set=0A=
+this=20so=20callers=20can=20distinguish=20the=20two.=0A+=0A=20+++=0A=20=
**=20'inhibit-message'=20can=20now=20inhibit=20clearing=20of=20the=20=
echo=20area.=0A=20Binding=20'inhibit-message'=20to=20a=20non-nil=20value=20=
will=20now=20suppress=20both=0Adiff=20--git=20a/lisp/newcomment.el=20=
b/lisp/newcomment.el=0Aindex=201f8a38b586e..76e23d29ecd=20100644=0A---=20=
a/lisp/newcomment.el=0A+++=20b/lisp/newcomment.el=0A@@=20-128,6=20=
+128,17=20@@=20comment-start-skip=0A=20;;;###autoload=0A=20(put=20=
'comment-start-skip=20'safe-local-variable=20'stringp)=0A=20=0A=
+;;;###autoload=0A+(defvar=20comment-start-line-regexp=20nil=0A+=20=20=
"Regexp=20matching=20the=20start=20of=20a=20line=20comment=20plus=20=
everything=20up=20to=20its=20body.=0A+=0A+Unlike=20`comment-start-skip',=20=
which=20matches=20the=20start=20of=20any=20comment,=0A+this=20regexp=20=
only=20matches=20start=20of=20line=20comments=20(as=20opposed=20to=20=
block=0A+comments).=20=20Combined,=20these=20two=20regexp=20can=20=
distinguish=20between=20line=0A+and=20block=20comments.")=0A=
+;;;###autoload=0A+(put=20'comment-start-line-regexp=20=
'safe-local-variable=20'stringp)=0A+=0A=20;;;###autoload=0A=20(defvar=20=
comment-end-skip=20nil=0A=20=20=20"Regexp=20to=20match=20the=20end=20of=20=
a=20comment=20plus=20everything=20back=20to=20its=20body.")=0Adiff=20=
--git=20a/lisp/progmodes/c-ts-common.el=20=
b/lisp/progmodes/c-ts-common.el=0Aindex=20d5e6b012fe7..d01cc41a2dc=20=
100644=0A---=20a/lisp/progmodes/c-ts-common.el=0A+++=20=
b/lisp/progmodes/c-ts-common.el=0A@@=20-60,6=20+60,11=20@@=20=
c-ts-common-comment-start-skip=0A=20=20=20=20=20=20=20(*=20(syntax=20=
whitespace)))=0A=20=20=20"The=20`comment-start-skip'=20used=20by=20=
`c-ts-common-comment-setup'.")=0A=20=0A+(defvar=20=
c-ts-common-line-comment-start-skip=0A+=20=20(rx=20(seq=20"/"=20(+=20=
"/"))=0A+=20=20=20=20=20=20(*=20(syntax=20whitespace)))=0A+=20=20"The=20=
`comment-start-skip'=20used=20by=20`c-ts-common-comment-setup'.")=0A+=0A=20=
(defun=20c-ts-common-looking-at-star=20(_n=20_p=20bol=20&rest=20_)=0A=20=20=
=20"A=20tree-sitter=20simple=20indent=20matcher.=0A=20Matches=20if=20=
there=20is=20a=20\"*\"=20after=20BOL."=0A@@=20-287,6=20+292,7=20@@=20=
c-ts-common-comment-setup=0A=20=20-=20`comment-start'=0A=20=20-=20=
`comment-end'=0A=20=20-=20`comment-start-skip'=0A+=20-=20=
`comment-start-line-regexp'=0A=20=20-=20`comment-end-skip'=0A=20=20-=20=
`adaptive-fill-mode'=0A=20=20-=20`adaptive-fill-first-line-regexp'=0A@@=20=
-298,6=20+304,7=20@@=20c-ts-common-comment-setup=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=
=20=20(setq-local=20comment-start-skip=20c-ts-common-comment-start-skip)=0A=
+=20=20(setq-local=20comment-start-line-regexp=20=
c-ts-common-line-comment-start-skip)=0A=20=20=20(setq-local=20=
comment-end-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(rx=20(*=20=
(syntax=20whitespace))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(group=20(or=20(syntax=20comment-end)=0Adiff=20--git=20=
a/lisp/progmodes/cmake-ts-mode.el=20b/lisp/progmodes/cmake-ts-mode.el=0A=
index=206abd92b5e1a..678f3b09678=20100644=0A---=20=
a/lisp/progmodes/cmake-ts-mode.el=0A+++=20=
b/lisp/progmodes/cmake-ts-mode.el=0A@@=20-229,6=20+229,7=20@@=20=
cmake-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20=20=
=20(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=0A=
=20=20=20=20=20;;=20Defuns.=0A=20=20=20=20=20(setq-local=20=
treesit-defun-type-regexp=20(rx=20(or=20"function"=20"macro")=0Adiff=20=
--git=20a/lisp/progmodes/dockerfile-ts-mode.el=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0Aindex=20=
b97ec89b99a..551bd1bcaee=20100644=0A---=20=
a/lisp/progmodes/dockerfile-ts-mode.el=0A+++=20=
b/lisp/progmodes/dockerfile-ts-mode.el=0A@@=20-176,6=20+176,7=20@@=20=
dockerfile-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"#"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Imenu.=0A=20=20=20=20=20=
(setq-local=20treesit-simple-imenu-settings=0Adiff=20--git=20=
a/lisp/progmodes/elixir-ts-mode.el=20b/lisp/progmodes/elixir-ts-mode.el=0A=
index=209bda7f0046f..b040113b3dc=20100644=0A---=20=
a/lisp/progmodes/elixir-ts-mode.el=0A+++=20=
b/lisp/progmodes/elixir-ts-mode.el=0A@@=20-724,6=20+724,7=20@@=20=
elixir-ts-mode=0A=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=20=20=
(setq-local=20comment-start-skip=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(rx=20"#"=20(*=20(syntax=20whitespace))))=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20comment-end=20"")=0A=20=20=20(setq-local=20=
comment-end-skip=0Adiff=20--git=20a/lisp/progmodes/go-ts-mode.el=20=
b/lisp/progmodes/go-ts-mode.el=0Aindex=208de6d0e0700..d7563c3bbf6=20=
100644=0A---=20a/lisp/progmodes/go-ts-mode.el=0A+++=20=
b/lisp/progmodes/go-ts-mode.el=0A@@=20-725,6=20+725,7=20@@=20=
go-work-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"//=20")=0A=
=20=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20(rx=20"//"=20(*=20(syntax=20=
whitespace))))=0A+=20=20=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20=
(setq-local=20indent-tabs-mode=20t=0Adiff=20--git=20=
a/lisp/progmodes/json-ts-mode.el=20b/lisp/progmodes/json-ts-mode.el=0A=
index=209575eaf6cf0..b2ffccecd76=20100644=0A---=20=
a/lisp/progmodes/json-ts-mode.el=0A+++=20=
b/lisp/progmodes/json-ts-mode.el=0A@@=20-198,6=20+198,7=20@@=20=
json-ts-mode=0A=20=20=20;;=20Comments.=0A=20=20=20(setq-local=20=
comment-start=20"//=20")=0A=20=20=20(setq-local=20comment-start-skip=20=
"\\(?://+\\|/\\*+\\)\\s=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20"//+\\s=20*")=0A=20=20=20(setq-local=20=
comment-end=20"")=0A=20=0A=20=20=20;;=20Electric=0Adiff=20--git=20=
a/lisp/progmodes/lua-ts-mode.el=20b/lisp/progmodes/lua-ts-mode.el=0A=
index=202963d5a96af..38b8bf992fb=20100644=0A---=20=
a/lisp/progmodes/lua-ts-mode.el=0A+++=20b/lisp/progmodes/lua-ts-mode.el=0A=
@@=20-683,6=20+683,7=20@@=20lua-ts-mode=0A=20=20=20=20=20;;=20Comments.=0A=
=20=20=20=20=20(setq-local=20comment-start=20"--")=0A=20=20=20=20=20=
(setq-local=20comment-start-skip=20"--\\s-*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=20=20=20=20=
(setq-local=20comment-end=20"")=0A=20=0A=20=20=20=20=20;;=20Pairs.=0A=
diff=20--git=20a/lisp/progmodes/python.el=20b/lisp/progmodes/python.el=0A=
index=2086336979067..848b2c54d25=20100644=0A---=20=
a/lisp/progmodes/python.el=0A+++=20b/lisp/progmodes/python.el=0A@@=20=
-7343,6=20+7343,7=20@@=20python-base-mode=0A=20=0A=20=20=20(setq-local=20=
comment-start=20"#=20")=0A=20=20=20(setq-local=20comment-start-skip=20=
"#+\\s-*")=0A+=20=20(setq-local=20comment-start-line-regexp=20=
comment-start-skip)=0A=20=0A=20=20=20(setq-local=20=
parse-sexp-lookup-properties=20t)=0A=20=20=20(setq-local=20=
parse-sexp-ignore-comments=20t)=0Adiff=20--git=20=
a/lisp/progmodes/ruby-mode.el=20b/lisp/progmodes/ruby-mode.el=0Aindex=20=
f2e38e0af46..ff33f0554ba=20100644=0A---=20a/lisp/progmodes/ruby-mode.el=0A=
+++=20b/lisp/progmodes/ruby-mode.el=0A@@=20-2693,6=20+2693,7=20@@=20=
ruby-base-mode=0A=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=
(setq-local=20comment-column=20ruby-comment-column)=0A=20=20=20=
(setq-local=20comment-start-skip=20"#+=20*")=0A+=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=
(setq-local=20parse-sexp-ignore-comments=20t)=0A=20=20=20(setq-local=20=
parse-sexp-lookup-properties=20t)=0Adiff=20--git=20=
a/lisp/progmodes/sh-script.el=20b/lisp/progmodes/sh-script.el=0Aindex=20=
7bda0153fe3..f66b752449b=20100644=0A---=20a/lisp/progmodes/sh-script.el=0A=
+++=20b/lisp/progmodes/sh-script.el=0A@@=20-1477,6=20+1477,7=20@@=20=
sh-base-mode=0A=20=20=20(setq-local=20paragraph-separate=20(concat=20=
paragraph-start=20"\\|#!/"))=0A=20=20=20(setq-local=20comment-start=20"#=20=
")=0A=20=20=20(setq-local=20comment-start-skip=20"#+[\t=20]*")=0A+=20=20=
(setq-local=20comment-start-line-regexp=20comment-start-skip)=0A=20=20=20=
(setq-local=20local-abbrev-table=20sh-mode-abbrev-table)=0A=20=20=20=
(setq-local=20comint-dynamic-complete-functions=0A=20=09=20=20=20=20=20=20=
sh-dynamic-complete-functions)=0Adiff=20--git=20=
a/lisp/textmodes/toml-ts-mode.el=20b/lisp/textmodes/toml-ts-mode.el=0A=
index=2063e3f60edd9..b121d8917d1=20100644=0A---=20=
a/lisp/textmodes/toml-ts-mode.el=0A+++=20=
b/lisp/textmodes/toml-ts-mode.el=0A@@=20-146,6=20+146,7=20@@=20=
toml-ts-mode=0A=20=20=20=20=20;;=20Comments=0A=20=20=20=20=20(setq-local=20=
comment-start=20"#=20")=0A=20=20=20=20=20(setq-local=20comment-end=20"")=0A=
+=20=20=20=20(setq-local=20comment-start-line-regexp=20"#+=20*")=0A=20=0A=
=20=20=20=20=20;;=20Indent.=0A=20=20=20=20=20(setq-local=20=
treesit-simple-indent-rules=20toml-ts-mode--indent-rules)=0Adiff=20--git=20=
a/lisp/textmodes/yaml-ts-mode.el=20b/lisp/textmodes/yaml-ts-mode.el=0A=
index=205afd4d2d111..bab0ba94c8c=20100644=0A---=20=
a/lisp/textmodes/yaml-ts-mode.el=0A+++=20=
b/lisp/textmodes/yaml-ts-mode.el=0A@@=20-271,6=20+271,7=20@@=20=
yaml-ts-mode=0A=20=20=20=20=20(setq-local=20comment-start=20"#=20")=0A=20=
=20=20=20=20(setq-local=20comment-end=20"")=0A=20=20=20=20=20(setq-local=20=
comment-start-skip=20"#+=20*")=0A+=20=20=20=20(setq-local=20=
comment-start-line-regexp=20comment-start-skip)=0A=20=0A=20=20=20=20=20=
;;=20Indentation.=0A=20=20=20=20=20(setq-local=20indent-tabs-mode=20nil)=0A=
diff=20--git=20a/lisp/treesit.el=20b/lisp/treesit.el=0Aindex=20=
5253439a9dd..5d81f6b9d1b=20100644=0A---=20a/lisp/treesit.el=0A+++=20=
b/lisp/treesit.el=0A@@=20-3749,17=20+3749,36=20@@=20=
treesit-forward-sentence=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20(max=20(point-min)=20=
(previous-single-char-property-change=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=20=20=20=20=20=
=20=20=20=20(point)=20'treesit-parser)))))))=0A=20=0A-(defun=20=
treesit-forward-comment=20(&optional=20count)=0A+(defun=20=
treesit--likely-line-comment-p=20(node)=0A+=20=20"Return=20non-nil=20if=20=
NODE=20is=20likely=20a=20line=20comment."=0A+=20=20(save-excursion=0A+=20=
=20=20=20(goto-char=20(treesit-node-start=20node))=0A+=20=20=20=20(if=20=
comment-start-line-regexp=0A+=20=20=20=20=20=20=20=20(looking-at=20=
comment-start-line-regexp)=0A+=20=20=20=20=20=20;;=20Heuristic:=20=
usually=20`comment-start'=20is=20set=20to=20the=20line=20comment=0A+=20=20=
=20=20=20=20;;=20start.=0A+=20=20=20=20=20=20(looking-at=20=
(string-trim-right=20comment-start)))))=0A+=0A+(defun=20=
treesit-forward-comment=20(count)=0A=20=20=20"Tree-sitter=20=
`forward-comment-function'=20implementation.=0A=20=0A=20COUNT=20is=20the=20=
same=20as=20in=20`forward-comment'."=0A-=20=20(let=20((res=20t)=20thing)=0A=
+=20=20(let=20((res=20t)=20thing=20line-comment-p)=0A=20=20=20=20=20=
(while=20(>=20count=200)=0A=20=20=20=20=20=20=20(skip-chars-forward=20"=20=
\t\n")=0A=20=20=20=20=20=20=20(setq=20thing=20(treesit-thing-at=20=
(point)=20'comment))=0A+=20=20=20=20=20=20(setq=20line-comment-p=20(and=20=
thing=20(treesit--likely-line-comment-p=20thing)))=0A=20=20=20=20=20=20=20=
(if=20(and=20thing=20(eq=20(point)=20(treesit-node-start=20thing)))=0A=20=
=20=20=20=20=20=20=20=20=20=20(progn=0A-=20=20=20=20=20=20=20=20=20=20=20=
=20(goto-char=20(min=20(1+=20(treesit-node-end=20thing))=20(point-max)))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(min=20=
(treesit-node-end=20thing)=20(point-max)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20;;=20For=20line=20comments,=20go=20to=20the=20next=20line.=20=20=
This=20is=0A+=20=20=20=20=20=20=20=20=20=20=20=20;;=20important=20=
because=20a)=20for=20navigation=20convenience,=20and=20b)=0A+=20=20=20=20=
=20=20=20=20=20=20=20=20;;=20many=20functions=20expect=20=
`forward-comment'=20to=20behave=20this=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20;;=20way=20(bug#80837).=0A+=20=20=20=20=20=20=20=20=20=20=20=20(when=20=
line-comment-p=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(skip-chars-forward=20"=20\t")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(when=20(looking-at=20"\n")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20(forward-char)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20=
count=20(1-=20count)))=0A=20=20=20=20=20=20=20=20=20(setq=20count=200=20=
res=20nil)))=0A=20=20=20=20=20(while=20(<=20count=200)=0A--=20=0A2.39.5=20=
(Apple=20Git-154)=0A=0A=
--Apple-Mail=_8ED64252-6C65-4A93-8C36-2B7A888C1732--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 17 May 2026 13:02:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 17 09:02:56 2026 Received: from localhost ([127.0.0.1]:42276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wOb8x-00057V-1Y for submit <at> debbugs.gnu.org; Sun, 17 May 2026 09:02:56 -0400 Received: from flow-b7-smtp.messagingengine.com ([202.12.124.142]:43391) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <spwhitton@HIDDEN>) id 1wOb8t-000561-6V for 80837 <at> debbugs.gnu.org; Sun, 17 May 2026 09:02:52 -0400 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailflow.stl.internal (Postfix) with ESMTP id 1966013000FA; Sun, 17 May 2026 09:02:44 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Sun, 17 May 2026 09:02:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=spwhitton.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1779022964; x=1779026564; bh=+SBtEH9eGD7n+WIzTVFFF8dqqNTEDI0Y 6MNw/rx1itw=; b=ozf/ptBm/HEh+JPGhTDbZe4+WvQ8Snh5ArpgEeK92ykyCrLx 8n+zP+ZInVNy6IZLQuWxXAQ/VF6S6QAUxlERYkDm92o0V8oz3TuipuI9LbDup0VD 9yAk911UhRosbE8ZyijK97zoip5roBgMjPgPe0+8BPfEE27CU68OAfGowzO1vxBb XYMIuGYZ/QGwP93gNwZFdRO1GeLgR+YXYTOhFdTJhsU6WdLffdflIi1OKC5itE04 ZO0eercs5ck/CUTivGUGogiVxnhQ0it7rBOXNMojr7L3ZPRuAXm0fxVRHCj7qjF0 so02plgYWvPJlOiJzKHwYRDpeJ+zCBnmjUZSeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1779022964; x= 1779026564; bh=+SBtEH9eGD7n+WIzTVFFF8dqqNTEDI0Y6MNw/rx1itw=; b=N 1K5sfxr5hG2ufiXhSd8CefH24KOb28OUrWeKUuvp86FolTOcgStFOD81Mo4I64Am 0t2Ei8k9zqOLlkvFQ/ixYeE8XPSD2w2A1jHkg4LFjCRl6HiIogFZt0U7nsTlck8P WJrVLy2f7U6phOkDpMhZ2PyT9gNr0Gv4lxjc5jRPR8c/oJIasUGsUl1WNYBPpbSv WnEaGuJNdn+pTunndOnk6Mo7IG7Vc8W3jqW/PcAKTX6uR17Yfvjm8mufwJkKjcJ+ MelVGDYqnmzri78aPPX3dmoDFQ2Blr2XOaXvBjbZFng/r1L8f6MnFDUK2LJ3TEMG anYzE3TS7teaqp6YEg9tg== X-ME-Sender: <xms:dLwJalc55NKYA4QjYjcNODYdpOUy9dllQoaR9n1T_-dq2q1RU44B3Q> <xme:dLwJaku-hap60J8OTVXtDy_ASUmhzgHy-qroB76QcuV3WKYzFSBrVueF9DxqmxWi3 kIX1409hrY2hIROoBfl6c-zGK1AhhSMzpiBjylQGtYUQd-1q05hId8> X-ME-Received: <xmr:dLwJaukkI3CEb1e-ra58GuvYPP4Q4p0G9OxEN3I_KQjhMDrXAa-FL1wc99CS5hXcf66zIeKfwxYREJYgcrVwTabQEbIfBg> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddufeeitdehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefujghffffkgggtgfesthhqtddttddtjeenucfhrhhomhepufgvrghnucgh hhhithhtohhnuceoshhpfihhihhtthhonhesshhpfihhihhtthhonhdrnhgrmhgvqeenuc ggtffrrghtthgvrhhnpeeuieelteekleejieetkeekfeeuuddtvdejgfekvdegkeevheeh gfegtefffedtieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehsphifhhhithhtohhnsehsphifhhhithhtohhnrdhnrghmvgdpnhgspghrtghp thhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghoiihhihgurghrse gsrghtshhovhdruggvvhdprhgtphhtthhopeektdekfeejseguvggssghughhsrdhgnhhu rdhorhhgpdhrtghpthhtoheptggrshhouhhrihesghhmrghilhdrtghomhdprhgtphhtth hopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrgdprhgtphhtthhopehj uhhriheslhhinhhkohhvrdhnvght X-ME-Proxy: <xmx:dLwJauxm6Gq-NwYxf1vmbT9Fj00Jj_HoWYnU-6m5Ep8R7gD999H2sg> <xmx:dLwJaoMiNTFjJ9BSkQYe7RRkhW0gT1g5IH6jORSwbINllghWAk0ZXQ> <xmx:dLwJaiql1hI0X6QSS3e-J7J8PTPKBD2B62iPlNA7MfszPWvEW_cavw> <xmx:dLwJapFpQ9VaRSSx1oaWGlhjPnXXeKgfyuszYJcLAAryTGUmfoalpg> <xmx:dLwJagj7HQ02wVQPM-gD7D5CEoQHpDpkHGj-TnlYJPmrtXl8OUb3xoPG> Feedback-ID: i62564b17:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 May 2026 09:02:43 -0400 (EDT) Received: by zephyr.silentflame.com (Postfix, from userid 1000) id 858AE940462; Sun, 17 May 2026 14:02:41 +0100 (BST) From: Sean Whitton <spwhitton@HIDDEN> To: Yuan Fu <casouri@HIDDEN>, Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> <871pg758em.fsf@HIDDEN> <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN> <87a4ukeeap.fsf@HIDDEN> <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN> <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN> <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN> <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN> Date: Sun, 17 May 2026 14:02:41 +0100 Message-ID: <87a4tyqjda.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>, Juri Linkov <juri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) Yuan Fu [15/May 4:37pm -07] wrote: > Cool, I can comment-start-line-regexp and at least the built-in modes > will have accurate forward-comment. > > Ummm cc=E2=80=99ing Sean as well, shall we add this to emacs-31? Since it= =E2=80=99s > needed to fix the forward-comment behavior for tree-sitter modes. I think I need to see the patch to think about it. --=20 Sean Whitton
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 15 May 2026 23:37:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 15 19:37:52 2026
Received: from localhost ([127.0.0.1]:50878 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wO26J-0001WV-L8
for submit <at> debbugs.gnu.org; Fri, 15 May 2026 19:37:52 -0400
Received: from mail-dy1-x132a.google.com ([2607:f8b0:4864:20::132a]:56643)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wO26G-0001Vy-NV
for 80837 <at> debbugs.gnu.org; Fri, 15 May 2026 19:37:50 -0400
Received: by mail-dy1-x132a.google.com with SMTP id
5a478bee46e88-2f30a4601bbso371936eec.1
for <80837 <at> debbugs.gnu.org>; Fri, 15 May 2026 16:37:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1778888267; x=1779493067; 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=QaWy9lq5PQbkryQ5v7ggutrayaQsQbQvbxQFIiwJmHQ=;
b=fg+ppWPG6UypzKLsO9MSpSILbgW3KLIw8GVI8Ahmmk3HY+3fOzKfxNxssWnn+aBdM5
XzgnlT1b3s1//CFoW+Bp4g093vyIPc4O/3kvyJpxnoy4tBxJnNNCMyVbirC8kehyrX7W
WBwmGNjLhxnTruWrnSSZO3JGiuhSF0Z+HaqA8Gypl7fazrFjwnYjHTGla3zkAfRthVd8
G47t2ROIPgKIYOCBWq2tATVLQrDtHnriUz4xjfVD36ecxMKXBwbVFclcjvL+M6Ipk2lg
dGKCICkxgNdR3T0MLjXwkSZXLi2KdVBpAFpZCS429bFwJVIskiyv5lSZFwMwWNyl5NQb
TxwQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1778888267; x=1779493067;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=QaWy9lq5PQbkryQ5v7ggutrayaQsQbQvbxQFIiwJmHQ=;
b=iNbxzCrrgwIYuEU3OEk3FRlcRPtWnI8UO3SuwCMpq8nyzMF3Lc2q1PFPM/TsPAPQkR
5WX3Xd+tPQb6YIzUk+GsQASrnWokjscDZjKxI3TlrySwdwDuLeO84e4GFgPxZIoZqXHC
T5wuOf+36q0buR/u/6U+ybARmy0RfX8s4xkN25ppvfmeVGvsUT1HiSp4/oDCi+nOE3GS
I5i9Vn1aOGc6iezVbR8sQGpLVcxAERN0uuHcAtJUaICyeOakQjWdqb/brHcxrjPAdh14
eELQ8CSiY0nE6h9wUqXCmyzREiw56+TuL51vs9JyGt5m5RAOpnvH8K/07UNhry3Oz5Dp
ilMw==
X-Forwarded-Encrypted: i=1;
AFNElJ+O1p7HjepbosYPTQHUgCcWKbuFXu88ANitLRbKtDvTt55FY5tL91dE9DwGtfkmpvTFmtPTHw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Ywp35sumE0tRxotTK5qcGm1KyiFW07m+gu7sZwJYvPTAEStp20P
Gx5uHNpaqVIsFsxZtCmyO3VfXF+NTczFI5CyT+qLTrr+jjU378RrXR6d
X-Gm-Gg: Acq92OF/i9mXCsj4neQUOO3yzOJMLEXi/PtyPEwvf8mkOSYkyMnbkrGtVq0GTUuExVo
8IHFxD3bdGSirllQ//QKJhPkkKxlWOhtZUKxdjI1C7e5gfjNAZeN54kEjXshylNha06esHd4wsg
OxHCLGrULONLWYW43eembyKyv8dUpHS1hI+IloYkgQPAi/RBUhFqrQzODeNng3ww5xh2Bh1UkKy
hwg+mJPV10UjDgxxUDwXMZCD9mBGJt6rf41dlDxXD7/cCu2zHwyOXhH9LoegcL4gvjWut2mW0gF
PLTRDKWAIy/Ln9tW+7O+FsKW7x5cb8AEvBpLFFkBlKHMhol6HCsMRzd01ErA7KkC+RGNGTztQkY
/chDS9QGbf1MCD3gO7qL27MG3FwsfxKIAOWwxWteGzhmVxHA0xnSI+BWl7MElZZ/uS5Ztq1a0fT
I48H/yBDEfYVHIjkeO5Ei0eklus3q1pmhzquaBN1M4Lq4oqg==
X-Received: by 2002:a05:7300:5726:b0:2d9:bc8d:f62a with SMTP id
5a478bee46e88-3039868cd4fmr2863970eec.16.1778888267157;
Fri, 15 May 2026 16:37:47 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c686:b320:61c1:2b84:c9a4:b880])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-302978b3cb2sm10709864eec.30.2026.05.15.16.37.46
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Fri, 15 May 2026 16:37:46 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
Date: Fri, 15 May 2026 16:37:35 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <08E5D854-156A-4F0D-9A80-5A390AE7ED4B@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
<jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Sean Whitton <spwhitton@HIDDEN>,
Bozhidar Batsov <bozhidar@HIDDEN>, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
> On May 14, 2026, at 6:46=E2=80=AFAM, Stefan Monnier =
<monnier@HIDDEN> wrote:
>=20
>>>>>> +(defvar treesit--block-comment-heuristic
>>>>>> + (let* ((pairs
>>>>>> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, =
CSS, SQL, PHP
>>>>>> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, =
F#, AppleScript
>>>>>> + ("{-" . "-}") ; Haskell, Elm, Agda
>>>>>> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
>>>>>> + ("<#" . "#>") ; PowerShell
>>>>>> + ("--[[" . "]]") ; Lua
>>>>>> + ("<!--" . "-->") ; HTML, XML, Markdown
>>>>>> + ("%{" . "%}") ; MATLAB, Octave
>>>>>> + ("\"" . "\"") ; Smalltalk
>>>>>> + ("###" . "###") ; CoffeeScript
>>>>>> + ("{" . "}") ; Delphi, Pascal
>>>>>> + ("(" . ")")) ; Forth
>>>=20
>>> Isn't it simpler to enumerate the line-comments rather than the
>>> block comments (since they all have the same "end")?
>>=20
>> My reasoning is that there are less variants of block commnts and =
matching
>> on both beginning and end is a stricter check.
>=20
> If we assume the centralized database is temporary hack, I don't think
> it matters much.
>=20
>>> As you can imagine, I'm not in favor of such a database.
>>> I'd let major modes set a `comment-line-start-regexp` and for those
>>> major modes which don't set it, we'd fallback on a simple heuristic =
based
>>> on `comment-end-skip` and/or
>>=20
>> My understanding is that comment-end-skip is already fine for the
>> job. Because it doesn=E2=80=99t really make sense to define if for =
line comment,
>> comment-end-skip usually only matches block comment ends. Is that =
right?
>=20
> Yes and no: "no" because `comment-end-skip` also matches the LF of =
line
> comments, but "yes" because if you try to match `comment-end-skip` =
from
> the position treesitter gives as comment-end then it will (usually) =
fail
> to match if it's a line-comment.
>=20
> The "usually" is because of cases like:
>=20
> int x; // This is a line-comment */
>=20
> which can show up in perfectly normal cases where a /*...*/ appears
> within a region that was commented out using `//`.
>=20
> So a `comment-start-line-regexp` would be more robust.
Ah, you=E2=80=99re right.=20
>=20
>> So here we=E2=80=99re really just talking about the fallback when the =
major mode
>> doesn=E2=80=99t set a comment-end-skip.
>=20
> Usually `comment-end-skip` is set by `comment-normalize-vars`.
TIL :)
>=20
>>> considering a comment to be a line
>>> comment if it ends right before LF.
>> I don=E2=80=99t think that=E2=80=99ll work since block comments =
normally also end with LF.
>=20
> For single-line block comments that end right before an LF, that would
> misfire, indeed, but in exactly the same way the current code =
misfires,
> so it'd be no worse than what we have.
>=20
> In any case, I think the main point is that the failures of a simple
> heuristic are minor enough that we don't need a central database and =
can
> just introduce a new var which major modes need to set, especiallu =
since
> major modes can add the setting right away within having to worry =
about
> the impact on older Emacsen.
Cool, I can comment-start-line-regexp and at least the built-in modes =
will have accurate forward-comment.=20
Ummm cc=E2=80=99ing Sean as well, shall we add this to emacs-31? Since =
it=E2=80=99s needed to fix the forward-comment behavior for tree-sitter =
modes.
Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 14 May 2026 13:46:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 14 09:46:35 2026
Received: from localhost ([127.0.0.1]:36645 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wNWOX-0004yL-QG
for submit <at> debbugs.gnu.org; Thu, 14 May 2026 09:46:35 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56489)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
id 1wNWOT-0004xL-VM
for 80837 <at> debbugs.gnu.org; Thu, 14 May 2026 09:46:31 -0400
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 4CF3B442FFE;
Thu, 14 May 2026 09:46:23 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
s=mail; t=1778766381;
bh=xHVJUjGBH3tkQmjMlSQDU9OKPGOlwwoOxxbISilfX8I=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=fKQk5v/g1IzQBZUTYjyxhGgBDJZEsW4Tc1DOt5Wcnvpgjv4BKJIjuw0WpiWX9xuh8
f12zNMTZJBlWgq+p+dS1JoayGH7HFbjlsX0/6NakarBtd2i/KMrbqKO6dbJ7d4vMOR
isUaOB/w709hWnhZ1R4Pzm9EiER8W+e8qCv3MC3L1WgS7wsizdMoxdXdOib+n6o3Wm
8lcg2QFPtfsINIyv4zzNqx9XjWUFmW+5OF+A9SxeCNTf6fLj+YQj2jaBP95j6BMCKS
iTxC63rz6y8LBqV88X9d8FVqnRv6PpdE4np+vvc1+IEmt83CCo5XOXgVljnyQD8Klz
Mqhim8P6a3ycw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AAC61442FFF;
Thu, 14 May 2026 09:46:21 -0400 (EDT)
Received: from pastel (104-195-197-162.cpe.teksavvy.com [104.195.197.162])
by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 77F70120314;
Thu, 14 May 2026 09:46:21 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
Message-ID: <jwvh5oaazfk.fsf-monnier+emacs@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
<265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
Date: Thu, 14 May 2026 09:46:20 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results: 0
ALL_TRUSTED -1 Passed through trusted hosts only via SMTP
AWL 0.076 Adjusted score from AWL reputation of From: address
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DKIM_SIGNED 0.1 Message has a DKIM or DK signature,
not necessarily valid
DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
domain
DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
domain
X-SPAM-LEVEL:
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>,
Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
>>>>> +(defvar treesit--block-comment-heuristic
>>>>> + (let* ((pairs
>>>>> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, SQ=
L, PHP
>>>>> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, Ap=
pleScript
>>>>> + ("{-" . "-}") ; Haskell, Elm, Agda
>>>>> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
>>>>> + ("<#" . "#>") ; PowerShell
>>>>> + ("--[[" . "]]") ; Lua
>>>>> + ("<!--" . "-->") ; HTML, XML, Markdown
>>>>> + ("%{" . "%}") ; MATLAB, Octave
>>>>> + ("\"" . "\"") ; Smalltalk
>>>>> + ("###" . "###") ; CoffeeScript
>>>>> + ("{" . "}") ; Delphi, Pascal
>>>>> + ("(" . ")")) ; Forth
>>=20
>> Isn't it simpler to enumerate the line-comments rather than the
>> block comments (since they all have the same "end")?
>
> My reasoning is that there are less variants of block commnts and matching
> on both beginning and end is a stricter check.
If we assume the centralized database is temporary hack, I don't think
it matters much.
>> As you can imagine, I'm not in favor of such a database.
>> I'd let major modes set a `comment-line-start-regexp` and for those
>> major modes which don't set it, we'd fallback on a simple heuristic based
>> on `comment-end-skip` and/or
>
> My understanding is that comment-end-skip is already fine for the
> job. Because it doesn=E2=80=99t really make sense to define if for line c=
omment,
> comment-end-skip usually only matches block comment ends. Is that right?
Yes and no: "no" because `comment-end-skip` also matches the LF of line
comments, but "yes" because if you try to match `comment-end-skip` from
the position treesitter gives as comment-end then it will (usually) fail
to match if it's a line-comment.
The "usually" is because of cases like:
int x; // This is a line-comment */
which can show up in perfectly normal cases where a /*...*/ appears
within a region that was commented out using `//`.
So a `comment-start-line-regexp` would be more robust.
> So here we=E2=80=99re really just talking about the fallback when the maj=
or mode
> doesn=E2=80=99t set a comment-end-skip.
Usually `comment-end-skip` is set by `comment-normalize-vars`.
>> considering a comment to be a line
>> comment if it ends right before LF.
> I don=E2=80=99t think that=E2=80=99ll work since block comments normally =
also end with LF.
For single-line block comments that end right before an LF, that would
misfire, indeed, but in exactly the same way the current code misfires,
so it'd be no worse than what we have.
In any case, I think the main point is that the failures of a simple
heuristic are minor enough that we don't need a central database and can
just introduce a new var which major modes need to set, especiallu since
major modes can add the setting right away within having to worry about
the impact on older Emacsen.
=3D=3D=3D Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 14 May 2026 03:10:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 13 23:10:28 2026
Received: from localhost ([127.0.0.1]:61000 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wNMSw-00042t-C8
for submit <at> debbugs.gnu.org; Wed, 13 May 2026 23:10:27 -0400
Received: from mail-dy1-x1329.google.com ([2607:f8b0:4864:20::1329]:54741)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wNMSq-000424-U6
for 80837 <at> debbugs.gnu.org; Wed, 13 May 2026 23:10:23 -0400
Received: by mail-dy1-x1329.google.com with SMTP id
5a478bee46e88-2ff5472f263so3802180eec.1
for <80837 <at> debbugs.gnu.org>; Wed, 13 May 2026 20:10:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1778728219; x=1779333019; 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=9gbgTHJGstm9ZmAjrYyMyH0i58I+zgm6SDbHbQU4T0w=;
b=fAGXlSYFQOccSPH+X9xofpjuJX6ATymjZIX3oeb680ChDxetoY/xynn/JJ//Nh0tJY
Z3vIHXlYKDlqHGmzvkocvwm1DacrMifZFu/tO5o0+TupiBJQWmQfEz9Q8o9D/tTytgIW
tWb07ybH1q49k8f4boMaBzfyfLP+XlRLhJvTwjrOPJLblplawLCLl+GNOUCAYtsFHQZl
OXxPayXLo/C4sBu4BLEXIPizn8V4IgAcrtGrrW+QEWrFSAriFIu5T/6cJelpVmGVo1mK
PLkB7TVTzk8c+EEAIWrbEZA0Ysx0kCh0HjmYIG7CaJ4BPyHfK6fAWmTUk/l68W2lyJER
HRXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1778728219; x=1779333019;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=9gbgTHJGstm9ZmAjrYyMyH0i58I+zgm6SDbHbQU4T0w=;
b=mCOswkPrz7DMOUlu/vBEjdB7OCMW4YZ3z160y5AbEd7CPPqQSbsELp+yO7EMhEj1BP
HdXjqzvjxyYXr40jgfqTPiuSDWHHUo9znn8u7Y67FPQ/993jvEA68HWzWqbgoY/0OzCr
i5ucONZ1aeeTGpc9bw2/E274ErJxm//fzkKsWT1rJoMBKEfXnxK3M6oZfpaPQ52/Xkrj
WFg9SOEyrYxdZ+EEX4d+c2ci+Sg6jzJLmIH0G/wl3gqe/R/xdMCsD/4dpiiCcA7pBFeL
YzygeYOY5fKhjrlJUlr5ouNSIskBiQEYB+lzeH2FF/qJt2eCwoRzsAtaW6atUNIPFeZR
G37w==
X-Forwarded-Encrypted: i=1;
AFNElJ+PHr5c4/k7kR4gRl+YgGLHQAXOLlncGg1aKOOmWxcaY4553zTIdr8zL0XhogKakVmuiVKLXg==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YxoetiGCQi4/BWCzDGlax8j6FaLqzNinmjeb0CL6Ef3hP8Ym1lO
ixEmjq0yxi7/T3KrMHRNp55CIGwDR99JCSu3V0YvatRPASDybgwWbYZ2
X-Gm-Gg: Acq92OHMQ+7nX9pvzhVL6mO10UK1da3gZtLhiCxjf665Ur14uCRAu2KEsytegYJDM0X
65yQZZsQEUsecWvw9NwXJnpRrpGbYHx8NM0WQmOpUE+KchriRVfHutp+mpv1OBU4Kz5YazvmdVT
PsCm+CVIx1U+MeCkxjM7dYcvMG6f8LxhndHab+H6w5n4snVhH3izel9eZtn2a65t3fHdCbEk5m4
a1zISv9QP3oC3Ju83zfGUcNt4P0wxSgahJQQcoX5flPPLYJ2XNr1FDrEempmnyHPkNww5CYPPTs
ZIPmTvprGHm3H+rrjqjrYduyExkhmtroJp3OP4KzR3RGUs+eCWtk5BGOYEj00BD7RgddtInGSZL
N8ipfE+5E0en/EJfD2n1GvLilVh4qLLz4V5DTYFocx7Hk4TmrK0E3eBP0+tBgBX4/IKKkmzSaN0
0nRp5lgLNh7m9WAKI5qBo7FyDQRBWEcracmmnXfvyPgOMb7g==
X-Received: by 2002:a05:7300:bb04:b0:2ea:cd38:f921 with SMTP id
5a478bee46e88-30119299933mr3560493eec.26.1778728218912;
Wed, 13 May 2026 20:10:18 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c686:b320:61c1:2b84:c9a4:b880])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-30290c4a699sm1536294eec.0.2026.05.13.20.10.18
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Wed, 13 May 2026 20:10:18 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
Date: Wed, 13 May 2026 20:10:07 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <265CE144-EAFA-48D4-96C7-29A746A3788D@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
<jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>,
Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
> On May 13, 2026, at 12:18=E2=80=AFPM, Stefan Monnier =
<monnier@HIDDEN> wrote:
>=20
>>> I know, but I can't find where block and line comments are used
>>> simultaneously. For example, 'c-ts-mode-toggle-comment-style'
>>> toggles between block and line comments.
>=20
> The question is not whether a mode uses them simultaneously, but
> whether the files do. And many files do.
> Things like `c-ts-mode-toggle-comment-style` control which style
> is used when commenting or inserting a new comment, not which comments
> can appear in the buffer.
Right
>>>> Ok, what do you think about this heuristic? Since we already know =
the node
>>>> is a comment node verified by the parser, this heuristics should be =
pretty
>>>> reliable.
>=20
> AFAICT we need to distinguish "line" comments vs "block" comments
> because Emacs consider line comments to end after the terminating the =
LF
> char whereas Treesit considers those comments to end before its
> terminating LF.
Exactly.
>>>> +(defvar treesit--block-comment-heuristic
>>>> + (let* ((pairs
>>>> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, =
SQL, PHP
>>>> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, =
AppleScript
>>>> + ("{-" . "-}") ; Haskell, Elm, Agda
>>>> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
>>>> + ("<#" . "#>") ; PowerShell
>>>> + ("--[[" . "]]") ; Lua
>>>> + ("<!--" . "-->") ; HTML, XML, Markdown
>>>> + ("%{" . "%}") ; MATLAB, Octave
>>>> + ("\"" . "\"") ; Smalltalk
>>>> + ("###" . "###") ; CoffeeScript
>>>> + ("{" . "}") ; Delphi, Pascal
>>>> + ("(" . ")")) ; Forth
>=20
> Isn't it simpler to enumerate the line-comments rather than the
> block comments (since they all have the same "end")?
My reasoning is that there are less variants of block commnts and =
matching on both beginning and end is a stricter check. But either way =
it doesn=E2=80=99t matter too much since the parser already tells us =
it=E2=80=99s a comment, we just need to distinguish between line vs =
block comment.
>>> I think maintaining a database of many different comment
>>> styles in treesit.el is not the right thing to do.
>>> For example, why there is no comments <%!-- --%> and <%# %>
>>> for heex-ts-mode existing in Emacs core, etc.
>> I can add them. In principle maintaining a database is not the way to =
go,
>> but in this particular case, we don=E2=80=99t have other good =
options, we do want to
>> provide a good fallback, and the number of possible block comment =
variations
>> isn=E2=80=99t that crazy.
>=20
> As you can imagine, I'm not in favor of such a database.
> I'd let major modes set a `comment-line-start-regexp` and for those
> major modes which don't set it, we'd fallback on a simple heuristic =
based
> on `comment-end-skip` and/or
My understanding is that comment-end-skip is already fine for the job. =
Because it doesn=E2=80=99t really make sense to define if for line =
comment, comment-end-skip usually only matches block comment ends. Is =
that right? So here we=E2=80=99re really just talking about the fallback =
when the major mode doesn=E2=80=99t set a comment-end-skip.
> considering a comment to be a line
> comment if it ends right before LF.
I don=E2=80=99t think that=E2=80=99ll work since block comments normally =
also end with LF.
>=20
> This will behave less nicely than your above database on those modes
> which haven't set this new var, but it's trivial to improve the modes =
to
> set this var with a `setq-local`, without any backward
> compatibility issues.
Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 13 May 2026 19:18:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 13 15:18:51 2026
Received: from localhost ([127.0.0.1]:55117 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wNF6W-0005gH-19
for submit <at> debbugs.gnu.org; Wed, 13 May 2026 15:18:51 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19041)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <monnier@HIDDEN>)
id 1wNF6T-0005fA-6e
for 80837 <at> debbugs.gnu.org; Wed, 13 May 2026 15:18:46 -0400
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5728D828C3;
Wed, 13 May 2026 15:18:39 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
s=mail; t=1778699917;
bh=m3au+1cOPcw4EYd5UhEAug05nnSok0BI+ccg7nxLqjI=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
b=FJBQyJC7w6XAZFGwL36IwQTdE8qu7ToEMsoIkPPnVn09GDlpqwQfcwxLcYIe5+cmt
zP8oW8IanQEbUwd536gjUG+zPk0oy2lW1jNGrrBNLf7/RKcUi1+L4ZMcPPsfL1T5Gx
UHB7erLQRWKhdLCwZZHnyRvP4ijHc5NFR+rkiN3FcVK6B5bPZnGnDivSqObzsgncph
6j5X5jR2yC0MGzYD+UU03HgLq7nae0OYAMqDXQqCKBqg9F9alEppi2gIJLeV3yLHm9
cyI9we1kcd+jr6l6vAgMQ6643g6UNOKTUQN3kzKKRKEQdpzs0DeV0sWn3kXYR+pSFM
erF9iA7C+rftQ==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 9D34681CF3;
Wed, 13 May 2026 15:18:37 -0400 (EDT)
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8C66E12022A;
Wed, 13 May 2026 15:18:37 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
Message-ID: <jwvjyt7no2y.fsf-monnier+emacs@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
Date: Wed, 13 May 2026 15:18:36 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results: 0
ALL_TRUSTED -1 Passed through trusted hosts only via SMTP
AWL 0.188 Adjusted score from AWL reputation of From: address
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DKIM_SIGNED 0.1 Message has a DKIM or DK signature,
not necessarily valid
DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
domain
DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
domain
X-SPAM-LEVEL:
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>,
Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
>> I know, but I can't find where block and line comments are used
>> simultaneously. For example, 'c-ts-mode-toggle-comment-style'
>> toggles between block and line comments.
The question is not whether a mode uses them simultaneously, but
whether the files do. And many files do.
Things like `c-ts-mode-toggle-comment-style` control which style
is used when commenting or inserting a new comment, not which comments
can appear in the buffer.
>>> Ok, what do you think about this heuristic? Since we already know the n=
ode
>>> is a comment node verified by the parser, this heuristics should be pre=
tty
>>> reliable.
AFAICT we need to distinguish "line" comments vs "block" comments
because Emacs consider line comments to end after the terminating the LF
char whereas Treesit considers those comments to end before its
terminating LF.
>>> +(defvar treesit--block-comment-heuristic
>>> + (let* ((pairs
>>> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, SQL,=
PHP
>>> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, Appl=
eScript
>>> + ("{-" . "-}") ; Haskell, Elm, Agda
>>> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
>>> + ("<#" . "#>") ; PowerShell
>>> + ("--[[" . "]]") ; Lua
>>> + ("<!--" . "-->") ; HTML, XML, Markdown
>>> + ("%{" . "%}") ; MATLAB, Octave
>>> + ("\"" . "\"") ; Smalltalk
>>> + ("###" . "###") ; CoffeeScript
>>> + ("{" . "}") ; Delphi, Pascal
>>> + ("(" . ")")) ; Forth
Isn't it simpler to enumerate the line-comments rather than the
block comments (since they all have the same "end")?
>> I think maintaining a database of many different comment
>> styles in treesit.el is not the right thing to do.
>> For example, why there is no comments <%!-- --%> and <%# %>
>> for heex-ts-mode existing in Emacs core, etc.
> I can add them. In principle maintaining a database is not the way to go,
> but in this particular case, we don=E2=80=99t have other good options, we=
do want to
> provide a good fallback, and the number of possible block comment variati=
ons
> isn=E2=80=99t that crazy.
As you can imagine, I'm not in favor of such a database.
I'd let major modes set a `comment-line-start-regexp` and for those
major modes which don't set it, we'd fallback on a simple heuristic based
on `comment-end-skip` and/or considering a comment to be a line
comment if it ends right before LF.
This will behave less nicely than your above database on those modes
which haven't set this new var, but it's trivial to improve the modes to
set this var with a `setq-local`, without any backward
compatibility issues.
=3D=3D=3D Stefan
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 13 May 2026 15:56:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 13 11:56:31 2026
Received: from localhost ([127.0.0.1]:52778 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wNBwl-00087A-19
for submit <at> debbugs.gnu.org; Wed, 13 May 2026 11:56:31 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:51786)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wNBwi-00086j-Jf
for 80837 <at> debbugs.gnu.org; Wed, 13 May 2026 11:56:29 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
id 1wNBwc-0004GQ-SK; Wed, 13 May 2026 11:56:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
Date; bh=aiRmq7bhSdlVjxFki4ds2ouKBrWl2NTBofeIb/agync=; b=H5ojs5JPIBLTGh0OHrS0
Pe8FtLj5HvSJa920TZTXwjTQup0DWTw3QANqSJEce/52+SFbmNrf0Pg71Nxfed0eD7Yf198jKG4PF
1CojyFlX3049xeiFnAHezMzJ2bmQCH700eIqfztGJ4DVDbXlc1cny4fXYisSfPPMvI+6K6ucgmB+A
uWPvelgVsMJuNgvMVqxO/kaZPIOmtwYf3mUM4dRA6YnUYbXmbWcdleuwfEJlw/z8E/yOVeSyQLV9I
afHX+24qUGc1+SDUYOeJiDT6qcpxi7uBXDMlM/9/wxjL+jl1+xLVU2XzpP/JK2soCesztNq3ckPb/
N+GqcHNG9MwPow==;
Date: Wed, 13 May 2026 18:55:32 +0300
Message-Id: <861pff9udn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>,
Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN> (message from
Yuan Fu on Wed, 13 May 2026 08:17:34 -0700)
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by
one character
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
<C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, bozhidar@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)
> Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>
> From: Yuan Fu <casouri@HIDDEN>
> Date: Wed, 13 May 2026 08:17:34 -0700
>
>
>
> > On Apr 30, 2026, at 8:24 AM, Juri Linkov <juri@HIDDEN> wrote:
> >
> >>> Could you find an example of a ts-mode that uses both line and block
> >>> comments at the same time? I can find only 'c-ts-mode-toggle-comment-style'
> >>> and 'php-ts-mode-set-comment-style' that switch between them.
> >>
> >> Maybe we’re not on the same page. Most C-like languages support both line
> >> and block comments. So major mode for these languages will set comment-end,
> >> so checking comment-end == “” isn’t a good check for whether the comment at
> >> point is line or block comment.
> >
> > I know, but I can't find where block and line comments are used
> > simultaneously. For example, 'c-ts-mode-toggle-comment-style'
> > toggles between block and line comments.
> >
> >>>> Better to strip the whitespace and do a string match, I think.
> >>>
> >>> Please clarify, do you mean something like
> >>> (string-empty-p (string-trim comment-end))
> >>
> >> I’m thinking of
> >>
> >> (save-excursion
> >> (goto-char (treesit-node-end node))
> >> (looking-back (regexp-quote
> >> (string-trim comment-end))
> >> (length (string-trim comment-end))))
> >
> > How this could detect a line comment
> > when 'comment-end' is e.g. " */"?
> >
> >> But anyway, comment-end probably isn’t a great heuristic since I found
> >> that some major modes that supports block comment syntax doesn’t set
> >> it, presumably because line comment is the “default” comment syntax.
> >
> > bug#77424 briefly added dedicated variables 'block-comment-start'
> > and 'block-comment-end' that were reverted in bug#77823.
> >
> >> Ok, what do you think about this heuristic? Since we already know the node
> >> is a comment node verified by the parser, this heuristics should be pretty
> >> reliable.
> >
> >> +(defvar treesit--block-comment-heuristic
> >> + (let* ((pairs
> >> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, SQL, PHP
> >> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, AppleScript
> >> + ("{-" . "-}") ; Haskell, Elm, Agda
> >> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
> >> + ("<#" . "#>") ; PowerShell
> >> + ("--[[" . "]]") ; Lua
> >> + ("<!--" . "-->") ; HTML, XML, Markdown
> >> + ("%{" . "%}") ; MATLAB, Octave
> >> + ("\"" . "\"") ; Smalltalk
> >> + ("###" . "###") ; CoffeeScript
> >> + ("{" . "}") ; Delphi, Pascal
> >> + ("(" . ")")) ; Forth
> >
> > I think maintaining a database of many different comment
> > styles in treesit.el is not the right thing to do.
> > For example, why there is no comments <%!-- --%> and <%# %>
> > for heex-ts-mode existing in Emacs core, etc.
>
> I can add them. In principle maintaining a database is not the way to go, but in this particular case, we don’t have other good options, we do want to provide a good fallback, and the number of possible block comment variations isn’t that crazy. If we missed one or two language, no big deal, we’re not promising to provide a 100% accurate solution anyway, it’s just a sensible fallback that we provide for convenience. But it’s important that we have a sensible fallback that works in 99% of the cases.
Stefan, any comments?
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 13 May 2026 15:17:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 13 11:17:57 2026
Received: from localhost ([127.0.0.1]:52187 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wNBLQ-0004UV-HH
for submit <at> debbugs.gnu.org; Wed, 13 May 2026 11:17:56 -0400
Received: from mail-dl1-x122f.google.com ([2607:f8b0:4864:20::122f]:56747)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wNBLM-0004UH-Vo
for 80837 <at> debbugs.gnu.org; Wed, 13 May 2026 11:17:54 -0400
Received: by mail-dl1-x122f.google.com with SMTP id
a92af1059eb24-1309f4ee97fso8562258c88.1
for <80837 <at> debbugs.gnu.org>; Wed, 13 May 2026 08:17:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1778685466; x=1779290266; 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=uR5xm9XD8oJyp7r9DBlXpU9PQMo8dLSIOjQAH/MTyx8=;
b=buYJczYy6b+62U7ZJdQdq901Maaou4DDHobUmn4Mao4ysmZdnsPp5MX3zot6VsBUWo
VUtUhnytnv1GucG+b0INQtZBlBjx8nqzy066BJhdOCsZLzZ+1IDMscwRRNwDzf2V3s+l
/3iAecFR7sJPzVrE2QW9T0qXL6Vrh4Ss02AKEy8eQOPqU5mmWpfec7x0lVUuDwLm0j4b
emyHjEq9llyydh96vL67rj5pyFEp1+FLdR7M8g2X76Tzekh0+itRkJsKFutblTYTD1VN
2LWhb0xZWHCBPd1NbFHP5JtRxJC503Pv3TT6Ks8YLNbf76cnT9jNbpw9YkXUEWTFuCeX
Pljg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1778685466; x=1779290266;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=uR5xm9XD8oJyp7r9DBlXpU9PQMo8dLSIOjQAH/MTyx8=;
b=hdV6H94/ES9GLFvy2VcqfLrzQWLFWSO0CNAIa169q1xAlcEaSgOaqaZ5r9hsg1QiCg
NtG65Ki0XrOTUgEMa+fSnt0TeVfB2F65W07hIrL/RXgrT/XPyfNXGXkDdszIwHGM0whU
btH4ZZCVoqncnmpnX8Gw1UV6d8pZ9/fr5ehb4g/B1Okl6Z8rppOaOqO2dUn3FYdDwtAk
ngDf6nlmTaSHQkaj+zrGDDU/JA+12maAi7f+vLp2DcOagSRuIRHpsgAAJnVbgkmmO9hM
f7EBJrQDRsMSHPsvOBjNFtckbds8ZpsSntVlZTvnabJE09SUg8y35j8kZoHVIRrzX86v
eiaA==
X-Gm-Message-State: AOJu0YwgMTNNkZ01PjOn/mWHw+ibrHpWvvIKbHZt8hQKf9ciJI8Y9ARE
iifrhdhjd8lS8TH3pmbsj3CJgfVYX6GDdh9tiXziNTWyh7drXvVhTLVX
X-Gm-Gg: Acq92OFNyIo7QSlfHQNqpqgzQ32w/RP+mZndmSN15di27UR3yLS/NrZ8R+C7y4Kdrx6
0lUE+iPm017Wtvl0XG5tTZzK1Wxg8lZSzg0DQjmOIHnFY0HvxQHSGpQ7IEIj4U9K8oE9kprjEaA
mfCM1Kflap5w8z6HLN3SEmxfllhKNizwiyLoUJQhjVVh4cieQgzu17ZfvoNBi08rQtfumy/FrKx
feO/YGEQIWl5DqtiIK7ON2btCRxhpWXySphOZl5GXbCKWm4py2Fi5B6YwfOXbAKqTbpPMv0niRY
D5cOJKIBYFWhOGUbYa8hhN5QVbKTjrlRY3EA7KlliDO9SH2tzRYDEHUG6D04ImV7jelppsZ6z7I
/8agrl6suDJDmRQWm9vzUIopTYr6XtKDFNB4rkdieqyUZ9LnT9M8zlV5DW4G9VXKWH6q9pNze8T
5wu8OJy/b+wFnmqf+upiLpdo2XZEpT1gyon6MhBg7CZEC3
X-Received: by 2002:a05:7301:1f0a:b0:2d9:bc8d:f62a with SMTP id
5a478bee46e88-301556533acmr1708767eec.16.1778685466247;
Wed, 13 May 2026 08:17:46 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c686:b320:e5f8:7e1f:4734:34a])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-2f888e381c9sm22293680eec.26.2026.05.13.08.17.45
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Wed, 13 May 2026 08:17:45 -0700 (PDT)
Content-Type: text/plain;
charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <87a4ukeeap.fsf@HIDDEN>
Date: Wed, 13 May 2026 08:17:34 -0700
Content-Transfer-Encoding: quoted-printable
Message-Id: <C537287D-2FA7-4A7F-91EF-63DF20309935@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
<87a4ukeeap.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
> On Apr 30, 2026, at 8:24=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>>> Could you find an example of a ts-mode that uses both line and block
>>> comments at the same time? I can find only =
'c-ts-mode-toggle-comment-style'
>>> and 'php-ts-mode-set-comment-style' that switch between them.
>>=20
>> Maybe we=E2=80=99re not on the same page. Most C-like languages =
support both line
>> and block comments. So major mode for these languages will set =
comment-end,
>> so checking comment-end =3D=3D =E2=80=9C=E2=80=9D isn=E2=80=99t a =
good check for whether the comment at
>> point is line or block comment.
>=20
> I know, but I can't find where block and line comments are used
> simultaneously. For example, 'c-ts-mode-toggle-comment-style'
> toggles between block and line comments.
>=20
>>>> Better to strip the whitespace and do a string match, I think.
>>>=20
>>> Please clarify, do you mean something like
>>> (string-empty-p (string-trim comment-end))
>>=20
>> I=E2=80=99m thinking of
>>=20
>> (save-excursion
>> (goto-char (treesit-node-end node))
>> (looking-back (regexp-quote
>> (string-trim comment-end))
>> (length (string-trim comment-end))))
>=20
> How this could detect a line comment
> when 'comment-end' is e.g. " */"?
>=20
>> But anyway, comment-end probably isn=E2=80=99t a great heuristic =
since I found
>> that some major modes that supports block comment syntax doesn=E2=80=99=
t set
>> it, presumably because line comment is the =E2=80=9Cdefault=E2=80=9D =
comment syntax.
>=20
> bug#77424 briefly added dedicated variables 'block-comment-start'
> and 'block-comment-end' that were reverted in bug#77823.
>=20
>> Ok, what do you think about this heuristic? Since we already know the =
node
>> is a comment node verified by the parser, this heuristics should be =
pretty
>> reliable.
>=20
>> +(defvar treesit--block-comment-heuristic
>> + (let* ((pairs
>> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, =
SQL, PHP
>> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, =
AppleScript
>> + ("{-" . "-}") ; Haskell, Elm, Agda
>> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
>> + ("<#" . "#>") ; PowerShell
>> + ("--[[" . "]]") ; Lua
>> + ("<!--" . "-->") ; HTML, XML, Markdown
>> + ("%{" . "%}") ; MATLAB, Octave
>> + ("\"" . "\"") ; Smalltalk
>> + ("###" . "###") ; CoffeeScript
>> + ("{" . "}") ; Delphi, Pascal
>> + ("(" . ")")) ; Forth
>=20
> I think maintaining a database of many different comment
> styles in treesit.el is not the right thing to do.
> For example, why there is no comments <%!-- --%> and <%# %>
> for heex-ts-mode existing in Emacs core, etc.
I can add them. In principle maintaining a database is not the way to =
go, but in this particular case, we don=E2=80=99t have other good =
options, we do want to provide a good fallback, and the number of =
possible block comment variations isn=E2=80=99t that crazy. If we missed =
one or two language, no big deal, we=E2=80=99re not promising to provide =
a 100% accurate solution anyway, it=E2=80=99s just a sensible fallback =
that we provide for convenience. But it=E2=80=99s important that we have =
a sensible fallback that works in 99% of the cases.
Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Juri Linkov <juri@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 30 Apr 2026 15:41:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 30 11:41:40 2026
Received: from localhost ([127.0.0.1]:56233 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wITWF-0001DA-W8
for submit <at> debbugs.gnu.org; Thu, 30 Apr 2026 11:41:40 -0400
Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:57604)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wITVz-00018z-QI
for 80837 <at> debbugs.gnu.org; Thu, 30 Apr 2026 11:41:25 -0400
Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4g5z0n1CzQz9tsV;
Thu, 30 Apr 2026 17:41:13 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1777563673;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=5p5NWe9UYyftyTfiee9a1sjuIZR42sDWAdyxmqRfJWA=;
b=g8vSRjjn6+TyOxr+biK+25paaIzLgS03PyltuFjP2je0esIjuNtc2r9/0cxgnws6BFeF8N
mg/YfSkhH9ukH55oYj6ln8/l+bPmhZvU/XSZYKqV6cDEEoAUejZbUtHdbbFYqrD7OpSJqD
19Qo1Bin0jL3fcw+j8hy6HhrxszLRY4RBFoKcFnHid0Ehtw+OlkORSAi9BQ+BYTAU3gR3u
fvrVxtB8TAjac8cnKrhxWKC55rv2dbfYSvH43wwH1VtWSVrj3J3nyCNPFhJ/kMOn2vaGRF
AsPeHpQdVc5vVzAWFyajXM3HZUpUAQa8TYoNRBxv3JLtrXrk5fdyGcWoLFziKA==
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
<678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
Date: Thu, 30 Apr 2026 18:24:10 +0300
Message-ID: <87a4ukeeap.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
>> Could you find an example of a ts-mode that uses both line and block
>> comments at the same time? I can find only 'c-ts-mode-toggle-comment-style'
>> and 'php-ts-mode-set-comment-style' that switch between them.
>
> Maybe we’re not on the same page. Most C-like languages support both line
> and block comments. So major mode for these languages will set comment-end,
> so checking comment-end == “” isn’t a good check for whether the comment at
> point is line or block comment.
I know, but I can't find where block and line comments are used
simultaneously. For example, 'c-ts-mode-toggle-comment-style'
toggles between block and line comments.
>>> Better to strip the whitespace and do a string match, I think.
>>
>> Please clarify, do you mean something like
>> (string-empty-p (string-trim comment-end))
>
> I’m thinking of
>
> (save-excursion
> (goto-char (treesit-node-end node))
> (looking-back (regexp-quote
> (string-trim comment-end))
> (length (string-trim comment-end))))
How this could detect a line comment
when 'comment-end' is e.g. " */"?
> But anyway, comment-end probably isn’t a great heuristic since I found
> that some major modes that supports block comment syntax doesn’t set
> it, presumably because line comment is the “default” comment syntax.
bug#77424 briefly added dedicated variables 'block-comment-start'
and 'block-comment-end' that were reverted in bug#77823.
> Ok, what do you think about this heuristic? Since we already know the node
> is a comment node verified by the parser, this heuristics should be pretty
> reliable.
> +(defvar treesit--block-comment-heuristic
> + (let* ((pairs
> + '(("/*" . "*/") ; C, C++, Java, JS, Rust, Go, CSS, SQL, PHP
> + ("(*" . "*)") ; Pascal, Clojure, OCaml, SML, F#, AppleScript
> + ("{-" . "-}") ; Haskell, Elm, Agda
> + ("#|" . "|#") ; Common Lisp, Racket, Scheme
> + ("<#" . "#>") ; PowerShell
> + ("--[[" . "]]") ; Lua
> + ("<!--" . "-->") ; HTML, XML, Markdown
> + ("%{" . "%}") ; MATLAB, Octave
> + ("\"" . "\"") ; Smalltalk
> + ("###" . "###") ; CoffeeScript
> + ("{" . "}") ; Delphi, Pascal
> + ("(" . ")")) ; Forth
I think maintaining a database of many different comment
styles in treesit.el is not the right thing to do.
For example, why there is no comments <%!-- --%> and <%# %>
for heex-ts-mode existing in Emacs core, etc.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 30 Apr 2026 07:16:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 30 03:16:28 2026
Received: from localhost ([127.0.0.1]:52044 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wILdL-0000ne-Gu
for submit <at> debbugs.gnu.org; Thu, 30 Apr 2026 03:16:28 -0400
Received: from mail-dy1-x1336.google.com ([2607:f8b0:4864:20::1336]:50222)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wILdI-0000n6-IF
for 80837 <at> debbugs.gnu.org; Thu, 30 Apr 2026 03:16:25 -0400
Received: by mail-dy1-x1336.google.com with SMTP id
5a478bee46e88-2e221a71e19so862005eec.0
for <80837 <at> debbugs.gnu.org>; Thu, 30 Apr 2026 00:16:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1777533383; x=1778138183; 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=QsP5CqMPRGfPmAxRmw1GHC3mzL/bzpsrsf1qmxy3eKA=;
b=ZIm6jSWbQW9YujBcIw2SPyxT3F4saoNjIoGle1DkV1G2b2zfAIt9Z4WDqyH1cHUrVk
826RxZlLHEvSnhPokPlGO3LUn8ppPQnFkYakVMy+3e5Ys/XV8FnajXIu//mN6VRDcy/I
Px+xFr673QaMqrjeLVcqmZAVZ1Cm7y4U2TWcce4plfIH/3m8PMTzcBF95+8jMBGDkypa
fKFKHhs/F4t52fACDukpXFZZb2hjZQVk0gl4ceB2xc0+H9eAAgZfkXVs8mTUBe3EBawV
fMLwvbgn+NSuHU0rbtqopXrqkk7SVYZrsYcZEzk3QY/BY1unb1G6VsbBsAH19Jq/gLAq
fxQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20251104; t=1777533383; x=1778138183;
h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to;
bh=QsP5CqMPRGfPmAxRmw1GHC3mzL/bzpsrsf1qmxy3eKA=;
b=Fo/Lhis94TZPuMzQXGySBHH8s77+kjO1iuAy+GjOsQrDQPIxVWM0FIxf72y8AswF7I
lR56lSRUQJeXr4oCt1qjRCrvvc2MkJWUjicBiRVQgrgl7jLXxVfxup1oTtm39KUhWvz/
80U76bjbuJHNSWiPYb0IazkaQgvgg8jfzvxL0cvFEgBm2CqEr5a+bpwq3psEb1bkOAWR
8QrBfyIPvv+e0FPevPhMFG+LhX2o90RXi2jHEELP7dpq2HMW46zAN7kVdDsNvnlCv99/
HnkNjpLhmdcV0IynP3LOJBQxX1OP1lv1FxQasw7t3j9o9t31wWjdye4BzSUtQN2gl/uG
axbw==
X-Gm-Message-State: AOJu0YyZTqVnIwSG35PXTgXBfQ3Ne5G/axuSrKzLAzq3Q9hA8Bepb6do
EBvvc3pTuFKFuCEoHmNkUA+NuhJ9Nx+HysIWFkW3FMiO7BT9NFuRhvtA
X-Gm-Gg: AeBDiet/MBKN8HZpupQusa01umT99MOKVJzJ4V5J0fWiXM0l+bU271lkeNcA+o11DTP
s1uoVPjvGUS5xKWECrbGt0Gh/06ItK4HrmQ/dxBbAYEA1BUoVKOWG2ymcYmnR1c9gvlEsac5WdN
P0NEcmOPeSK9awGIo1t1rh2qrXH0uuKGlAeqcMlPMrlDPWIRKek+ymRAxubEznRbvA1JvipS8ET
HA0jRG9pdxfy+TYhbWTVaF7kt2VfsVHPkWN4mRcGcgu17umARqbqMjDhZm7zD8F42E0KTW+psL0
oIZ3bSNP2KFbNa7TwCEr+mklaBPqihm6XVhv37oX20vwRdoRej9LQUNlCJ8udXerKGsamvMOyjM
Lc4nU15jF6co8UhZFo5z3IeljipVnQKVQk2zyHfNNy+JL1ggAHb64RV6GHk+IZih6eEoOSnkiAf
UmSpk/3EuD9vqHlMAliPJKybytmQRJ4eA0iCTFKeBtyYa2D+K66GwDHqSY
X-Received: by 2002:a05:7300:e614:b0:2dd:c066:c02 with SMTP id
5a478bee46e88-2ed3dbc07a9mr775844eec.22.1777533382885;
Thu, 30 Apr 2026 00:16:22 -0700 (PDT)
Received: from smtpclient.apple ([2601:645:c686:b320:19b1:e3f2:b31a:17cb])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-2ed1bf8e281sm5669438eec.9.2026.04.30.00.16.22
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Thu, 30 Apr 2026 00:16:22 -0700 (PDT)
From: Yuan Fu <casouri@HIDDEN>
Message-Id: <678B0681-921F-4A07-8432-C6C716B84F46@HIDDEN>
Content-Type: multipart/mixed;
boundary="Apple-Mail=_AD9468CE-7A4A-4F5F-AB60-965CF7348CAF"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\))
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
Date: Thu, 30 Apr 2026 00:16:11 -0700
In-Reply-To: <871pg758em.fsf@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
<875x5ks4fa.fsf@HIDDEN>
<0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN>
<871pg758em.fsf@HIDDEN>
X-Mailer: Apple Mail (2.3826.700.81)
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)
--Apple-Mail=_AD9468CE-7A4A-4F5F-AB60-965CF7348CAF
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On Apr 22, 2026, at 8:30=E2=80=AFAM, Juri Linkov <juri@HIDDEN> =
wrote:
>=20
>> I was thinking more like a heuristic that checks for */ *) etc, since
>> there=E2=80=99s only that many block comments in the world (right? =
right?) But
>> I admit it=E2=80=99s clearly not a 100% solution.
>=20
> For example, HTML comments: (setq-local comment-end " -->")
>=20
>> Comment end could be a nice solution too, since major modes _ought =
to_
>> define them. But I don=E2=80=99t think comparing it to empty string =
is that useful,
>> languages that has both line and block comments will define that
>> variable.
>=20
> Could you find an example of a ts-mode that uses both line and block
> comments at the same time? I can find only =
'c-ts-mode-toggle-comment-style'
> and 'php-ts-mode-set-comment-style' that switch between them.
Maybe we=E2=80=99re not on the same page. Most C-like languages support =
both line and block comments. So major mode for these languages will set =
comment-end, so checking comment-end =3D=3D =E2=80=9C=E2=80=9D isn=E2=80=99=
t a good check for whether the comment at point is line or block =
comment.
>=20
>> Better to strip the whitespace and do a string match, I think.
>=20
> Please clarify, do you mean something like
> (string-empty-p (string-trim comment-end))
I=E2=80=99m thinking of
(save-excursion
(goto-char (treesit-node-end node))
(looking-back (regexp-quote
(string-trim comment-end))
(length (string-trim comment-end))))
But anyway, comment-end probably isn=E2=80=99t a great heuristic since I =
found that some major modes that supports block comment syntax doesn=E2=80=
=99t set it, presumably because line comment is the =E2=80=9Cdefault=E2=80=
=9D comment syntax.
>=20
>> IMHO we should do both: use a dedicate function for uncomment region, =
since
>=20
> Any ts-mode can already override 'uncomment-region-function'
> to use specifics of its grammar. But I think no general treesit
> function is possible that would cover all grammars.
Actually, yeah, this seems to be a rare case where a tree-sitter version =
wouldn=E2=80=99t be better than the default implementation.
>> that=E2=80=99s usually how we deal with these kind of functions. But =
it=E2=80=99s probably
>> good to make tree-sitter=E2=80=99s forward-comment behave exactly =
like the old one
>> as much as possible, for a) ergonomics (it=E2=80=99s definitely more =
convenient to
>> go directly to the next line rather than EOL when the comment is a =
line
>> comment), and b) there might be other functions that rely on that =
behavior
>> out in the wilds.
>=20
> Agreed.
Ok, what do you think about this heuristic? Since we already know the =
node is a comment node verified by the parser, this heuristics should be =
pretty reliable.
Yuan
--Apple-Mail=_AD9468CE-7A4A-4F5F-AB60-965CF7348CAF
Content-Disposition: attachment;
filename=block-comment-heuristic.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="block-comment-heuristic.patch"
Content-Transfer-Encoding: quoted-printable
=46rom=206f2e350df2fd4a03e68e75c79a53d3f34f47bac3=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Yuan=20Fu=20<casouri@HIDDEN>=0ADate:=20Thu,=20=
30=20Apr=202026=2000:12:28=20-0700=0ASubject:=20[PATCH]=20Use=20a=20=
heuristic=20to=20imitate=20forward-comment=20in=20tree-sitter=0A=20=
(bug#80837)=0A=0ALine=20comment:=20go=20to=20next=20line=0ABlock=20=
comment:=20go=20to=20end=20of=20comment=0A=0A*=20lisp/treesit.el=20=
(treesit--block-comment-heuristic):=20New=20variable.=0A=
(treesit--probably-block-comment-p):=20new=20function.=0A=
(treesit-forward-comment):=20Use=20the=20heuristic.=0A---=0A=20=
lisp/treesit.el=20|=2056=20=
++++++++++++++++++++++++++++++++++++++++++++++---=0A=201=20file=20=
changed,=2053=20insertions(+),=203=20deletions(-)=0A=0Adiff=20--git=20=
a/lisp/treesit.el=20b/lisp/treesit.el=0Aindex=204579d416f34..7065c310434=20=
100644=0A---=20a/lisp/treesit.el=0A+++=20b/lisp/treesit.el=0A@@=20=
-3747,22=20+3747,72=20@@=20treesit-forward-sentence=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(max=20(point-min)=20=
(previous-single-char-property-change=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=20=20=20=20=20=
=20=20=20=20(point)=20'treesit-parser)))))))=0A=20=0A-(defun=20=
treesit-forward-comment=20(&optional=20count)=0A+(defvar=20=
treesit--block-comment-heuristic=0A+=20=20(let*=20((pairs=0A+=20=20=20=20=
=20=20=20=20=20=20'(("/*"=20.=20"*/")=20=20=20=20=20=20;=20C,=20C++,=20=
Java,=20JS,=20Rust,=20Go,=20CSS,=20SQL,=20PHP=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20("(*"=20.=20"*)")=20=20=20=20=20=20;=20Pascal,=20Clojure,=20=
OCaml,=20SML,=20F#,=20AppleScript=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
("{-"=20.=20"-}")=20=20=20=20=20=20;=20Haskell,=20Elm,=20Agda=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20("#|"=20.=20"|#")=20=20=20=20=20=20;=20Common=20=
Lisp,=20Racket,=20Scheme=0A+=20=20=20=20=20=20=20=20=20=20=20=20("<#"=20=
.=20"#>")=20=20=20=20=20=20;=20PowerShell=0A+=20=20=20=20=20=20=20=20=20=20=
=20=20("--[["=20.=20"]]")=20=20=20=20;=20Lua=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20("<!--"=20.=20"-->")=20=20=20;=20HTML,=20XML,=20Markdown=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20("%{"=20.=20"%}")=20=20=20=20=20=20;=20=
MATLAB,=20Octave=0A+=20=20=20=20=20=20=20=20=20=20=20=20("\""=20.=20=
"\"")=20=20=20=20=20=20;=20Smalltalk=0A+=20=20=20=20=20=20=20=20=20=20=20=
=20("###"=20.=20"###")=20=20=20=20;=20CoffeeScript=0A+=20=20=20=20=20=20=20=
=20=20=20=20=20("{"=20.=20"}")=20=20=20=20=20=20=20=20;=20Delphi,=20=
Pascal=0A+=20=20=20=20=20=20=20=20=20=20=20=20("("=20.=20")"))=20=20=20=20=
=20=20=20;=20Forth=0A+=20=20=20=20=20=20=20=20=20=20)=0A+=20=20=20=20=20=20=
=20=20=20(beg-list=0A+=20=20=20=20=20=20=20=20=20=20(mapcar=20#'car=20=
pairs))=0A+=20=20=20=20=20=20=20=20=20(end-list=0A+=20=20=20=20=20=20=20=20=
=20=20(mapcar=20#'cdr=20pairs)))=0A+=20=20=20=20(cons=20(regexp-opt=20=
beg-list)=0A+=20=20=20=20=20=20=20=20=20=20(regexp-opt=20end-list)))=0A+=20=
=20"Heuristic=20regexp=20of=20beginning=20and=20end=20of=20block=20=
comments.=0A+=0A+The=20car=20is=20regexp=20matching=20beginning=20of=20=
block=20comments,=20the=20cdr=20is=0A+regexp=20mathcing=20the=20end.")=0A=
+=0A+;;=20We=20don't=20verify=20if=20the=20beginning=20and=20end=20comes=20=
from=20the=20same=20pair,=0A+;;=20but=20this=20should=20suffice:=20=
afterall,=20the=20parser=20has=20done=20the=20hard=20work=0A+;;=20and=20=
we=20already=20know=20the=20node=20must=20be=20a=20comment=20node.=20=20=
This=20is=20just=20a=0A+;;=20fallback=20when=20major=20mode=20doesn't=20=
provide=20their=20own=20check.=0A+(defun=20=
treesit--probably-block-comment-p=20(node)=0A+=20=20"Return=20non-nil=20=
if=20NODE=20is=20probably=20a=20block=20comment."=0A+=20=20=
(save-excursion=0A+=20=20=20=20(catch=20'return=0A+=20=20=20=20=20=20=
(let=20(beg-match=20end-match)=0A+=20=20=20=20=20=20=20=20(goto-char=20=
(treesit-node-start=20node))=0A+=20=20=20=20=20=20=20=20(when=20(not=20=
(looking-at=20(car=20treesit--block-comment-heuristic)))=0A+=20=20=20=20=20=
=20=20=20=20=20(throw=20'return=20nil))=0A+=20=20=20=20=20=20=20=20=
(goto-char=20(treesit-node-end=20node))=0A+=20=20=20=20=20=20=20=20(when=20=
(not=20(looking-back=20(cdr=20treesit--block-comment-heuristic)=203))=0A=
+=20=20=20=20=20=20=20=20=20=20(throw=20'return=20nil))=0A+=20=20=20=20=20=
=20=20=20t))))=0A+=0A+(defun=20treesit-forward-comment=20(count)=0A=20=20=
=20"Tree-sitter=20`forward-comment-function'=20implementation.=0A=20=0A=20=
COUNT=20is=20the=20same=20as=20in=20`forward-comment'."=0A-=20=20(let=20=
((res=20t)=20thing)=0A+=20=20(let=20((res=20t)=20thing=20=
block-comment-p)=0A=20=20=20=20=20(while=20(>=20count=200)=0A=20=20=20=20=
=20=20=20(skip-chars-forward=20"=20\t\n")=0A=20=20=20=20=20=20=20(setq=20=
thing=20(treesit-thing-at=20(point)=20'comment))=0A+=20=20=20=20=20=20=
(setq=20block-comment-p=20(and=20thing=20=
(treesit--probably-block-comment-p=20thing)))=0A=20=20=20=20=20=20=20(if=20=
(and=20thing=20(eq=20(point)=20(treesit-node-start=20thing)))=0A=20=20=20=
=20=20=20=20=20=20=20=20(progn=0A-=20=20=20=20=20=20=20=20=20=20=20=20=
(goto-char=20(min=20(1+=20(treesit-node-end=20thing))=20(point-max)))=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(min=20=
(treesit-node-end=20thing)=20(point-max)))=0A+=20=20=20=20=20=20=20=20=20=
=20=20=20;;=20For=20line=20comments,=20go=20to=20the=20next=20line.=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20(when=20(not=20block-comment-p)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20(skip-chars-forward=20"=20\t")=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20(when=20(looking-at=20"\n")=0A+=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(forward-char)))=0A=20=20=20=
=20=20=20=20=20=20=20=20=20=20(setq=20count=20(1-=20count)))=0A=20=20=20=20=
=20=20=20=20=20(setq=20count=200=20res=20nil)))=0A=20=20=20=20=20(while=20=
(<=20count=200)=0A=20=20=20=20=20=20=20(skip-chars-backward=20"=20\t\n")=0A=
=20=20=20=20=20=20=20(setq=20thing=20(treesit-thing-at=20(max=20(1-=20=
(point))=20(point-min))=20'comment))=0A+=20=20=20=20=20=20(setq=20=
block-comment-p=20(and=20thing=20(treesit--probably-block-comment-p=20=
thing)))=0A=20=20=20=20=20=20=20(if=20(and=20thing=20(eq=20(point)=20=
(treesit-node-end=20thing)))=0A=20=20=20=20=20=20=20=20=20=20=20(progn=0A=
=20=20=20=20=20=20=20=20=20=20=20=20=20(goto-char=20(treesit-node-start=20=
thing))=0A--=20=0A2.39.5=20(Apple=20Git-154)=0A=0A=
--Apple-Mail=_AD9468CE-7A4A-4F5F-AB60-965CF7348CAF
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
--Apple-Mail=_AD9468CE-7A4A-4F5F-AB60-965CF7348CAF--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 22 Apr 2026 15:30:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 22 11:30:56 2026 Received: from localhost ([127.0.0.1]:38506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wFZXT-0006Lx-UX for submit <at> debbugs.gnu.org; Wed, 22 Apr 2026 11:30:56 -0400 Received: from mout-p-201.mailbox.org ([80.241.56.171]:39556) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wFZXS-0006Lb-DL for 80837 <at> debbugs.gnu.org; Wed, 22 Apr 2026 11:30:55 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4g138Q2Xcsz9v0h; Wed, 22 Apr 2026 17:30:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1776871846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W5kkQpR6Y7JXkT1w9GshV2n0XlmRq5GaZfKKl1qkZ+w=; b=oG2H4GcGYYq8bAaS465LEUW+j+l5R/0HoYcotQPOvgK/J5PaZVSoPw3zYG06tn1e198lv6 nkodgfnDGsaZMFSdLelQGzfkjtuDoqwzqQHJL5Yn1QtHg7rcyAMtABbqlPIGFa9Hv6IJQB PCmrxIzasOvyllBp5Loyn/ggSCo7JgrM+9GbGvqeKx4Zzlr5dUPAe8psJZ5J8g316CDqTE juyeeY+rAaZ8XM274yy2Hul35Y9jdLOVKidnXV7InfGaV5F3xSBcrw5iPyAlRfAOKoUoXe f/5gHHBreWsh3vyknDo9E7AbNG0VXmjEytd4AHmQnABIf+SISebhF1OMYxAT2Q== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=juri@HIDDEN From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> Date: Wed, 22 Apr 2026 18:30:17 +0300 Message-ID: <871pg758em.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4g138Q2Xcsz9v0h X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) > I was thinking more like a heuristic that checks for */ *) etc, since > there’s only that many block comments in the world (right? right?) But > I admit it’s clearly not a 100% solution. For example, HTML comments: (setq-local comment-end " -->") > Comment end could be a nice solution too, since major modes _ought to_ > define them. But I don’t think comparing it to empty string is that useful, > languages that has both line and block comments will define that > variable. Could you find an example of a ts-mode that uses both line and block comments at the same time? I can find only 'c-ts-mode-toggle-comment-style' and 'php-ts-mode-set-comment-style' that switch between them. > Better to strip the whitespace and do a string match, I think. Please clarify, do you mean something like (string-empty-p (string-trim comment-end)) > IMHO we should do both: use a dedicate function for uncomment region, since Any ts-mode can already override 'uncomment-region-function' to use specifics of its grammar. But I think no general treesit function is possible that would cover all grammars. > that’s usually how we deal with these kind of functions. But it’s probably > good to make tree-sitter’s forward-comment behave exactly like the old one > as much as possible, for a) ergonomics (it’s definitely more convenient to > go directly to the next line rather than EOL when the comment is a line > comment), and b) there might be other functions that rely on that behavior > out in the wilds. Agreed.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 22 Apr 2026 03:38:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 21 23:38:28 2026 Received: from localhost ([127.0.0.1]:57221 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wFOPz-0004dR-UG for submit <at> debbugs.gnu.org; Tue, 21 Apr 2026 23:38:28 -0400 Received: from mail-dy1-x132a.google.com ([2607:f8b0:4864:20::132a]:60512) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wFOPx-0004dC-JM for 80837 <at> debbugs.gnu.org; Tue, 21 Apr 2026 23:38:26 -0400 Received: by mail-dy1-x132a.google.com with SMTP id 5a478bee46e88-2b4520f6b32so6446798eec.0 for <80837 <at> debbugs.gnu.org>; Tue, 21 Apr 2026 20:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776829104; x=1777433904; 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=r7ormtK1o904bItW5Y2t+aDzlnrumA4Uf85LthOOPL8=; b=kQL+Ts0EfjQDYTTQeHc4WlkUFhyWR+EmCAbqyUxlS2Gfqt1HV/aFrKnBAYsiaKsfXQ m4/mFSh/HT1bcVSlIiu0OccTyqO+yCVeUb+TwXlyBQg565+wgf0Sc6D8aFJtOa1gXLSw tPrP4VbVuNXCbx/cUj3LPZgDiENk+nmMEM8tNHOSb1XpwatM4CwwfqPqCEam7qL+ND1Y blQYMUu07zdhs/9jcNU0SzFYbi2oZzp36jiyn/0zpOWv6800bGPhSHO0q5l4Et3epKdt NnOkO4iAcOmBbWNXEyg+tTd/lVcvho/0QLQka3vKVVHkeLHi//yh67uWEobCruLT/k2v RDKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776829104; x=1777433904; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=r7ormtK1o904bItW5Y2t+aDzlnrumA4Uf85LthOOPL8=; b=KivhvXs/pJkCv0Qoc3gFim1q+bL9kljjomuP1Rnod/OfrNTTrAcy2KaflQjuJxZ1XM nlKD0fO1VVMR8DcI7lp2liv/2U1IZYaq9dnUy59+T4TcB6j/SP5tyFlWCpRFwRhAqT4U E5ihm3e1BlzB9TpsgBlmPhLKoVdC6yVaq82cnWBNorDRjfCtJficC+fXGCcPJEhI8Z7I pRhBM9/5gm75QsI+maRe5mSJFnm0eJnuCVICv41cvkva1BBZ/zYtNfHGcZXlMIQeN9W7 mv1yi0ODO4qz8XC0AYvJom6BsAErX4vj89vn7fDGeaB+z1RFHLGHYbn5gQC95MBr3LMV COCg== X-Gm-Message-State: AOJu0YyySY26EjUWK28ApjtqA2cEd7K4ZrT40UztIM+mC+nJuBIF4qDM qkMuV53rHFCggk4WUcF3JdW4AhdK4QJMMdqqHY07De3s9lbDUxAmSDsL X-Gm-Gg: AeBDievURqVHtkIDHwh0Ja9d6O+SfC6RNLaNLOrQM+DbgJYo7dZvIbrDx+zAviJGtIp bo8c2UFvyp0utU1cf0SOevH1pupLRfM8VFyfkkkViyrA9WcQDgxGZs0bdh78BxG9HnEs0VAmTl9 Da2y8Zsd75KIkUqvBR8D9gSg7ZON2ll7Q81i4Lj7Cpt4BmUocFDcFeVgNEDQuxx6yN0k+rOxmtt 1A5rvMEy+zE4klOzBJbUzfMqJsCxjWDcPz9x+AgGv8QpPeLonyxDf57+YtHH+WUOoWjbjUqBDP8 e2y6xEh1jco6gcjyMwnpUyOuMg1MPZvoDVIlz+3DaaUMv/WZbbSHUw82RkjW7gvHCLhL6iqPoU7 78ZZPG6x+VALtL/EidElU3cheXJpS9VUUCMEO5onrLgdltB9dAzh2lU/u8JkINfuVD0P8GrOe/i MootKkv60tABe6tSuyqhAALbEcRtYpKPIptjhpVi/XZmPKLYqj+dAg5YdJkmj0XI/efrs= X-Received: by 2002:a05:7301:1e97:b0:2d9:77e1:57d4 with SMTP id 5a478bee46e88-2e47930c509mr11117336eec.29.1776829104057; Tue, 21 Apr 2026 20:38:24 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c686:b320:58c4:b11e:e51e:f62b]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2e53ccce0f5sm21449906eec.17.2026.04.21.20.38.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2026 20:38:23 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <875x5ks4fa.fsf@HIDDEN> Date: Tue, 21 Apr 2026 20:38:12 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <0777647F-0B38-4473-A76B-BA777629D31A@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN> <875x5ks4fa.fsf@HIDDEN> To: Juri Linkov <juri@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Apr 21, 2026, at 8:45=E2=80=AFAM, Juri Linkov <juri@HIDDEN> = wrote: >=20 >>>> I think the TRT to do for treesit-forward-comment is to mimic what >>>> forward-comment does: go to the next line for line comment, and go = to the >>>> end of the comment for block comment. Unfortunately there=E2=80=99s = currently no >>>> proper way to distinguish between the two in the tree-sitter thing >>>> system. Maybe we can add line-comment and block comment thing? Or = use som >>>> heuristic to distinguish between the two. >=20 > The only heuristic that we can use is to rely on non-ts variables > because in modes with line comments the value of 'comment-end' is "": >=20 > diff --git a/lisp/treesit.el b/lisp/treesit.el > index b4f148e8972..c2a8e49130b 100644 > --- a/lisp/treesit.el > +++ b/lisp/treesit.el > @@ -3637,13 +3637,16 @@ treesit-forward-comment > "Tree-sitter `forward-comment-function' implementation. >=20 > COUNT is the same as in `forward-comment'." > - (let ((res t) thing) > + (let ((res t) > + (line-comment (equal comment-end "")) > + thing) > (while (> count 0) > (skip-chars-forward " \t\n") > (setq thing (treesit-thing-at (point) 'comment)) > (if (and thing (eq (point) (treesit-node-start thing))) > (progn > - (goto-char (min (1+ (treesit-node-end thing)) = (point-max))) > + (goto-char (treesit-node-end thing)) > + (when line-comment (skip-chars-forward "\n" (1+ = (point)))) > (setq count (1- count))) > (setq count 0 res nil))) > (while (< count 0) I was thinking more like a heuristic that checks for */ *) etc, since = there=E2=80=99s only that many block comments in the world (right? = right?) But I admit it=E2=80=99s clearly not a 100% solution. Comment end could be a nice solution too, since major modes _ought to_ = define them. But I don=E2=80=99t think comparing it to empty string is = that useful, languages that has both line and block comments will define = that variable. Better to strip the whitespace and do a string match, I = think. IMHO we should do both: use a dedicate function for uncomment region, = since that=E2=80=99s usually how we deal with these kind of functions. = But it=E2=80=99s probably good to make tree-sitter=E2=80=99s = forward-comment behave exactly like the old one as much as possible, for = a) ergonomics (it=E2=80=99s definitely more convenient to go directly to = the next line rather than EOL when the comment is a line comment), and = b) there might be other functions that rely on that behavior out in the = wilds. Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at 80837) by debbugs.gnu.org; 21 Apr 2026 15:49:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 21 11:49:43 2026
Received: from localhost ([127.0.0.1]:48734 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wFDM5-0000hp-6p
for submit <at> debbugs.gnu.org; Tue, 21 Apr 2026 11:49:43 -0400
Received: from mout-p-201.mailbox.org ([2001:67c:2050:0:465::201]:34214)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wFDM0-0000h3-G3
for 80837 <at> debbugs.gnu.org; Tue, 21 Apr 2026 11:49:38 -0400
Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(No client certificate requested)
by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4g0RcR4pfXz9tkD;
Tue, 21 Apr 2026 17:49:27 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001;
t=1776786567;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:content-type:content-type:
in-reply-to:in-reply-to:references:references;
bh=RvgMkWFD0NJRIXBCP5LqGXEoANLOYSSf7Y8vOrHFeIo=;
b=WI/zFls8oTq9jokCTiWQTOwGQwv+so1rwhLkj4BD+2LaTIiS4BExG7s3DilmH5LGMluyrI
yJUKSKNRLXoYYLt0C1Tmnfq8YntlvI21W64bsnFKzYE7QfGYDVBB5ZSn0Bg5dJrYz62vr+
eml3iJDbl05EfuXM+EZmCGNBwepyHKY9GhygrxEpD69nr1cTNWeBprj51Aep5WXncB9L1/
rn6zfJde6QFeiGgd0ra53UB4tOFxdhXIs39W5+Jre4RC7e6DmUXVBHzLSPsMcLGGS7MJHn
C0/dv7T92yD3YNgDNDdqtfNmf9GxjqlMVRNnI7uGfXrPiTzC7nMfNxNniM7pRQ==
From: Juri Linkov <juri@HIDDEN>
To: Yuan Fu <casouri@HIDDEN>
Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots
by one character
In-Reply-To: <87a4ux7kjj.fsf@HIDDEN>
Organization: LINKOV.NET
References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
<87mrz2uchs.fsf@HIDDEN>
<A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN>
<87zf31ek6k.fsf@HIDDEN> <87a4ux7kjj.fsf@HIDDEN>
Date: Tue, 21 Apr 2026 18:45:29 +0300
Message-ID: <875x5ks4fa.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 80837
Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)
--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
>>> I think the TRT to do for treesit-forward-comment is to mimic what
>>> forward-comment does: go to the next line for line comment, and go to the
>>> end of the comment for block comment. Unfortunately there’s currently no
>>> proper way to distinguish between the two in the tree-sitter thing
>>> system. Maybe we can add line-comment and block comment thing? Or use som
>>> heuristic to distinguish between the two.
The only heuristic that we can use is to rely on non-ts variables
because in modes with line comments the value of 'comment-end' is "":
--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline;
filename=treesit-forward-comment-line-comment.patch
diff --git a/lisp/treesit.el b/lisp/treesit.el
index b4f148e8972..c2a8e49130b 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3637,13 +3637,16 @@ treesit-forward-comment
"Tree-sitter `forward-comment-function' implementation.
COUNT is the same as in `forward-comment'."
- (let ((res t) thing)
+ (let ((res t)
+ (line-comment (equal comment-end ""))
+ thing)
(while (> count 0)
(skip-chars-forward " \t\n")
(setq thing (treesit-thing-at (point) 'comment))
(if (and thing (eq (point) (treesit-node-start thing)))
(progn
- (goto-char (min (1+ (treesit-node-end thing)) (point-max)))
+ (goto-char (treesit-node-end thing))
+ (when line-comment (skip-chars-forward "\n" (1+ (point))))
(setq count (1- count)))
(setq count 0 res nil)))
(while (< count 0)
--=-=-=--
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 20 Apr 2026 15:19:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 20 11:19:27 2026 Received: from localhost ([127.0.0.1]:57983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wEqPH-0008DA-7E for submit <at> debbugs.gnu.org; Mon, 20 Apr 2026 11:19:27 -0400 Received: from mout-p-201.mailbox.org ([80.241.56.171]:50816) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wEqPE-0008Cm-OR for 80837 <at> debbugs.gnu.org; Mon, 20 Apr 2026 11:19:25 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4fzq035xdJz9stk; Mon, 20 Apr 2026 17:19:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1776698355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zfd3vkj0cIQgAlWZuxHWkH9D643GPl31078QSBQ4ko0=; b=FaCvh+SQuE93diQocN3VRCot1Q0DeYyVGInIMav/S2asjiMhdb7KlaMbGf2Mg3adUE4tp5 kq7IFxZkv4ABwgvquvka6kB88QUXD8KBO0w/PqTome1o3p5TLp4snaLZmm4ONHnAgRtxlf CnEf2BEQiXxBjjlam6RzTDg72B1t15aItkiXwceee13TkMUw7lb15dlyj4l4nsGjJ+LQlV cFlKD1zviX/zkci9uvJXN8GMsQnJZ3BTVEFFSCP0uGiQpAKYHbcpw3lCyY5cuwoixdleq4 F+OGvzAWSfUDq978K6IWkQRf9YcRiD3jMN+onyJeQQ6RnqQKqKYQoT2fxIbfPA== From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <87zf31ek6k.fsf@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> <87zf31ek6k.fsf@HIDDEN> Date: Mon, 20 Apr 2026 18:10:04 +0300 Message-ID: <87a4ux7kjj.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) >> I think the TRT to do for treesit-forward-comment is to mimic what >> forward-comment does: go to the next line for line comment, and go to the >> end of the comment for block comment. Unfortunately there’s currently no >> proper way to distinguish between the two in the tree-sitter thing >> system. Maybe we can add line-comment and block comment thing? Or use som >> heuristic to distinguish between the two. > > Unfortunately, there is no distinction between line and block > comments in most grammars, including tree-sitter-ocaml. > And I can't imagine a heuristic since both line and block > comments can end in a newline. > > Does this problem exists only for uncomment-region? > If yes, then we can redefine uncomment-region-function. > The default implementation in uncomment-region-default-1 > is over-complicated. But a new treesit-uncomment-region > would be very simple: it will just delete the text between > the node 'comment' and its children node 'comment_content'. Ah, no way, because 'comment_content' is specific only to Lua grammar. So we can't use 'comment_content' neither for uncomment-region-function, nor for a heuristic to distinguish between line/block comments. And distinction between "line_comment" and "block_comment" exists only in Java and Rust grammars. It would be sad to require every ts-mode to override treesit-forward-comment with own implementation.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 17 Apr 2026 15:38:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 17 11:38:18 2026 Received: from localhost ([127.0.0.1]:36957 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wDlGs-0002h0-3y for submit <at> debbugs.gnu.org; Fri, 17 Apr 2026 11:38:18 -0400 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]:35732) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wDlGp-0002gh-P4 for 80837 <at> debbugs.gnu.org; Fri, 17 Apr 2026 11:38:16 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4fxzYC1q9Qz9vYd; Fri, 17 Apr 2026 17:38:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1776440287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sVsATmisNs73CfYZ+2RVW+iQk8rHisO8NU3xIC/rwSc=; b=Gn0/0k8wS3hnVMMkK/xJ41U8DucQ3uBVtJH6QdAtmpJadr84xYd89O9my75Az/4G2HhQAP AJYH28kgjhr45pUyyCQjaAw8+ADmmvfjKOjSA97xa2CyY7s6kc1Lfysq5i2kO3PslQ+pMX Cq2K0ybdAEhEBpdcQVnPUE5jG3mhzbvrsqs28EaBL8E0VNt7g40B1YJj3GEeyEJ/TvQcMW wiFJslPBMb+VrmqLU09wlBIx1hrkbd0nlE9NkvMW+WATqp1B6ibei42UbUWKtrNfwqD6Zp myeHfT9xpW9Tn6yqHw0oT3vCGIGFAajNqBbnSrcNeKTy8EP6Ny0aeGo+7wprWQ== From: Juri Linkov <juri@HIDDEN> To: Yuan Fu <casouri@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> Date: Fri, 17 Apr 2026 18:27:31 +0300 Message-ID: <87zf31ek6k.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) > I think the TRT to do for treesit-forward-comment is to mimic what > forward-comment does: go to the next line for line comment, and go to the > end of the comment for block comment. Unfortunately there’s currently no > proper way to distinguish between the two in the tree-sitter thing > system. Maybe we can add line-comment and block comment thing? Or use som > heuristic to distinguish between the two. Unfortunately, there is no distinction between line and block comments in most grammars, including tree-sitter-ocaml. And I can't imagine a heuristic since both line and block comments can end in a newline. Does this problem exists only for uncomment-region? If yes, then we can redefine uncomment-region-function. The default implementation in uncomment-region-default-1 is over-complicated. But a new treesit-uncomment-region would be very simple: it will just delete the text between the node 'comment' and its children node 'comment_content'.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 17 Apr 2026 06:56:08 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 17 02:56:07 2026 Received: from localhost ([127.0.0.1]:60625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wDd7X-0004Wh-CJ for submit <at> debbugs.gnu.org; Fri, 17 Apr 2026 02:56:07 -0400 Received: from mail-dl1-x122f.google.com ([2607:f8b0:4864:20::122f]:50382) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <casouri@HIDDEN>) id 1wDd7R-0004UD-FV for 80837 <at> debbugs.gnu.org; Fri, 17 Apr 2026 02:56:04 -0400 Received: by mail-dl1-x122f.google.com with SMTP id a92af1059eb24-1279eced0b9so470548c88.0 for <80837 <at> debbugs.gnu.org>; Thu, 16 Apr 2026 23:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776408958; x=1777013758; 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=edzAKTbZYNaeJzyFwefaQ1QTnkA1QorWfCtIz0ujQPU=; b=Dm7dLoJkrEouAUoDRJBHYBxFkPYnGWV2U/UMOkq1YspGkMDj9gAJwMH4Df0PCNTowq BSqxZzFjBIaxNlTetWus76Z+tdEzQkbr1Vlw58NkyV7FI26D3TJRJ9XcPhx4CsFKlqlk azV16AyD/U63AIk7ro2XHOttd+xzwQi7poUjyJbfamdt4/lQGOZCTmz35LC3FyvRaTx4 mYKtrC4gf5O0ODqT8Z1zdaCznzMo/sJ6yjUBESzvWpo+ppQeMf1dHM2Pl8KPg7Qe6Wkm PNnTrQQm7uF35u8mPqg04w+MU7j/nOJA01ugUz5EqL1gX4pETwqrDw63aqalE1r63lFf tUVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776408958; x=1777013758; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=edzAKTbZYNaeJzyFwefaQ1QTnkA1QorWfCtIz0ujQPU=; b=akbF8dNqgR45Bm0XcswFzEJPwFEj9dz1t56f/oL+5ZQqmgj5h8zhQ4hL7zJWpdi5eI q+RsL3q2is9rq2e8kfVw+6DE4+rH6QXo4D94mAf1qeLkxvIF8gUdcOtH2WQnqG9qBWuU vpx/vYhbquWbIgjmqWOfgWUntK/5I3Zfs/oVxsMR1eb3gakNwS9EF3xhZi49EgBSRPwd XgrTlLyz1YeQgk4Fc8gZf9CXL1VQ5dI3f0ANbiDrXKyLaJ+xtgHVqyOZq2WlfTPXDHiS NQOgGwxi6iYeYRqZN8aUc6xd8ATe54B/EVUeNxk5r0LKB5TpsXN8Vxt9B6pU1u039ecO sewg== X-Forwarded-Encrypted: i=1; AFNElJ9pp5NBEn2xs4ouzd6Rg15ZYJJhy32We8BQ/Cjewx1PSgs+qQw8E6Vt73hIVMYdPYwhNaXYmA==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxPCffFuQmX2qb1Noqc9FmsW0mZEX358KcpczxVjNt8MkCDhLww zAKmYy7JlNaxN6Saa0WnpSa0vwK0LDODJqi/mqseio/HLqvWG6QyK6ji X-Gm-Gg: AeBDieuYdyip3X4naJ7LOxfsBrcme/e67emSg1d7N4bhNwm09kstJx+FeTK14Ap3f5c CrYZKac+rrRTZgcjB/eDSKoIIR/2a+u3rpx4Ok1ytaw9e/3GFyxVIh0LGjMJfon3OVxvUPKRmUm qhdLrvO83cPB6wOhAtGJFDHsdQ+tfsM7gR5ZjJJDZ8cB94AIaFojVo3Prmtx5QUfXNcsyXaCc09 UVBRzQlMfyUWOSSzNrHnZa4vZzUDAN8UifA1R3UAMBB6IDjCaz3OyGec4kskO8j/vSRajcinN/I sD7gdvgbK26/Jv3F8ucNgRAivYh4koxq12wxgtxJfn5fkIhH5ANXXGX66m1uO33TavAXr0VsxrC xTsDOOngF2OEflGLelPOTOLGNMolDIENk6rSSDkeBaCa4iA1y8vcl4EtyKdnLCruZTvKm68IRoP FNMyJd2wPhs0KWvq4MI9PRjOC4e5BktgFT9pwyqggAoyMM5pP6QdzD/7K2 X-Received: by 2002:a05:7301:168a:b0:2d1:815f:19c1 with SMTP id 5a478bee46e88-2e479c0427dmr615129eec.15.1776408957842; Thu, 16 Apr 2026 23:55:57 -0700 (PDT) Received: from smtpclient.apple ([2601:645:c686:b320:e5b4:ad68:f329:dbbc]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2e53a4a8bd2sm1000955eec.11.2026.04.16.23.55.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Apr 2026 23:55:57 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character From: Yuan Fu <casouri@HIDDEN> In-Reply-To: <87mrz2uchs.fsf@HIDDEN> Date: Thu, 16 Apr 2026 23:55:46 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <A2D955D2-AB1A-45E5-9C8B-A13C82FEA734@HIDDEN> References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> <87mrz2uchs.fsf@HIDDEN> To: Juri Linkov <juri@HIDDEN> X-Mailer: Apple Mail (2.3826.700.81) X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) > On Apr 16, 2026, at 9:34=E2=80=AFAM, Juri Linkov <juri@HIDDEN> = wrote: >=20 >> The fix is to remove the `1+`: >>=20 >> (goto-char (min (treesit-node-end thing) (point-max))) >>=20 >> Reproducible with any tree-sitter major mode that defines the = `comment` >> thing and uses block comments. Tested on Emacs 31.0.50. >=20 > I called this "off-by-one curse" in > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76791#8 >=20 > When we removed `1+`, navigation failed in some modes. > When we added `1+` back, it failed in other modes. >=20 > So I'm 100% sure that removing the `1+` here > will break other modes. >=20 > I see only one mode in Emacs core that uses the `comment` thing: > it's `lua-ts-mode`. And there is an example of Lua block comments > in test/lisp/progmodes/lua-ts-mode-resources/hide-show.lua: >=20 > --[[ > This is a > comment block. > ]] >=20 > I see no difference with or without `1+`, so this is ok. >=20 > However, there is a problem for non-block comments. > Removing the `1+` breaks test/manual/etags/lua-src/allegro.lua: >=20 > -- > -- Read "LEGAL.txt" for more information. >=20 > where `uncomment-region` doesn't uncomment the second line. >=20 > In any case, we need more tests in test/src/treesit-tests.el > to have an overview of ts-modes affected by differences of `1+`. I think the TRT to do for treesit-forward-comment is to mimic what = forward-comment does: go to the next line for line comment, and go to = the end of the comment for block comment. Unfortunately there=E2=80=99s = currently no proper way to distinguish between the two in the = tree-sitter thing system. Maybe we can add line-comment and block = comment thing? Or use som heuristic to distinguish between the two. Yuan=
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 16 Apr 2026 16:37:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 16 12:37:28 2026 Received: from localhost ([127.0.0.1]:53758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wDPiZ-0001tf-U0 for submit <at> debbugs.gnu.org; Thu, 16 Apr 2026 12:37:28 -0400 Received: from mout-p-101.mailbox.org ([80.241.56.151]:57062) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1wDPiX-0001st-21 for 80837 <at> debbugs.gnu.org; Thu, 16 Apr 2026 12:37:26 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4fxNvs6y2sz9t9t; Thu, 16 Apr 2026 18:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linkov.net; s=MBO0001; t=1776357434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=96YWx3Nl4GB6hhiSK/XtyIwcPHppl2ecHvZ/wPXYocU=; b=RfmXidHq1LU5ZGn3ptJMD1lyuZS5Fqj57i4UxirxqXdsh9IV+3Qe6/WOcvzAZams1okhGt enrUUm+1Qk1JgHN0BVmhu9h9gTEm6ej5NlqVRbwqXl1maqXRDpJVh5DzL+KHbXQ/o9fInO cxtTIQFc3kRimMG7EMujddD+DNh1u1fctaozRNs10ShyKMaNeh4BJiHeUl33xDH5HLAyDk FcszuOnLrU9JoCQRWjDxF1qyb0vMrHjw5dNIIzr1J36ShuvNcYwW9I9/IR6bGEEQgdNuAF /AVeP9FHLrTSGcInjSvJ6bo5fgILsnb2hNqQvDtIL3UhkOG4amZehTwwY9mzEw== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of juri@HIDDEN designates 2001:67c:2050:b231:465::202 as permitted sender) smtp.mailfrom=juri@HIDDEN From: Juri Linkov <juri@HIDDEN> To: "Bozhidar Batsov" <bozhidar@HIDDEN> Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character In-Reply-To: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> Organization: LINKOV.NET References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> Date: Thu, 16 Apr 2026 19:34:39 +0300 Message-ID: <87mrz2uchs.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 4fxNvs6y2sz9t9t X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org, Yuan Fu <casouri@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.7 (-) > The fix is to remove the `1+`: > > (goto-char (min (treesit-node-end thing) (point-max))) > > Reproducible with any tree-sitter major mode that defines the `comment` > thing and uses block comments. Tested on Emacs 31.0.50. I called this "off-by-one curse" in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76791#8 When we removed `1+`, navigation failed in some modes. When we added `1+` back, it failed in other modes. So I'm 100% sure that removing the `1+` here will break other modes. I see only one mode in Emacs core that uses the `comment` thing: it's `lua-ts-mode`. And there is an example of Lua block comments in test/lisp/progmodes/lua-ts-mode-resources/hide-show.lua: --[[ This is a comment block. ]] I see no difference with or without `1+`, so this is ok. However, there is a problem for non-block comments. Removing the `1+` breaks test/manual/etags/lua-src/allegro.lua: -- -- Read "LEGAL.txt" for more information. where `uncomment-region` doesn't uncomment the second line. In any case, we need more tests in test/src/treesit-tests.el to have an overview of ts-modes affected by differences of `1+`.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.Received: (at 80837) by debbugs.gnu.org; 16 Apr 2026 08:09:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 16 04:09:22 2026 Received: from localhost ([127.0.0.1]:50597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1wDHmo-0004eO-EZ for submit <at> debbugs.gnu.org; Thu, 16 Apr 2026 04:09:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40310) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1wDHmi-0004ck-Ci for 80837 <at> debbugs.gnu.org; Thu, 16 Apr 2026 04:09:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1wDHmc-00087h-H9; Thu, 16 Apr 2026 04:09:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Rdr0TCYtMVcJ+co2yQG1oenZ9VTqm9amuTzOQi74Ags=; b=XmBgSp9uZCc7 r9vllZobJsdjzofkBgVHso6jVcYktVmhECr+fFYhNri8TrrcFqI57PntmMMjUsDcBZigd+AwGzDck ptuOC99uJ+pDNXxpyU2XjfNLoJmYajkafQCjBn2f2VcC9J5WHZNLJuIkfZ9EQt51w8XQk9BiEZzA/ zONP5rZdz1VREg6nvx3DmiqiMuaT7dpfBB8tdq1uTqqFCxukjZ8hlf1i3TBY8mQXw3u59bCuLLP9e O7gnN558FVioaIUbxCtEkcnhQEznBw/HPo66Kv1HY4O/lXhRVQfbXxch1V0uWmTv8j11jniZL4wSS sygQ2c9f75ZzltjR2Zuf6A==; Date: Thu, 16 Apr 2026 11:09:00 +0300 Message-Id: <86ldenl42r.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: "Bozhidar Batsov" <bozhidar@HIDDEN>, Yuan Fu <casouri@HIDDEN> In-Reply-To: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> (bozhidar@HIDDEN) Subject: Re: bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character References: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 80837 Cc: 80837 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Thu, 16 Apr 2026 09:37:01 +0300 > From: "Bozhidar Batsov" <bozhidar@HIDDEN> > > `treesit-forward-comment` (introduced in commit 63df216490 for bug#75609) has an off-by-one error in the > forward branch. The line: > > (goto-char (min (1+ (treesit-node-end thing)) (point-max))) > > adds 1 to `treesit-node-end`, but `treesit-node-end` already returns an exclusive position (one past the last > character of the node). This causes point to overshoot by one character after skipping a comment. > > The practical impact is that `uncomment-region` breaks for languages with block comments (e.g., OCaml's (* ... > *)). When uncommenting a multi-line region where each line is individually commented: > > (* let () = *) > (* let a = 3 in *) > (* Format.eprintf "%d@." a *) > > The leading (* is removed but the trailing *) is left behind: > > let () = *) > let a = 3 in *) > Format.eprintf "%d@." a *) > > This happens because `uncomment-region-default-1` calls `comment-forward`, which calls `forward-comment 1 > `. The overshoot places point on the next line, where `comment-enter-backward` sees `(bolp)` as true and > takes the branch meant for line-comment modes, skipping removal of the closing delimiter. > > The fix is to remove the `1+`: > > (goto-char (min (treesit-node-end thing) (point-max))) > > Reproducible with any tree-sitter major mode that defines the `comment` thing and uses block comments. > Tested on Emacs 31.0.50. > > I came across this when a user of neocaml (a tree-sitter OCaml major mode) reported the problem: > https://github.com/bbatsov/neocaml/issues/25 > > I haven't reported any bugs here in ages, so I hope I got the report right. Thanks, I add Yuan to the discussion.
bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 16 Apr 2026 06:37:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 16 02:37:46 2026
Received: from localhost ([127.0.0.1]:50397 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1wDGM9-00068Z-5n
for submit <at> debbugs.gnu.org; Thu, 16 Apr 2026 02:37:45 -0400
Received: from lists1p.gnu.org ([2001:470:142::17]:58800)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <bozhidar@HIDDEN>)
id 1wDGM2-00063V-IQ
for submit <at> debbugs.gnu.org; Thu, 16 Apr 2026 02:37:38 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <bozhidar@HIDDEN>)
id 1wDGLw-000887-Ty
for bug-gnu-emacs@HIDDEN; Thu, 16 Apr 2026 02:37:28 -0400
Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <bozhidar@HIDDEN>)
id 1wDGLu-0000pU-Ee
for bug-gnu-emacs@HIDDEN; Thu, 16 Apr 2026 02:37:28 -0400
Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43])
by mailfout.stl.internal (Postfix) with ESMTP id 1A9671D0012B
for <bug-gnu-emacs@HIDDEN>; Thu, 16 Apr 2026 02:37:22 -0400 (EDT)
Received: from phl-imap-01 ([10.202.2.91])
by phl-compute-03.internal (MEProxy); Thu, 16 Apr 2026 02:37:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=batsov.dev; h=cc
:content-type:content-type:date:date:from:from:in-reply-to
:message-id:mime-version:reply-to:subject:subject:to:to; s=fm1;
t=1776321441; x=1776407841; bh=thZnr4DBlcQ24MxsLb2jwkBEK1IgMidk
d42cLmyOuaE=; b=H5Ye//rDKf/XYbCkJ/+2MLxjTjqaNPKwRlRWdqu+giyXytpq
CmQzKcShWp1MIIq80w53+Kz5/b8dx7/AYhBxXKZITOtV0Uc5aSVyA5qbMziikS+n
gnniGyb8o8rI6tE5CHCZ2r0xwrKjJo9qJfdUgvKhxxncUWY4X0xpNZdOXn7ax3Y9
pg0qGGmwOkSI93SrVtPdbxtR/+IvKr5dYQEVj+2yJiz+ib/L30FAaLcse9rFfk6u
R92yHVWsgfBKUT1G2+2D+nqiw8Q2Dc7wrKNQb8+IHP8nP9kZTNcGVsGjtp2ZXI/s
bA8aYj9EYu2AENocBjJvMQFu0infyRrn7OJF2Q==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:message-id
:mime-version:reply-to:subject:subject:to:to:x-me-proxy
:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1776321441; x=
1776407841; bh=thZnr4DBlcQ24MxsLb2jwkBEK1IgMidkd42cLmyOuaE=; b=G
B6o3MQPvEhAMUX78+u5Lff8F6a45YILrsc4gh2+PFjhQZmW9ZAwl7vyYJPbpA7By
TkjAENB2M8NrWcpWarDwsRQYKXVmJDqZmx1NmPMqaeexHnTB/sW2TuCuGUQt5t3g
Qn9S56jkv/36sD6XJ6oIVC/AMhGqmz9QSw3XYiBmnQ/9tSSTuYP7LpoJkEvjfqHj
ClusEgPIPbEctUnws7opV78Adm/CGgEaeotNDbv0eo056LAanINeGJK8P84mPr1C
Fii6IaYiOD9UIOFiqkM97MTB27+UaUOAw+bSAZCpS0nzNqS4diPyLJYpqm70A32G
zWfCF2Qu7RfoCFHrKoTBQ==
X-ME-Sender: <xms:oYPgaZjcG303KQMZVpF00TRwPXps6yCmQgn52sVZy83nTOJ6BBkwGg>
<xme:oYPgaY1QvFR9VX0_4sGQfw7LDyhr59jO3P1d1R8YUivf3SL5wpPrJZURnd8RB4J2-
b8hpNMYnfleB2MYZDTaoJSv-8dD88_DMQD-cEQjt0q9_ujFGqcsrA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdegieeftdcutefuodetggdotefrod
ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr
ihhlohhuthemuceftddtnecunecujfgurhepofggfffhvffkufgtsegrtderreertddtne
cuhfhrohhmpedfuehoiihhihgurghruceurghtshhovhdfuceosghoiihhihgurghrsegs
rghtshhovhdruggvvheqnecuggftrfgrthhtvghrnhepueehleffiedugedugeevffduke
ehleejgfefteegjeevudegiedtkeejgeduteegnecuffhomhgrihhnpehgihhthhhusgdr
tghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe
gsohiihhhiuggrrhessggrthhsohhvrdguvghvpdhnsggprhgtphhtthhopedupdhmohgu
vgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurd
horhhg
X-ME-Proxy: <xmx:oYPgabGi76Tvr2Wx_uNs5ZlhDKRg265MgLqav0jbwKtY81msxzhF5A>
<xmx:oYPgafRf_6VeR5v0VtQAykxXfVn0Ifx3y3Rh3RUQNorPZf2p1QkgFA>
<xmx:oYPgaSx-A6fxoXwRFP1F2VWGgJdz_kPv6zpy9Iy9k2UZN1VfWP5Ncg>
<xmx:oYPgaePB3SCRx_a936jT1UzZBGTX6bg4Vhpdw11Krh6fvKK_E9_SQw>
<xmx:oYPgaS_LOot-x1ZFcKkUc-aAUlH1Yom-tzEd5lM1JyrAtBUc9FwYay03>
Feedback-ID: i025946a9:Fastmail
Received: by mailuser.phl.internal (Postfix, from userid 501)
id A139918C0067; Thu, 16 Apr 2026 02:37:21 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
MIME-Version: 1.0
X-ThreadId: AmdKaEwoFgMo
Date: Thu, 16 Apr 2026 09:37:01 +0300
From: "Bozhidar Batsov" <bozhidar@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-Id: <ee8e55cc-d3fb-4ef9-9868-b8da4f3362ff@HIDDEN>
Subject: treesit-forward-comment off-by-one issue: overshoots by one character
Content-Type: multipart/alternative;
boundary=46f7486897f8e7b83709658aff9220e1adc25a78
Received-SPF: pass client-ip=202.12.124.151; envelope-from=bozhidar@HIDDEN;
helo=fout-b8-smtp.messagingengine.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 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, HEXHASH_WORD=1,
HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7,
RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,
SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Hey there! `treesit-forward-comment` (introduced in commit
63df216490 for bug#75609) has an off-by-one error in the forward branch.
The line: (goto-char (min (1+ (treesit-node-end thing)) (point-max)))
Content analysis details: (1.7 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org]
0.7 SPF_NEUTRAL SPF: sender does not match SPF record (neutral)
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
0.0 HTML_MESSAGE BODY: HTML included in message
1.0 HEXHASH_WORD Multiple instances of word + hexadecimal hash
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.3 (/)
--46f7486897f8e7b83709658aff9220e1adc25a78
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hey there!
`treesit-forward-comment` (introduced in commit 63df216490 for bug#75609) has an off-by-one error in the forward branch. The line:
(goto-char (min (1+ (treesit-node-end thing)) (point-max)))
adds 1 to `treesit-node-end`, but `treesit-node-end` already returns an exclusive position (one past the last character of the node). This causes point to overshoot by one character after skipping a comment.
The practical impact is that `uncomment-region` breaks for languages with block comments (e.g., OCaml's (* ... *)). When uncommenting a multi-line region where each line is individually commented:
(* let () = *)
(* let a = 3 in *)
(* Format.eprintf "%d@." a *)
The leading (* is removed but the trailing *) is left behind:
let () = *)
let a = 3 in *)
Format.eprintf "%d@." a *)
This happens because `uncomment-region-default-1` calls `comment-forward`, which calls `forward-comment 1`. The overshoot places point on the next line, where `comment-enter-backward` sees `(bolp)` as true and takes the branch meant for line-comment modes, skipping removal of the closing delimiter.
The fix is to remove the `1+`:
(goto-char (min (treesit-node-end thing) (point-max)))
Reproducible with any tree-sitter major mode that defines the `comment` thing and uses block comments. Tested on Emacs 31.0.50.
I came across this when a user of neocaml (a tree-sitter OCaml major mode) reported the problem: https://github.com/bbatsov/neocaml/issues/25
I haven't reported any bugs here in ages, so I hope I got the report right.
--46f7486897f8e7b83709658aff9220e1adc25a78
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html><html><head><title></title></head><body><div>Hey there!</=
div><div><br></div><div>`treesit-forward-comment` (introduced in commit =
63df216490 for bug#75609) has an off-by-one error in the forward branch.=
The line:</div><div><br></div><div> (goto-char (min (1+ (treesit-=
node-end thing)) (point-max)))</div><div><br></div><div>adds 1 to `trees=
it-node-end`, but `treesit-node-end` already returns an exclusive positi=
on (one past the last character of the node). This causes point to overs=
hoot by one character after skipping a comment.</div><div><br></div><div=
>The practical impact is that `uncomment-region` breaks for languages wi=
th block comments (e.g., OCaml's (* ... *)). When uncommenting a multi-l=
ine region where each line is individually commented:</div><div><br></di=
v><div> (* let () =3D *)</div><div> (* let=
a =3D 3 in *)</div><div> (* Format.eprintf "%d@=
." a *)</div><div><br></div><div>The leading (* is removed but the=
trailing *) is left behind:</div><div><br></div><div> let () =3D&=
nbsp; *)</div><div> let a =3D 3 in *)</div><div>=
Format.eprintf "%d@." a *)</div><div><br></div>=
<div>This happens because `uncomment-region-default-1` calls `comment-fo=
rward`, which calls `forward-comment 1`. The overshoot places point on t=
he next line, where `comment-enter-backward` sees `(bolp)` as true and t=
akes the branch meant for line-comment modes, skipping removal of the cl=
osing delimiter.</div><div><br></div><div>The fix is to remove the `1+`:=
</div><div><br></div><div> (goto-char (min (treesit-node-end thing=
) (point-max)))</div><div><br></div><div>Reproducible with any tree-sitt=
er major mode that defines the `comment` thing and uses block comments. =
Tested on Emacs 31.0.50.</div><div><br></div><div>I came across this whe=
n a user of neocaml (a tree-sitter OCaml major mode) reported the proble=
m: <a href=3D"https://github.com/bbatsov/neocaml/issues/25">https://gith=
ub.com/bbatsov/neocaml/issues/25</a></div><div><br></div><div>I haven't =
reported any bugs here in ages, so I hope I got the report right.</div><=
div><br></div></body></html>
--46f7486897f8e7b83709658aff9220e1adc25a78--
"Bozhidar Batsov" <bozhidar@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#80837; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.