From d082bfb92a17f3968910182009939300ed51a3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sat, 25 Feb 2023 03:07:55 +0100 Subject: [PATCH] Check the anchor along with the offset in treesit-indent-region * lisp/treesit.el (treesit-indent-region): To compute a valid column, having a non-nil offset is not enough, we need a non-nil anchor as well. --- lisp/treesit.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 045fdf21cba..1decfc3d7cf 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1533,7 +1533,7 @@ treesit-indent-region (dotimes (jdx idx) (let ((anchor (aref meta-vec (* jdx meta-len))) (offset (aref meta-vec (+ 1 (* jdx meta-len))))) - (when offset + (when (and anchor offset) (let ((col (save-excursion (goto-char anchor) (+ offset (current-column))))) -- 2.34.1