]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/treesit.el (treesit-show-paren-data--categorize): Improve.
authorJuri Linkov <juri@linkov.net>
Mon, 30 Dec 2024 07:23:05 +0000 (09:23 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 4 Jan 2025 20:25:22 +0000 (21:25 +0100)
Instead of using only the immediate parent, try to search more levels
using 'treesit-parent-until' (bug#75122).

(cherry picked from commit dc653bf0636d481303f558e2034550648ee58947)

lisp/treesit.el

index 99468c91bf540663956bb353597364844fc0fcdf..0932f0fe67eaec913973f5bbe68bb361791b76ca 100644 (file)
@@ -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)))