Next: Substitution, Previous: Case Changes, Up: Text [Contents][Index]
Text properties are an alternative interface to extents (see Extents), and are built on top of them. They are useful when you want to view textual properties as being attached to the characters themselves rather than to intervals of characters. The text property interface is compatible with FSF Emacs.
Each character position in a buffer or a string can have a text property list, much like the property list of a symbol (see Property Lists). The properties belong to a particular character at a particular place, such as, the letter ‘T’ at the beginning of this sentence or the first ‘o’ in ‘foo’—if the same character occurs in two different places, the two occurrences generally have different properties.
Each property has a name and a value. Both of these can be any Lisp object, but the name is normally a symbol. The usual way to access the property list is to specify a name and ask what value corresponds to it.
Note that FSF Emacs also looks at the category
property to find
defaults for text properties. We consider this too bogus to implement.
Copying text between strings and buffers preserves the properties
along with the characters; this includes such diverse functions as
substring
, insert
, and buffer-substring
.
• Examining Properties: | Looking at the properties of one character. | |
• Changing Properties: | Setting the properties of a range of text. | |
• Property Search: | Searching for where a property changes value. | |
• Special Properties: | Particular properties with special meanings. | |
• Saving Properties: | Saving text properties in files, and reading them back. | |
• Fields: | Emacs-compatible text fields. |
Next: Substitution, Previous: Case Changes, Up: Text [Contents][Index]