Skip to content

Commit

Permalink
refactor: tree-sitter.
Browse files Browse the repository at this point in the history
  • Loading branch information
seagle0128 committed Oct 18, 2023
1 parent 2c3193d commit 7a7831d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lisp/init-c.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
("<f12>" . compile))
:init (setq-default c-basic-offset 4))

(when (and centaur-tree-sitter (centaur-treesit-available-p))
(when (centaur-treesit-available-p)
(use-package c-ts-mode
:init (setq c-ts-mode-indent-offset 4)))

Expand Down
3 changes: 2 additions & 1 deletion lisp/init-funcs.el
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ Same as '`replace-string' `C-q' `C-m' `RET' `RET''."
(defun centaur-treesit-available-p ()
"Check whether tree-sitter is available.
Native tree-sitter is introduced since 29."
(and (fboundp 'treesit-available-p)
(and centaur-tree-sitter
(fboundp 'treesit-available-p)
(treesit-available-p)))

(defun centaur-set-variable (variable value &optional no-save)
Expand Down
2 changes: 1 addition & 1 deletion lisp/init-go.el
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
("C-c t c" . go-test-current-coverage)
("C-c t x" . go-run))))

(when (and centaur-tree-sitter (centaur-treesit-available-p))
(when (centaur-treesit-available-p)
(use-package go-ts-mode
:init (setq go-ts-mode-indent-offset 4)))

Expand Down
2 changes: 1 addition & 1 deletion lisp/init-prog.el
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
(setq prettify-symbols-unprettify-at-point 'right-edge))

;; Tree-sitter support
(when (and centaur-tree-sitter (centaur-treesit-available-p))
(when (centaur-treesit-available-p)
(use-package treesit-auto
:hook (after-init . global-treesit-auto-mode)
:init (setq treesit-auto-install 'prompt)))
Expand Down

0 comments on commit 7a7831d

Please sign in to comment.