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: Yuan Fu
Subject: Re: master 09b5f00613: ; Fix calls to treesit functions
Date: Mon, 19 Dec 2022 00:35:56 -0800


> On Dec 18, 2022, at 10:26 PM, Theodor Thornhill <theo@thornhill.no> wrote:
> 
> 
> 
> On 19 December 2022 04:37:03 CET, Stefan Monnier <monnier@iro.umontreal.ca> 
> wrote:
>>>> How 'bout always defining `treesit-parser-list` (and making it return
>>>> `nil` if Emacs was compiled without Tree-sitter support)?
>>> Is it indeed guaranteed that the first function to be called by any
>>> application that wants to optionally use tree-sitter will be
>>> treesit-parser-list? Av
>> 
>> Good question.  Tho I don't think we need a guarantee.
>> We just need it to be frequent enough.
>> 
>>> What if they want to start with some other function?
>> 
>> There's always `treesit-available-p`.
>> 
>> 
>>       Stefan
> 1>
>> 
> 
> How about treesit-ensure, that checks treesit-available-p and whether it's 
> enabled for the current mode? The treesit-parser-list is also kind of working 
> just by accident, as it isn't its job to ensure availability.

Depends on how you view it. If all you need to know is whether there is a 
parser and everything you do is language-agnostic, then checking 
treesit-parser-list is the right thing to do. 

OTOH treesit-ensure feels vague to me, what exactly does it represent? 
Treesit-available-p + treesit-parser-list? If it represents “this major mode is 
a tree-sitter mode”, it still doesn’t say much IMO. I think it makes more sense 
to check for specific features, eg, "is there a parser”.


Yuan


reply via email to

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