aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorKaroly Lorentey2005-04-11 12:40:15 +0000
committerKaroly Lorentey2005-04-11 12:40:15 +0000
commit221d5c8772dc29f854292ec7cb423fce925daecf (patch)
tree5fe05145ce31ffcc9d1a621c027410151e4a2106 /lispref
parent1b9ab2508610fea57aa777956de14ee84d66862f (diff)
parent9552bee8c6e7c5ee16ca60cddebaebdf5d238e05 (diff)
downloademacs-221d5c8772dc29f854292ec7cb423fce925daecf.tar.gz
emacs-221d5c8772dc29f854292ec7cb423fce925daecf.zip
Merged from miles@gnu.org--gnu-2005 (patch 59, 240-245)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-240 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-241 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-242 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-243 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-244 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-245 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-59 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-326
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog7
-rw-r--r--lispref/modes.texi167
2 files changed, 94 insertions, 80 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 1f5c324bdd1..2d3bd39ccca 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,8 @@
12005-04-08 Lute Kamstra <lute@gnu.org>
2
3 * modes.texi (Search-based Fontification): Fix cross references.
4 Use consistent terminology. Document anchored highlighting.
5
12005-04-05 Lute Kamstra <lute@gnu.org> 62005-04-05 Lute Kamstra <lute@gnu.org>
2 7
3 * modes.texi (Defining Minor Modes): Document :group keyword 8 * modes.texi (Defining Minor Modes): Document :group keyword
@@ -2348,7 +2353,7 @@
2348 2353
2349 * files.texi (Changing Files): copy-file allows dir as NEWNAME. 2354 * files.texi (Changing Files): copy-file allows dir as NEWNAME.
2350 (Magic File Names): Specify precedence order of handlers. 2355 (Magic File Names): Specify precedence order of handlers.
2351o 2356
2352 * commands.texi (Command Overview): Emacs server runs pre-command-hook 2357 * commands.texi (Command Overview): Emacs server runs pre-command-hook
2353 and post-command-hook. 2358 and post-command-hook.
2354 (Waiting): New calling convention for sit-for. 2359 (Waiting): New calling convention for sit-for.
diff --git a/lispref/modes.texi b/lispref/modes.texi
index ecbe39dbb31..b43b22275cc 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -1,6 +1,6 @@
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,
4@c 2003, 2004, 2005 Free Software Foundation, Inc. 4@c 2003, 2004, 2005 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
@@ -2111,7 +2111,7 @@ processes the elements of @code{font-lock-keywords} one by one, and for
2111each element, it finds and handles all matches. Ordinarily, once 2111each element, it finds and handles all matches. Ordinarily, once
2112part of the text has been fontified already, this cannot be overridden 2112part of the text has been fontified already, this cannot be overridden
2113by a subsequent match in the same text; but you can specify different 2113by a subsequent match in the same text; but you can specify different
2114behavior using the @var{override} element of a @var{highlighter}. 2114behavior using the @var{override} element of a @var{subexp-highlighter}.
2115 2115
2116 Each element of @code{font-lock-keywords} should have one of these 2116 Each element of @code{font-lock-keywords} should have one of these
2117forms: 2117forms:
@@ -2122,14 +2122,14 @@ Highlight all matches for @var{regexp} using
2122@code{font-lock-keyword-face}. For example, 2122@code{font-lock-keyword-face}. For example,
2123 2123
2124@example 2124@example
2125;; @r{Highlight discrete occurrences of @samp{foo}} 2125;; @r{Highlight occurrences of the word @samp{foo}}
2126;; @r{using @code{font-lock-keyword-face}.} 2126;; @r{using @code{font-lock-keyword-face}.}
2127"\\<foo\\>" 2127"\\<foo\\>"
2128@end example 2128@end example
2129 2129
2130The function @code{regexp-opt} (@pxref{Syntax of Regexps}) is useful for 2130The function @code{regexp-opt} (@pxref{Regexp Functions}) is useful
2131calculating optimal regular expressions to match a number of different 2131for calculating optimal regular expressions to match a number of
2132keywords. 2132different keywords.
2133 2133
2134@item @var{function} 2134@item @var{function}
2135Find text by calling @var{function}, and highlight the matches 2135Find text by calling @var{function}, and highlight the matches
@@ -2146,10 +2146,10 @@ and with point where the previous invocation left it, until
2146@var{function} fails. On failure, @var{function} need not reset point 2146@var{function} fails. On failure, @var{function} need not reset point
2147in any particular way. 2147in any particular way.
2148 2148
2149@item (@var{matcher} . @var{match}) 2149@item (@var{matcher} . @var{subexp})
2150In this kind of element, @var{matcher} is either a regular 2150In this kind of element, @var{matcher} is either a regular
2151expression or a function, as described above. The @sc{cdr}, 2151expression or a function, as described above. The @sc{cdr},
2152@var{match}, specifies which subexpression of @var{matcher} should be 2152@var{subexp}, specifies which subexpression of @var{matcher} should be
2153highlighted (instead of the entire text that @var{matcher} matched). 2153highlighted (instead of the entire text that @var{matcher} matched).
2154 2154
2155@example 2155@example
@@ -2159,8 +2159,8 @@ highlighted (instead of the entire text that @var{matcher} matched).
2159@end example 2159@end example
2160 2160
2161If you use @code{regexp-opt} to produce the regular expression 2161If you use @code{regexp-opt} to produce the regular expression
2162@var{matcher}, then you can use @code{regexp-opt-depth} (@pxref{Syntax 2162@var{matcher}, then you can use @code{regexp-opt-depth} (@pxref{Regexp
2163of Regexps}) to calculate the value for @var{match}. 2163Functions}) to calculate the value for @var{subexp}.
2164 2164
2165@item (@var{matcher} . @var{facespec}) 2165@item (@var{matcher} . @var{facespec})
2166In this kind of element, @var{facespec} is an object which specifies 2166In this kind of element, @var{facespec} is an object which specifies
@@ -2173,37 +2173,39 @@ is a Lisp variable (a symbol), whose value should be a face name.
2173("fubar" . fubar-face) 2173("fubar" . fubar-face)
2174@end example 2174@end example
2175 2175
2176However, @var{facespec} can also be a list of the form 2176However, @var{facespec} can also be a list of the form:
2177 2177
2178@example 2178@example
2179(face @var{face} @var{prop1} @var{val1} @var{prop2} @var{val2}@dots{}) 2179(face @var{face} @var{prop1} @var{val1} @var{prop2} @var{val2}@dots{})
2180@end example 2180@end example
2181 2181
2182to specify various text properties to put on the text that matches. 2182to specify the face @var{face} and various additional text properties
2183If you do this, be sure to add the other text property names that you 2183to put on the text that matches. If you do this, be sure to add the
2184set in this way to the value of @code{font-lock-extra-managed-props} 2184other text property names that you set in this way to the value of
2185so that the properties will also be cleared out when they are no longer 2185@code{font-lock-extra-managed-props} so that the properties will also
2186appropriate. 2186be cleared out when they are no longer appropriate. Alternatively,
2187you can set the variable @code{font-lock-unfontify-region-function} to
2188a function that clears these properties.
2187 2189
2188@item (@var{matcher} . @var{highlighter}) 2190@item (@var{matcher} . @var{subexp-highlighter})
2189In this kind of element, @var{highlighter} is a list 2191In this kind of element, @var{subexp-highlighter} is a list
2190which specifies how to highlight matches found by @var{matcher}. 2192which specifies how to highlight matches found by @var{matcher}.
2191It has the form 2193It has the form:
2192 2194
2193@example 2195@example
2194(@var{subexp} @var{facespec} @var{override} @var{laxmatch}) 2196(@var{subexp} @var{facespec} [[@var{override} [@var{laxmatch}]])
2195@end example 2197@end example
2196 2198
2197The @sc{car}, @var{subexp}, is an integer specifying which subexpression 2199The @sc{car}, @var{subexp}, is an integer specifying which subexpression
2198of the match to fontify (0 means the entire matching text). The second 2200of the match to fontify (0 means the entire matching text). The second
2199subelement, @var{facespec}, specifies the face, as described above. 2201subelement, @var{facespec}, specifies the face, as described above.
2200 2202
2201The last two values in @var{highlighter}, @var{override} and 2203The last two values in @var{subexp-highlighter}, @var{override} and
2202@var{laxmatch}, are flags. If @var{override} is @code{t}, this 2204@var{laxmatch}, are optional flags. If @var{override} is @code{t},
2203element can override existing fontification made by previous elements 2205this element can override existing fontification made by previous
2204of @code{font-lock-keywords}. If it is @code{keep}, then each 2206elements of @code{font-lock-keywords}. If it is @code{keep}, then
2205character is fontified if it has not been fontified already by some 2207each character is fontified if it has not been fontified already by
2206other element. If it is @code{prepend}, the face specified by 2208some other element. If it is @code{prepend}, the face specified by
2207@var{facespec} is added to the beginning of the @code{font-lock-face} 2209@var{facespec} is added to the beginning of the @code{font-lock-face}
2208property. If it is @code{append}, the face is added to the end of the 2210property. If it is @code{append}, the face is added to the end of the
2209@code{font-lock-face} property. 2211@code{font-lock-face} property.
@@ -2219,8 +2221,8 @@ terminates search-based fontification.
2219Here are some examples of elements of this kind, and what they do: 2221Here are some examples of elements of this kind, and what they do:
2220 2222
2221@smallexample 2223@smallexample
2222;; @r{Highlight occurrences of either @samp{foo} or @samp{bar},} 2224;; @r{Highlight occurrences of either @samp{foo} or @samp{bar}, using}
2223;; @r{using @code{foo-bar-face}, even if they have already been highlighted.} 2225;; @r{@code{foo-bar-face}, even if they have already been highlighted.}
2224;; @r{@code{foo-bar-face} should be a variable whose value is a face.} 2226;; @r{@code{foo-bar-face} should be a variable whose value is a face.}
2225("foo\\|bar" 0 foo-bar-face t) 2227("foo\\|bar" 0 foo-bar-face t)
2226 2228
@@ -2230,64 +2232,71 @@ Here are some examples of elements of this kind, and what they do:
2230(fubar-match 1 fubar-face) 2232(fubar-match 1 fubar-face)
2231@end smallexample 2233@end smallexample
2232 2234
2233@item (@var{matcher} @var{highlighters}@dots{}) 2235@item (@var{matcher} . @var{anchored-highlighter})
2234This sort of element specifies several @var{highlighter} lists for a 2236In this kind of element, @var{anchored-highlighter} specifies how to
2235single @var{matcher}. In order for this to be useful, each 2237highlight text that follows a match found by @var{matcher}. So a
2236@var{highlighter} should have a different value of @var{subexp}; that is, 2238match found by @var{matcher} acts as the anchor for further searches
2237each one should apply to a different subexpression of @var{matcher}. 2239specified by @var{anchored-highlighter}. @var{anchored-highlighter}
2240is a list of the following form:
2238 2241
2239@ignore 2242@example
2240@item (@var{matcher} . @var{anchored}) 2243(@var{anchored-matcher} @var{pre-form} @var{post-form}
2241In this kind of element, @var{anchored} acts much like a 2244 @var{subexp-highlighters}@dots{})
2242@var{highlighter}, but it is more complex and can specify multiple 2245@end example
2243successive searches.
2244 2246
2245For highlighting single items, typically only @var{highlighter} is 2247Here, @var{anchored-matcher}, like @var{matcher}, is either a regular
2246required. However, if an item or (typically) items are to be 2248expression or a function. After a match of @var{matcher} is found,
2247highlighted following the instance of another item (the anchor) then 2249point is at the end of the match. Now, Font Lock evaluates the form
2248@var{anchored} may be required. 2250@var{pre-form}. Then it searches for matches of
2251@var{anchored-matcher} and uses @var{subexp-highlighters} to highlight
2252these. A @var{subexp-highlighter} is as described above. Finally,
2253Font Lock evaluates @var{post-form}.
2254
2255The forms @var{pre-form} and @var{post-form} can be used to initialize
2256before, and cleanup after, @var{anchored-matcher} is used. Typically,
2257@var{pre-form} is used to move point to some position relative to the
2258match of @var{matcher}, before starting with @var{anchored-matcher}.
2259@var{post-form} might be used to move back, before resuming with
2260@var{matcher}.
2261
2262After Font Lock evaluates @var{pre-form}, it does not search for
2263@var{anchored-matcher} beyond the end of the line. However, if
2264@var{pre-form} returns a buffer position that is greater than the
2265position of point after @var{pre-form} is evaluated, then the position
2266returned by @var{pre-form} is used as the limit of the search instead.
2267It is generally a bad idea to return a position greater than the end
2268of the line; in other words, the @var{anchored-matcher} search should
2269not span lines.
2249 2270
2250It has this format: 2271For example,
2251 2272
2252@example 2273@smallexample
2253(@var{submatcher} @var{pre-match-form} @var{post-match-form} @var{highlighters}@dots{}) 2274;; @r{Highlight occurrences of the word @samp{item} following}
2254@end example 2275;; @r{an occurrence of the word @samp{anchor} (on the same line)}
2276;; @r{in the value of @code{item-face}.}
2277("\\<anchor\\>" "\\<item\\>" nil nil (0 item-face))
2278@end smallexample
2255 2279
2256@c I can't parse this text -- rms 2280Here, @var{pre-form} and @var{post-form} are @code{nil}. Therefore
2257where @var{submatcher} is much like @var{matcher}, with one 2281searching for @samp{item} starts at the end of the match of
2258exception---see below. @var{pre-match-form} and @var{post-match-form} 2282@samp{anchor}, and searching for subsequent instances of @samp{anchor}
2259are evaluated before the first, and after the last, instance 2283resumes from where searching for @samp{item} concluded.
2260@var{anchored}'s @var{submatcher} is used. Therefore they can be used
2261to initialize before, and cleanup after, @var{submatcher} is used.
2262Typically, @var{pre-match-form} is used to move to some position
2263relative to the original @var{submatcher}, before starting with
2264@var{anchored}'s @var{submatcher}. @var{post-match-form} might be used
2265to move, before resuming with @var{anchored}'s parent's @var{matcher}.
2266 2284
2267For example, an element of the form highlights (if not already highlighted): 2285@item (@var{matcher} @var{highlighters}@dots{})
2286This sort of element specifies several @var{highlighter} lists for a
2287single @var{matcher}. A @var{highlighter} list can be of the type
2288@var{subexp-highlighter} or @var{anchored-highlighter} as described
2289above.
2268 2290
2269@example 2291For example,
2270("\\<anchor\\>" (0 anchor-face) ("\\<item\\>" nil nil (0 item-face)))
2271@end example
2272 2292
2273Discrete occurrences of @samp{anchor} in the value of 2293@smallexample
2274@code{anchor-face}, and subsequent discrete occurrences of @samp{item} 2294;; @r{Highlight occurrences of the word @samp{anchor} in the value}
2275(on the same line) in the value of @code{item-face}. (Here 2295;; @r{of @code{anchor-face}, and subsequent occurrences of the word}
2276@var{pre-match-form} and @var{post-match-form} are @code{nil}. 2296;; @r{@samp{item} (on the same line) in the value of @code{item-face}.}
2277Therefore @samp{item} is initially searched for starting from the end of 2297("\\<anchor\\>" (0 anchor-face)
2278the match of @samp{anchor}, and searching for subsequent instance of 2298 ("\\<item\\>" nil nil (0 item-face)))
2279@samp{anchor} resumes from where searching for @samp{item} concluded.) 2299@end smallexample
2280
2281The above-mentioned exception is as follows. The limit of the
2282@var{submatcher} search defaults to the end of the line after
2283@var{pre-match-form} is evaluated. However, if @var{pre-match-form}
2284returns a position greater than the position after @var{pre-match-form}
2285is evaluated, that position is used as the limit of the search. It is
2286generally a bad idea to return a position greater than the end of the
2287line; in other words, the @var{submatcher} search should not span lines.
2288
2289@item (@var{matcher} @var{highlighters-or-anchoreds} ...)
2290@end ignore
2291 2300
2292@item (eval . @var{form}) 2301@item (eval . @var{form})
2293Here @var{form} is an expression to be evaluated the first time 2302Here @var{form} is an expression to be evaluated the first time
@@ -2301,7 +2310,7 @@ to match text which spans lines; this does not work reliably. While
2301updating when you edit the buffer does not, since it considers text one 2310updating when you edit the buffer does not, since it considers text one
2302line at a time. If you have patterns that typically only span one 2311line at a time. If you have patterns that typically only span one
2303line but can occasionally span two or three, such as 2312line but can occasionally span two or three, such as
2304@samp{<title>...</title>}, you can ask font-lock to be more careful by 2313@samp{<title>...</title>}, you can ask Font Lock to be more careful by
2305setting @code{font-lock-multiline} to @code{t}. But it still will not 2314setting @code{font-lock-multiline} to @code{t}. But it still will not
2306work in all cases. 2315work in all cases.
2307 2316