(or (treesit-parser-create language)
(error "Cannot find a parser for %s" language))
is turned into
(treesit-parser-create language)
because treesit-parser-create never returns nil. (We used to use
treesit-get-parser which don't create parser automatically.)
* lisp/treesit.el (treesit-buffer-root-node): Replace error with signal.
for LANGUAGE."
(if-let ((parser
(or (if language
- (or (treesit-parser-create language)
- (error "Cannot find a parser for %s" language))
+ (treesit-parser-create language)
(or (car (treesit-parser-list))
- (error "Buffer has no parser"))))))
+ (signal 'treesit-error
+ '("Buffer has no parser")))))))
(treesit-parser-root-node parser)))
(defun treesit-filter-child (node pred &optional named)