diff options
| author | Miles Bader | 2005-06-09 07:13:03 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-06-09 07:13:03 +0000 |
| commit | d113efea8e0a56aedd60615f5dc6669c72aca77f (patch) | |
| tree | c51aa1cd5076acfc2391217b0d7dea96552011de /lispref | |
| parent | 2435213ba6b74f7425e15b1f799c9ae18467e43d (diff) | |
| parent | 47600d8e97925ed8816b099267e24f4ab3311e75 (diff) | |
| download | emacs-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/ChangeLog | 29 | ||||
| -rw-r--r-- | lispref/display.texi | 16 | ||||
| -rw-r--r-- | lispref/modes.texi | 96 | ||||
| -rw-r--r-- | lispref/searching.texi | 53 |
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 @@ | |||
| 1 | 2005-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 | |||
| 6 | 2005-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 | |||
| 19 | 2005-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 | |||
| 26 | 2005-06-08 Juri Linkov <juri@jurta.org> | ||
| 27 | |||
| 28 | * display.texi (Standard Faces): Add `shadow' face. | ||
| 29 | |||
| 1 | 2005-05-29 Luc Teirlinck <teirllm@auburn.edu> | 30 | 2005-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. | |||
| 1775 | This face forces use of a particular variable-width font. It's | 1775 | This face forces use of a particular variable-width font. It's |
| 1776 | reasonable to customize this to use a different variable-width font, if | 1776 | reasonable to customize this to use a different variable-width font, if |
| 1777 | you like, but you should not make it a fixed-width font. | 1777 | you like, but you should not make it a fixed-width font. |
| 1778 | |||
| 1779 | @item shadow | ||
| 1780 | @kindex shadow @r{(face name)} | ||
| 1781 | This face is used for making the text less noticeable than the | ||
| 1782 | surrounding 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 |
| 1791 | kind of customization item (@pxref{Customization}) which the user can | 1796 | kind of customization item (@pxref{Customization}) which the user can |
| 1792 | customize using the Customization buffer (@pxref{Easy Customization,,, | 1797 | customize using the Customization buffer (@pxref{Easy Customization,,, |
| 1793 | emacs, The GNU Emacs Manual}). | 1798 | emacs, The GNU Emacs Manual}). |
| 1794 | 1799 | ||
| 1795 | @defmac defface face spec doc [keyword value]... | 1800 | @defmac defface face spec doc [keyword value]... |
| 1796 | This declares @var{face} as a customizable face that defaults according | 1801 | This declares @var{face} as a customizable face that defaults |
| 1797 | to @var{spec}. You should not quote the symbol @var{face}. The | 1802 | according to @var{spec}. You should not quote the symbol @var{face}, |
| 1803 | and it should not end in @samp{-face} (that would be redundant). The | ||
| 1798 | argument @var{doc} specifies the face documentation. The keywords you | 1804 | argument @var{doc} specifies the face documentation. The keywords you |
| 1799 | can use in @code{defface} are the same ones that are meaningful in both | 1805 | can 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 | ||
| 1802 | When @code{defface} executes, it defines the face according to | 1808 | When @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}) |
| 1653 | A list whose first element is a symbol that is not a keyword specifies a | 1653 | A list whose first element is a symbol that is not a keyword specifies |
| 1654 | conditional. Its meaning depends on the value of @var{symbol}. If the | 1654 | a conditional. Its meaning depends on the value of @var{symbol}. If |
| 1655 | value is non-@code{nil}, the second element, @var{then}, is processed | 1655 | @var{symbol} has a non-@code{nil} value, the second element, |
| 1656 | recursively 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. | 1657 | Otherwise, the third element, @var{else}, is processed recursively. |
| 1658 | You may omit @var{else}; then the mode-line element displays nothing if | 1658 | You may omit @var{else}; then the mode-line element displays nothing |
| 1659 | the value of @var{symbol} is @code{nil}. | 1659 | if 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{}) |
| 1662 | A list whose first element is an integer specifies truncation or | 1662 | A 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 | ||
| 2627 | You 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 | ||
| 2628 | search-based fontification rules to a major mode, and | 2632 | search-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 |
| 2632 | This function adds highlighting @var{keywords} for @var{mode}. The | 2636 | This function adds highlighting @var{keywords}, for the current buffer |
| 2633 | argument @var{keywords} should be a list with the same format as the | 2637 | or for major mode @var{mode}. The argument @var{keywords} should be a |
| 2634 | variable @code{font-lock-keywords}. @var{mode} should be a symbol, | 2638 | list with the same format as the variable @code{font-lock-keywords}. |
| 2635 | the major mode command name, such as @code{c-mode}. When Font Lock | 2639 | |
| 2636 | mode is turned on in @var{mode}, it adds @var{keywords} to | 2640 | If @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 |
| 2638 | highlighting @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. | 2643 | Calling with a non-@code{nil} value of @var{mode} is correct only in |
| 2644 | your @file{~/.emacs} file. | ||
| 2645 | |||
| 2646 | If @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 | ||
| 2641 | By default, @var{keywords} are added at the beginning of | 2650 | By 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 | |||
| 2645 | non-@code{nil} value, they are added at the end of | 2654 | non-@code{nil} value, they are added at the end of |
| 2646 | @code{font-lock-keywords}. | 2655 | @code{font-lock-keywords}. |
| 2647 | 2656 | ||
| 2648 | For example: | 2657 | Some modes provide specialized support you can use in additional |
| 2658 | highlighting 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 | ||
| 2665 | or indirectly, except through their mode hooks. (Doing so would lead | ||
| 2666 | to incorrect behavior for some minor modes.) They should set up their | ||
| 2667 | rules for search-based fontification by setting | ||
| 2668 | @code{font-lock-keywords}. | ||
| 2669 | @end defun | ||
| 2670 | |||
| 2671 | @defun font-lock-remove-keywords mode keywords | ||
| 2672 | This function removes @var{keywords} from @code{font-lock-keywords} | ||
| 2673 | for the current buffer or for major mode @var{mode}. As in | ||
| 2674 | @code{font-lock-add-keywords}, @var{mode} should be a major mode | ||
| 2675 | command 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 | ||
| 2656 | adds two fontification patterns for C mode: one to fontify the word | 2688 | adds 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 | ||
| 2660 | Some modes have specialized support for additional patterns. See the | 2692 | @noindent |
| 2661 | variables @code{c-font-lock-extra-types}, | 2693 | That 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} | 2694 | C mode @emph{and} all modes derived from it, do this instead: |
| 2663 | and @code{java-font-lock-extra-types}, for example. | ||
| 2664 | @end defun | ||
| 2665 | |||
| 2666 | @defun font-lock-remove-keywords mode keywords | ||
| 2667 | This function removes highlighting @var{keywords} for @var{mode}. As | ||
| 2668 | in @code{font-lock-add-keywords}, @var{mode} should be a major mode | ||
| 2669 | command 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 |
| 2674 | you 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 () |
| 2676 | use these functions from a Lisp program (such as a minor mode), we | 2699 | (font-lock-add-keywords nil |
| 2677 | recommend that you use @code{nil} for @var{mode} (and place the call | 2700 | '(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend) |
| 2678 | on a hook) to avoid subtle problems due to the details of the | 2701 | ("\\<\\(and\\|or\\|not\\)\\>" . |
| 2679 | implementation. | 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 |
| 1486 | write the entire match data, all at once. | 1486 | write the entire match data, all at once. |
| 1487 | 1487 | ||
| 1488 | @defun match-data &optional integers reuse | 1488 | @defun match-data &optional integers reuse reseat |
| 1489 | This function returns a newly constructed list containing all the | 1489 | This function returns a list of positions (markers or integers) that |
| 1490 | information on what text the last search matched. Element zero is the | 1490 | record all the information on what text the last search matched. |
| 1491 | position of the beginning of the match for the whole expression; element | 1491 | Element zero is the position of the beginning of the match for the |
| 1492 | one is the position of the end of the match for the expression. The | 1492 | whole expression; element one is the position of the end of the match |
| 1493 | next two elements are the positions of the beginning and end of the | 1493 | for the expression. The next two elements are the positions of the |
| 1494 | match for the first subexpression, and so on. In general, element | 1494 | beginning and end of the match for the first subexpression, and so on. |
| 1495 | In general, element | ||
| 1495 | @ifnottex | 1496 | @ifnottex |
| 1496 | number 2@var{n} | 1497 | number 2@var{n} |
| 1497 | @end ifnottex | 1498 | @end ifnottex |
| @@ -1508,15 +1509,13 @@ number {\mathsurround=0pt $2n+1$} | |||
| 1508 | @end tex | 1509 | @end tex |
| 1509 | corresponds to @code{(match-end @var{n})}. | 1510 | corresponds to @code{(match-end @var{n})}. |
| 1510 | 1511 | ||
| 1511 | All the elements are markers or @code{nil} if matching was done on a | 1512 | Normally all the elements are markers or @code{nil}, but if |
| 1512 | buffer 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 |
| 1513 | string with @code{string-match}. If @var{integers} is | 1514 | of markers. (In that case, the buffer itself is appended as an |
| 1514 | non-@code{nil}, then the elements are integers or @code{nil}, even if | 1515 | additional element at the end of the list, to facilitate complete |
| 1515 | matching was done on a buffer. In that case, the buffer itself is | 1516 | restoration of the match data.) If the last match was done on a |
| 1516 | appended as an additional element at the end of the list | 1517 | string with @code{string-match}, then integers are always used, |
| 1517 | to facilitate complete restoration of the match data. Also, | 1518 | since markers can't point into a string. |
| 1518 | @code{match-beginning} and | ||
| 1519 | @code{match-end} always return integers or @code{nil}. | ||
| 1520 | 1519 | ||
| 1521 | If @var{reuse} is non-@code{nil}, it should be a list. In that case, | 1520 | If @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, | |||
| 1524 | have the right length. If it is not long enough to contain the match | 1523 | have the right length. If it is not long enough to contain the match |
| 1525 | data, it is extended. If it is too long, the length of @var{reuse} | 1524 | data, it is extended. If it is too long, the length of @var{reuse} |
| 1526 | stays the same, but the elements that were not used are set to | 1525 | stays 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 |
| 1528 | much garbage, that would later have to be collected. | 1527 | garbage collection. |
| 1528 | |||
| 1529 | If @var{reseat} is non-@code{nil}, all markers on the @var{reuse} list | ||
| 1530 | are reseated to point to nowhere, and if the value is @code{evaporate}, | ||
| 1531 | the markers are put back on the free list. | ||
| 1532 | |||
| 1533 | @strong{Warning:} When @code{evaporate} is specified for @var{reseat}, | ||
| 1534 | no other references to the markers on the @var{reuse} list; otherwise, | ||
| 1535 | Emacs may crash during the next garbage collection. | ||
| 1529 | 1536 | ||
| 1530 | As always, there must be no possibility of intervening searches between | 1537 | As always, there must be no possibility of intervening searches between |
| 1531 | the call to a search function and the call to @code{match-data} that is | 1538 | the 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 |
| 1546 | This function sets the match data from the elements of @var{match-list}, | 1553 | This function sets the match data from the elements of @var{match-list}, |
| 1547 | which should be a list that was the value of a previous call to | 1554 | which 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.) | |||
| 1551 | If @var{match-list} refers to a buffer that doesn't exist, you don't get | 1558 | If @var{match-list} refers to a buffer that doesn't exist, you don't get |
| 1552 | an error; that sets the match data in a meaningless but harmless way. | 1559 | an error; that sets the match data in a meaningless but harmless way. |
| 1553 | 1560 | ||
| 1561 | If @var{reseat} is non-@code{nil}, all markers on the @var{match-list} list | ||
| 1562 | are reseated to point to nowhere, and if the value is @code{evaporate}, | ||
| 1563 | the markers are put back on the free list. | ||
| 1564 | |||
| 1565 | @strong{Warning:} When @code{evaporate} is specified for @var{reseat}, | ||
| 1566 | no other references to the markers on the @var{match-list} list; otherwise, | ||
| 1567 | Emacs 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 |