Function: jit-lock-context-fontify

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

Signature

(jit-lock-context-fontify)

Documentation

Refresh fontification to take new context into account.

Source Code

;; Defined in /usr/src/emacs/lisp/jit-lock.el.gz
(defun jit-lock-context-fontify ()
  "Refresh fontification to take new context into account."
  (unless memory-full
    (dolist (buffer (buffer-list))
      (with-current-buffer buffer
	(when jit-lock-context-unfontify-pos
	  ;; (message "Jit-Context %s" (buffer-name))
	  (save-restriction
            ;; Don't be blindsided by narrowing that starts in the middle
            ;; of a jit-lock-defer-multiline.
	    (widen)
	    (when (and (>= jit-lock-context-unfontify-pos (point-min))
		       (< jit-lock-context-unfontify-pos (point-max)))
	      ;; If we're in text that matches a complex multi-line
	      ;; font-lock pattern, make sure the whole text will be
	      ;; redisplayed eventually.
	      ;; Despite its name, we treat jit-lock-defer-multiline here
	      ;; rather than in jit-lock-defer since it has to do with multiple
	      ;; lines, i.e. with context.
	      (when (get-text-property jit-lock-context-unfontify-pos
				       'jit-lock-defer-multiline)
		(setq jit-lock-context-unfontify-pos
		      (or (previous-single-property-change
			   jit-lock-context-unfontify-pos
			   'jit-lock-defer-multiline)
			  (point-min))))
	      (with-silent-modifications
	       ;; Force contextual refontification.
	       (remove-text-properties
		jit-lock-context-unfontify-pos (point-max)
		'(fontified nil jit-lock-defer-multiline nil)))
	      (setq jit-lock-context-unfontify-pos (point-max)))))))))