mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 10:31:23 -08:00
fix(tree-sitter): arity error installing grammars on <=29
This commit is contained in:
parent
fd643d78a8
commit
0d2f10dcab
1 changed files with 13 additions and 9 deletions
|
|
@ -99,15 +99,19 @@
|
||||||
mode)))
|
mode)))
|
||||||
|
|
||||||
:config
|
:config
|
||||||
;; HACK: Keep $EMACSDIR clean by installing grammars to the active profile.
|
;; HACK: Keep $EMACSDIR clean by installing grammars to central location (the
|
||||||
(add-to-list 'treesit-extra-load-path (file-name-concat doom-profile-data-dir "tree-sitter"))
|
;; active profile).
|
||||||
(defadvice! +tree-sitter--install-grammar-to-local-dir-a (fn lang &optional outdir &rest args)
|
(let ((data-dir (file-name-concat doom-profile-data-dir "tree-sitter")))
|
||||||
"Write grammars to `doom-profile-data-dir' instead."
|
(add-to-list 'treesit-extra-load-path data-dir)
|
||||||
|
;; Treesit's API saw major changes in 30.x.
|
||||||
|
(if (< emacs-major-version 30)
|
||||||
|
(defadvice! +tree-sitter--install-grammar-to-local-dir-a (fn out-dir &rest args)
|
||||||
|
:around #'treesit--install-language-grammar-1
|
||||||
|
(apply fn (or out-dir data-dir) args))
|
||||||
|
(defadvice! +tree-sitter--install-grammar-to-local-dir-a (fn lang &optional out-dir &rest args)
|
||||||
:around #'treesit-install-language-grammar
|
:around #'treesit-install-language-grammar
|
||||||
:around #'treesit--build-grammar
|
:around #'treesit--build-grammar
|
||||||
(apply fn lang
|
(apply fn lang (or out-dir data-dir) args))))
|
||||||
(or outdir (file-name-concat doom-profile-data-dir "tree-sitter"))
|
|
||||||
args))
|
|
||||||
|
|
||||||
;; TODO: Move most of these out to modules
|
;; TODO: Move most of these out to modules
|
||||||
(dolist (map '((awk "https://github.com/Beaglefoot/tree-sitter-awk" nil nil nil nil)
|
(dolist (map '((awk "https://github.com/Beaglefoot/tree-sitter-awk" nil nil nil nil)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue