emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 fb82d4e3286 4/4: (treesit-simple-indent-presets): Have n-p-gp c


From: Dmitry Gutov
Subject: emacs-29 fb82d4e3286 4/4: (treesit-simple-indent-presets): Have n-p-gp check for grandparent's presence
Date: Thu, 19 Jan 2023 12:44:55 -0500 (EST)

branch: emacs-29
commit fb82d4e3286935286b51765c4823f290428f25aa
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    (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.
---
 lisp/treesit.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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 _)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]