From: Yuan Fu Date: Sat, 22 Oct 2022 01:50:24 +0000 (-0700) Subject: * lisp/treesit.el (treesit-font-lock-enable): Add function back. X-Git-Tag: emacs-29.0.90~1806 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7c750343be6309a78d3fd289959bca241d9daf5d;p=emacs.git * lisp/treesit.el (treesit-font-lock-enable): Add function back. --- diff --git a/lisp/treesit.el b/lisp/treesit.el index 136b756badd..3096a21f6fe 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -508,6 +508,18 @@ If LOUDLY is non-nil, message some debugging information." (let ((font-lock-unfontify-region-function #'ignore)) (funcall #'font-lock-default-fontify-region start end loudly))) +(defun treesit-font-lock-enable () + "Enable tree-sitter font-locking for the current buffer." + (treesit-font-lock-recompute-features) + (setq-local font-lock-fontify-region-function + #'treesit-font-lock-fontify-region) + ;; If we don't set `font-lock-defaults' to some non-nil value, + ;; font-lock doesn't enable properly (`font-lock-mode-internal' + ;; doesn't run). See `font-lock-specified-p'. + (when (null font-lock-defaults) + (setq font-lock-defaults '(nil))) + (font-lock-mode 1)) + ;;; Indent (defvar treesit--indent-verbose nil