(treesit-simple-indent-presets): Have n-p-gp check for grandparent's presence

* lisp/treesit.el (treesit-simple-indent-presets): Have n-p-gp
check for grandparent's presence before checking its type.
This commit is contained in:
Dmitry Gutov 2023-01-19 19:43:19 +02:00
parent 25ddb3f7d9
commit fb82d4e328

View file

@ -1102,10 +1102,12 @@ See `treesit-simple-indent-presets'.")
(string-match-p
parent-t (treesit-node-type parent)))
(or (null grand-parent-t)
(string-match-p
grand-parent-t
(treesit-node-type
(treesit-node-parent parent))))))))
(and
(treesit-node-parent parent)
(string-match-p
grand-parent-t
(treesit-node-type
(treesit-node-parent parent)))))))))
(cons 'no-node (lambda (node &rest _) (null node)))
(cons 'parent-is (lambda (type)
(lambda (_n parent &rest _)