Previous: , Up: MULE   [Contents][Index]


66.8 Category Tables

A category table is a type of char table used for keeping track of categories. Categories are used for classifying characters for use in regexps—you can refer to a category rather than having to use a complicated [] expression (and category lookups are significantly faster).

There are 95 different categories available, one for each printable character (including space) in the ASCII charset. Each category is designated by one such character, called a category designator. They are specified in a regexp using the syntax ‘\cX’, where X is a category designator. (This is not yet implemented.)

A category table specifies, for each character, the categories that the character is in. Note that a character can be in more than one category. More specifically, a category table maps from a character to either the value nil (meaning the character is in no categories) or a 95-element bit vector, specifying for each of the 95 categories whether the character is in that category.

Special Lisp functions are provided that abstract this, so you do not have to directly manipulate bit vectors.

Function: category-table-p object

This function returns t if object is a category table.

Function: category-table &optional buffer

This function returns the current category table. This is the one specified by the current buffer, or by buffer if it is non-nil.

Function: standard-category-table

This function returns the standard category table. This is the one used for new buffers.

Function: copy-category-table &optional category-table

This function returns a new category table which is a copy of category-table, which defaults to the standard category table.

Function: set-category-table category-table &optional buffer

This function selects category-table as the new category table for buffer. buffer defaults to the current buffer if omitted.

Function: category-designator-p object

This function returns t if object is a category designator (a char in the range ‘' '’ to ‘'~'’).

Function: category-table-value-p object

This function returns t if object is a category table value. Valid values are nil or a bit vector of size 95.


Previous: , Up: MULE   [Contents][Index]