To make Font Lock mode faster for buffers visiting large files, you can use Fast Lock mode. Fast Lock mode saves the font information for each file in a separate cache file; each time you visit the file, it rereads the font information from the cache file instead of refontifying the text from scratch.
The command M-x fast-lock-mode turns Fast Lock mode on or off, according to the argument (with no argument, it toggles). You can also arrange to enable Fast Lock mode whenever you use Font Lock mode, like this:
(setq font-lock-support-mode 'fast-lock-mode)
It is not worth writing a cache file for small buffers. Therefore,
the variable fast-lock-minimum-size
specifies a minimum file size
for caching font information.
The variable fast-lock-cache-directories
specifies where to put
the cache files. Its value is a list of directories to try; "."
means the same directory as the file being edited. The default value is
("." "~/.emacs-flc")
, which means to use the same directory if
possible, and otherwise the directory `~/.emacs-flc
'.
The variable fast-lock-save-others
specifies whether Fast Lock
mode should save cache files for files that you do not own. A
non-nil
value means yes (and that is the default).