Function: add-face-text-property

add-face-text-property is a function defined in textprop.c.

Signature

(add-face-text-property START END FACE &optional APPEND OBJECT)

Documentation

Add the face property to the text from START to END.

FACE specifies the face to add. It should be a valid value of the face property (typically a face name or a plist of face attributes and values).

If any text in the region already has a non-nil face property, those face(s) are retained. This is done by setting the face property to a list of faces, with FACE as the first element (by default) and the pre-existing faces as the remaining elements.

If optional fourth argument APPEND is non-nil, append FACE to the end of the face list instead.

If optional fifth argument OBJECT is a buffer (or nil, which means the current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it.

Other relevant functions are documented in the text-properties group.

View in manual

Probably introduced at or before Emacs version 24.4.

Shortdoc

;; text-properties
(add-face-text-property START END '(:foreground "green"))

Source Code

// Defined in /usr/src/emacs/src/textprop.c
{
  AUTO_LIST2 (properties, Qface, face);
  add_text_properties_1 (start, end, properties, object,
			 (NILP (append)
			  ? TEXT_PROPERTY_PREPEND
			  : TEXT_PROPERTY_APPEND),
			 false);
  return Qnil;
}