diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-08-23 23:14:00 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-08-23 23:14:00 +0300 |
commit | a849b5641044c19ee3d8a4206c7c827e2620c325 (patch) | |
tree | 4dc75e5945bd38b33eefa187ffdbf0bf17ca347e /lisp/jit-lock.el | |
parent | 8f43180f0dc5b3e25d8252950ea63e2e92d40611 (diff) | |
download | emacs-a849b5641044c19ee3d8a4206c7c827e2620c325.tar.gz |
Document 'jit-lock-bounds'
* doc/lispref/modes.texi (Other Font Lock Variables):
* lisp/jit-lock.el (jit-lock-functions, jit-lock-register):
Document the return value of the fontification functions.
Diffstat (limited to 'lisp/jit-lock.el')
-rw-r--r-- | lisp/jit-lock.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index a1287926eb9..a905936b6b9 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -150,7 +150,10 @@ If 0, then fontification is only deferred while there is input pending." (defvar jit-lock-functions nil "Special hook run to do the actual fontification. The functions are called with two arguments: -the START and END of the region to fontify.") +the START and END of the region to fontify. +Each function 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.") (defvar-local jit-lock-context-unfontify-pos nil "Consider text after this position as contextually unfontified. @@ -332,7 +335,10 @@ like `debug-on-error' and Edebug can be used." "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." +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)) |