]> git.eshelyaron.com Git - emacs.git/commitdiff
; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers.
authorYuan Fu <casouri@gmail.com>
Wed, 23 Nov 2022 01:29:26 +0000 (17:29 -0800)
committerYuan Fu <casouri@gmail.com>
Wed, 23 Nov 2022 01:29:26 +0000 (17:29 -0800)
lisp/treesit.el

index 6042b7e6c96648b9675274d7a4150eea793b826f..3ea6fae4dfc228ed89a02aa2d606329f2f0ac21d 100644 (file)
@@ -1602,7 +1602,8 @@ instead of emitting a warning."
       (when (not (treesit-available-p))
         (setq msg "tree-sitter library is not compiled with Emacs")
         (throw 'term nil))
-      (when (> (position-bytes (1- (point-max))) treesit-max-buffer-size)
+      (when (> (position-bytes (max (point-min) (1- (point-max))))
+               treesit-max-buffer-size)
         (setq msg "buffer larger than `treesit-max-buffer-size'")
         (throw 'term nil))
       (dolist (lang language-list)