aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-08-16 10:53:33 +0300
committerEli Zaretskii2011-08-16 10:53:33 +0300
commit1ea897d542c8de7858ff5ea1bf7e26c8e5bca135 (patch)
treee0bae183f9acb326e4b3dff1d0fc140d6bd0a247
parent5b409b390c68db74ab80d061f80d5524095eacb4 (diff)
downloademacs-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/ChangeLog10
-rw-r--r--doc/lispref/searching.texi6
-rw-r--r--doc/lispref/syntax.texi18
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 @@
12011-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
12011-08-09 Chong Yidong <cyd@stupidchicken.com> 112011-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
718matches any character whose syntax is not @var{code}. 718matches 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}
721matches any character whose category is @var{c}. Here @var{c} is a 722matches any character whose category is @var{c}. Here @var{c} is a
722character that represents a category: thus, @samp{c} for Chinese 723character that represents a category: thus, @samp{c} for Chinese
723characters or @samp{g} for Greek characters in the standard category 724characters or @samp{g} for Greek characters in the standard category
724table. 725table. You can see the list of all the currently defined categories
726with @kbd{M-x describe-categories @key{RET}}. You can also define
727your 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}
727matches any character whose category is not @var{c}. 731matches 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
1085This function defines a new category, with name @var{char} and 1085This function defines a new category, with name @var{char} and
1086documentation @var{docstring}, for the category table @var{table}. 1086documentation @var{docstring}, for the category table @var{table}.
1087
1088Here's an example of defining a new category for characters that have
1089strong right-to-left directionality (@pxref{Bidirectional Display})
1090and 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