1134 |
@table @code |
@table @code |
1135 |
@item :group @var{group} |
@item :group @var{group} |
1136 |
Custom group name to use in all generated @code{defcustom} forms. |
Custom group name to use in all generated @code{defcustom} forms. |
1137 |
Defaults to @var{mode} without the possible trailing @samp{-mode}. Be |
Defaults to @var{mode} without the possible trailing @samp{-mode}. |
1138 |
aware that this default may not be a valid customization group defined |
@strong{Warning:} don't use this default group name unless you have |
1139 |
with @code{defgroup}. Please make sure it is. |
written a @code{defgroup} to define that group properly. @xref{Group |
1140 |
|
Definitions}. |
1141 |
|
|
1142 |
@item :global @var{global} |
@item :global @var{global} |
1143 |
If non-@code{nil} specifies that the minor mode should be global. |
If non-@code{nil} specifies that the minor mode should be global. |
2026 |
which contexts. This section explains how to customize Font Lock for a |
which contexts. This section explains how to customize Font Lock for a |
2027 |
particular major mode. |
particular major mode. |
2028 |
|
|
2029 |
Font Lock mode finds text to highlight in two ways: through syntactic |
Font Lock mode finds text to highlight in two ways: through |
2030 |
parsing based on the syntax table, and through searching (usually for |
syntactic parsing based on the syntax table, and through searching |
2031 |
regular expressions). Syntactic fontification happens first; it finds |
(usually for regular expressions). Syntactic fontification happens |
2032 |
comments and string constants, and highlights them using |
first; it finds comments and string constants and highlights them. |
2033 |
@code{font-lock-comment-face} and @code{font-lock-string-face} |
Search-based fontification happens second. |
|
(@pxref{Faces for Font Lock}). Search-based fontification follows. |
|
2034 |
|
|
2035 |
@menu |
@menu |
2036 |
* Font Lock Basics:: Overview of customizing Font Lock. |
* Font Lock Basics:: Overview of customizing Font Lock. |
2041 |
* Precalculated Fontification:: How Lisp programs that produce the buffer |
* Precalculated Fontification:: How Lisp programs that produce the buffer |
2042 |
contents can also specify how to fontify it. |
contents can also specify how to fontify it. |
2043 |
* Faces for Font Lock:: Special faces specifically for Font Lock. |
* Faces for Font Lock:: Special faces specifically for Font Lock. |
2044 |
* Syntactic Font Lock:: Defining character syntax based on context |
* Syntactic Font Lock:: Fontification based on syntax tables. |
2045 |
|
* Setting Syntax Properties:: Defining character syntax based on context |
2046 |
using the Font Lock mechanism. |
using the Font Lock mechanism. |
2047 |
@end menu |
@end menu |
2048 |
|
|
2057 |
|
|
2058 |
@defvar font-lock-defaults |
@defvar font-lock-defaults |
2059 |
This variable is set by major modes, as a buffer-local variable, to |
This variable is set by major modes, as a buffer-local variable, to |
2060 |
specify how to fontify text in that mode. The value should look like |
specify how to fontify text in that mode. It automatically becomes |
2061 |
this: |
buffer-local when you set it. The value should look like this: |
2062 |
|
|
2063 |
@example |
@example |
2064 |
(@var{keywords} @var{keywords-only} @var{case-fold} |
(@var{keywords} [@var{keywords-only} [@var{case-fold} |
2065 |
@var{syntax-alist} @var{syntax-begin} @var{other-vars}@dots{}) |
[@var{syntax-alist} [@var{syntax-begin} @var{other-vars}@dots{}]]]]) |
2066 |
@end example |
@end example |
2067 |
|
|
2068 |
The first element, @var{keywords}, indirectly specifies the value of |
The first element, @var{keywords}, indirectly specifies the value of |
2069 |
@code{font-lock-keywords}. It can be a symbol, a variable whose value |
@code{font-lock-keywords} which directs search-based fontification. |
2070 |
is the list to use for @code{font-lock-keywords}. It can also be a list of |
It can be a symbol, a variable or a function whose value is the list |
2071 |
several such symbols, one for each possible level of fontification. The |
to use for @code{font-lock-keywords}. It can also be a list of |
2072 |
first symbol specifies how to do level 1 fontification, the second |
several such symbols, one for each possible level of fontification. |
2073 |
symbol how to do level 2, and so on. |
The first symbol specifies how to do level 1 fontification, the second |
2074 |
|
symbol how to do level 2, and so on. @xref{Levels of Font Lock}. |
2075 |
|
|
2076 |
The second element, @var{keywords-only}, specifies the value of the |
The second element, @var{keywords-only}, specifies the value of the |
2077 |
variable @code{font-lock-keywords-only}. If this is non-@code{nil}, |
variable @code{font-lock-keywords-only}. If this is non-@code{nil}, |
2078 |
syntactic fontification (of strings and comments) is not performed. |
syntactic fontification (of strings and comments) is not performed. |
2079 |
|
@xref{Syntactic Font Lock}. |
2080 |
|
|
2081 |
The third element, @var{case-fold}, specifies the value of |
The third element, @var{case-fold}, specifies the value of |
2082 |
@code{font-lock-keywords-case-fold-search}. If it is non-@code{nil}, Font Lock |
@code{font-lock-keywords-case-fold-search}. If it is non-@code{nil}, |
2083 |
mode ignores case when searching as directed by |
Font Lock mode ignores case when searching as directed by |
2084 |
@code{font-lock-keywords}. |
@code{font-lock-keywords}. |
2085 |
|
|
2086 |
If the fourth element, @var{syntax-alist}, is non-@code{nil}, it should be |
If the fourth element, @var{syntax-alist}, is non-@code{nil}, it |
2087 |
a list of cons cells of the form @code{(@var{char-or-string} |
should be a list of cons cells of the form @code{(@var{char-or-string} |
2088 |
. @var{string})}. These are used to set up a syntax table for |
. @var{string})}. These are used to set up a syntax table for |
2089 |
fontification (@pxref{Syntax Table Functions}). The resulting syntax |
syntactic fontification (@pxref{Syntax Table Functions}). The |
2090 |
table is stored in @code{font-lock-syntax-table}. |
resulting syntax table is stored in @code{font-lock-syntax-table}. |
2091 |
|
|
2092 |
The fifth element, @var{syntax-begin}, specifies the value of |
The fifth element, @var{syntax-begin}, specifies the value of |
2093 |
@code{font-lock-beginning-of-syntax-function} (see below). |
@code{font-lock-beginning-of-syntax-function}. |
2094 |
|
|
2095 |
All the remaining elements (if any) are collectively called |
All the remaining elements (if any) are collectively called |
2096 |
@var{other-vars}. Each of these elements should have the form |
@var{other-vars}. Each of these elements should have the form |
2097 |
@code{(@var{variable} . @var{value})}---which means, make @var{variable} |
@code{(@var{variable} . @var{value})}---which means, make |
2098 |
buffer-local and then set it to @var{value}. You can use these |
@var{variable} buffer-local and then set it to @var{value}. You can |
2099 |
@var{other-vars} to set other variables that affect fontification, |
use these @var{other-vars} to set other variables that affect |
2100 |
aside from those you can control with the first five elements. |
fontification, aside from those you can control with the first five |
2101 |
|
elements. @xref{Other Font Lock Variables}. |
2102 |
@end defvar |
@end defvar |
2103 |
|
|
2104 |
@node Search-based Fontification |
@node Search-based Fontification |
2106 |
|
|
2107 |
The most important variable for customizing Font Lock mode is |
The most important variable for customizing Font Lock mode is |
2108 |
@code{font-lock-keywords}. It specifies the search criteria for |
@code{font-lock-keywords}. It specifies the search criteria for |
2109 |
search-based fontification. |
search-based fontification. You should specify the value of this |
2110 |
|
variable with @var{keywords} in @code{font-lock-defaults}. |
2111 |
|
|
2112 |
@defvar font-lock-keywords |
@defvar font-lock-keywords |
2113 |
This variable's value is a list of the keywords to highlight. Be |
This variable's value is a list of the keywords to highlight. Be |
2197 |
@code{font-lock-extra-managed-props} so that the properties will also |
@code{font-lock-extra-managed-props} so that the properties will also |
2198 |
be cleared out when they are no longer appropriate. Alternatively, |
be cleared out when they are no longer appropriate. Alternatively, |
2199 |
you can set the variable @code{font-lock-unfontify-region-function} to |
you can set the variable @code{font-lock-unfontify-region-function} to |
2200 |
a function that clears these properties. |
a function that clears these properties. @xref{Other Font Lock |
2201 |
|
Variables}. |
2202 |
|
|
2203 |
@item (@var{matcher} . @var{subexp-highlighter}) |
@item (@var{matcher} . @var{subexp-highlighter}) |
2204 |
In this kind of element, @var{subexp-highlighter} is a list |
In this kind of element, @var{subexp-highlighter} is a list |
2318 |
Its value should have one of the forms described in this table. |
Its value should have one of the forms described in this table. |
2319 |
@end table |
@end table |
2320 |
|
|
2321 |
|
@vindex font-lock-multiline |
2322 |
@strong{Warning:} Do not design an element of @code{font-lock-keywords} |
@strong{Warning:} Do not design an element of @code{font-lock-keywords} |
2323 |
to match text which spans lines; this does not work reliably. While |
to match text which spans lines; this does not work reliably. While |
2324 |
@code{font-lock-fontify-buffer} handles multi-line patterns correctly, |
@code{font-lock-fontify-buffer} handles multi-line patterns correctly, |
2329 |
setting @code{font-lock-multiline} to @code{t}. But it still will not |
setting @code{font-lock-multiline} to @code{t}. But it still will not |
2330 |
work in all cases. |
work in all cases. |
2331 |
|
|
2332 |
@node Other Font Lock Variables |
You can use @var{case-fold} in @code{font-lock-defaults} to specify |
2333 |
@subsection Other Font Lock Variables |
the value of @code{font-lock-keywords-case-fold-search} which says |
2334 |
|
whether search-based fontification should be case-insensitive. |
|
This section describes additional variables that a major mode |
|
|
can set by means of @code{font-lock-defaults}. |
|
|
|
|
|
@defvar font-lock-keywords-only |
|
|
Non-@code{nil} means Font Lock should not fontify comments or strings |
|
|
syntactically; it should only fontify based on |
|
|
@code{font-lock-keywords}. |
|
|
@end defvar |
|
|
|
|
|
@ignore |
|
|
Other variables include those for buffer-specialized fontification functions, |
|
|
`font-lock-fontify-buffer-function', `font-lock-unfontify-buffer-function', |
|
|
`font-lock-fontify-region-function', `font-lock-unfontify-region-function', |
|
|
`font-lock-inhibit-thing-lock' and `font-lock-maximum-size'. |
|
|
@end ignore |
|
2335 |
|
|
2336 |
@defvar font-lock-keywords-case-fold-search |
@defvar font-lock-keywords-case-fold-search |
2337 |
Non-@code{nil} means that regular expression matching for the sake of |
Non-@code{nil} means that regular expression matching for the sake of |
2338 |
@code{font-lock-keywords} should be case-insensitive. |
@code{font-lock-keywords} should be case-insensitive. |
2339 |
@end defvar |
@end defvar |
2340 |
|
|
2341 |
@defvar font-lock-syntax-table |
You can use @code{font-lock-add-keywords} to add additional |
2342 |
This variable specifies the syntax table to use for fontification of |
search-based fontification rules to a major mode, and |
2343 |
comments and strings. |
@code{font-lock-remove-keywords} to removes rules. |
2344 |
@end defvar |
|
2345 |
|
@defun font-lock-add-keywords mode keywords &optional append |
2346 |
|
This function adds highlighting @var{keywords} for @var{mode}. The |
2347 |
|
argument @var{keywords} should be a list with the same format as the |
2348 |
|
variable @code{font-lock-keywords}. @var{mode} should be a symbol, |
2349 |
|
the major mode command name, such as @code{c-mode}. When Font Lock |
2350 |
|
mode is turned on in @var{mode}, it adds @var{keywords} to |
2351 |
|
@code{font-lock-keywords}. @var{mode} can also be @code{nil}; the |
2352 |
|
highlighting @var{keywords} are immediately added to |
2353 |
|
@code{font-lock-keywords} in the current buffer in that case. |
2354 |
|
|
2355 |
|
By default, @var{keywords} are added at the beginning of |
2356 |
|
@code{font-lock-keywords}. If the optional argument @var{append} is |
2357 |
|
@code{set}, they are used to replace the value of |
2358 |
|
@code{font-lock-keywords}. If @var{append} is any other |
2359 |
|
non-@code{nil} value, they are added at the end of |
2360 |
|
@code{font-lock-keywords}. |
2361 |
|
|
2362 |
@defvar font-lock-beginning-of-syntax-function |
For example: |
|
If this variable is non-@code{nil}, it should be a function to move |
|
|
point back to a position that is syntactically at ``top level'' and |
|
|
outside of strings or comments. Font Lock uses this when necessary |
|
|
to get the right results for syntactic fontification. |
|
2363 |
|
|
2364 |
This function is called with no arguments. It should leave point at the |
@smallexample |
2365 |
beginning of any enclosing syntactic block. Typical values are |
(font-lock-add-keywords 'c-mode |
2366 |
@code{beginning-of-line} (i.e., the start of the line is known to be |
'(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) |
2367 |
outside a syntactic block), or @code{beginning-of-defun} for programming |
("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face))) |
2368 |
modes or @code{backward-paragraph} for textual modes (i.e., the |
@end smallexample |
|
mode-dependent function is known to move outside a syntactic block). |
|
2369 |
|
|
2370 |
If the value is @code{nil}, the beginning of the buffer is used as a |
adds two fontification patterns for C mode: one to fontify the word |
2371 |
position outside of a syntactic block. This cannot be wrong, but it can |
@samp{FIXME}, even in comments, and another to fontify the words |
2372 |
be slow. |
@samp{and}, @samp{or} and @samp{not} as keywords. |
2373 |
@end defvar |
|
2374 |
|
Some modes have specialized support for additional patterns. See the |
2375 |
|
variables @code{c-font-lock-extra-types}, |
2376 |
|
@code{c++-font-lock-extra-types}, @code{objc-font-lock-extra-types} |
2377 |
|
and @code{java-font-lock-extra-types}, for example. |
2378 |
|
@end defun |
2379 |
|
|
2380 |
|
@defun font-lock-remove-keywords mode keywords |
2381 |
|
This function removes highlighting @var{keywords} for @var{mode}. As |
2382 |
|
in @code{font-lock-add-keywords}, @var{mode} should be a major mode |
2383 |
|
command name or @code{nil}. If @code{nil}, the highlighting |
2384 |
|
@var{keywords} are immediately removed in the current buffer. |
2385 |
|
@end defun |
2386 |
|
|
2387 |
|
@strong{Warning:} Only use a non-@code{nil} @var{mode} argument when |
2388 |
|
you use @code{font-lock-add-keywords} or |
2389 |
|
@code{font-lock-remove-keywords} in your @file{.emacs} file. When you |
2390 |
|
use these functions from a Lisp program (such as a minor mode), we |
2391 |
|
recommend that you use @code{nil} for @var{mode} (and place the call |
2392 |
|
on a hook) to avoid subtle problems due to the details of the |
2393 |
|
implementation. |
2394 |
|
|
2395 |
|
@node Other Font Lock Variables |
2396 |
|
@subsection Other Font Lock Variables |
2397 |
|
|
2398 |
|
This section describes additional variables that a major mode can |
2399 |
|
set by means of @var{other-vars} in @code{font-lock-defaults} |
2400 |
|
(@pxref{Font Lock Basics}). |
2401 |
|
|
2402 |
@defvar font-lock-mark-block-function |
@defvar font-lock-mark-block-function |
2403 |
If this variable is non-@code{nil}, it should be a function that is |
If this variable is non-@code{nil}, it should be a function that is |
2413 |
@end defvar |
@end defvar |
2414 |
|
|
2415 |
@defvar font-lock-extra-managed-props |
@defvar font-lock-extra-managed-props |
2416 |
Additional properties (other than @code{font-lock-face}) that are |
This variable specifies additional properties (other than |
2417 |
being managed by Font Lock mode. Font Lock mode normally manages only |
@code{font-lock-face}) that are being managed by Font Lock mode. It |
2418 |
the @code{font-lock-face} property; if you want it to manage others as |
is used by @code{font-lock-default-unfontify-region}, which normally |
2419 |
well, you must specify them in a @var{facespec} in |
only manages the @code{font-lock-face} property. If you want Font |
2420 |
@code{font-lock-keywords} as well as adding them to this list. |
Lock to manage other properties as well, you must specify them in a |
2421 |
@end defvar |
@var{facespec} in @code{font-lock-keywords} as well as add them to |
2422 |
|
this list. @xref{Search-based Fontification}. |
2423 |
@defvar font-lock-syntactic-face-function |
@end defvar |
2424 |
A function to determine which face to use for a given syntactic |
|
2425 |
element (a string or a comment). The function is called with one |
@defvar font-lock-fontify-buffer-function |
2426 |
argument, the parse state at point returned by |
Function to use for fontifying the buffer. The default value is |
2427 |
@code{parse-partial-sexp}, and should return a face. The default |
@code{font-lock-default-fontify-buffer}. |
2428 |
value returns @code{font-lock-comment-face} for comments and |
@end defvar |
2429 |
@code{font-lock-string-face} for strings. |
|
2430 |
|
@defvar font-lock-unfontify-buffer-function |
2431 |
This can be used to highlighting different kinds of strings or |
Function to use for unfontifying the buffer. This is used when |
2432 |
comments differently. It is also sometimes abused together with |
turning off Font Lock mode. The default value is |
2433 |
@code{font-lock-syntactic-keywords} to highlight elements that span |
@code{font-lock-default-unfontify-buffer}. |
2434 |
multiple lines, but this is too obscure to document in this manual. |
@end defvar |
2435 |
|
|
2436 |
|
@defvar font-lock-fontify-region-function |
2437 |
|
Function to use for fontifying a region. It should take two |
2438 |
|
arguments, the beginning and end of the region, and an optional third |
2439 |
|
argument @var{verbose}. If @var{verbose} is non-@code{nil}, the |
2440 |
|
function should print status messages. The default value is |
2441 |
|
@code{font-lock-default-fontify-region}. |
2442 |
|
@end defvar |
2443 |
|
|
2444 |
|
@defvar font-lock-unfontify-region-function |
2445 |
|
Function to use for unfontifying a region. It should take two |
2446 |
|
arguments, the beginning and end of the region. The default value is |
2447 |
|
@code{font-lock-default-unfontify-region}. |
2448 |
@end defvar |
@end defvar |
2449 |
|
|
2450 |
@defvar font-lock-lines-before |
@defvar font-lock-lines-before |
2455 |
multi-line patterns. |
multi-line patterns. |
2456 |
@end defvar |
@end defvar |
2457 |
|
|
2458 |
|
@ignore |
2459 |
|
@defvar font-lock-inhibit-thing-lock |
2460 |
|
List of Font Lock mode related modes that should not be turned on. |
2461 |
|
Currently, valid mode names are @code{fast-lock-mode}, |
2462 |
|
@code{jit-lock-mode} and @code{lazy-lock-mode}. |
2463 |
|
@end defvar |
2464 |
|
@end ignore |
2465 |
|
|
2466 |
@node Levels of Font Lock |
@node Levels of Font Lock |
2467 |
@subsection Levels of Font Lock |
@subsection Levels of Font Lock |
2468 |
|
|
2507 |
@code{list-buffers} and @code{occur}. |
@code{list-buffers} and @code{occur}. |
2508 |
|
|
2509 |
If your mode does not use any of the other machinery of Font Lock |
If your mode does not use any of the other machinery of Font Lock |
2510 |
(i.e. it only uses the @code{font-lock-face} property), you can tell |
(i.e. it only uses the @code{font-lock-face} property), it should not |
2511 |
Emacs not to load all of font-lock.el (unless it's already loaded), by |
set the variable @code{font-lock-defaults}. That way, it will not |
2512 |
setting the variable @code{font-lock-core-only} to non-@code{nil} as |
cause loading of the @file{font-lock} library. |
|
part of the @code{font-lock-defaults} settings. Here is the canonical |
|
|
way to do this: |
|
|
|
|
|
@example |
|
|
(set (make-local-variable 'font-lock-defaults) |
|
|
'(nil t nil nil nil (font-lock-core-only . t))) |
|
|
@end example |
|
2513 |
|
|
2514 |
@node Faces for Font Lock |
@node Faces for Font Lock |
2515 |
@subsection Faces for Font Lock |
@subsection Faces for Font Lock |
2527 |
@vindex font-lock-comment-face |
@vindex font-lock-comment-face |
2528 |
Used (typically) for comments. |
Used (typically) for comments. |
2529 |
|
|
2530 |
|
@item font-lock-comment-delimiter-face |
2531 |
|
@vindex font-lock-comment-delimiter-face |
2532 |
|
Used (typically) for comments delimiters. |
2533 |
|
|
2534 |
@item font-lock-doc-face |
@item font-lock-doc-face |
2535 |
@vindex font-lock-doc-face |
@vindex font-lock-doc-face |
2536 |
Used (typically) for documentation strings in the code. |
Used (typically) for documentation strings in the code. |
2582 |
@node Syntactic Font Lock |
@node Syntactic Font Lock |
2583 |
@subsection Syntactic Font Lock |
@subsection Syntactic Font Lock |
2584 |
|
|
2585 |
|
Syntactic fontification uses the syntax table to find comments and |
2586 |
|
string constants (@pxref{Syntax Tables}). It highlights them using |
2587 |
|
@code{font-lock-comment-face} and @code{font-lock-string-face} |
2588 |
|
(@pxref{Faces for Font Lock}). There are several variables that |
2589 |
|
affect syntactic fontification; you should set them by means of |
2590 |
|
@code{font-lock-defaults} (@pxref{Font Lock Basics}). |
2591 |
|
|
2592 |
|
@defvar font-lock-keywords-only |
2593 |
|
Non-@code{nil} means Font Lock should not do syntactic fontification; |
2594 |
|
it should only fontify based on @code{font-lock-keywords}. The normal |
2595 |
|
way for a mode to set this variable to @code{t} is with |
2596 |
|
@var{keywords-only} in @code{font-lock-defaults}. |
2597 |
|
@end defvar |
2598 |
|
|
2599 |
|
@defvar font-lock-syntax-table |
2600 |
|
This variable holds the syntax table to use for fontification of |
2601 |
|
comments and strings. Specify it using @var{syntax-alist} in |
2602 |
|
@code{font-lock-defaults}. |
2603 |
|
@end defvar |
2604 |
|
|
2605 |
|
@c ??? |
2606 |
|
@c The docstring says that font-lock-syntax-table is semi-obsolete. |
2607 |
|
@c How the alternative should be used is not clear. --lute |
2608 |
|
|
2609 |
|
@defvar font-lock-beginning-of-syntax-function |
2610 |
|
If this variable is non-@code{nil}, it should be a function to move |
2611 |
|
point back to a position that is syntactically at ``top level'' and |
2612 |
|
outside of strings or comments. Font Lock uses this when necessary |
2613 |
|
to get the right results for syntactic fontification. |
2614 |
|
|
2615 |
|
This function is called with no arguments. It should leave point at |
2616 |
|
the beginning of any enclosing syntactic block. Typical values are |
2617 |
|
@code{beginning-of-line} (used when the start of the line is known to |
2618 |
|
be outside a syntactic block), or @code{beginning-of-defun} for |
2619 |
|
programming modes, or @code{backward-paragraph} for textual modes. |
2620 |
|
|
2621 |
|
If the value is @code{nil}, the beginning of the buffer is used as a |
2622 |
|
position outside of a syntactic block. This cannot be wrong, but it |
2623 |
|
can be slow. |
2624 |
|
|
2625 |
|
Specify this variable using @var{syntax-begin} in |
2626 |
|
@code{font-lock-defaults}. |
2627 |
|
@end defvar |
2628 |
|
|
2629 |
|
@defvar font-lock-syntactic-face-function |
2630 |
|
A function to determine which face to use for a given syntactic |
2631 |
|
element (a string or a comment). The function is called with one |
2632 |
|
argument, the parse state at point returned by |
2633 |
|
@code{parse-partial-sexp}, and should return a face. The default |
2634 |
|
value returns @code{font-lock-comment-face} for comments and |
2635 |
|
@code{font-lock-string-face} for strings. |
2636 |
|
|
2637 |
|
This can be used to highlighting different kinds of strings or |
2638 |
|
comments differently. It is also sometimes abused together with |
2639 |
|
@code{font-lock-syntactic-keywords} to highlight elements that span |
2640 |
|
multiple lines, but this is too obscure to document in this manual. |
2641 |
|
|
2642 |
|
Specify this variable using @var{other-vars} in |
2643 |
|
@code{font-lock-defaults}. |
2644 |
|
@end defvar |
2645 |
|
|
2646 |
|
@node Setting Syntax Properties |
2647 |
|
@subsection Setting Syntax Properties |
2648 |
|
|
2649 |
Font Lock mode can be used to update @code{syntax-table} properties |
Font Lock mode can be used to update @code{syntax-table} properties |
2650 |
automatically. This is useful in languages for which a single syntax |
automatically (@pxref{Syntax Properties}). This is useful in |
2651 |
table by itself is not sufficient. |
languages for which a single syntax table by itself is not sufficient. |
2652 |
|
|
2653 |
@defvar font-lock-syntactic-keywords |
@defvar font-lock-syntactic-keywords |
2654 |
This variable enables and controls syntactic Font Lock. It is |
This variable enables and controls updating @code{syntax-table} |
2655 |
normally set via @code{font-lock-defaults}. Its value should be a |
properties by Font Lock. Its value should be a list of elements of |
2656 |
list of elements of this form: |
this form: |
2657 |
|
|
2658 |
@example |
@example |
2659 |
(@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) |
(@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) |
2663 |
sort of element of @code{font-lock-keywords}, |
sort of element of @code{font-lock-keywords}, |
2664 |
|
|
2665 |
@example |
@example |
2666 |
(@var{matcher} @var{subexp} @var{facename} @var{override} @var{laxmatch}) |
(@var{matcher} @var{subexp} @var{facespec} @var{override} @var{laxmatch}) |
2667 |
@end example |
@end example |
2668 |
|
|
2669 |
However, instead of specifying the value @var{facename} to use for the |
However, instead of specifying the value @var{facespec} to use for the |
2670 |
@code{face} property, it specifies the value @var{syntax} to use for |
@code{face} property, it specifies the value @var{syntax} to use for |
2671 |
the @code{syntax-table} property. Here, @var{syntax} can be a string |
the @code{syntax-table} property. Here, @var{syntax} can be a string |
2672 |
(as taken by @code{modify-syntax-entry}), a syntax table, a cons cell |
(as taken by @code{modify-syntax-entry}), a syntax table, a cons cell |
2703 |
as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as |
as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as |
2704 |
strings. |
strings. |
2705 |
|
|
2706 |
|
Major modes normally set this variable with @var{other-vars} in |
2707 |
|
@code{font-lock-defaults}. |
2708 |
@end defvar |
@end defvar |
2709 |
|
|
2710 |
@node Desktop Save Mode |
@node Desktop Save Mode |