From: Yuan Fu Date: Wed, 23 Nov 2022 01:29:26 +0000 (-0800) Subject: ; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers. X-Git-Tag: emacs-29.0.90~1585 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c69858b3f0ab32ed9287043c120949ec47dc54d4;p=emacs.git ; * lisp/treesit.el (treesit-ready-p): Guard against empty buffers. --- 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)