comparison lispref/modes.texi @ 61678:3c8535295b32

(Search-based Fontification): Explain that facespec is an expression to be evaluated.
author Richard M. Stallman <rms@gnu.org>
date Tue, 19 Apr 2005 21:06:00 +0000
parents d719a3a92aa5
children 7f8f03acf7fe e1fbb019c538
comparison
equal deleted inserted replaced
61677:5d556f24030d 61678:3c8535295b32
2161 If you use @code{regexp-opt} to produce the regular expression 2161 If you use @code{regexp-opt} to produce the regular expression
2162 @var{matcher}, then you can use @code{regexp-opt-depth} (@pxref{Regexp 2162 @var{matcher}, then you can use @code{regexp-opt-depth} (@pxref{Regexp
2163 Functions}) to calculate the value for @var{subexp}. 2163 Functions}) to calculate the value for @var{subexp}.
2164 2164
2165 @item (@var{matcher} . @var{facespec}) 2165 @item (@var{matcher} . @var{facespec})
2166 In this kind of element, @var{facespec} is an object which specifies 2166 In this kind of element, @var{facespec} is an expression whose value
2167 the face variable to use for highlighting. In the simplest case, it 2167 specifies the face to use for highlighting. In the simplest case,
2168 is a Lisp variable (a symbol), whose value should be a face name. 2168 @var{facespec} is a Lisp variable (a symbol) whose value is a face
2169 name.
2169 2170
2170 @example 2171 @example
2171 ;; @r{Highlight occurrences of @samp{fubar},} 2172 ;; @r{Highlight occurrences of @samp{fubar},}
2172 ;; @r{using the face which is the value of @code{fubar-face}.} 2173 ;; @r{using the face which is the value of @code{fubar-face}.}
2173 ("fubar" . fubar-face) 2174 ("fubar" . fubar-face)
2174 @end example 2175 @end example
2175 2176
2176 However, @var{facespec} can also be a list of the form: 2177 However, @var{facespec} can also evaluate to a list of this form:
2177 2178
2178 @example 2179 @example
2179 (face @var{face} @var{prop1} @var{val1} @var{prop2} @var{val2}@dots{}) 2180 (face @var{face} @var{prop1} @var{val1} @var{prop2} @var{val2}@dots{})
2180 @end example 2181 @end example
2181 2182
2183 @noindent
2182 to specify the face @var{face} and various additional text properties 2184 to specify the face @var{face} and various additional text properties
2183 to put on the text that matches. If you do this, be sure to add the 2185 to put on the text that matches. If you do this, be sure to add the
2184 other text property names that you set in this way to the value of 2186 other text property names that you set in this way to the value of
2185 @code{font-lock-extra-managed-props} so that the properties will also 2187 @code{font-lock-extra-managed-props} so that the properties will also
2186 be cleared out when they are no longer appropriate. Alternatively, 2188 be cleared out when they are no longer appropriate. Alternatively,
2196 (@var{subexp} @var{facespec} [[@var{override} [@var{laxmatch}]]) 2198 (@var{subexp} @var{facespec} [[@var{override} [@var{laxmatch}]])
2197 @end example 2199 @end example
2198 2200
2199 The @sc{car}, @var{subexp}, is an integer specifying which subexpression 2201 The @sc{car}, @var{subexp}, is an integer specifying which subexpression
2200 of the match to fontify (0 means the entire matching text). The second 2202 of the match to fontify (0 means the entire matching text). The second
2201 subelement, @var{facespec}, specifies the face, as described above. 2203 subelement, @var{facespec}, is an expression whose value specifies the
2204 face, as described above.
2202 2205
2203 The last two values in @var{subexp-highlighter}, @var{override} and 2206 The last two values in @var{subexp-highlighter}, @var{override} and
2204 @var{laxmatch}, are optional flags. If @var{override} is @code{t}, 2207 @var{laxmatch}, are optional flags. If @var{override} is @code{t},
2205 this element can override existing fontification made by previous 2208 this element can override existing fontification made by previous
2206 elements of @code{font-lock-keywords}. If it is @code{keep}, then 2209 elements of @code{font-lock-keywords}. If it is @code{keep}, then