aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorMiles Bader2005-06-09 07:13:03 +0000
committerMiles Bader2005-06-09 07:13:03 +0000
commitd113efea8e0a56aedd60615f5dc6669c72aca77f (patch)
treec51aa1cd5076acfc2391217b0d7dea96552011de /lispref
parent2435213ba6b74f7425e15b1f799c9ae18467e43d (diff)
parent47600d8e97925ed8816b099267e24f4ab3311e75 (diff)
downloademacs-d113efea8e0a56aedd60615f5dc6669c72aca77f.tar.gz
emacs-d113efea8e0a56aedd60615f5dc6669c72aca77f.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-61
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 353-357) - Update from CVS
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog29
-rw-r--r--lispref/display.texi16
-rw-r--r--lispref/modes.texi96
-rw-r--r--lispref/searching.texi53
4 files changed, 134 insertions, 60 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 6077deea9bb..6742080bd03 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,32 @@
12005-06-09 Kim F. Storm <storm@cua.dk>
2
3 * searching.texi (Entire Match Data): Explain new `reseat' argument to
4 match-data and set-match-data.
5
62005-06-08 Richard M. Stallman <rms@gnu.org>
7
8 * searching.texi (Entire Match Data): Clarify when match-data
9 returns markers and when integers.
10
11 * display.texi (Defining Faces): Explain that face name should not
12 end in `-face'.
13
14 * modes.texi (Mode Line Data): Minor cleanup.
15 (Customizing Keywords): Node split out of Search-based Fontification.
16 Add example of using font-lock-add-keywords from a hook.
17 Clarify when MODE should be non-nil, and when nil.
18
192005-06-06 Richard M. Stallman <rms@gnu.org>
20
21 * modes.texi (Mode Line Data): Explain what happens when the car
22 of a list is a void symbol.
23 (Search-based Fontification): Explain MODE arg to
24 font-lock-add-keywords and warn about calls from major modes.
25
262005-06-08 Juri Linkov <juri@jurta.org>
27
28 * display.texi (Standard Faces): Add `shadow' face.
29
12005-05-29 Luc Teirlinck <teirllm@auburn.edu> 302005-05-29 Luc Teirlinck <teirllm@auburn.edu>
2 31
3 * modes.texi (Major Mode Conventions): A derived mode only needs 32 * modes.texi (Major Mode Conventions): A derived mode only needs
diff --git a/lispref/display.texi b/lispref/display.texi
index 7b4db373f63..87520fb4d4f 100644
--- a/lispref/display.texi
+++ b/lispref/display.texi
@@ -1775,6 +1775,11 @@ This face forces use of a particular fixed-width font.
1775This face forces use of a particular variable-width font. It's 1775This face forces use of a particular variable-width font. It's
1776reasonable to customize this to use a different variable-width font, if 1776reasonable to customize this to use a different variable-width font, if
1777you like, but you should not make it a fixed-width font. 1777you like, but you should not make it a fixed-width font.
1778
1779@item shadow
1780@kindex shadow @r{(face name)}
1781This face is used for making the text less noticeable than the
1782surrounding ordinary text.
1778@end table 1783@end table
1779 1784
1780@defvar show-trailing-whitespace 1785@defvar show-trailing-whitespace
@@ -1790,14 +1795,15 @@ end of a line.
1790 The way to define a new face is with @code{defface}. This creates a 1795 The way to define a new face is with @code{defface}. This creates a
1791kind of customization item (@pxref{Customization}) which the user can 1796kind of customization item (@pxref{Customization}) which the user can
1792customize using the Customization buffer (@pxref{Easy Customization,,, 1797customize using the Customization buffer (@pxref{Easy Customization,,,
1793emacs, The GNU Emacs Manual}). 1798emacs, The GNU Emacs Manual}).
1794 1799
1795@defmac defface face spec doc [keyword value]... 1800@defmac defface face spec doc [keyword value]...
1796This declares @var{face} as a customizable face that defaults according 1801This declares @var{face} as a customizable face that defaults
1797to @var{spec}. You should not quote the symbol @var{face}. The 1802according to @var{spec}. You should not quote the symbol @var{face},
1803and it should not end in @samp{-face} (that would be redundant). The
1798argument @var{doc} specifies the face documentation. The keywords you 1804argument @var{doc} specifies the face documentation. The keywords you
1799can use in @code{defface} are the same ones that are meaningful in both 1805can use in @code{defface} are the same as in @code{defgroup} and
1800@code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). 1806@code{defcustom} (@pxref{Common Keywords}).
1801 1807
1802When @code{defface} executes, it defines the face according to 1808When @code{defface} executes, it defines the face according to
1803@var{spec}, then uses any customizations that were read from the 1809@var{spec}, then uses any customizations that were read from the
diff --git a/lispref/modes.texi b/lispref/modes.texi
index f8c1ae82a4e..2366fca5b96 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -1650,13 +1650,13 @@ properties specified by @var{props} to the result. The argument
1650@var{value}. (This feature is new as of Emacs 22.1.) 1650@var{value}. (This feature is new as of Emacs 22.1.)
1651 1651
1652@item (@var{symbol} @var{then} @var{else}) 1652@item (@var{symbol} @var{then} @var{else})
1653A list whose first element is a symbol that is not a keyword specifies a 1653A list whose first element is a symbol that is not a keyword specifies
1654conditional. Its meaning depends on the value of @var{symbol}. If the 1654a conditional. Its meaning depends on the value of @var{symbol}. If
1655value is non-@code{nil}, the second element, @var{then}, is processed 1655@var{symbol} has a non-@code{nil} value, the second element,
1656recursively as a mode-line element. But if the value of @var{symbol} is 1656@var{then}, is processed recursively as a mode-line element.
1657@code{nil}, the third element, @var{else}, is processed recursively. 1657Otherwise, the third element, @var{else}, is processed recursively.
1658You may omit @var{else}; then the mode-line element displays nothing if 1658You may omit @var{else}; then the mode-line element displays nothing
1659the value of @var{symbol} is @code{nil}. 1659if the value of @var{symbol} is @code{nil} or void.
1660 1660
1661@item (@var{width} @var{rest}@dots{}) 1661@item (@var{width} @var{rest}@dots{})
1662A list whose first element is an integer specifies truncation or 1662A list whose first element is an integer specifies truncation or
@@ -2319,6 +2319,7 @@ Search-based fontification happens second.
2319@menu 2319@menu
2320* Font Lock Basics:: Overview of customizing Font Lock. 2320* Font Lock Basics:: Overview of customizing Font Lock.
2321* Search-based Fontification:: Fontification based on regexps. 2321* Search-based Fontification:: Fontification based on regexps.
2322* Customizing Keywords:: Customizing search-based fontification.
2322* Other Font Lock Variables:: Additional customization facilities. 2323* Other Font Lock Variables:: Additional customization facilities.
2323* Levels of Font Lock:: Each mode can define alternative levels 2324* Levels of Font Lock:: Each mode can define alternative levels
2324 so that the user can select more or less. 2325 so that the user can select more or less.
@@ -2624,19 +2625,27 @@ Non-@code{nil} means that regular expression matching for the sake of
2624@code{font-lock-keywords} should be case-insensitive. 2625@code{font-lock-keywords} should be case-insensitive.
2625@end defvar 2626@end defvar
2626 2627
2627You can use @code{font-lock-add-keywords} to add additional 2628@node Customizing Keywords
2629@subsection Customizing Search-Based Fontification
2630
2631 You can use @code{font-lock-add-keywords} to add additional
2628search-based fontification rules to a major mode, and 2632search-based fontification rules to a major mode, and
2629@code{font-lock-remove-keywords} to removes rules. 2633@code{font-lock-remove-keywords} to removes rules.
2630 2634
2631@defun font-lock-add-keywords mode keywords &optional append 2635@defun font-lock-add-keywords mode keywords &optional append
2632This function adds highlighting @var{keywords} for @var{mode}. The 2636This function adds highlighting @var{keywords}, for the current buffer
2633argument @var{keywords} should be a list with the same format as the 2637or for major mode @var{mode}. The argument @var{keywords} should be a
2634variable @code{font-lock-keywords}. @var{mode} should be a symbol, 2638list with the same format as the variable @code{font-lock-keywords}.
2635the major mode command name, such as @code{c-mode}. When Font Lock 2639
2636mode is turned on in @var{mode}, it adds @var{keywords} to 2640If @var{mode} is a symbol which is a major mode command name, such as
2637@code{font-lock-keywords}. @var{mode} can also be @code{nil}; the 2641@code{c-mode}, the effect is that enabling Font Lock mode in
2638highlighting @var{keywords} are immediately added to 2642@var{mode} will add @var{keywords} to @code{font-lock-keywords}.
2639@code{font-lock-keywords} in the current buffer in that case. 2643Calling with a non-@code{nil} value of @var{mode} is correct only in
2644your @file{~/.emacs} file.
2645
2646If @var{mode} is @code{nil}, this function adds @var{keywords} to
2647@code{font-lock-keywords} in the current buffer. This way of calling
2648@code{font-lock-add-keywords} is usually used in mode hook functions.
2640 2649
2641By default, @var{keywords} are added at the beginning of 2650By default, @var{keywords} are added at the beginning of
2642@code{font-lock-keywords}. If the optional argument @var{append} is 2651@code{font-lock-keywords}. If the optional argument @var{append} is
@@ -2645,7 +2654,29 @@ By default, @var{keywords} are added at the beginning of
2645non-@code{nil} value, they are added at the end of 2654non-@code{nil} value, they are added at the end of
2646@code{font-lock-keywords}. 2655@code{font-lock-keywords}.
2647 2656
2648For example: 2657Some modes provide specialized support you can use in additional
2658highlighting patterns. See the variables
2659@code{c-font-lock-extra-types}, @code{c++-font-lock-extra-types},
2660@code{objc-font-lock-extra-types} and
2661@code{java-font-lock-extra-types}, for example.
2662
2663@strong{Warning:} major mode functions must not call
2664@code{font-lock-add-keywords} under any circumstances, either directly
2665or indirectly, except through their mode hooks. (Doing so would lead
2666to incorrect behavior for some minor modes.) They should set up their
2667rules for search-based fontification by setting
2668@code{font-lock-keywords}.
2669@end defun
2670
2671@defun font-lock-remove-keywords mode keywords
2672This function removes @var{keywords} from @code{font-lock-keywords}
2673for the current buffer or for major mode @var{mode}. As in
2674@code{font-lock-add-keywords}, @var{mode} should be a major mode
2675command name or @code{nil}. All the caveats and requirments for
2676@code{font-lock-add-keywords} apply here too.
2677@end defun
2678
2679 For example, this code
2649 2680
2650@smallexample 2681@smallexample
2651(font-lock-add-keywords 'c-mode 2682(font-lock-add-keywords 'c-mode
@@ -2653,30 +2684,23 @@ For example:
2653 ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face))) 2684 ("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
2654@end smallexample 2685@end smallexample
2655 2686
2687@noindent
2656adds two fontification patterns for C mode: one to fontify the word 2688adds two fontification patterns for C mode: one to fontify the word
2657@samp{FIXME}, even in comments, and another to fontify the words 2689@samp{FIXME}, even in comments, and another to fontify the words
2658@samp{and}, @samp{or} and @samp{not} as keywords. 2690@samp{and}, @samp{or} and @samp{not} as keywords.
2659 2691
2660Some modes have specialized support for additional patterns. See the 2692@noindent
2661variables @code{c-font-lock-extra-types}, 2693That example affects only C mode proper. To add the same patterns to
2662@code{c++-font-lock-extra-types}, @code{objc-font-lock-extra-types} 2694C mode @emph{and} all modes derived from it, do this instead:
2663and @code{java-font-lock-extra-types}, for example.
2664@end defun
2665
2666@defun font-lock-remove-keywords mode keywords
2667This function removes highlighting @var{keywords} for @var{mode}. As
2668in @code{font-lock-add-keywords}, @var{mode} should be a major mode
2669command name or @code{nil}. If @code{nil}, the highlighting
2670@var{keywords} are immediately removed in the current buffer.
2671@end defun
2672 2695
2673@strong{Warning:} Only use a non-@code{nil} @var{mode} argument when 2696@smallexample
2674you use @code{font-lock-add-keywords} or 2697(add-hook 'c-mode-hook
2675@code{font-lock-remove-keywords} in your @file{.emacs} file. When you 2698 (lambda ()
2676use these functions from a Lisp program (such as a minor mode), we 2699 (font-lock-add-keywords nil
2677recommend that you use @code{nil} for @var{mode} (and place the call 2700 '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
2678on a hook) to avoid subtle problems due to the details of the 2701 ("\\<\\(and\\|or\\|not\\)\\>" .
2679implementation. 2702 font-lock-keyword-face)))))
2703@end smallexample
2680 2704
2681@node Other Font Lock Variables 2705@node Other Font Lock Variables
2682@subsection Other Font Lock Variables 2706@subsection Other Font Lock Variables
diff --git a/lispref/searching.texi b/lispref/searching.texi
index 1f4a82d3f1f..15037068dd2 100644
--- a/lispref/searching.texi
+++ b/lispref/searching.texi
@@ -1485,13 +1485,14 @@ character of the buffer counts as 1.)
1485 The functions @code{match-data} and @code{set-match-data} read or 1485 The functions @code{match-data} and @code{set-match-data} read or
1486write the entire match data, all at once. 1486write the entire match data, all at once.
1487 1487
1488@defun match-data &optional integers reuse 1488@defun match-data &optional integers reuse reseat
1489This function returns a newly constructed list containing all the 1489This function returns a list of positions (markers or integers) that
1490information on what text the last search matched. Element zero is the 1490record all the information on what text the last search matched.
1491position of the beginning of the match for the whole expression; element 1491Element zero is the position of the beginning of the match for the
1492one is the position of the end of the match for the expression. The 1492whole expression; element one is the position of the end of the match
1493next two elements are the positions of the beginning and end of the 1493for the expression. The next two elements are the positions of the
1494match for the first subexpression, and so on. In general, element 1494beginning and end of the match for the first subexpression, and so on.
1495In general, element
1495@ifnottex 1496@ifnottex
1496number 2@var{n} 1497number 2@var{n}
1497@end ifnottex 1498@end ifnottex
@@ -1508,15 +1509,13 @@ number {\mathsurround=0pt $2n+1$}
1508@end tex 1509@end tex
1509corresponds to @code{(match-end @var{n})}. 1510corresponds to @code{(match-end @var{n})}.
1510 1511
1511All the elements are markers or @code{nil} if matching was done on a 1512Normally all the elements are markers or @code{nil}, but if
1512buffer and all are integers or @code{nil} if matching was done on a 1513@var{integers} is non-@code{nil}, that means to use integers instead
1513string with @code{string-match}. If @var{integers} is 1514of markers. (In that case, the buffer itself is appended as an
1514non-@code{nil}, then the elements are integers or @code{nil}, even if 1515additional element at the end of the list, to facilitate complete
1515matching was done on a buffer. In that case, the buffer itself is 1516restoration of the match data.) If the last match was done on a
1516appended as an additional element at the end of the list 1517string with @code{string-match}, then integers are always used,
1517to facilitate complete restoration of the match data. Also, 1518since markers can't point into a string.
1518@code{match-beginning} and
1519@code{match-end} always return integers or @code{nil}.
1520 1519
1521If @var{reuse} is non-@code{nil}, it should be a list. In that case, 1520If @var{reuse} is non-@code{nil}, it should be a list. In that case,
1522@code{match-data} stores the match data in @var{reuse}. That is, 1521@code{match-data} stores the match data in @var{reuse}. That is,
@@ -1524,8 +1523,16 @@ If @var{reuse} is non-@code{nil}, it should be a list. In that case,
1524have the right length. If it is not long enough to contain the match 1523have the right length. If it is not long enough to contain the match
1525data, it is extended. If it is too long, the length of @var{reuse} 1524data, it is extended. If it is too long, the length of @var{reuse}
1526stays the same, but the elements that were not used are set to 1525stays the same, but the elements that were not used are set to
1527@code{nil}. The purpose of this feature is to avoid producing too 1526@code{nil}. The purpose of this feature is to reduce the need for
1528much garbage, that would later have to be collected. 1527garbage collection.
1528
1529If @var{reseat} is non-@code{nil}, all markers on the @var{reuse} list
1530are reseated to point to nowhere, and if the value is @code{evaporate},
1531the markers are put back on the free list.
1532
1533@strong{Warning:} When @code{evaporate} is specified for @var{reseat},
1534no other references to the markers on the @var{reuse} list; otherwise,
1535Emacs may crash during the next garbage collection.
1529 1536
1530As always, there must be no possibility of intervening searches between 1537As always, there must be no possibility of intervening searches between
1531the call to a search function and the call to @code{match-data} that is 1538the call to a search function and the call to @code{match-data} that is
@@ -1542,7 +1549,7 @@ intended to access the match data for that search.
1542@end example 1549@end example
1543@end defun 1550@end defun
1544 1551
1545@defun set-match-data match-list 1552@defun set-match-data match-list &optional reseat
1546This function sets the match data from the elements of @var{match-list}, 1553This function sets the match data from the elements of @var{match-list},
1547which should be a list that was the value of a previous call to 1554which should be a list that was the value of a previous call to
1548@code{match-data}. (More precisely, anything that has the same format 1555@code{match-data}. (More precisely, anything that has the same format
@@ -1551,6 +1558,14 @@ will work.)
1551If @var{match-list} refers to a buffer that doesn't exist, you don't get 1558If @var{match-list} refers to a buffer that doesn't exist, you don't get
1552an error; that sets the match data in a meaningless but harmless way. 1559an error; that sets the match data in a meaningless but harmless way.
1553 1560
1561If @var{reseat} is non-@code{nil}, all markers on the @var{match-list} list
1562are reseated to point to nowhere, and if the value is @code{evaporate},
1563the markers are put back on the free list.
1564
1565@strong{Warning:} When @code{evaporate} is specified for @var{reseat},
1566no other references to the markers on the @var{match-list} list; otherwise,
1567Emacs may crash during the next garbage collection.
1568
1554@findex store-match-data 1569@findex store-match-data
1555@code{store-match-data} is a semi-obsolete alias for @code{set-match-data}. 1570@code{store-match-data} is a semi-obsolete alias for @code{set-match-data}.
1556@end defun 1571@end defun