GNU Emacs Manual - Fast or Lazy

Go to the first, previous, next, last section, table of contents.

### Fast Lock or Lazy Lock?

Here is a simple guide to help you choose one of the Font Lock support modes.

- Fast Lock mode intervenes only during file visiting and buffer killing (and related events); therefore buffer editing and window scrolling are no faster or slower than in plain Font Lock mode.
- Fast Lock mode is slower at reading a cache file than Lazy Lock mode is at fontifying a window; therefore Fast Lock mode is slower at visiting a file than Lazy Lock mode.
- Lazy Lock mode intervenes during window scrolling to fontify text that scrolls onto the screen; therefore, scrolling is slower than in plain Font Lock mode.
- Lazy Lock mode doesn't fontify during buffer editing (it defers fontification of changes); therefore, editing is faster than in plain Font Lock mode.
- Fast Lock mode can be fooled by a file that is kept under version control software; therefore buffer fontification may occur even when a cache file exists for the file.
- Fast Lock mode only works with a buffer visiting a file; Lazy Lock mode works with any buffer.
- Fast Lock mode generates cache files; Lazy Lock mode does not.

The variable `font-lock-support-mode` specifies which of these support modes to use; for example, to specify that Fast Lock mode is used for C/C++ modes, and Lazy Lock mode otherwise, set the variable like this:

    (setq font-lock-support-mode
          '((c-mode . fast-lock-mode) (c++-mode . fast-lock-mode)
            (t . lazy-lock-mode)))

Go to the first, previous, next, last section, table of contents.