GNU bug report logs - #78458
31.0.50; treesit.el: thing navigation functions work incorrectly with some Clojure nodes

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Roman Rudakov <rrudakov@HIDDEN>; Done: Juri Linkov <juri@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 31.0.50, send any further explanations to 78458 <at> debbugs.gnu.org and Roman Rudakov <rrudakov@HIDDEN> Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 20 May 2025 06:56:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 20 02:56:04 2025
Received: from localhost ([127.0.0.1]:52759 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uHGtQ-0002hN-A5
	for submit <at> debbugs.gnu.org; Tue, 20 May 2025 02:56:04 -0400
Received: from relay7-d.mail.gandi.net ([2001:4b98:dc4:8::227]:43017)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>)
 id 1uHGtJ-0002fG-1f; Tue, 20 May 2025 02:55:57 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 61C2D439AC;
 Tue, 20 May 2025 06:55:48 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Roman Rudakov <rrudakov@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m2ecwk1jri.fsf@HIDDEN>
Organization: LINKOV.NET
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN> <87iklwze3a.fsf@HIDDEN>
 <m2plg41myk.fsf@HIDDEN> <87bjroxweu.fsf@HIDDEN>
 <m2jz6c1keu.fsf@HIDDEN> <m2ecwk1jri.fsf@HIDDEN>
Date: Tue, 20 May 2025 09:49:32 +0300
Message-ID: <87o6vnlqtf.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvdefheelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepfedprhgtphhtthhopegtohhnthhrohhlseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjeekgeehkeesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphhtthhopehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgtohhm
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

close 78458 31.0.50
thanks

