; * lisp/treesit.el (treesit-node-top-level): cleaner and faster

This commit is contained in:
Mattias Engdegård 2023-05-09 13:28:20 +02:00
parent 56468b52b2
commit a85609c22d

View file

@ -251,8 +251,7 @@ than using NODE's type. PRED can also be a predicate function,
and more. See `treesit-thing-settings' for details.
If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED."
(let ((pred (or pred (rx-to-string
`(seq bos ,(treesit-node-type node) eos))))
(let ((pred (or pred (rx bos (literal (treesit-node-type node)) eos)))
(result nil))
(cl-loop for cursor = (if include-node node
(treesit-node-parent node))