renzmann / treesit-auto

Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29
GNU General Public License v3.0
369 stars 28 forks source link

[feature] Provide customizable variable for directory containing compiled grammars #18

Closed ktetzlaff closed 1 year ago

ktetzlaff commented 1 year ago

Currently, compiled tree-sitter grammars are stored in the directory <user-emacs-directory>/tree-sitter. It would be nice if the location could be customized.

renzmann commented 1 year ago

I agree that would be nice, but I also don't think it would be in scope for this project. At least for now, treesit-install-language-grammar doesn't let us pick a place to install, since it's always passing nil to out-dir, and I'd rather not try to rely on an internal function like treesit--install-langauge-grammar-1, so we might have more luck submitting a patch to treesit.el instead of here. If that gets accepted upstream, I'd consider adding it here, but that would increase the already strong requirement we have on compatible Emacs versions.

renzmann commented 1 year ago

That said, you are free to customize treesit-extra-load-path and place your grammars there, once compiled.

ktetzlaff commented 1 year ago

At least for now, treesit-install-language-grammar doesn't let us pick a place to install, since it's always passing nil to out-dir, and I'd rather not try to rely on an internal function like treesit--install-langauge-grammar-1, so we might have more luck submitting a patch to treesit.el instead of here.

Oh, ok. I didn't notice that you're just using a function defined by upstream. In this case I agree. The functionality should be provided by treesit.el. In the meantime I will probably use an :after advice.

Thanks for working on this!