Function: treesit--compute-font-lock-level

treesit--compute-font-lock-level is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit--compute-font-lock-level LEVEL)

Documentation

Compute the font-lock level for the current major mode.

LEVEL should be the value of treesit-font-lock-level. Return a number representing the font-lock level for the current major mode. If there's no match, return 3.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit--compute-font-lock-level (level)
  "Compute the font-lock level for the current major mode.

LEVEL should be the value of `treesit-font-lock-level'.  Return a number
representing the font-lock level for the current major mode.  If there's
no match, return 3."
  (if (numberp level)
      level
    (catch 'found
      (dolist (config level)
        (let ((mode (car config))
              (num (cdr config)))
          (when (derived-mode-p mode)
            (throw 'found num))))
      (or (alist-get t level)
          3))))