elisp: Text Props and Strings
2.3.8.4 Text Properties in Strings
..................................
A string can hold properties for the characters it contains, in addition
to the characters themselves. This enables programs that copy text
between strings and buffers to copy the text’s properties with no
special effort. Text Properties, for an explanation of what
text properties mean. Strings with text properties use a special read
and print syntax:
#("CHARACTERS" PROPERTY-DATA...)
where PROPERTY-DATA consists of zero or more elements, in groups of
three as follows:
BEG END PLIST
The elements BEG and END are integers, and together specify a range of
indices in the string; PLIST is the property list for that range. For
example,
#("foo bar" 0 3 (face bold) 3 4 nil 4 7 (face italic))
represents a string whose textual contents are ‘foo bar’, in which the
first three characters have a ‘face’ property with value ‘bold’, and the
last three have a ‘face’ property with value ‘italic’. (The fourth
character has no text properties, so its property list is ‘nil’. It is
not actually necessary to mention ranges with ‘nil’ as the property
list, since any characters not mentioned in any range will default to
having no properties.)