ErgoEmacsEmacsLispBlogEmacsLispBuy Tutorial

38.12.6 Functions for Working with Faces

Here are additional functions for creating and working with faces.

— Function: make-face name

This function defines a new face named name, initially with all attributes nil. It does nothing if there is already a face named name.

— Function: face-list

This function returns a list of all defined face names.

— Function: copy-face old-face new-name &optional frame new-frame

This function defines a face named new-name as a copy of the existing face named old-face. It creates the face new-name if that doesn't already exist.

If the optional argument frame is given, this function applies only to that frame. Otherwise it applies to each frame individually, copying attributes from old-face in each frame to new-face in the same frame.

If the optional argument new-frame is given, then copy-face copies the attributes of old-face in frame to new-name in new-frame.

— Function: face-id face

This function returns the face number of face face. This is a number that uniquely identifies a face at low levels within Emacs. It is seldom necessary to refer to a face by its face number.

— Function: face-documentation face

This function returns the documentation string of face face, or nil if none was specified for it.

— Function: face-equal face1 face2 &optional frame

This returns t if the faces face1 and face2 have the same attributes for display.

— Function: face-differs-from-default-p face &optional frame

This returns non-nil if the face face displays differently from the default face.

A face alias provides an equivalent name for a face. You can define a face alias by giving the alias symbol the face-alias property, with a value of the target face name. The following example makes modeline an alias for the mode-line face.

     (put 'modeline 'face-alias 'mode-line)
— Function: define-obsolete-face-alias obsolete-face current-face &optional when

This function defines a face alias and marks it as obsolete, indicating that it may be removed in future. The optional string when indicates when the face was made obsolete (for example, a release number).

blog comments powered by Disqus