emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 5cba5ee8905: Fix tree-sitter range update function


From: Yuan Fu
Subject: emacs-29 5cba5ee8905: Fix tree-sitter range update function
Date: Mon, 18 Sep 2023 23:49:02 -0400 (EDT)

branch: emacs-29
commit 5cba5ee8905a41484beef4100976acd52b5b1531
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix tree-sitter range update function
    
    * lisp/treesit.el (treesit-update-ranges): If an embedded language
    doesn't have any range, don't set its range to nil (which means whole
    buffer), instead, set its range to a dummy (1 . 1) zero range.
---
 lisp/treesit.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 41ebc62fca6..8163ffdf329 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -544,7 +544,12 @@ region."
             (when (eq (treesit-parser-language parser)
                       language)
               (treesit-parser-set-included-ranges
-               parser set-ranges))))))))
+               parser (or set-ranges
+                          ;; When there's no range for the embedded
+                          ;; language, set it's range to a dummy (1
+                          ;; . 1), otherwise it would be set to the
+                          ;; whole buffer, which is not what we want.
+                          `((,(point-min) . ,(point-min))))))))))))
 
 (defun treesit-parser-range-on (parser beg &optional end)
   "Check if PARSER's range covers the portion between BEG and END.



reply via email to

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