]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/jit-lock.el (jit-lock-function): Don't fontify invisible text
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 6 Sep 2022 21:24:11 +0000 (17:24 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 6 Sep 2022 21:24:11 +0000 (17:24 -0400)
See bug#57447.  This can speed up fontification significantly when using
things like outline-mode.

lisp/jit-lock.el

index 9543253cf24a6f1c58dc787facbdd0f9d66bc9a8..e28d6ec9247908970c9c56946d3f0ce10dfffbc4 100644 (file)
@@ -382,7 +382,11 @@ is active."
                   (or (not (eq jit-lock-defer-time 0))
                       (input-pending-p))))
        ;; No deferral.
-       (jit-lock-fontify-now start (+ start jit-lock-chunk-size))
+       (let* ((cend (min (point-max) (+ start jit-lock-chunk-size)))
+              (vend (next-single-property-change start 'invisible nil cend)))
+         ;; FIXME: Presumably if we're called it means `start' is
+         ;; not at EOB (nor invisible) and hence (> vend start).
+         (jit-lock-fontify-now start vend))
       ;; Record the buffer for later fontification.
       (unless (memq (current-buffer) jit-lock-defer-buffers)
        (push (current-buffer) jit-lock-defer-buffers))