From: Daniel Martín Date: Sat, 25 Feb 2023 02:07:55 +0000 (+0100) Subject: Check the anchor along with the offset in treesit-indent-region X-Git-Tag: emacs-29.0.90~322 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5cf50d60041c82deccc4b32a8ecdb1a28b6e8f91;p=emacs.git 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. --- 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 @@ Similar to `treesit-indent', but indent a region instead." (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)))))