Next: , Previous: , Up: Character Attributes   [Contents][Index]


9.3 Character Attribute Functions

Function: defattribute name documentation &optional type initial-value

This function defines a new character attribute with name, a simple-string. Character attribute operations take attribute arguments as a keyword whose name is name uppercased with spaces replaced by hyphens.

Documentation describes the uses of the character attribute.

Type, which defaults to (mod 2), specifies what type the values of the character attribute are. Values of a character attribute may be of any type which may be specified to make-array. Initial-value (default 0) is the value which all characters will initially have for this attribute.

Function: character-attribute-name attribute
Function: character-attribute-documentation attribute

These functions return the name or documentation for attribute.

Hemlock Variable: Character Attribute Hook
Function: character-attribute attribute character

character-attribute returns the value of attribute for character. This signals an error if attribute is undefined.

setf will set a character’s attributes. This setf method invokes the functions in Character Attribute Hook on the attribute and character before it makes the change.

If character is nil, then the value of the attribute for the beginning or end of the buffer can be accessed or set. The buffer beginning and end thus become a sort of fictitious character, which simplifies the use of character attributes in many cases.

Function: character-attribute-p symbol

This function returns t if symbol is the name of a character attribute, nil otherwise.

Hemlock Variable: Shadow Attribute Hook
Function: shadow-attribute attribute character value mode

This function establishes value as the value of character’s attribute attribute when in the mode mode. Mode must be the name of a major mode. Shadow Attribute Hook is invoked with the same arguments when this function is called. If the value for an attribute is set while the value is shadowed, then only the shadowed value is affected, not the global one.

Hemlock Variable: Unshadow Attribute Hook
Function: unshadow-attribute attribute character mode

Make the value of attribute for character no longer be shadowed in mode. Unshadow Attribute Hook is invoked with the same arguments when this function is called.

Function: find-attribute mark attribute &optional test
Function: reverse-find-attribute mark attribute &optional test

These functions find the next (or previous) character with some value for the character attribute attribute starting at mark. They pass Test one argument, the value of attribute for the character tested. If the test succeeds, then these routines modify mark to point before (after for reverse-find-attribute) the character which satisfied the test. If no characters satisfy the test, then these return nil, and mark remains unmodified. Test defaults to not zerop. There is no guarantee that the test is applied in any particular fashion, so it should have no side effects and depend only on its argument.


Next: Character Attribute Hooks, Previous: Character Attribute Names, Up: Character Attributes   [Contents][Index]