emacs-devel
[Top][All Lists]
Advanced

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

Re: Tree-sitter api


From: Eli Zaretskii
Subject: Re: Tree-sitter api
Date: Mon, 27 Sep 2021 08:37:48 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 26 Sep 2021 21:42:36 -0700
> Cc: Tuấn-Anh Nguyễn <ubolonton@gmail.com>,
>  Theodor Thornhill <theo@thornhill.no>,
>  Clément Pit-Claudel <cpitclaudel@gmail.com>,
>  Emacs developers <emacs-devel@gnu.org>,
>  Stefan Monnier <monnier@iro.umontreal.ca>,
>  Stephen Leake <stephen_leake@stephe-leake.org>,
>  John Yates <john@yates-sheets.org>
> 
> Currently, because font-lock.el uses functions and variables defined in 
> tree-sitter.el, it needs to require tree-sitter.el.

But only conditioned on some variable, right?

> Should we require tree-sitter.el by default?

No, but you could require it on the same condition that makes
font-lock use tree-sitter functions.

> Then what do we do when tree-sitter is not available on the system? Should I 
> wrap every reference to tree-sitter in font-lock.el with (when (featurep 
> ’tree-sitter))? Or is there better ways to deal with this?

Again, you probably already have a condition that wraps it, no?

> Another approach is to define everything tree-sitter related in 
> tree-sitter.el, and make tree-sitter.el require font-lock.el instead of the 
> other way around. Would that be better?

If it works, yes.  But I'm not sure I understand the details well
enough for my answer to be correct.



reply via email to

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