From c69858b3f0ab32ed9287043c120949ec47dc54d4 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 22 Nov 2022 17:29:26 -0800 Subject: [PATCH] ; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers. --- lisp/treesit.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 6042b7e6c96..3ea6fae4dfc 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -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) -- 2.39.5