emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 5cf50d60041: Check the anchor along with the offset in treesit-


From: Yuan Fu
Subject: emacs-29 5cf50d60041: Check the anchor along with the offset in treesit-indent-region
Date: Sat, 25 Feb 2023 00:21:48 -0500 (EST)

branch: emacs-29
commit 5cf50d60041c82deccc4b32a8ecdb1a28b6e8f91
Author: Daniel Martín <mardani29@yahoo.es>
Commit: Yuan Fu <casouri@gmail.com>

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



reply via email to

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