From: Dmitry Gutov Date: Thu, 19 Jan 2023 17:43:19 +0000 (+0200) Subject: (treesit-simple-indent-presets): Have n-p-gp check for grandparent's presence X-Git-Tag: emacs-29.0.90~663 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fb82d4e3286935286b51765c4823f290428f25aa;p=emacs.git (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. --- diff --git a/lisp/treesit.el b/lisp/treesit.el index 34d288226fa..7669ed6d18c 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -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 _)