GNU bug report logs - #60251
29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point

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: Wilhelm H Kirschbaum <wilhelm@HIDDEN>; dated Thu, 22 Dec 2022 08:57:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 60251) by debbugs.gnu.org; 5 Sep 2023 23:32:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 05 19:32:21 2023
Received: from localhost ([127.0.0.1]:59808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qdfWv-0002DQ-25
	for submit <at> debbugs.gnu.org; Tue, 05 Sep 2023 19:32:21 -0400
Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]:53511)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1qdfWt-0002DA-Ch
 for 60251 <at> debbugs.gnu.org; Tue, 05 Sep 2023 19:32:20 -0400
Received: by mail-lf1-x12e.google.com with SMTP id
 2adb3069b0e04-50091b91a83so5096620e87.3
 for <60251 <at> debbugs.gnu.org>; Tue, 05 Sep 2023 16:32:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1693956732; x=1694561532; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=NmZFcsWeOaf6pEo0UBL8Yx86jFxfnccnaa37iKzsNtE=;
 b=S9lVdK4h5l/rxjKi927BdIg9jrzprBKnBAsE2R81+Ax6qJwpisADzYWVT0ux+B/TaW
 OLt1UzRGCpkcdvsPSlyhoqK1LQQJORCkYNAnQL/Waz6tDStZqMffH7nXudxmMufQsjkt
 77RvlE+/21MVmq+oMTKzAOfQ5xssImsLYPEzYJlxGoWc/aIyp+4wE/l9UvHxFUrBsbyZ
 OU9vt907A8dJYUnZt1IPJKis7ErTFPrkNPtPkoOJiB67xHHI2nlH6DWyMDtH9jOm3F1S
 dDyw/q41vD77x46AJ2cA9UlKs+d5hGYnw+FkvRYltfVxVB7sGkJ58QWxQ8ICEbNk4FJN
 ArWw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1693956732; x=1694561532;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=NmZFcsWeOaf6pEo0UBL8Yx86jFxfnccnaa37iKzsNtE=;
 b=CHrXOE9R9hTV+yr65RLVn0AHoaNsnFhDr3hXuqzg1Fh/JkaZAZJPLUh1IzAHoyCOcB
 JTigNjPFp3bN2uM6sGXK1SDGnddVB+oawQRhEh9SFgVJNTFxEDUyVK+ZFROw7RB8LtY3
 fxUZc8IfElpcBidZ7Koa3gfGXDGPl8N0UjJ0hEe1NNE1YGIPfNY6I5Cc0JaJ2EyKlFA8
 0q/2JAWQdV6cT4icFU5MrZWYEJVir6lHwG39tN2+U+OME6j5kttd0MOatfVmI9fXOLkU
 4J7g1ioelpEus46F3VgcEcwiMgqhAD/3+TC52QoR3PgbYBlstrAjFn8o2PI5+YoreM3M
 HuSw==
X-Gm-Message-State: AOJu0Yx3oD+QS6W1PqqY2/nrwxpu9RKRknYCilq5n+Fq+hHXfK/X5Le0
 4P8k1TXjnJsi8g9wux3Iwh8IdLAaKAX9cLcMrOw/Y9YRDyc=
X-Google-Smtp-Source: AGHT+IGl6hFgnxmIrBLrvshSltawkSfrEaNXrYBq/0Yz4nCa2RIKwDRw0XhlPJLJmqIhwBfkHQxSqyKn9GUW5SYvkO8=
X-Received: by 2002:a05:6512:443:b0:500:9de4:5966 with SMTP id
 y3-20020a056512044300b005009de45966mr802013lfk.62.1693956732524; Tue, 05 Sep
 2023 16:32:12 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 5 Sep 2023 16:32:12 -0700
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87lemzes0b.fsf@HIDDEN> (Wilhelm H. Kirschbaum's message of
 "Thu, 22 Dec 2022 10:42:03 +0200")
References: <87lemzes0b.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 5 Sep 2023 16:32:12 -0700
Message-ID: <CADwFkmndn+8qA9z=q-fNRJ7wxdP3pB90iRJWhoZJZnu37YQh2A@HIDDEN>
Subject: Re: bug#60251: 29.0.60; Consider the language at point for tree
 sitter treesit-inspect-node-at-point
To: Wilhelm H Kirschbaum <wilhelm@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60251
Cc: Yuan Fu <casouri@HIDDEN>, 60251 <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.0 (-)

Wilhelm H Kirschbaum <wilhelm@HIDDEN> writes:

> The following change will make it possible to inspect a node when using
> an embedded language, otherwise it will assume the first specified
> language without allowing specifying the language. This assumes that
> treesit-language-at-point-function has been correctly set. diff --git

Yuan, do you have any comments on the below patch?  Thanks in advance.

