diff options
| author | Eli Zaretskii | 2011-08-16 10:53:33 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-08-16 10:53:33 +0300 |
| commit | 1ea897d542c8de7858ff5ea1bf7e26c8e5bca135 (patch) | |
| tree | e0bae183f9acb326e4b3dff1d0fc140d6bd0a247 | |
| parent | 5b409b390c68db74ab80d061f80d5524095eacb4 (diff) | |
| download | emacs-1ea897d542c8de7858ff5ea1bf7e26c8e5bca135.tar.gz emacs-1ea897d542c8de7858ff5ea1bf7e26c8e5bca135.zip | |
Improve documentation of regexp search for categories.
doc/lispref/searching.texi (Regexp Backslash): Document how to display
existing categories. Mention the possibility of adding
categories, and add an xref to where this is described. Add an
index entry.
doc/lispref/syntax.texi (Categories): Add an example of defining a new
category and category table.
| -rw-r--r-- | doc/lispref/ChangeLog | 10 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/syntax.texi | 18 |
3 files changed, 33 insertions, 1 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 5bdc17136e1..40ad3dc8c52 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-08-16 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * syntax.texi (Categories): Add an example of defining a new | ||
| 4 | category and category table. | ||
| 5 | |||
| 6 | * searching.texi (Regexp Backslash): Document how to display | ||
| 7 | existing categories. Mention the possibility of adding | ||
| 8 | categories, and add an xref to where this is described. Add an | ||
| 9 | index entry. | ||
| 10 | |||
| 1 | 2011-08-09 Chong Yidong <cyd@stupidchicken.com> | 11 | 2011-08-09 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 12 | ||
| 3 | * text.texi (Special Properties): | 13 | * text.texi (Special Properties): |
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 6272301dbb4..fe7c805c6f7 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -717,11 +717,15 @@ the characters that stand for them. | |||
| 717 | @cindex @samp{\S} in regexp | 717 | @cindex @samp{\S} in regexp |
| 718 | matches any character whose syntax is not @var{code}. | 718 | matches any character whose syntax is not @var{code}. |
| 719 | 719 | ||
| 720 | @cindex category, regexp search for | ||
| 720 | @item \c@var{c} | 721 | @item \c@var{c} |
| 721 | matches any character whose category is @var{c}. Here @var{c} is a | 722 | matches any character whose category is @var{c}. Here @var{c} is a |
| 722 | character that represents a category: thus, @samp{c} for Chinese | 723 | character that represents a category: thus, @samp{c} for Chinese |
| 723 | characters or @samp{g} for Greek characters in the standard category | 724 | characters or @samp{g} for Greek characters in the standard category |
| 724 | table. | 725 | table. You can see the list of all the currently defined categories |
| 726 | with @kbd{M-x describe-categories @key{RET}}. You can also define | ||
| 727 | your own categories in addition to the standard ones using the | ||
| 728 | @code{define-category} function (@pxref{Categories}). | ||
| 725 | 729 | ||
| 726 | @item \C@var{c} | 730 | @item \C@var{c} |
| 727 | matches any character whose category is not @var{c}. | 731 | matches any character whose category is not @var{c}. |
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index 31ee7eb4e7d..0d7a0c0bed4 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi | |||
| @@ -1084,6 +1084,24 @@ defaults to the current buffer's category table. | |||
| 1084 | @defun define-category char docstring &optional table | 1084 | @defun define-category char docstring &optional table |
| 1085 | This function defines a new category, with name @var{char} and | 1085 | This function defines a new category, with name @var{char} and |
| 1086 | documentation @var{docstring}, for the category table @var{table}. | 1086 | documentation @var{docstring}, for the category table @var{table}. |
| 1087 | |||
| 1088 | Here's an example of defining a new category for characters that have | ||
| 1089 | strong right-to-left directionality (@pxref{Bidirectional Display}) | ||
| 1090 | and using it in a special category table: | ||
| 1091 | |||
| 1092 | @example | ||
| 1093 | (defvar special-category-table-for-bidi | ||
| 1094 | (let ((category-table (make-category-table)) | ||
| 1095 | (uniprop-table (unicode-property-table-internal 'bidi-class))) | ||
| 1096 | (define-category ?R "Characters of bidi-class R, AL, or RLO" | ||
| 1097 | category-table) | ||
| 1098 | (map-char-table | ||
| 1099 | #'(lambda (key val) | ||
| 1100 | (if (memq val '(R AL RLO)) | ||
| 1101 | (modify-category-entry key ?R category-table))) | ||
| 1102 | uniprop-table) | ||
| 1103 | category-table)) | ||
| 1104 | @end example | ||
| 1087 | @end defun | 1105 | @end defun |
| 1088 | 1106 | ||
| 1089 | @defun category-docstring category &optional table | 1107 | @defun category-docstring category &optional table |