Function: modify-category-entry
modify-category-entry is a function defined in category.c.
Signature
(modify-category-entry CHARACTER CATEGORY &optional TABLE RESET)
Documentation
Modify the category set of CHARACTER by adding CATEGORY to it.
The category is changed only for table TABLE, which defaults to
the current buffer's category table.
CHARACTER can be either a single character or a cons representing the
lower and upper ends of an inclusive character range to modify.
CATEGORY must be a category name (a character between and ~).
Use describe-categories to see existing category names.
If optional fourth argument RESET is non-nil,
then delete CATEGORY from the category set instead of adding it.
Probably introduced at or before Emacs version 23.1.
Source Code
// Defined in /usr/src/emacs/src/category.c
{
bool set_value; /* Actual value to be set in category sets. */
Lisp_Object category_set;
int start, end;
int from, to;
if (FIXNUMP (character))
{
CHECK_CHARACTER (character);
start = end = XFIXNAT (character);
}
else
{
CHECK_CONS (character);
CHECK_CHARACTER_CAR (character);
CHECK_CHARACTER_CDR (character);
start = XFIXNAT (XCAR (character));
end = XFIXNAT (XCDR (character));
}
CHECK_CATEGORY (category);
table = check_category_table (table);
if (NILP (CATEGORY_DOCSTRING (table, XFIXNAT (category))))
error ("Undefined category: %c", (int) XFIXNAT (category));
set_value = NILP (reset);
while (start <= end)
{
from = start, to = end;
category_set = char_table_ref_and_range (table, start, &from, &to);
if (CATEGORY_MEMBER (XFIXNAT (category), category_set) != NILP (reset))
{
category_set = Fcopy_sequence (category_set);
set_category_set (category_set, XFIXNAT (category), set_value);
category_set = hash_get_category_set (table, category_set);
char_table_set_range (table, start, to, category_set);
}
start = to + 1;
}
return Qnil;
}