(remove-hook 'jit-lock-functions fun t)
(unless jit-lock-functions (jit-lock-mode nil)))
-;; This function is used to prevent font-lock-fontify-buffer from
-;; fontifying eagerly the whole buffer. This is important for
-;; things like CWarn mode which adds/removes a few keywords and
-;; does a refontify (which takes ages on large files).
(defun jit-lock-refontify (&optional beg end)
"Force refontification of the region BEG..END (default whole buffer)."
(with-buffer-prepared-for-jit-lock