diff --git a/modules/tools/tree-sitter/README.org b/modules/tools/tree-sitter/README.org index 5d1fbbec1..39bcd1a73 100644 --- a/modules/tools/tree-sitter/README.org +++ b/modules/tools/tree-sitter/README.org @@ -75,6 +75,9 @@ requires two additional steps: version constraints; newer versions of some grammars may not work with older versions of Emacs). +To test whether tree-sitter is functioning in the current buffer, execute ~M-x ++tree-sitter/doctor~. + * TODO Usage #+begin_quote 󱌣 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]] diff --git a/modules/tools/tree-sitter/autoload/tree-sitter.el b/modules/tools/tree-sitter/autoload/tree-sitter.el index 66a84c1b9..0d7ee88bd 100644 --- a/modules/tools/tree-sitter/autoload/tree-sitter.el +++ b/modules/tools/tree-sitter/autoload/tree-sitter.el @@ -69,6 +69,14 @@ pre-Emacs 31." (let (auto-mode-alist interpreter-mode-alist) (apply fn args))) -;;; TODO: Backwards compatibility +;;;###autoload +(defun +tree-sitter/doctor () + "Test if the current buffer is correctly tree-sitter-enabled." + (interactive) + (unless (treesit-available-p) + (user-error "This Emacs install wasn't built with treesit support!")) + (unless (treesit-parser-list) + (user-error "No tree-sitter parsers are active in this buffer; are the grammars properly installed?")) + (message "Tree-sitter is functioning in this buffer!")) ;;; tree-sitter.el ends here