Font Lock Basics
----------------
There are several variables that control how Font Lock mode
highlights text. But major modes should not set any of these variables
directly. Instead, they should set `font-lock-defaults' as a
buffer-local variable. The value assigned to this variable is used, if
and when Font Lock mode is enabled, to set all the other variables.
- Variable: font-lock-defaults
This variable is set by major modes, as a buffer-local variable, to
specify how to fontify text in that mode. The value should look
like this:
(KEYWORDS KEYWORDS-ONLY CASE-FOLD
SYNTAX-ALIST SYNTAX-BEGIN OTHER-VARS...)
The first element, KEYWORDS, indirectly specifies the value of
`font-lock-keywords'. It can be a symbol, a variable whose value
is the list to use for `font-lock-keywords'. It can also be a
list of several such symbols, one for each possible level of
fontification. The first symbol specifies how to do level 1
fontification, the second symbol how to do level 2, and so on.
The second element, KEYWORDS-ONLY, specifies the value of the
variable `font-lock-keywords-only'. If this is non-`nil',
syntactic fontification (of strings and comments) is not performed.
The third element, CASE-FOLD, specifies the value of
`font-lock-case-fold-search'. If it is non-`nil', Font Lock mode
ignores case when searching as directed by `font-lock-keywords'.
If the fourth element, SYNTAX-ALIST, is non-`nil', it should be a
list of cons cells of the form `(CHAR-OR-STRING . STRING)'. These
are used to set up a syntax table for fontification (Note:Syntax
Table Functions). The resulting syntax table is stored in
`font-lock-syntax-table'.
The fifth element, SYNTAX-BEGIN, specifies the value of
`font-lock-beginning-of-syntax-function' (see below).
All the remaining elements (if any) are collectively called
OTHER-VARS. Each of these elements should have the form
`(VARIABLE . VALUE)'--which means, make VARIABLE buffer-local and
then set it to VALUE. You can use these OTHER-VARS to set other
variables that affect fontification, aside from those you can
control with the first five elements.