From: Juri Linkov Date: Mon, 30 Dec 2024 07:23:05 +0000 (+0200) Subject: * lisp/treesit.el (treesit-show-paren-data--categorize): Improve. X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c121b4257e4a9b51b367461893023135092f9262;p=emacs.git * lisp/treesit.el (treesit-show-paren-data--categorize): Improve. Instead of using only the immediate parent, try to search more levels using 'treesit-parent-until' (bug#75122). (cherry picked from commit dc653bf0636d481303f558e2034550648ee58947) --- diff --git a/lisp/treesit.el b/lisp/treesit.el index 99468c91bf5..0932f0fe67e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3385,8 +3385,7 @@ For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in (defun treesit-show-paren-data--categorize (pos &optional end-p) (let* ((pred 'sexp-list) - (parent (treesit-node-parent (treesit-node-at (if end-p (1- pos) pos)))) - (parent (when (treesit-node-match-p parent pred t) parent)) + (parent (treesit-parent-until (treesit-node-at (if end-p (1- pos) pos)) pred)) (first (when parent (treesit-node-child parent 0))) (first-start (when first (treesit-node-start first))) (first-end (when first (treesit-node-end first)))