refactor(tree-sitter): remove doom-tree-sitter-fail-gracefully-a

Use turn-on-tree-sitter-mode instead of tree-sitter-mode directly
because the former now ignore errors.
This commit is contained in:
Daanturo 2021-08-22 10:46:27 +07:00 committed by Jeetaditya Chatterjee
parent 56432f1649
commit 76d38ddc63
No known key found for this signature in database
GPG key ID: 09D54CECD2132B91

View file

@ -2,7 +2,7 @@
(use-package! tree-sitter
:when (bound-and-true-p module-file-suffix)
:hook (prog-mode . tree-sitter-mode)
:hook (prog-mode . turn-on-tree-sitter-mode)
:hook (tree-sitter-after-on . tree-sitter-hl-mode)
:config
(require 'tree-sitter-langs)
@ -10,19 +10,7 @@
;; This makes every node a link to a section of code
(setq tree-sitter-debug-jump-buttons t
;; and this highlights the entire sub tree in your code
tree-sitter-debug-highlight-jump-region t)
(defadvice! doom-tree-sitter-fail-gracefully-a (orig-fn &rest args)
"Don't break with errors when current major mode lacks tree-sitter support."
:around #'tree-sitter-mode
(condition-case e
(apply orig-fn args)
(error
(unless (string-match-p (concat "^Cannot find shared library\\|"
"^No language registered\\|"
"cannot open shared object file")
(error-message-string e))
(signal (car e) (cadr e)))))))
tree-sitter-debug-highlight-jump-region t))
(when (featurep! :editor evil +everywhere)
(use-package! evil-textobj-tree-sitter