Function: jit-lock-stealth-fontify
jit-lock-stealth-fontify is a byte-compiled function defined in
jit-lock.el.gz.
Signature
(jit-lock-stealth-fontify &optional REPEAT)
Documentation
Fontify buffers stealthily.
This function is called repeatedly after Emacs has become idle for
jit-lock-stealth-time seconds. Optional argument REPEAT is expected
non-nil in a repeated invocation of this function.
Source Code
;; Defined in /usr/src/emacs/lisp/jit-lock.el.gz
(defun jit-lock-stealth-fontify (&optional repeat)
"Fontify buffers stealthily.
This function is called repeatedly after Emacs has become idle for
`jit-lock-stealth-time' seconds. Optional argument REPEAT is expected
non-nil in a repeated invocation of this function."
;; Cancel timer for repeated invocations.
(unless repeat
(cancel-timer jit-lock-stealth-repeat-timer))
(unless (or executing-kbd-macro
memory-full
(window-minibuffer-p)
;; For first invocation set up `jit-lock-stealth-buffers'.
;; In repeated invocations it's already been set up.
(null (if repeat
jit-lock-stealth-buffers
(setq jit-lock-stealth-buffers (buffer-list)))))
(let ((buffer (car jit-lock-stealth-buffers))
(delay 0)
minibuffer-auto-raise
message-log-max
start)
(if (and jit-lock-stealth-load
;; load-average can return nil. The w32 emulation does
;; that during the first few dozens of seconds after
;; startup.
(> (or (car (load-average)) 0) jit-lock-stealth-load))
;; Wait a little if load is too high.
(setq delay jit-lock-stealth-time)
(if (buffer-live-p buffer)
(with-current-buffer buffer
(if (and jit-lock-mode
(setq start (jit-lock-stealth-chunk-start (point))))
;; Fontify one block of at most `jit-lock-chunk-size'
;; characters.
(with-temp-message (if jit-lock-stealth-verbose
(concat "JIT stealth lock "
(buffer-name)))
(jit-lock-fontify-now start
(+ start jit-lock-chunk-size))
;; Run again after `jit-lock-stealth-nice' seconds.
(setq delay (or jit-lock-stealth-nice 0)))
;; Nothing to fontify here. Remove this buffer from
;; `jit-lock-stealth-buffers' and run again immediately.
(setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers))))
;; Buffer is no longer live. Remove it from
;; `jit-lock-stealth-buffers' and run again immediately.
(setq jit-lock-stealth-buffers (cdr jit-lock-stealth-buffers))))
;; Call us again.
(when jit-lock-stealth-buffers
(timer-set-idle-time jit-lock-stealth-repeat-timer (current-idle-time))
(timer-inc-time jit-lock-stealth-repeat-timer delay)
(timer-activate-when-idle jit-lock-stealth-repeat-timer t)))))