emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 09b5f00613: ; Fix calls to treesit functions


From: Eli Zaretskii
Subject: Re: master 09b5f00613: ; Fix calls to treesit functions
Date: Mon, 19 Dec 2022 17:21:37 +0200

> From: Theodor Thornhill <theo@thornhill.no>
> Cc: emacs-devel@gnu.org, monnier@iro.umontreal.ca
> Date: Mon, 19 Dec 2022 15:51:22 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >   How about treesit-ensure, that checks treesit-available-p and
> >   whether it's enabled for the current mode?
> >
> > If this check is for the current mode, then you already have the
> > "particular language", don't you?
> >
> > And that is eventually the right test, because even if the tree-sitter
> > library is compiled in and available, the grammar library might not
> > be, which means the code cannot use tree-sitter in such a situation.
> 
> Yeah, but in for example prog-mode I then have to do something like
> (treesit-language-available-p (treesit-language-at (point)))
> 
> Which seems long.

Maybe, but I think there's no way around it, if we want to include
tree-sitter code safely.

Yuan, Stefan, WDYT?

> IIRC I used something similar in an earlier patch,
> and was dismissed because it should have its own api?
> 
> ```
>   (interactive "P")
>   (save-excursion
>     (if (or (and (treesit-available-p)
>                  (treesit-ready-p (treesit-language-at (point)))

AFAIK, treesit-ready-p already calls treesit-available-p.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]