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: Tue, 20 Dec 2022 16:36:03 -0800


> On Dec 20, 2022, at 8:02 AM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> 
>> With functions returning a list, this is almost obvious, yes.  But
>> what about functions that return a buffer position, or a symbol, or
>> some other data type?  In those cases it is much less trivially
>> evident what to expect when tree-sitter support is unavailable.
> 
> In such cases, the better choice may be not to provide an implementation
> (or signal an error).
> 
>> Thus the need to document this stuff.
> 
> My take on it is that if we need to change the doc, then maybe this is
> not a good candidate for the set of functions that are always defined :-)

Technically there are only a handful of “entry functions”, ones that returns a 
node or parser which the user can further use, like treesit-node-at, 
treesit-parser-list. However many other functions that takes a node or parser 
as an argument also accepts a language symbol, or nil, for convenience. Maybe 
we can state explicitly that only functions that do not take a node or parser 
an an argument are always defined, and return nil when tree-sitter is not 
available. 


Yuan


reply via email to

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