Function: jit-lock-register

jit-lock-register is a byte-compiled function defined in jit-lock.el.gz.

Signature

(jit-lock-register FUN &optional CONTEXTUAL)

Documentation

Register FUN as a fontification function to be called in this buffer.

FUN will be called with two arguments START and END indicating the region that needs to be (re)fontified. If non-nil, CONTEXTUAL means that a contextual fontification would be useful. FUN can return a list of the form (jit-lock-bounds BEG . END), to indicate the bounds of the region it actually fontified; JIT font-lock will use this information to optimize redisplay cycles.

View in manual

Probably introduced at or before Emacs version 23.1.

Source Code

;; Defined in /usr/src/emacs/lisp/jit-lock.el.gz
(defun jit-lock-register (fun &optional contextual)
  "Register FUN as a fontification function to be called in this buffer.
FUN will be called with two arguments START and END indicating the region
that needs to be (re)fontified.
If non-nil, CONTEXTUAL means that a contextual fontification would be useful.
FUN can return a list of the form (jit-lock-bounds BEG . END),
to indicate the bounds of the region it actually fontified; JIT
font-lock will use this information to optimize redisplay cycles."
  (add-hook 'jit-lock-functions fun nil t)
  (when (and contextual jit-lock-contextually)
    (setq-local jit-lock-contextually t))
  (jit-lock-mode t))