>>> Since the treesit grammar can't handle this case,
>>> you could try to use the default function by
>>>
>>>   (setq-local down-list-function nil)
>> Thank you! That is very helpful. I was able to use your patch with
>> small modifications to make it work for function literals and sets
>> (that have the same # marker node).  I'll try to discuss with the
>> author of the grammar possibility to modify it to have just one
>> 'open:' node instead of two.

One node instead of two would be nicer for such things as
show-paren-mode.  But probably it won't much of help for navigation.
For example, bash-ts-mode still requires the trick with 'sexp-default'
even when the bash grammar defines "$(" as a single node.

>> I think this bug can be closed now.

Ok, so closing now.

> One more question.  Will the trick with defining 'sexp-default' work in
> Emacs 30?  Or is it a new "thing" which is only available in master?

Alas, 'sexp-default' is available only in master.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 19:30:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 15:30:05 2025
Received: from localhost ([127.0.0.1]:45177 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uH6BY-0000Ca-4S
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 15:30:04 -0400
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:47373)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uH6BV-0000Ag-1o
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 15:30:02 -0400
Received: from phl-compute-12.internal (phl-compute-12.phl.internal
 [10.202.2.52])
 by mailfout.phl.internal (Postfix) with ESMTP id 83F10138009A;
 Mon, 19 May 2025 15:29:55 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-12.internal (MEProxy); Mon, 19 May 2025 15:29:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc: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=fm3; t=1747682995; x=1747769395; bh=1ttWj/M9z+
 BkvBdCSedl8jdEsxhuQy2ioOG9CYkCnQw=; b=IWUwWq0VCzr1HtSE+hkvCG9Kjk
 Y9qIvQQD93DktNk0lFJg0m+xLzfhQ4pETylmSomKGIjTwg1xOtiArEWgh4j3zeTd
 b2p2+tMnzV68i9GPBccRc1qltABnadDvSFeww4YEKwyc8LvRPOGWY3VVcmtfSs9B
 OVN8YwytYy4fNZOx8f/N+gnIlcKUJbOEcZB6v0mkYAkNlRPy2JFaSEdsll00gZzT
 ZE8Q5weUuxEhCo1PZZ+BAnztv/caPRdtKdnAq4qETYXbtROKewrNi38W44qjFwrG
 dweOby7hbdK0y/FE9NeDYIV7LoAIPg3LbPFwsi0CgyjVoBOm7EvIlGIGFvEA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=
 1747682995; x=1747769395; bh=1ttWj/M9z+BkvBdCSedl8jdEsxhuQy2ioOG
 9CYkCnQw=; b=k9HVUxmOwNQU0VpYEDYDkRmOCdzQhF6z5eSKYPToPTq01IqcAwU
 lQd+daizDP3lnXy0NJKotVJsrxc/STSIerTJxZTHdThDcBdc/ttZZRsVJCkWXXJA
 VISf1JoBqhTfsgMlOtGFBhSCzITvkDgt+BTqdLyEiU+SbL5q9+VfZeZU14UZCzVY
 49CgDeloSsO62wp9Ruczpp7VRdY1UUCTREYaq1/t+xKHDfNk+x/B8v+Zk0KUKWY6
 UNs6pnVIjT3x4MLDlzgI2c9tUbQr9y0vSfJe7OlVBjCu2gI2FFrArGF8QL2y26hB
 afWWFbR/Xbgmp7aoFiJDRn4vRO7rTBaFEzA==
X-ME-Sender: <xms:s4YraEN15dl9ddE59mImkJLkn_gMFh4Q7HfVQSbzWDsg4mQO7vSueA>
 <xme:s4YraK87x2n8nVmGfSLp-uKhF_kciNB5keyDgNsA100a4BGXDEwXt1eyesesoxTyV
 ANLRtKpl3E7cMXy_3c>
X-ME-Received: <xmr:s4YraLT7J8gz6OvFFbc4lJrwbOAFTkRnyTaL5LD9aQY3w8C1p8pWoVWKX1K9hY-uZuxlrAUjXJF25DY4jlnIqQHF>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvvddvucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
 gvnhhtshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttder
 tdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcuoehrrhhuuggrkhhovhesfhgrsh
 htmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeegledtffevueeujeekueeluedu
 udeggfffieelhfduhffhudekjeetfeduffeujeenucevlhhushhtvghrufhiiigvpedtne
 curfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgt
 ohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 ejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehl
 ihhnkhhovhdrnhgvth
X-ME-Proxy: <xmx:s4YraMtP_Yu3IjW79cPcoXiOxco46zkOxhyjXordBvjcE6O8ta3CHg>
 <xmx:s4YraMcf8wX36webv4moyjYqU0B6hH2v2Sa1pD2J93LgIJeumeFe-Q>
 <xmx:s4YraA3ua1VVaph7rQoRZvRyDTRypYzLh08ClwpTSLeJamuFu2wflQ>
 <xmx:s4YraA-bbYP-NXWY_v__5HMESdEiencVrjJZluiC-3U3j5lpxjTrXQ>
 <xmx:s4YraNvHWlF8gIh2cnYYKQ27XCWgrobUwXbfcmiH-XM3O2OlrJlm8h74>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 19 May 2025 15:29:54 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m2jz6c1keu.fsf@HIDDEN>
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN> <87iklwze3a.fsf@HIDDEN>
 <m2plg41myk.fsf@HIDDEN> <87bjroxweu.fsf@HIDDEN>
 <m2jz6c1keu.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Mon, 19 May 2025 21:29:53 +0200
Message-ID: <m2ecwk1jri.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

Roman Rudakov <rrudakov@HIDDEN> writes:

> Juri Linkov <juri@HIDDEN> writes:
>
>>>> +      (setq-local down-list-function
>>>> +                  (lambda (&optional arg)
>>>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>>>> +                      (treesit-down-list arg))))
>>>> +      (setq-local up-list-function
>>>> +                  (lambda (&optional arg escape-strings
>>>> no-syntax-crossing)
>>>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>>>> +                      (treesit-up-list arg escape-strings
>>>> no-syntax-crossing))))
>>>> +
>>>>        ;; Workaround for treesit-transpose-sexps not correctly
>>>>        working with
>>>>        ;; treesit-thing-settings on Emacs 30.
>>>>        ;; Once treesit-transpose-sexps it working again this can
>>>>        be removed
>>> Thank you very much for the patch Juri. It indeed solves all of 
>>> the
>>> problems I mentioned.  However while I was testing the patch I
>>> noticed that
>>> the 'down-list' function behaves a bit odd. If I call it multiple
>>> times
>>> starting from the beginning of the line it moves the point to the
>>> following
>>> positions:
>>>
>>> #|(-> (.-value (.-target %)))
>>> #(->| (.-value (.-target %)))
>>> #(-> (.-value| (.-target %)))
>>> #(-> (.-value| (|.-target %)))
>>> #(-> (.-value| (.-target| %)))
>>> #(-> (.-value| (.-target %|)))
>>
>> Then please remove '(setq-local down-list-function ..' from the
>> patch,
>> it's not needed.
>>
>>> While it would be more logical to have:
>>>
>>> #(|-> (.-value (.-target %)))
>>> #(-> (|.-value (.-target %)))
>>> #(-> (.-value (|.-target %)))
>>
>> Without redefining 'down-list-function'
>> the 'down-list' function behaves like above.
>>
>> But we can do nothing to fix the first step:
>>
>> #|(-> (.-value (.-target %)))
>>
>> because using treesit nodes, "#" is a child node of
>> 'anon_fn_lit', so 'down-list' goes after it.
>>
>> Since the treesit grammar can't handle this case,
>> you could try to use the default function by
>>
>>   (setq-local down-list-function nil)
> Thank you! That is very helpful. I was able to use your patch with
> small modifications to make it work for function literals and sets
> (that have the same # marker node).  I'll try to discuss with the
> author of the grammar possibility to modify it to have just one
> 'open:' node instead of two.
>
> I think this bug can be closed now.
One more question.  Will the trick with defining 'sexp-default' work 
in Emacs 30?  Or is it a new "thing" which is only available in 
master?
--
Best regards, Roman




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 19:16:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 15:16:09 2025
Received: from localhost ([127.0.0.1]:45007 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uH5y4-0007Ko-H3
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 15:16:09 -0400
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:56649)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uH5xx-0007Jl-Mt
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 15:16:05 -0400
Received: from phl-compute-03.internal (phl-compute-03.phl.internal
 [10.202.2.43])
 by mailfout.phl.internal (Postfix) with ESMTP id 230901380404;
 Mon, 19 May 2025 15:15:56 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-03.internal (MEProxy); Mon, 19 May 2025 15:15:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc: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=fm3; t=1747682156; x=1747768556; bh=Tx5/3a+XUE
 AUslglV+bfBf6Zzgyelfo5M9jKda+xePY=; b=O8oCxbpo8YsFHjWZkXPxFLFm1E
 83iqSvSe56aOjftmrHKh1PFk7EPoCc90Jlk7/QoaAd9dliLGNhMvl2sf9va2bBp5
 p3asqdMjbmDgI8jJuTdGKfHqal8+wTgT9+0geRWXVOxB92f4wY26jeAJdgncHXsC
 XnAdmhhvvwKWp/ymYNfU1mjmDIsBWJ2o7FmmkRh67johFVsxu2yUPck307RiHJfU
 TzUbsYUHLzr2l40CX5hHrfhv0dnyykqmsax0nnaF17/vaBkmQqJLdAtmJ4C63XRZ
 AR7oUJ12SANUThosu5BRTXEyY+sOKv88y4KflQ6Tq0hqe2IyTW8xY9DBUXWw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=
 1747682156; x=1747768556; bh=Tx5/3a+XUEAUslglV+bfBf6Zzgyelfo5M9j
 Kda+xePY=; b=dUziz9zbH9QiwDvokjLci24qJOCDDu9kCz0ZKVgTOh8yqOQgt4y
 YZvmjXa7Pjh71n0SPVHJOsYX4YAcXgZHQmHgJ3HjHpTDnhWbfzdtCUNr1SIotcKB
 69r2dBLH5lWN7cZwar+8G5AeZHUP95OfDGz+oxkF36pZaVf6b4XxHyKsf3QkmWu1
 ochGLbxwR15XIrMLkD3NwiC6QgdAo+f+sLgzGEKfS8/tETbAHlwNQhbYLFJOmpGo
 EsW78Ftb3/6uiqLXewO7Ko8O1PjQUnpKb5mpQNJw7G7o1NGgvzEQgFVcMu0gj0qj
 j17YriZWvwCeo3GzAUjD4Sjz893VibOgIGg==
X-ME-Sender: <xms:a4MraNF1zXz4o4I2zB6ZzweRTYw41Xj60RTYdqJzeQILe4a14UjVJw>
 <xme:a4MraCUM991tRk-6RBGj9xpy_YtEbm-OvZmusqY8KyXyWgygNzfwLPX77kIrYMXaM
 -XyJjZD7gYTLLFTnUU>
X-ME-Received: <xmr:a4MraPLBlba_IjGJiuDi-ELTK00rkqUG-ZxgTOzhLOFzawrGJy5MKrOFhbcIB3eyvE_lKkF8VLFi6EFHi-xhJ-U9>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvudelucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
 gvnhhtshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttder
 tdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcuoehrrhhuuggrkhhovhesfhgrsh
 htmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeegledtffevueeujeekueeluedu
 udeggfffieelhfduhffhudekjeetfeduffeujeenucevlhhushhtvghrufhiiigvpedtne
 curfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgt
 ohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 ejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehl
 ihhnkhhovhdrnhgvth
X-ME-Proxy: <xmx:a4MraDFs_jXz4WHYVOe9Td0Xu1Fx01tYbW1bZ1cx2QPhzWy6ECnmTA>
 <xmx:a4MraDXb9wnK86b9LAsKAEwTBRJa4gUmAx5bVSQWBjJOUVS345zq6Q>
 <xmx:a4MraOOPPHkZccgvqOmkYWQREA8jrmVTFvkFaAw_7W2uB1D1zBR2sg>
 <xmx:a4MraC3H8Pkt3MxvpgqeO-fkmLheSO1JDTMJHRuNGt2JcRLtCZVdrA>
 <xmx:bIMraBmFjn2KX7EAqlsUEG543qve5Qdt5Ayo-nFiuaeSJSMl8r95gjoQ>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 19 May 2025 15:15:55 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <87bjroxweu.fsf@HIDDEN>
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN> <87iklwze3a.fsf@HIDDEN>
 <m2plg41myk.fsf@HIDDEN> <87bjroxweu.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Mon, 19 May 2025 21:15:53 +0200
Message-ID: <m2jz6c1keu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>>> +      (setq-local down-list-function
>>> +                  (lambda (&optional arg)
>>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>>> +                      (treesit-down-list arg))))
>>> +      (setq-local up-list-function
>>> +                  (lambda (&optional arg escape-strings 
>>> no-syntax-crossing)
>>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>>> +                      (treesit-up-list arg escape-strings 
>>> no-syntax-crossing))))
>>> +
>>>        ;; Workaround for treesit-transpose-sexps not correctly 
>>>        working with
>>>        ;; treesit-thing-settings on Emacs 30.
>>>        ;; Once treesit-transpose-sexps it working again this can 
>>>        be removed
>> Thank you very much for the patch Juri. It indeed solves all of the
>> problems I mentioned.  However while I was testing the patch I 
>> noticed that
>> the 'down-list' function behaves a bit odd. If I call it multiple 
>> times
>> starting from the beginning of the line it moves the point to the 
>> following
>> positions:
>>
>> #|(-> (.-value (.-target %)))
>> #(->| (.-value (.-target %)))
>> #(-> (.-value| (.-target %)))
>> #(-> (.-value| (|.-target %)))
>> #(-> (.-value| (.-target| %)))
>> #(-> (.-value| (.-target %|)))
>
> Then please remove '(setq-local down-list-function ..' from the 
> patch,
> it's not needed.
>
>> While it would be more logical to have:
>>
>> #(|-> (.-value (.-target %)))
>> #(-> (|.-value (.-target %)))
>> #(-> (.-value (|.-target %)))
>
> Without redefining 'down-list-function'
> the 'down-list' function behaves like above.
>
> But we can do nothing to fix the first step:
>
> #|(-> (.-value (.-target %)))
>
> because using treesit nodes, "#" is a child node of
> 'anon_fn_lit', so 'down-list' goes after it.
>
> Since the treesit grammar can't handle this case,
> you could try to use the default function by
>
>   (setq-local down-list-function nil)
Thank you! That is very helpful. I was able to use your patch with 
small modifications to make it work for function literals and sets 
(that have the same # marker node).  I'll try to discuss with the 
author of the grammar possibility to modify it to have just one 
'open:' node instead of two.

I think this bug can be closed now.
--
Best regards, Roman




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 18:57:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 14:57:22 2025
Received: from localhost ([127.0.0.1]:44798 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uH5fu-0005U1-H2
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 14:57:22 -0400
Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]:50999)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1uH5fr-0005TO-Pe
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 14:57:21 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id CECE942E7E;
 Mon, 19 May 2025 18:57:11 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Roman Rudakov <rrudakov@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m2plg41myk.fsf@HIDDEN>
Organization: LINKOV.NET
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN> <87iklwze3a.fsf@HIDDEN>
 <m2plg41myk.fsf@HIDDEN>
