aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/aux-files/emacs
diff options
context:
space:
mode:
authorAndrew Tropin <andrew@trop.in>2023-02-10 12:32:12 +0400
committerAndrew Tropin <andrew@trop.in>2023-02-11 12:02:46 +0400
commitc77a3d4554175ee5320ccc713aa21b1ba3e6b8a3 (patch)
treeab55e177757725be7c95f9d732ce36c0ee7adfbc /gnu/packages/aux-files/emacs
parent3ab8559436356ef89aa60135d3558681d64443ae (diff)
downloadguix-c77a3d4554175ee5320ccc713aa21b1ba3e6b8a3.tar
guix-c77a3d4554175ee5320ccc713aa21b1ba3e6b8a3.tar.gz
gnu: emacs: Add TREE_SITTER_GRAMMAR_PATH support.
gnu/packages/emacs.scm (emacs)[native-search-paths]: Add a search-path for tree-sitter grammars. gnu/packages/aux-files/emacs/guix-emacs.el: Add directories from TREE_SITTER_GRAMMAR_PATH to treesit-extra-load-path.
Diffstat (limited to 'gnu/packages/aux-files/emacs')
-rw-r--r--gnu/packages/aux-files/emacs/guix-emacs.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/gnu/packages/aux-files/emacs/guix-emacs.el b/gnu/packages/aux-files/emacs/guix-emacs.el
index 56dbcb8d67..708093267d 100644
--- a/gnu/packages/aux-files/emacs/guix-emacs.el
+++ b/gnu/packages/aux-files/emacs/guix-emacs.el
@@ -76,6 +76,13 @@ The files in the list do not have extensions (.el, .elc)."
(when (file-directory-p pkg-dir)
(package-load-descriptor pkg-dir)))))))))))
+;; If emacs built with tree-sitter, read the value of the environment variable
+;; to make tree-sitter grammars available in emacs out-of-the-box.
+(with-eval-after-load 'treesit
+ (when-let ((grammar-path (getenv "TREE_SITTER_GRAMMAR_PATH")))
+ (mapcar (lambda (x) (add-to-list 'treesit-extra-load-path x))
+ (split-string grammar-path ":"))))
+
(provide 'guix-emacs)
;;; guix-emacs.el ends here