emacs-tree-sitter/tree-sitter-langs

Allow specifying a local bins dir?

hgl opened this issue · 5 comments

hgl commented

Users, for whatever reason, might want to use the bins that they compile themselves, instead of using the prebuilt version. Do you think it'd be a good idea to allow setting a path variable that would allow emacs-tree-langs to point to a local directory that contains such compiled bins?

For me personally, I need to run emacs-tree-sitter on an old Mac, and the mac version of the prebuilt bins are incompatible with my old macOS.

meain commented

You should be able to configure tree-sitter-load-path to where the package should look for artifacts.

hgl commented

Thanks for the suggestion. I was not aware of that variable.

I'm still pretty new to elisp, do you think there is a hook that I can use to change the variable? Or should I use something like with-eval-after-load to change it after tree-sitter-langs.el is loaded

meain commented

An eval-after-load with something like (setq tree-sitter-load-path '("/path/to/bin/")) should do the trick.

hgl commented

It seems tree-sitter-langs changes this variable by using an advice on tree-sitter-load, does that mean I need to use advice too if I want my path to be in front of that of tree-sitter-langs'?

I tried setq as you suggested, but tree-sitter-langs' path was put before the local path.

hgl commented

I should simply disable loading this package instead. I was using a config framework and this package came builtin, so it was not obvious to me.