Function: fast-lock-mode
fast-lock-mode is an interactive and byte-compiled function defined in
fast-lock.el.gz.
Signature
(fast-lock-mode &optional ARG)
Documentation
Toggle Fast Lock mode.
With arg, turn Fast Lock mode on if and only if arg is positive and the buffer
is associated with a file. Enable it automatically in your ~/.emacs by:
(setq font-lock-support-mode 'fast-lock-mode)
If Fast Lock mode is enabled, and the current buffer does not contain any text
properties, any associated Font Lock cache is used if its timestamp matches the
buffer's file, and its font-lock-keywords match those that you are using.
Font Lock caches may be saved:
- When you save the file's buffer.
- When you kill an unmodified file's buffer.
- When you exit Emacs, for all unmodified or saved buffers.
Depending on the value of fast-lock-save-events.
See also the commands fast-lock-read-cache and fast-lock-save-cache.
Use M-x font-lock-fontify-buffer (font-lock-fontify-buffer) to fontify the buffer if the cache is bad.
Various methods of control are provided for the Font Lock cache. In general,
see variable fast-lock-cache-directories and function fast-lock-cache-name.
For saving, see variables fast-lock-minimum-size, fast-lock-save-events,
fast-lock-save-others and fast-lock-save-faces.
Probably introduced at or before Emacs version 19.29.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/fast-lock.el.gz
;; User Functions:
;;;###autoload
(defun fast-lock-mode (&optional arg)
"Toggle Fast Lock mode.
With arg, turn Fast Lock mode on if and only if arg is positive and the buffer
is associated with a file. Enable it automatically in your `~/.emacs' by:
(setq font-lock-support-mode \\='fast-lock-mode)
If Fast Lock mode is enabled, and the current buffer does not contain any text
properties, any associated Font Lock cache is used if its timestamp matches the
buffer's file, and its `font-lock-keywords' match those that you are using.
Font Lock caches may be saved:
- When you save the file's buffer.
- When you kill an unmodified file's buffer.
- When you exit Emacs, for all unmodified or saved buffers.
Depending on the value of `fast-lock-save-events'.
See also the commands `fast-lock-read-cache' and `fast-lock-save-cache'.
Use \\[font-lock-fontify-buffer] to fontify the buffer if the cache is bad.
Various methods of control are provided for the Font Lock cache. In general,
see variable `fast-lock-cache-directories' and function `fast-lock-cache-name'.
For saving, see variables `fast-lock-minimum-size', `fast-lock-save-events',
`fast-lock-save-others' and `fast-lock-save-faces'."
(interactive "P")
;; Only turn on if we are visiting a file. We could use `buffer-file-name',
;; but many packages temporarily wrap that to nil when doing their own thing.
(set (make-local-variable 'fast-lock-mode)
(and buffer-file-truename
(not (memq 'fast-lock-mode font-lock-inhibit-thing-lock))
(if arg (> (prefix-numeric-value arg) 0) (not fast-lock-mode))))
(if (and fast-lock-mode (not font-lock-mode))
;; Turned on `fast-lock-mode' rather than `font-lock-mode'.
(progn
(message "Use font-lock-support-mode rather than calling fast-lock-mode")
(sit-for 2))
;; Let's get down to business.
(set (make-local-variable 'fast-lock-cache-timestamp) nil)
(set (make-local-variable 'fast-lock-cache-filename) nil)
(when (and fast-lock-mode (not font-lock-fontified))
(fast-lock-read-cache))))