diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-08-07 17:47:55 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-08-07 17:47:55 +0000 |
commit | 65c986aa9470183c3a546b21dbd1d14eae109626 (patch) | |
tree | fb86fdc7e0c117a2e668c70600fc6c550dc72895 /lisp/font-lock.el | |
parent | 1402611cf2f7573544c420d79f08b624ec39b970 (diff) | |
download | emacs-65c986aa9470183c3a546b21dbd1d14eae109626.tar.gz |
(font-lock-extend-jit-lock-region-after-change): Add docstring.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r-- | lisp/font-lock.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3496560cc71..ab80316ae6a 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1173,6 +1173,13 @@ what properties to clear before refontifying a region.") (defvar jit-lock-start) (defvar jit-lock-end) (defun font-lock-extend-jit-lock-region-after-change (beg end old-len) + "Function meant for `jit-lock-after-change-extend-region-functions'. +This function does 2 things: +- extend the region so that it not only includes the part that was modified + but also the surrounding text whose highlighting may change as a consequence. +- anticipate (part of) the region extension that will happen later in + `font-lock-default-fontify-region', in order to avoid the need for + double-redisplay in `jit-lock-fontify-now'." (save-excursion ;; First extend the region as font-lock-after-change-function would. (let ((region (if font-lock-extend-after-change-region-function @@ -1198,8 +1205,11 @@ what properties to clear before refontifying a region.") 'font-lock-multiline nil) (point-max))) ;; Finally, pre-enlarge the region to a whole number of lines, to try - ;; and predict what font-lock-default-fontify-region will do, so as to + ;; and anticipate what font-lock-default-fontify-region will do, so as to ;; avoid double-redisplay. + ;; We could just run `font-lock-extend-region-functions', but since + ;; the only purpose is to avoid the double-redisplay, we prefer to + ;; do here only the part that is cheap and most likely to be useful. (when (memq 'font-lock-extend-region-wholelines font-lock-extend-region-functions) (goto-char beg) |