fix(tree-sitter): always install grammars to profile data dir

Fix: #8578
Co-authored-by: falloutphil <falloutphil@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2025-12-01 00:31:46 -05:00
parent c523ee9586
commit 281e3069a7
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -101,12 +101,13 @@
:config
;; HACK: Keep $EMACSDIR clean by installing grammars to the active profile.
(add-to-list 'treesit-extra-load-path (file-name-concat doom-profile-data-dir "tree-sitter"))
(defadvice! +tree-sitter--install-grammar-to-local-dir-a (fn &rest args)
"Write grammars to `doom-profile-data-dir'."
(defadvice! +tree-sitter--install-grammar-to-local-dir-a (fn lang &optional outdir &rest args)
"Write grammars to `doom-profile-data-dir' instead."
:around #'treesit-install-language-grammar
:around #'treesit--build-grammar
(let ((user-emacs-directory doom-profile-data-dir))
(apply fn args)))
(apply fn lang
(or outdir (file-name-concat doom-profile-data-dir "tree-sitter"))
args))
;; TODO: Move most of these out to modules
(dolist (map '((awk "https://github.com/Beaglefoot/tree-sitter-awk" nil nil nil nil)