-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmelt-ts.el
34 lines (24 loc) · 873 Bytes
/
smelt-ts.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;;; smelt-ts.el --- Support for tree-sitter-mode -*- lexical-binding: t; coding: utf-8 -*-
;;; Commentary:
;;; Code:
(require 'cl-lib)
(require 'tree-sitter)
(require 'tree-sitter-load)
(require 'smelt-core)
(defun smelt-ts--init-load-path ()
"Add the directory of the compiled grammar to `tree-sitter-load-path'."
(cl-pushnew smelt--bin-dir tree-sitter-load-path
:test #'string-equal))
(smelt-ts--init-load-path)
(defun smelt-ts--init-major-mode-alist ()
"Link `smelt-mode' to `sml' grammar."
(cl-pushnew '(smelt-mode . sml) tree-sitter-major-mode-language-alist
:key #'car))
(smelt-ts--init-major-mode-alist)
(defun smelt-ts--setup ()
"Configure and enable `tree-sitter-mode' for `smelt-mode'."
(tree-sitter-mode +1)
)
(add-hook 'smelt-mode--setup-hook #'smelt-ts--setup 1)
(provide 'smelt-ts)
;;; smelt-ts.el ends here