Mercurial > emacs
comparison lispref/modes.texi @ 50693:17c60796aa6a
(font-lock-syntactic-keywords): Fix/expand description.
author | Dave Love <fx@gnu.org> |
---|---|
date | Thu, 24 Apr 2003 16:16:56 +0000 |
parents | 23a1cea22d13 |
children | 59fa0bb3f282 |
comparison
equal
deleted
inserted
replaced
50692:bc1fc97effe0 | 50693:17c60796aa6a |
---|---|
1 @c -*-texinfo-*- | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | 2 @c This is part of the GNU Emacs Lisp Reference Manual. |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 | 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2003 |
4 @c Free Software Foundation, Inc. | 4 @c Free Software Foundation, Inc. |
5 @c See the file elisp.texi for copying conditions. | 5 @c See the file elisp.texi for copying conditions. |
6 @setfilename ../info/modes | 6 @setfilename ../info/modes |
7 @node Modes, Documentation, Keymaps, Top | 7 @node Modes, Documentation, Keymaps, Top |
8 @chapter Major and Minor Modes | 8 @chapter Major and Minor Modes |
2176 Font Lock mode can be used to update @code{syntax-table} properties | 2176 Font Lock mode can be used to update @code{syntax-table} properties |
2177 automatically. This is useful in languages for which a single syntax | 2177 automatically. This is useful in languages for which a single syntax |
2178 table by itself is not sufficient. | 2178 table by itself is not sufficient. |
2179 | 2179 |
2180 @defvar font-lock-syntactic-keywords | 2180 @defvar font-lock-syntactic-keywords |
2181 This variable enables and controls syntactic Font Lock. Its value | 2181 This variable enables and controls syntactic Font Lock. It is |
2182 should be a list of elements of this form: | 2182 normally set via @code{font-lock-defaults}. Its value should be a |
2183 list of elements of this form: | |
2183 | 2184 |
2184 @example | 2185 @example |
2185 (@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) | 2186 (@var{matcher} @var{subexp} @var{syntax} @var{override} @var{laxmatch}) |
2186 @end example | 2187 @end example |
2187 | 2188 |
2191 @example | 2192 @example |
2192 (@var{matcher} @var{subexp} @var{facename} @var{override} @var{laxmatch}) | 2193 (@var{matcher} @var{subexp} @var{facename} @var{override} @var{laxmatch}) |
2193 @end example | 2194 @end example |
2194 | 2195 |
2195 However, instead of specifying the value @var{facename} to use for the | 2196 However, instead of specifying the value @var{facename} to use for the |
2196 @code{face} property, it specifies the value @var{syntax} to use for the | 2197 @code{face} property, it specifies the value @var{syntax} to use for |
2197 @code{syntax-table} property. Here, @var{syntax} can be a variable | 2198 the @code{syntax-table} property. Here, @var{syntax} can be a string |
2198 whose value is a syntax table, a syntax entry of the form | 2199 (as taken by @code{modify-syntax-entry}), a syntax table, a cons cell |
2199 @code{(@var{syntax-code} . @var{matching-char})}, or an expression whose | 2200 (as returned by @code{string-to-syntax}), or an expression whose value |
2200 value is one of those two types. | 2201 is one of those two types. @var{override} cannot be @code{prepend} or |
2202 @code{append}. | |
2203 | |
2204 For example, an element of the form: | |
2205 | |
2206 @example | |
2207 ("\\$\\(#\\)" 1 ".") | |
2208 @end example | |
2209 | |
2210 highlights syntactically a hash character when following a dollar | |
2211 character, with a SYNTAX of @code{"."} (meaning punctuation syntax). | |
2212 Assuming that the buffer syntax table specifies hash characters to | |
2213 have comment start syntax, the element will only highlight hash | |
2214 characters that do not follow dollar characters as comments | |
2215 syntactically. | |
2216 | |
2217 An element of the form: | |
2218 | |
2219 @example | |
2220 ("\\('\\).\\('\\)" | |
2221 (1 "\"") | |
2222 (2 "\"")) | |
2223 @end example | |
2224 | |
2225 highlights syntactically both single quotes which surround a single | |
2226 character, with a SYNTAX of @code{"\""} (meaning string quote syntax). | |
2227 Assuming that the buffer syntax table does not specify single quotes | |
2228 to have quote syntax, the element will only highlight single quotes of | |
2229 the form @samp{'@var{c}'} as strings syntactically. Other forms, such | |
2230 as @samp{foo'bar} or @samp{'fubar'}, will not be highlighted as | |
2231 strings. | |
2232 | |
2201 @end defvar | 2233 @end defvar |
2202 | 2234 |
2203 @node Hooks | 2235 @node Hooks |
2204 @section Hooks | 2236 @section Hooks |
2205 @cindex hooks | 2237 @cindex hooks |