unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60251: 29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point
@ 2022-12-22  8:42 Wilhelm H Kirschbaum
  2023-09-05 23:32 ` Stefan Kangas
  0 siblings, 1 reply; 2+ messages in thread
From: Wilhelm H Kirschbaum @ 2022-12-22  8:42 UTC (permalink / raw)
  To: 60251


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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#60251: 29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point
  2022-12-22  8:42 bug#60251: 29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point Wilhelm H Kirschbaum
@ 2023-09-05 23:32 ` Stefan Kangas
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2023-09-05 23:32 UTC (permalink / raw)
  To: Wilhelm H Kirschbaum; +Cc: Yuan Fu, 60251

Wilhelm H Kirschbaum <wilhelm@floatpays.co.za> 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-05 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22  8:42 bug#60251: 29.0.60; Consider the language at point for tree sitter treesit-inspect-node-at-point Wilhelm H Kirschbaum
2023-09-05 23:32 ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).