Date: Mon, 19 May 2025 21:50:37 +0300
Message-ID: <87bjroxweu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvudeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprhhruhgurghkohhvsehfrghsthhmrghilhdrtghomh
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

>> +      (setq-local down-list-function
>> +                  (lambda (&optional arg)
>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>> +                      (treesit-down-list arg))))
>> +      (setq-local up-list-function
>> +                  (lambda (&optional arg escape-strings no-syntax-crossing)
>> +                    (let ((treesit-sexp-type-regexp 'sexp))
>> +                      (treesit-up-list arg escape-strings no-syntax-crossing))))
>> +
>>        ;; Workaround for treesit-transpose-sexps not correctly working with
>>        ;; treesit-thing-settings on Emacs 30.
>>        ;; Once treesit-transpose-sexps it working again this can be removed
> Thank you very much for the patch Juri. It indeed solves all of the
> problems I mentioned.  However while I was testing the patch I noticed that
> the 'down-list' function behaves a bit odd. If I call it multiple times
> starting from the beginning of the line it moves the point to the following
> positions:
>
> #|(-> (.-value (.-target %)))
> #(->| (.-value (.-target %)))
> #(-> (.-value| (.-target %)))
> #(-> (.-value| (|.-target %)))
> #(-> (.-value| (.-target| %)))
> #(-> (.-value| (.-target %|)))

Then please remove '(setq-local down-list-function ..' from the patch,
it's not needed.

> While it would be more logical to have:
>
> #(|-> (.-value (.-target %)))
> #(-> (|.-value (.-target %)))
> #(-> (.-value (|.-target %)))

Without redefining 'down-list-function'
the 'down-list' function behaves like above.

But we can do nothing to fix the first step:

#|(-> (.-value (.-target %)))

because using treesit nodes, "#" is a child node of
'anon_fn_lit', so 'down-list' goes after it.

Since the treesit grammar can't handle this case,
you could try to use the default function by

  (setq-local down-list-function nil)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 18:21:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 14:21:04 2025
Received: from localhost ([127.0.0.1]:44419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uH56m-00029H-7e
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 14:21:04 -0400
Received: from fout-a3-smtp.messagingengine.com ([103.168.172.146]:44049)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uH56j-00028D-8i
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 14:21:02 -0400
Received: from phl-compute-06.internal (phl-compute-06.phl.internal
 [10.202.2.46])
 by mailfout.phl.internal (Postfix) with ESMTP id 89CF41380409;
 Mon, 19 May 2025 14:20:55 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-06.internal (MEProxy); Mon, 19 May 2025 14:20:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc: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=fm3; t=1747678855; x=1747765255; bh=xbLyBJikyq
 kYos4JQNw8GlhLQuMmCZAgwZ2RGpbVRRY=; b=R1EA9GsEFg/+0PrFGRkpYVfLox
 NQWwxjiP1jlteL+u2NO9y4fRgCNGbPi4F8bCewJE7GB2oO5gUR3a+E/lY7bvAvTR
 vQpW4BCrFh9hjVBqQ/N1nK0flC/9RzVLP3JcbTmPJ6uzUjx/kxE/53X6bMx6pznV
 55+r4MPcY7/y2QBPLHjkpZafokjaUIOt1T2ikkIntMGmWiZK6uvixUAiLLwSEXOY
 tNFXDH+45JQwRyOqiokJ57pifX0dn7sFh7f0KVSZeV3tEAAuWWk1iSHRcdXjcdwB
 5EvjkNzS8jiVPFOafmET/U0KZ6Q17KAmxLXZYFEUev23H4hLtxpOUi7aQJfA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=
 1747678855; x=1747765255; bh=xbLyBJikyqkYos4JQNw8GlhLQuMmCZAgwZ2
 RGpbVRRY=; b=E40qodNsCQJq+bab3efd+p2yFOnDYEQ6MtSuTLGqrC96DueBuvx
 hdiSuKuWWkaEU2eOwRKRROIAWRv0fHqlOnhIkPQiOLC3de24GP1S4tdsDpMciYAP
 OxXrqufl2xYxQEJsxBbVri+ycvdKMlFTFCm4bbqpm+qj/oPyu0ZfLAa/QdOgtrKv
 a6oCZ1cWdwRbFRr+U6LYN49UstQNMQ6Pt0cPlf6ftmXbKRZ9g1gig4Hff0AEy9qM
 T/4JHTjjm7cO9BEX6M6E3F5DXJ3EJ4G4h26oLrrbHJSlTwumqzlAN+64zVPGcjZn
 8p81QJfJsO+TyLevpaTTDuFRx3I7h4EB2Gw==
X-ME-Sender: <xms:h3YraL0LRpsj15YQjHphWzxd03oYgytXdNor0xgomzNkb2zBt14txQ>
 <xme:h3YraKHpkAv2Gu4gNbUY2Flu3XdwsXzdEfz2HTh2tMCcXtmjcCQ1CpDERca75wag1
 4NmJBrIqaDGXjpbpAg>
X-ME-Received: <xmr:h3YraL53ZhQHCQnFtRD8z8QSg0OvI_72NHeq68cGPfJp2IX8_chkmmOMlikBejg_j0Fwjg8j1JdYbiO3cR6ffHkl>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvtdekucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
 gvnhhtshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttder
 tdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcuoehrrhhuuggrkhhovhesfhgrsh
 htmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeegledtffevueeujeekueeluedu
 udeggfffieelhfduhffhudekjeetfeduffeujeenucevlhhushhtvghrufhiiigvpedtne
 curfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgt
 ohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 ejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehl
 ihhnkhhovhdrnhgvth
X-ME-Proxy: <xmx:h3YraA0cQSsrb6My9Insh5phXNlW9cHXxnGYAPCbwuQXGvaKe5VRBw>
 <xmx:h3YraOFjLEgZYzKPJrfH5aQvGGrv-FeNFjgdCYvLLRfhWgwGz6VXFQ>
 <xmx:h3YraB9J9U7RftFPGJhsCGZlKioyNrobYvVkekx4IgkOlxBVpbf-CQ>
 <xmx:h3YraLmNU7sDIUe0qipowwHitPKUcut5EfsamCcmPgxmq-tQJAiO-g>
 <xmx:h3YraHusaEouLbycuzxaeDDu7TLRMS8tQTFLXoKcBIZxr6x1cpDuNXnT>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 19 May 2025 14:20:54 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <87iklwze3a.fsf@HIDDEN>
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN> <87iklwze3a.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Mon, 19 May 2025 20:20:51 +0200
Message-ID: <m2plg41myk.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>>> +     (sexp-default
>>> +      ;; For `C-M-f' in "#|(a)"
>>> +      ("(" . ,(lambda (node)
>>> +                 (and (eq (char-before (point)) ?\#)
>>> +                      (equal (treesit-node-type 
>>> (treesit-node-parent node))
>>> +                             "anon_fn_lit")))))
>> Thanks Juri. I tried your patch and for some reason it doesn't 
>> solve the
>> issue neither with 'raise-sexp' nor with 'C-M-f' navigation. The 
>> point is
>> moved from:
>>
>> #|(-> (.-value (.-target %)))
>>
>> to
>>
>> #(-> (.-value (.-target %))|)
>
> I tested that this patch fixes 'C-M-f' navigation where point moves 
> to
>
> #(-> (.-value (.-target %)))|
>
>> and 'raise-sexp' called from:
>>
>> #(-> |(.-value (.-target %)))
>>
>> produces:
>>
>> #(.-value (.-target %)))
>
> Indeed, it didn't fix this case.  For down/up-list it needs
> to use 'sexp' thing instead of 'list' thing.  Probably the simplest
> setting would be to redefine down-list-function/up-list-function.
>
> Ok, here is a complete tested patch that fixes all your test cases:
>
> [2. text/x-diff; clojure-ts-mode-sexp.patch]
> diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el
> index 8b6bca7..6ae8e16 100644
> --- a/clojure-ts-mode.el
> +++ b/clojure-ts-mode.el
> @@ -1549,6 +1549,12 @@ clojure-ts--thing-settings
>    `((clojure
>       (sexp ,(regexp-opt clojure-ts--sexp-nodes))
>       (list ,(regexp-opt clojure-ts--list-nodes))
> +     (sexp-default
> +      ;; For `C-M-f' in "#|(a)"
> +      ("(" . ,(lambda (node)
> +                 (and (eq (char-before (point)) ?\#)
> +                      (equal (treesit-node-type 
> (treesit-node-parent node))
> +                             "anon_fn_lit")))))
>       (text ,(regexp-opt '("comment")))
>       (defun ,#'clojure-ts--defun-node-p))
>      (when clojure-ts-use-markdown-inline
> @@ -2601,6 +2607,15 @@ clojure-ts-mode
>                  0
>                  t)
>
> +      (setq-local down-list-function
> +                  (lambda (&optional arg)
> +                    (let ((treesit-sexp-type-regexp 'sexp))
> +                      (treesit-down-list arg))))
> +      (setq-local up-list-function
> +                  (lambda (&optional arg escape-strings 
> no-syntax-crossing)
> +                    (let ((treesit-sexp-type-regexp 'sexp))
> +                      (treesit-up-list arg escape-strings 
> no-syntax-crossing))))
> +
>        ;; Workaround for treesit-transpose-sexps not correctly 
>        working with
>        ;; treesit-thing-settings on Emacs 30.
>        ;; Once treesit-transpose-sexps it working again this can be 
>        removed
Thank you very much for the patch Juri. It indeed solves all of the 
problems I mentioned.  However while I was testing the patch I noticed 
that the 'down-list' function behaves a bit odd. If I call it multiple 
times starting from the beginning of the line it moves the point to 
the following positions:

#|(-> (.-value (.-target %)))
#(->| (.-value (.-target %)))
#(-> (.-value| (.-target %)))
#(-> (.-value| (|.-target %)))
#(-> (.-value| (.-target| %)))
#(-> (.-value| (.-target %|)))

While it would be more logical to have:

#(|-> (.-value (.-target %)))
#(-> (|.-value (.-target %)))
#(-> (.-value (|.-target %)))

--
Best regards, Roman




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 17:51:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 13:51:15 2025
Received: from localhost ([127.0.0.1]:44089 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uH4dv-0007fN-4p
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 13:51:15 -0400
Received: from relay4-d.mail.gandi.net ([217.70.183.196]:41975)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1uH4dj-0007e8-7E
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 13:51:03 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 1703A4438F;
 Mon, 19 May 2025 17:50:55 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Roman Rudakov <rrudakov@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m25xhxkocz.fsf@HIDDEN>
Organization: LINKOV.NET
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
 <m25xhxkocz.fsf@HIDDEN>
Date: Mon, 19 May 2025 20:48:25 +0300
Message-ID: <87iklwze3a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvtddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeettdeiieegfeehtddvgeekhfelvdeggfevfeevgeelvdffudekkedtledtgfekvdenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprhhruhgurghkohhvsehfrghsthhmrghilhdrtghomh
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

--=-=-=
Content-Type: text/plain

>> +     (sexp-default
>> +      ;; For `C-M-f' in "#|(a)"
>> +      ("(" . ,(lambda (node)
>> +                 (and (eq (char-before (point)) ?\#)
>> +                      (equal (treesit-node-type (treesit-node-parent node))
>> +                             "anon_fn_lit")))))
> Thanks Juri. I tried your patch and for some reason it doesn't solve the
> issue neither with 'raise-sexp' nor with 'C-M-f' navigation. The point is
> moved from:
>
> #|(-> (.-value (.-target %)))
>
> to
>
> #(-> (.-value (.-target %))|)

I tested that this patch fixes 'C-M-f' navigation where point moves to

#(-> (.-value (.-target %)))|

> and 'raise-sexp' called from:
>
> #(-> |(.-value (.-target %)))
>
> produces:
>
> #(.-value (.-target %)))

Indeed, it didn't fix this case.  For down/up-list it needs
to use 'sexp' thing instead of 'list' thing.  Probably the simplest
setting would be to redefine down-list-function/up-list-function.

Ok, here is a complete tested patch that fixes all your test cases:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=clojure-ts-mode-sexp.patch

diff --git a/clojure-ts-mode.el b/clojure-ts-mode.el
index 8b6bca7..6ae8e16 100644
--- a/clojure-ts-mode.el
+++ b/clojure-ts-mode.el
@@ -1549,6 +1549,12 @@ clojure-ts--thing-settings
   `((clojure
      (sexp ,(regexp-opt clojure-ts--sexp-nodes))
      (list ,(regexp-opt clojure-ts--list-nodes))
+     (sexp-default
+      ;; For `C-M-f' in "#|(a)"
+      ("(" . ,(lambda (node)
+                 (and (eq (char-before (point)) ?\#)
+                      (equal (treesit-node-type (treesit-node-parent node))
+                             "anon_fn_lit")))))
      (text ,(regexp-opt '("comment")))
      (defun ,#'clojure-ts--defun-node-p))
     (when clojure-ts-use-markdown-inline
@@ -2601,6 +2607,15 @@ clojure-ts-mode
                 0
                 t)
 
+      (setq-local down-list-function
+                  (lambda (&optional arg)
+                    (let ((treesit-sexp-type-regexp 'sexp))
+                      (treesit-down-list arg))))
+      (setq-local up-list-function
+                  (lambda (&optional arg escape-strings no-syntax-crossing)
+                    (let ((treesit-sexp-type-regexp 'sexp))
+                      (treesit-up-list arg escape-strings no-syntax-crossing))))
+
       ;; Workaround for treesit-transpose-sexps not correctly working with
       ;; treesit-thing-settings on Emacs 30.
       ;; Once treesit-transpose-sexps it working again this can be removed

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 08:15:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 04:15:55 2025
Received: from localhost ([127.0.0.1]:37118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uGvf9-0005gf-G2
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 04:15:55 -0400
Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]:59815)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uGvf5-0005gI-HJ
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 04:15:52 -0400
Received: from phl-compute-06.internal (phl-compute-06.phl.internal
 [10.202.2.46])
 by mailfout.phl.internal (Postfix) with ESMTP id BEC2713803FC;
 Mon, 19 May 2025 04:15:45 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-06.internal (MEProxy); Mon, 19 May 2025 04:15:45 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc: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=fm3; t=1747642545; x=1747728945; bh=Z6KhFgnE+m
 yMxP6Y0Aat65vc2sqW5a5N3d9/iEXh9YI=; b=2Ee4r9ucwoWQB4lbKxsTm0+Q8Y
 Vs/2zVdXqYPV+zU1bDaeg4N9fkSaGanijEPvsgQ2TnRvVKCFDqkFzGFv2wxKsO16
 Kl4gdHDMAWFlzv+Zre0ieYQU9VcxQ/GwLouiIGVWfIAoDX3+fIGxqLXAVO6NtR+J
 3fsHmLPRrqGVugTPFeyzt2cTXpxN7NvCp1CmkO7qx3Fu7CROw/qA/buBI+vy4byZ
 6rJpMFj8heJ27PDMtHKBUEDio5UJwwQEKDlQlmz+HUYCbBvhaJyTboLXRi4yWtXh
 u2bJYgaY5BgyIcd+VtWLVholENd1dJsZCb5BWQl0GFyt+YQ7tz0cnOONuwPw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=
 1747642545; x=1747728945; bh=Z6KhFgnE+myMxP6Y0Aat65vc2sqW5a5N3d9
 /iEXh9YI=; b=toX8vn7tRMbo+tchnIXF+CRooor8aFFVeYhxPrDLzrK4eFX5SZN
 rxPVNQUKLn7EKZBmbCs/KPQI7J8Z7NWylUs9tn7AISVY/gYVPxn1e9649muGFwWM
 Hr3Zr3t3VUC4fdoj33tHoNEoaelGkrk2Y3DeT1Bfap/9npTjgTWn6bCBzxUBrh3a
 FWcqA3xFDzzBBLJH357PV7VwNevon/I4eA5BhT29TuXDcNxUDtTOc9W/FEN2T0DM
 owxuujhcpwT8gbOWBDgwtnuhN4U7lMYPJdcSMkz2qs94xhqj3ce9I9Ueab2jUoWf
 BrAhUASQh/0tHmp16HIoCbEYrJ+UiMHlb7w==
X-ME-Sender: <xms:segqaFKGBInbfIWHsCq-ZMoo2RFIuRrsPNiTKuw5GIQlxALQEomh5A>
 <xme:segqaBL5KJ_WA5PIw3fMhG5BCyq19CYW7zjauUIg9Ys2mq7Bl8zf3e1PB4bEF8aA3
 sIs4K9i0kq-AQZKV5M>
X-ME-Received: <xmr:segqaNuQMMTxcgwbhBr76RJmP8YFgrIoSylt0SYqGs7k5TCAMNPlmGdGylVYl_WRCK4>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddtkeejucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
 gvnhhtshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttder
 tdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcuoehrrhhuuggrkhhovhesfhgrsh
 htmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeegledtffevueeujeekueeluedu
 udeggfffieelhfduhffhudekjeetfeduffeujeenucevlhhushhtvghrufhiiigvpedtne
 curfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgt
 ohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 ejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehl
 ihhnkhhovhdrnhgvth
X-ME-Proxy: <xmx:segqaGbbmeNFPnxfzsJB8G1f52IOM6LP9bgAxzDppThnt_86lwkS0g>
 <xmx:segqaMbS6xWwmDRxSrPRvbU_yhhTFomv8ljkBRCfDetU6JieHLRHmQ>
 <xmx:segqaKA-NbgrwdFdsvy9MIyktebPQiWA2OTlP8WLKpPjWWzRf0pP0Q>
 <xmx:segqaKb7DDMwDNFIEzi-0QzQMvXPXNMXwUV3spy2SSwaT94aMDeD7w>
 <xmx:segqaIL8b9gHG46ZuMPHNH-8mEnJdNGJuFIlJ2pV0hE3zMdVND1kp9qu>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 19 May 2025 04:15:45 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <87bjrp13ev.fsf@HIDDEN>
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN> <87bjrp13ev.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Mon, 19 May 2025 10:15:40 +0200
Message-ID: <m25xhxkocz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>>>> Reproducing issues requires installing clojure-ts-mode from 
>>>> NonGNU ELPA.
>>>
>>> Please also try all these test cases
>>> after calling 'treesit-cycle-sexp-type'.
>> This makes it somewhat better.
>>
>> There is still some weird behavior (I guess it's mostly related to 
>> the
>> Clojure grammar itself):
>>
>> #|(-> (.-value (.-target %)))
>>
>> If the point is at "|", calling "forward-sexp" moves it to:
>>
>> #(->| (.-value (.-target %)))
>>
>> And executing M-x raise-sexp produces:
>>
>> (->
>>
>> How can I set the default "cycle type" programmatically for a major 
>> mode?
>
> Programmatically you can set it by just adding 
> '(treesit-cycle-sexp-type)'
> to the end of 'clojure-ts-mode'.  Then theoretically it requires
> more changes in 'clojure-ts--sexp-nodes'.  But now I realized that
> no definition can match "(" with ")" when point is between "#" and 
> "(":
>
>   (anon_fn_lit marker: "#" open: "("
>
> So the right solution is without 'treesit-cycle-sexp-type'
> but with using 'sexp-default':
>
> @@ -1549,6 +1549,12 @@ clojure-ts--thing-settings
>    `((clojure
>       (sexp ,(regexp-opt clojure-ts--sexp-nodes))
>       (list ,(regexp-opt clojure-ts--list-nodes))
> +     (sexp-default
> +      ;; For `C-M-f' in "#|(a)"
> +      ("(" . ,(lambda (node)
> +                 (and (eq (char-before (point)) ?\#)
> +                      (equal (treesit-node-type 
> (treesit-node-parent node))
> +                             "anon_fn_lit")))))
>       (text ,(regexp-opt '("comment")))
>       (defun ,#'clojure-ts--defun-node-p))
>      (when clojure-ts-use-markdown-inline
Thanks Juri. I tried your patch and for some reason it doesn't solve 
the issue neither with 'raise-sexp' nor with 'C-M-f' navigation. The 
point is moved from:

#|(-> (.-value (.-target %)))

to

#(-> (.-value (.-target %))|)

and 'raise-sexp' called from:

#(-> |(.-value (.-target %)))

produces:

#(.-value (.-target %)))

Quick debugging confirmed that when the point is between # and ( the 
matched "thing" is 'sexp-default'.
--
Best regards, Roman




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 19 May 2025 07:15:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 03:15:04 2025
Received: from localhost ([127.0.0.1]:36599 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uGuiG-0001MK-68
	for submit <at> debbugs.gnu.org; Mon, 19 May 2025 03:15:04 -0400
Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]:45301)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1uGuiA-0001LK-Nr
 for 78458 <at> debbugs.gnu.org; Mon, 19 May 2025 03:14:59 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id 6FA1043B5A;
 Mon, 19 May 2025 07:14:49 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Roman Rudakov <rrudakov@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m27c2gbkbw.fsf@HIDDEN>
Organization: LINKOV.NET
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
 <m27c2gbkbw.fsf@HIDDEN>
Date: Mon, 19 May 2025 09:58:40 +0300
Message-ID: <87bjrp13ev.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddtjeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprhhruhgurghkohhvsehfrghsthhmrghilhdrtghomh
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

>>> Reproducing issues requires installing clojure-ts-mode from NonGNU ELPA.
>>
>> Please also try all these test cases
>> after calling 'treesit-cycle-sexp-type'.
> This makes it somewhat better.
>
> There is still some weird behavior (I guess it's mostly related to the
> Clojure grammar itself):
>
> #|(-> (.-value (.-target %)))
>
> If the point is at "|", calling "forward-sexp" moves it to:
>
> #(->| (.-value (.-target %)))
>
> And executing M-x raise-sexp produces:
>
> (->
>
> How can I set the default "cycle type" programmatically for a major mode?

Programmatically you can set it by just adding '(treesit-cycle-sexp-type)'
to the end of 'clojure-ts-mode'.  Then theoretically it requires
more changes in 'clojure-ts--sexp-nodes'.  But now I realized that
no definition can match "(" with ")" when point is between "#" and "(":

  (anon_fn_lit marker: "#" open: "("

So the right solution is without 'treesit-cycle-sexp-type'
but with using 'sexp-default':

@@ -1549,6 +1549,12 @@ clojure-ts--thing-settings
   `((clojure
      (sexp ,(regexp-opt clojure-ts--sexp-nodes))
      (list ,(regexp-opt clojure-ts--list-nodes))
+     (sexp-default
+      ;; For `C-M-f' in "#|(a)"
+      ("(" . ,(lambda (node)
+                 (and (eq (char-before (point)) ?\#)
+                      (equal (treesit-node-type (treesit-node-parent node))
+                             "anon_fn_lit")))))
      (text ,(regexp-opt '("comment")))
      (defun ,#'clojure-ts--defun-node-p))
     (when clojure-ts-use-markdown-inline




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 16 May 2025 16:18:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 16 12:18:43 2025
Received: from localhost ([127.0.0.1]:40438 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uFxlh-0005B9-Cl
	for submit <at> debbugs.gnu.org; Fri, 16 May 2025 12:18:43 -0400
Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]:52927)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uFxlf-0005AG-2i
 for 78458 <at> debbugs.gnu.org; Fri, 16 May 2025 12:18:40 -0400
Received: from phl-compute-05.internal (phl-compute-05.phl.internal
 [10.202.2.45])
 by mailfout.phl.internal (Postfix) with ESMTP id 4F1FB13803E8;
 Fri, 16 May 2025 12:18:33 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-05.internal (MEProxy); Fri, 16 May 2025 12:18:33 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc: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=fm3; t=1747412313; x=1747498713; bh=r8VWoQ6zSA
 JZAjUtOt/8KZFfQ/l7Y9OEa1gfQIZoWx0=; b=MpdmNXMa7fyfEFFuBiRTKMuYll
 yn0PZwKRSn05foP5gLLWewbb0M1F9k1Fmzgc1PLou3TF0/n2CoEG1kika6f0z2Ox
 qN7d7YYer/5GAj7udyLR7cF5Oqa0ETriMz1jTpepFx9yf05zxWy76BzqTPWIVvnQ
 3v5D8cHuj8ijfmsrTMNf6xqP6/kU1fXr3+9t7dPCHiQVDWVOiPAg8CdYLB5E59ig
 fB1rGougvOLbjX809F+9uxzTPZ8CPFxMFux/mMLX74cD/H/g1SEwLFqeYxSKTZrn
 RACW2ufBnBfn5QdFHgUa3XrtYO7/FUKbGbwTtU8I+jyS5yu+jIA8VoPYekyw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc: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=
 1747412313; x=1747498713; bh=r8VWoQ6zSAJZAjUtOt/8KZFfQ/l7Y9OEa1g
 fQIZoWx0=; b=ZpOpKGioHvK0dfjdlE+OnsRxvEZrThh5O6gK34pXGUOGV7U/xqU
 8aOjTGRzQfVjAApfzGRebeik37py1/XthV95Ek6uNBPQt7luLXXc3Xg6Ula+WcXG
 9bY8c7+qVkUz0NVAt2cetUqWw/hNgfaKQy3oDn2tlhnb6zlbUoM3XnMH/SAAxdgw
 8IZpOYK+0iLGI5P4vvoVXrPZkkVfHMiQbvEuxB7s/PhkMUjBDGIJM341/Uh5lhZR
 0AstpKLml2DI2nq/zUqSTylnWrWg+JSPz+DNvU6GotJxzZSrRnXDBVSSRc7u6bu3
 unMD8/qPu267v18r2hueTjPJ1eD/qnEZePw==
X-ME-Sender: <xms:WGUnaGW97j0xmr6eVI9PAhlvbrZ871PgIbzon5gYk2JsIyzhY0tOSA>
 <xme:WGUnaCl-4VNkDJKVUrt4tBym17n584beOavxy7MBb-quYYlLv07IR-ZL1bbwhQkL6
 T98-t7IUtHiSextTAY>
X-ME-Received: <xmr:WGUnaKblhyEWOSo5qb270L0JN47329iehpACKOLr0wS9Q6JsrUxwhwJcuH5TXcBoQESCBDM-M9HV0xwTY4t85Pd2>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudefvddtucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih
 gvnhhtshculddquddttddmnecujfgurhephffvvefujghffgffkfggtgesthdtredttder
 tdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcuoehrrhhuuggrkhhovhesfhgrsh
 htmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpeegledtffevueeujeekueeluedu
 udeggfffieelhfduhffhudekjeetfeduffeujeenucevlhhushhtvghrufhiiigvpedtne
 curfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgt
 ohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhope
 ejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtohepjhhurhhisehl
 ihhnkhhovhdrnhgvth
X-ME-Proxy: <xmx:WGUnaNVXG02X5tOrU_NqS1z7luO7YxJef62pMfVjiZfWXbZOl4U9vQ>
 <xmx:WGUnaAmILVBxP5Oe-gq4PWUZwOcmvEHD4B7fK7e6WaP3vWKRebSJew>
 <xmx:WGUnaCeezcJVf4Z9mQ4SKvAEQV5XoejfCQ3A2KcVeQ1XAevIYRrcPA>
 <xmx:WGUnaCHyNL6jPK-t9Kct0xYUW253SV4Cm0ktik0uARLlkL-ld4UOdg>
 <xmx:WWUnaM2SAGJpjjwPcBIXtzYD12SUHVU0y4vRnhZO5RODOsOi0zuL77nH>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri,
 16 May 2025 12:18:32 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <87y0uw4kg6.fsf@HIDDEN>
References: <m2h61k7ej0.fsf@HIDDEN> <87y0uw4kg6.fsf@HIDDEN>
User-Agent: mu4e 1.12.11; emacs 31.0.50
Date: Fri, 16 May 2025 18:18:27 +0200
Message-ID: <m27c2gbkbw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

Juri Linkov <juri@HIDDEN> writes:

>> Reproducing issues requires installing clojure-ts-mode from NonGNU 
>> ELPA.
>
> Please also try all these test cases
> after calling 'treesit-cycle-sexp-type'.
This makes it somewhat better.

There is still some weird behavior (I guess it's mostly related to the 
Clojure grammar itself):

#|(-> (.-value (.-target %)))

If the point is at "|", calling "forward-sexp" moves it to:

#(->| (.-value (.-target %)))

And executing M-x raise-sexp produces:

(->

How can I set the default "cycle type" programmatically for a major 
mode?

--
Best regards, Roman




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at 78458 <at> debbugs.gnu.org:


Received: (at 78458) by debbugs.gnu.org; 16 May 2025 16:03:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 16 12:03:46 2025
Received: from localhost ([127.0.0.1]:40353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uFxXF-0008UU-TZ
	for submit <at> debbugs.gnu.org; Fri, 16 May 2025 12:03:46 -0400
Received: from relay2-d.mail.gandi.net ([217.70.183.194]:34237)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <juri@HIDDEN>) id 1uFxWu-0008QM-1Z
 for 78458 <at> debbugs.gnu.org; Fri, 16 May 2025 12:03:24 -0400
Received: by mail.gandi.net (Postfix) with ESMTPSA id EAE224388E;
 Fri, 16 May 2025 16:03:15 +0000 (UTC)
From: Juri Linkov <juri@HIDDEN>
To: Roman Rudakov <rrudakov@HIDDEN>
Subject: Re: bug#78458: 31.0.50; treesit.el: thing navigation functions work
 incorrectly with some Clojure nodes
In-Reply-To: <m2h61k7ej0.fsf@HIDDEN>
Organization: LINKOV.NET
References: <m2h61k7ej0.fsf@HIDDEN>
Date: Fri, 16 May 2025 19:02:40 +0300
Message-ID: <87y0uw4kg6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-GND-State: clean
X-GND-Score: -100
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudefudekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufgjohhffffkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucggtffrrghtthgvrhhnpeffgeetfeevlefhleejfeeuheeiudeitdffhfdutdekfeffgffhveehteegueekheenucfkphepledurdduvdelrddutdehrdduudejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepledurdduvdelrddutdehrdduudejpdhhvghlohepmhgrihhlrdhgrghnughirdhnvghtpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhgspghrtghpthhtohepvddprhgtphhtthhopeejkeegheekseguvggssghughhsrdhgnhhurdhorhhgpdhrtghpthhtoheprhhruhgurghkohhvsehfrghsthhmrghilhdrtghomh
X-GND-Sasl: juri@HIDDEN
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 78458
Cc: 78458 <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: -1.7 (-)

> Reproducing issues requires installing clojure-ts-mode from NonGNU ELPA.

Please also try all these test cases
after calling 'treesit-cycle-sexp-type'.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 16 May 2025 15:37:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 16 11:37:44 2025
Received: from localhost ([127.0.0.1]:40160 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uFx83-0004nP-5L
	for submit <at> debbugs.gnu.org; Fri, 16 May 2025 11:37:44 -0400
Received: from lists.gnu.org ([2001:470:142::17]:32852)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rrudakov@HIDDEN>)
 id 1uFx80-0004ms-OW
 for submit <at> debbugs.gnu.org; Fri, 16 May 2025 11:37:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rrudakov@HIDDEN>)
 id 1uFx7u-000155-Uv
 for bug-gnu-emacs@HIDDEN; Fri, 16 May 2025 11:37:34 -0400
Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rrudakov@HIDDEN>)
 id 1uFx7r-0000BG-S3
 for bug-gnu-emacs@HIDDEN; Fri, 16 May 2025 11:37:34 -0400
Received: from phl-compute-11.internal (phl-compute-11.phl.internal
 [10.202.2.51])
 by mailfout.phl.internal (Postfix) with ESMTP id 2A0FC13803DF
 for <bug-gnu-emacs@HIDDEN>; Fri, 16 May 2025 11:37:29 -0400 (EDT)
Received: from phl-mailfrontend-02 ([10.202.2.163])
 by phl-compute-11.internal (MEProxy); Fri, 16 May 2025 11:37:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:content-type:content-type:date:date:from:from:in-reply-to
 :message-id:mime-version:reply-to:subject:subject:to:to; s=fm3;
 t=1747409849; x=1747496249; bh=hye22NXjpSJhRn0Pjqd5jcPSRdzy4U19
 5L9cNkcMSvM=; b=lFGP1wqI+upztB2Aug7I8HdokgJSmEQBm4+59Yh1n17zxLMc
 rURiW5KEyd7Y8Z4zy50MSY5zA/5ZQ283cbXjvgdj9J6wxdcaFrHW4VFf8SBw27Yw
 WfPCnvRPPICvWl3FO19/6XGe846sPMgoWbINzhvp+w0kVrbIvLIaK+6I0w2iKZdW
 Vq3DyYBRb8SBGnv5/RFIsiA+XfMerfwWLRTnzjcrmjJvIsXrY/0YciI0YkAOWw53
 YGZtfAyspPK6rMvYUhJpatSYnQMqYT9NQH1RXfzEiTw0IiByK6xrYMwiebskpQEU
 N5WD5muAYJiBlg1+8Hft68In9lCeVnajyEddtA==
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=fm3; t=1747409849; x=
 1747496249; bh=hye22NXjpSJhRn0Pjqd5jcPSRdzy4U195L9cNkcMSvM=; b=n
 /IZGeQnmaacA/klfgrq8nndP3NEadhNgI8c8VAY2yERLuQQe4HjT+glfWuHqjg7L
 BvFu0iu1lYdSXyF3ykbjFYnIUb8aKbmfPrEgfGqZdBV6secu5+BxZ5vKqBUZo7z9
 vPIs8DrTkgfueA013fnpPn8KdKlMpbQURWHjcBCAeS3feccNMCU4wDAftDcg7GKd
 1xQXRkl3NHfuoqDTRdOcwYGIydY7qT43V4d4ZxHKtzwW921IyKREHb25HMvO/jCE
 Ri4+KScoa+N2rjql0nvnqKvdb0aUHRlhWM4EL8ZPg/yjmAXvQXmK+UbT7M+xk8HR
 yRbfb5tEATy/YPnfLqoWA==
X-ME-Sender: <xms:uFsnaAjyHkLw_oE-6gC6Tz0w012BeiBNtSkARUfr3UQN5b6O4XJGbA>
 <xme:uFsnaJBZ9kvpgmbgIP3-GlLYmu_SAoEwAb3sEqtbiB0SmHPyAFFwHFwHV085uQZ_K
 kxJXCK2KWeDSlUc5ds>
X-ME-Received: <xmr:uFsnaIHaexTttdUzBAQOGY0uEeFj_cGl_8UqZC2BY0pa0Q9m_KAFRh_mqsLDmaWtVKNuNwz0ETKgjJaP6wxaD5jb>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefudefuddvucetufdoteggodetrf
 dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv
 pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvf
 fufgffkfggtgesthdtredttdertdenucfhrhhomheptfhomhgrnhcutfhuuggrkhhovhcu
 oehrrhhuuggrkhhovhesfhgrshhtmhgrihhlrdgtohhmqeenucggtffrrghtthgvrhhnpe
 ehffejtddvgfevffevffdvheeijedtffdtgfeugeegheeuueeljeelveekkeehleenucev
 lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrhhuuggrkh
 hovhesfhgrshhtmhgrihhlrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhm
 thhpohhuthdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnhhurdhorhhg
X-ME-Proxy: <xmx:uFsnaBRb25AemQoDX54vkEegMM8kYIhGV-ZgNkQk8Ml61iNx93h_cw>
 <xmx:uVsnaNyD7UtHY5YGGVmdBb3yfMOKPoM3KMANbIpPbrhkHxgiukC_ZQ>
 <xmx:uVsnaP5oT5BVvgfA6NCwQnPVEakStTBsi4RJFcnrYdwKws1XFq31sw>
 <xmx:uVsnaKx56UodoGLFivaxKOuNmZKMNUS7Dj2EOLXIbbiQZmLU_NOkDg>
 <xmx:uVsnaMxn6b3tFVKmYHzJbgync7LvdlQC3Nza1q7RzMBFacmcySDAbJRm>
Feedback-ID: i1c714620:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA for
 <bug-gnu-emacs@HIDDEN>; Fri, 16 May 2025 11:37:28 -0400 (EDT)
From: Roman Rudakov <rrudakov@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 31.0.50; treesit.el: thing navigation functions work incorrectly
 with some Clojure nodes
User-Agent: mu4e 1.12.11; emacs 31.0.50
X-Debbugs-Cc: 
Date: Fri, 16 May 2025 17:37:23 +0200
Message-ID: <m2h61k7ej0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
Received-SPF: pass client-ip=103.168.172.148;
 envelope-from=rrudakov@HIDDEN; helo=fout-a5-smtp.messagingengine.com
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=0.001,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
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.0 (/)


Reproducing issues requires installing clojure-ts-mode from NonGNU 
ELPA.

Considering the following Clojure expression:

#(-> (.-value (.-target %)))

The parsed syntax tree is:

(anon_fn_lit marker: # open: (
 value: (sym_lit name: (sym_name))
 value:
  (list_lit open: (
   value: (sym_lit name: (sym_name))
   value:
    (list_lit open: (
     value: (sym_lit name: (sym_name))
     value: (sym_lit name: (sym_name))
     close: ))
   close: ))
 close: ))

Issue 1

1. Put the point on the "->" symbol
2. Execute M-x backward-up-list


Expected result: point at the # character, which is the beginning of
the anon_fn_lit node.

Actual result: point is between # and (

If I execute M-x backward-up-list again, point goes to the #
character.

Issue 2

1. Put the point after # on the opening paren.
2. Execute M-x forward-sexp


Expected result: either some error or point is moved to the matching
closing paren.
Actual result: point is before matching paren.

If the expression doesn't have any nested lists (for example #(+ 2 2))
then the same steps would signal a user error "No next step".

Issue 3

1. Put the point on the opening paren of the first nested list.
2. Execute M-x raise-sexp


Expected result: (.-value (.-target %))
Actual result: #(.-value (.-target %)))

Actual result also has unbalanced parenthesis.

Again, if the expression doesn't have any nested lists, executing
raise-sexp would signal an error:

treesit--forward-list-with-default: Scan error: "No more list to move 
across"

All the issues are also applicable to nodes with metadata, for
example:

^boolean (+ 2 2)

With syntax tree:

(list_lit
 meta:
  (meta_lit marker: ^
   value: (sym_lit name: (sym_name)))
 open: (
 value: (sym_lit name: (sym_name))
 value: (num_lit) value: (num_lit) close: ))



In GNU Emacs 31.0.50 (build 1, aarch64-apple-darwin24.4.0, NS
 appkit-2575.50 Version 15.4.1 (Build 24E263)) of 2025-04-29 built on
 macbookpro.home
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.4.1

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
 --infodir=/opt/homebrew/Cellar/emacs-plus@31/31.0.50/share/info/emacs
 --prefix=/opt/homebrew/Cellar/emacs-plus@31/31.0.50
 --with-native-compilation=aot --with-xml2 --with-gnutls
 --without-compress-install --without-dbus --without-imagemagick
 --with-modules --with-rsvg --with-webp --without-pop --with-ns
 --disable-ns-self-contained 'CFLAGS=-O2 -DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT -I/opt/homebrew/opt/sqlite/include
 -I/opt/homebrew/opt/gcc/include 
 -I/opt/homebrew/opt/libgccjit/include'
 'LDFLAGS=-L/opt/homebrew/opt/sqlite/lib -L/opt/homebrew/lib/gcc/14
 -I/opt/homebrew/opt/gcc/include 
 -I/opt/homebrew/opt/libgccjit/include''
Configured features:
ACL GIF GLIB GMP GNUTLS JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM ZLIB
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  TeX-PDF-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  idle-highlight-mode: t
  subword-mode: t
  yas-minor-mode: t
  hl-todo-mode: t
  flymake-mode: t
  server-mode: t
  pdf-occur-global-minor-mode: t
  mu4e-column-faces-mode: t
  mu4e-modeline-mode: t
  auto-insert-mode: t
  electric-pair-mode: t
  org-roam-db-autosync-mode: t
  minions-mode: t
  repeat-mode: t
  save-place-mode: t
  minibuffer-electric-default-mode: t
  savehist-mode: t
  recentf-mode: t
  global-auto-revert-mode: t
  global-hl-line-mode: t
  apheleia-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/rrudakov/.config/emacs/elpa/ef-themes-1.10.0/theme-loaddefs 
hides 
/Users/rrudakov/.config/emacs/elpa/modus-themes-4.7.0/theme-loaddefs
/Users/rrudakov/.config/emacs/elpa/magit-4.3.2/magit-autorevert hides 
/Users/rrudakov/.config/emacs/elpa/magit-section-4.3.2/magit-autorevert
/Users/rrudakov/.config/emacs/elpa/transient-0.8.8/transient hides 
/opt/homebrew/Cellar/emacs-plus@31/31.0.50/share/emacs/31.0.50/lisp/transient
/Users/rrudakov/.config/emacs/elpa/ef-themes-1.10.0/theme-loaddefs 
hides 
/opt/homebrew/Cellar/emacs-plus@31/31.0.50/share/emacs/31.0.50/lisp/theme-loaddefs

Features:
(shadow emacsbug flyspell-correct reftex-dcr reftex reftex-loaddefs
reftex-vars tex-fold preview font-latex latex latex-flymake tex-ispell
tex-style tex texmathp auctex tex-mode google-c-style plantuml-mode
artist picture reporter find-dired
clojure-ts-mode-refactor-add-arity-test test-helper buttercup ert ewoc
debug backtrace buttercup-compat magit-extras goto-addr cider-ns
apheleia apheleia-rcs apheleia-dp apheleia-formatters apheleia-utils
apheleia-log apheleia-formatter-context qp cal-iso pcmpl-unix 
pcmpl-gnu
sort smiley gnus-cite mm-archive mail-extr textsec uni-scripts
idna-mapping uni-confusable textsec-check misc emacs-everywhere vc-hg
vc-svn bug-reference tramp-cache time-stamp shortdoc cl-print misearch
multi-isearch org-goto help-fns radix-tree cal-move markdown-mode
edit-indirect face-remap magit-bookmark magit-submodule magit-blame
magit-stash magit-reflog magit-bisect magit-push magit-pull 
magit-fetch
magit-clone magit-remote magit-commit magit-sequence magit-notes
magit-worktree magit-tag magit-merge magit-branch magit-reset
magit-files magit-refs magit-status magit magit-repos magit-apply
magit-wip magit-log magit-diff smerge-mode diff git-commit log-edit
pcvs-util add-log magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor magit-mode elp magit-git
magit-base which-func vc-git diff-mode track-changes flymake-kondor
clj-refactor hydra lv inflections mc-hide-unmatched-lines-mode
mc-mark-more sgml-mode mc-cycle-cursors multiple-cursors-core rect
paredit cider tramp-sh cider-debug cider-browse-ns cider-mode
cider-xref-backend cider-find cider-completion cider-profile
cider-inspector cider-eval cider-jar arc-mode archive-mode
clojure-ts-mode cider-repl-history pulse cider-repl cider-resolve
cider-test cider-overlays cider-stacktrace cider-doc cider-browse-spec
cider-clojuredocs cider-eldoc cider-docstring cider-client 
cider-common
xref cider-completion-context cider-connection cider-popup
sesman-browser nrepl-client tramp trampver tramp-integration
tramp-message tramp-compat tramp-loaddefs sesman queue nrepl-dict
cider-util spinner parseedn parseclj-parser parseclj-lex 
parseclj-alist
clojure-mode align idle-highlight-mode cap-words superword subword
yasnippet ef-maris-dark-theme ef-themes hl-todo checkdoc lisp-mnt
flymake view cus-start alert log4e gntp server github org-git
ghub-graphql treepy gsexp ghub url-http url-gw nsm url-auth
google-translate-smooth-ui google-translate-core-ui facemenu color 
popup
google-translate-core google-translate-backend use-package-ensure
pdf-occur tablist tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-isearch
let-alist pdf-misc pdf-tools pdf-view jka-compr pdf-cache pdf-info tq
pdf-util pdf-macs image-mode exif ob-restclient restclient
mu4e-column-faces mu4e-icalendar gnus-icalendar icalendar mu4e 
mu4e-org
mu4e-notification notifications mu4e-main smtpmail mu4e-view
mu4e-mime-parts mu4e-headers mu4e-thread mu4e-actions mu4e-compose
mu4e-draft gnus-msg mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark
mu4e-message flow-fill mu4e-contacts mu4e-update mu4e-folders
mu4e-context mu4e-query-items mu4e-server mu4e-modeline mu4e-vars
mu4e-helpers mu4e-config mu4e-window bookmark ido mu4e-obsolete 
nix-mode
ffap nix-repl nix-shell nix-store nix-log nix-instantiate nix-shebang
nix-format nix yaml-ts-mode dockerfile-ts-mode rust-ts-mode
typescript-ts-mode js c-ts-common imenu cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs 
vlf-setup
vlf vlf-base vlf-tune autoinsert rg files-x vc vc-dispatcher
rg-info-hack rg-menu transient edmacro kmacro rg-ibuffer rg-result
wgrep-rg wgrep rg-history rg-header ibuf-ext ibuffer ibuffer-loaddefs
grep compile elec-pair emacsql-sqlite-builtin org-roam-migrate
org-roam-log org-roam-mode org-roam-capture org-roam-id org-roam-node
crm org-roam-db org-roam-utils org-roam-compat org-roam org-capture
emacsql-sqlite emacsql emacsql-compiler magit-section benchmark
cursor-sensor llama comp comp-cstr dash async ob-async ob-plantuml
ob-ditaa ob-clojure ob-haskell ob-sqlite ob-shell shell ob-sql 
ob-python
python project pcase org-clock appt diary-lib diary-loaddefs
org-duration comp-run comp-common flyspell ispell oc-basic bibtex
disp-table ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view
mml-smime smime gnutls dig gnus-sum shr-tag-pre-highlight
language-detection shr pixel-fill kinsoku url-file svg dom gnus-group
gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
message sendmail yank-media puny dired dired-loaddefs rfc822 mml 
mml-sec
epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils
mailheader gnus-win gnus nnheader gnus-util text-property-search
mail-utils range mm-util mail-prsvr ox-gfm ox-md ox-odt rng-loc 
rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar ox-html table ox-ascii
ox-publish ox org-attach org-agenda org-element org-persist org-id
org-element-ast inline avl-tree generator org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie treesit
executable ob-comint org-pcomplete pcomplete org-list org-footnote
org-faces org-entities time-date noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-cycle org-table org-keys oc
org-loaddefs thingatpt find-func cal-menu calendar cal-loaddefs ol
org-fold org-fold-core org-compat org-macs format-spec
exec-path-from-shell minions compat warnings repeat hippie-exp comint
ansi-osc ansi-color ring advice saveplace minibuf-eldef savehist 
recentf
tree-widget cl-extra help-mode autorevert filenotify use-package-core
easy-mmode hl-line rx finder-inf package browse-url xdg url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars info
add-node-modules-path-autoloads alert-autoloads apheleia-autoloads
auctex-autoloads tex-site buttercup-autoloads clj-refactor-autoloads
cider-autoloads clojure-mode-autoloads clojure-ts-mode-autoloads
csv-mode-autoloads debbugs-autoloads dired-git-info-autoloads
dired-subtree-autoloads dired-hacks-utils-autoloads direnv-autoloads
dtrt-indent-autoloads edit-indirect-autoloads ef-themes-autoloads
elfeed-autoloads emacs-everywhere-autoloads emmet-mode-autoloads
exec-path-from-shell-autoloads expand-region-autoloads
flymake-kondor-autoloads flyspell-correct-autoloads ghub-autoloads
git-link-autoloads gitignore-templates-autoloads gntp-autoloads
google-c-style-autoloads google-translate-autoloads
groovy-mode-autoloads haskell-mode-autoloads hl-todo-autoloads
hydra-autoloads idle-highlight-mode-autoloads inflections-autoloads
log4e-autoloads logview-autoloads datetime-autoloads extmap-autoloads
lua-mode-autoloads lv-autoloads magit-autoloads 
markdown-mode-autoloads
minions-autoloads modus-themes-autoloads mu4e-column-faces-autoloads
multiple-cursors-autoloads nginx-mode-autoloads nix-mode-autoloads
nov-autoloads esxml-autoloads ob-async-autoloads async-autoloads
ob-restclient-autoloads org-roam-autoloads magit-section-autoloads
llama-autoloads emacsql-autoloads org-tree-slide-autoloads
ox-jira-autoloads ox-slack-autoloads ox-gfm-autoloads 
paredit-autoloads
parseedn-autoloads parseclj-autoloads password-store-otp-autoloads
password-store-autoloads pdf-tools-autoloads 
pip-requirements-autoloads
pkgbuild-mode-autoloads plantuml-mode-autoloads dash-autoloads
popup-autoloads pyvenv-autoloads queue-autoloads 
rainbow-mode-autoloads
restclient-autoloads rg-autoloads s-autoloads sesman-autoloads
shr-tag-pre-highlight-autoloads language-detection-autoloads
sly-autoloads spinner-autoloads sql-indent-autoloads
ssh-config-mode-autoloads tablist-autoloads telega-autoloads
transient-autoloads treepy-autoloads vimrc-mode-autoloads
visual-fill-column-autoloads vlf-autoloads web-mode-autoloads
wgrep-autoloads with-editor-autoloads yasnippet-autoloads cus-edit pp
cus-load icons wid-edit cl-loaddefs cl-lib rmc iso-transl tooltip 
cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode 
register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet 
lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj 
charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray 
oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable 
backquote
threads kqueue cocoa ns lcms2 multi-tty make-network-process
tty-child-frames native-compile emacs)

Memory information:
((conses 16 1719864 397462) (symbols 48 72397 42)
 (strings 32 381592 20509) (string-bytes 1 12071862)
 (vectors 16 317198) (vector-slots 8 3093109 175837)
 (floats 8 91865 4975) (intervals 56 61124 11438) (buffers 992 76))

-- 
Best regards, Roman




Acknowledgement sent to Roman Rudakov <rrudakov@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#78458; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 20 May 2025 07:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.