> a/lisp/treesit.el b/lisp/treesit.el
> index 6407669118..74dfd26776 100644
> --- a/lisp/treesit.el
> +++ b/lisp/treesit.el
> @@ -1931,7 +1931,7 @@ treesit-inspect-node-at-point
>   (interactive "p")
>   ;; NODE-LIST contains all the node that starts at point.
>   (let* ((node-list
> -          (cl-loop for node = (treesit-node-at (point))
> +          (cl-loop for node = (treesit-node-at (point) (treesit-language-at
> (point)))
>                    then (treesit-node-parent node)
>                    while node
>                    if (eq (treesit-node-start node)
>
>
> Another option might be to allow parser-or-lang as an argument, but
> thinking that as an interactive function for debugging the above might
> be more useful, but either way it does not seem possible to
> inspect-node-at-point for multiple language configuration.
>
> Regards,
> Wilhelm




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

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


Received: (at submit) by debbugs.gnu.org; 22 Dec 2022 08:56:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 22 03:56:41 2022
Received: from localhost ([127.0.0.1]:57090 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p8HNY-0004bg-L6
	for submit <at> debbugs.gnu.org; Thu, 22 Dec 2022 03:56:40 -0500
Received: from lists.gnu.org ([209.51.188.17]:44186)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wilhelm@HIDDEN>) id 1p8HNX-0004ba-41
 for submit <at> debbugs.gnu.org; Thu, 22 Dec 2022 03:56:39 -0500
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 <wilhelm@HIDDEN>)
 id 1p8HNW-0001I4-Pp
 for bug-gnu-emacs@HIDDEN; Thu, 22 Dec 2022 03:56:38 -0500
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <wilhelm@HIDDEN>)
 id 1p8HNV-0004nt-4x
 for bug-gnu-emacs@HIDDEN; Thu, 22 Dec 2022 03:56:38 -0500
Received: by mail-wm1-x336.google.com with SMTP id
 bi26-20020a05600c3d9a00b003d3404a89faso3559279wmb.1
 for <bug-gnu-emacs@HIDDEN>; Thu, 22 Dec 2022 00:56:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=floatpays.co.za; s=google;
 h=mime-version:message-id:date:subject:to:user-agent:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=c+maFTMsdAAyc9x5LeQgcBRW1c8dkpU8i25mA4FwXK8=;
 b=LCaOY6tDE+fo6QxKplNOmfLXxgSeXwKIHMShRzH4mjV0VUcCtlUKWirXhQEwlDSY9b
 oIF6oX6ewfz06Ew2lcCgW5nNcQqspynBkhsYvJ+cPSM3bs9ekv8tSi6IQGwoCXNMYd9H
 4ieULzUHotBrpct0BmrVUHl8Zhf7mMkJpOgsI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:subject:to:user-agent:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=c+maFTMsdAAyc9x5LeQgcBRW1c8dkpU8i25mA4FwXK8=;
 b=2Rf6SdoCB/dJ9ugQTdiQ63p8tfcxAxmittnDdAwGnGjHSwzpVjcIGOU2BQKijGulLj
 pBR9cabyXNv5EwQveL1MnMbRtQVsDYxfHDiZDzv50CbdIHkNAIAegrFSa8GnLiAkHhGg
 ald/p9E5CcnHP6kAeyYwzHGjo49sz6Q+gLKtO223LYuI6npolKbEQEKkfghGs+B/g3nr
 qylB8ZLokQTzZcdzMUOcqWFWuHSu8kdgq10WgJJ5qLYpZh+sPZqy9Ys6vrPot2ZBKOXX
 D2+rTA3gFYrcuVXy5QudYKF0Q84czJTVm2btkV7gbzKi0y7kM4zYBxvugSZFBExH8x0F
 OxBg==
X-Gm-Message-State: AFqh2koql6yQMsP26TiMoP74NK4qNfcLIJ5oQEd8IRXyr4vGiejsToPT
 f6nxe84I39cwKPRAXwcJKf3SkulCmYJV93Up
X-Google-Smtp-Source: AMrXdXvQLisNn6nmDrG4mqINEqT/UmLQNK5TZQtfmp0z/MaYSfoP3YAiNqVtcbG3cMOYZDTqRiQPiw==
X-Received: by 2002:a05:600c:601e:b0:3d0:7fee:8a70 with SMTP id
 az30-20020a05600c601e00b003d07fee8a70mr3849146wmb.19.1671699394558; 
 Thu, 22 Dec 2022 00:56:34 -0800 (PST)
Received: from melissa.local ([2c0f:ef18:1431:0:b09:9616:db04:c248])
 by smtp.gmail.com with ESMTPSA id
 b22-20020a05600c4e1600b003c6d21a19a0sm244270wmq.29.2022.12.22.00.56.33
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 22 Dec 2022 00:56:33 -0800 (PST)
From: Wilhelm H Kirschbaum <wilhelm@HIDDEN>
X-Google-Original-From: Wilhelm H Kirschbaum <wkirschbaum@HIDDEN>
User-agent: mu4e 1.9.3; emacs 29.0.60
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.60; Consider the language at point for tree sitter
 treesit-inspect-node-at-point
Date: Thu, 22 Dec 2022 10:42:03 +0200
Message-ID: <87lemzes0b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
Received-SPF: pass client-ip=2a00:1450:4864:20::336;
 envelope-from=wilhelm@HIDDEN; helo=mail-wm1-x336.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 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,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
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: -2.3 (--)


The following change will make it possible to inspect a node when 
using
an embedded language, otherwise it will assume the first specified
language without allowing specifying the language. This assumes 
that
treesit-language-at-point-function has been correctly set. 

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 6407669118..74dfd26776 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1931,7 +1931,7 @@ treesit-inspect-node-at-point
   (interactive "p")
   ;; NODE-LIST contains all the node that starts at point.
   (let* ((node-list
-          (cl-loop for node = (treesit-node-at (point))
+          (cl-loop for node = (treesit-node-at (point) 
(treesit-language-at (point)))
                    then (treesit-node-parent node)
                    while node
                    if (eq (treesit-node-start node)


Another option might be to allow parser-or-lang as an argument, 
but
thinking that as an interactive function for debugging the above 
might
be more useful, but either way it does not seem possible to
inspect-node-at-point for multiple language configuration.

Regards,
Wilhelm




Acknowledgement sent to Wilhelm H Kirschbaum <wilhelm@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#60251; 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, 5 Sep 2023 23:45:01 UTC

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