When Emacs displays a given piece of text, the visual appearance of the text may be determined by faces drawn from different sources. If these various sources together specify more than one face for a particular character, Emacs merges the attributes of the various faces. Here is the order in which Emacs merges the faces, from highest to lowest priority:
regionface. See Standard Faces in The GNU Emacs Manual.
faceproperty, Emacs applies the face(s) specified by that property. If the overlay has a
mouse-faceproperty and the mouse is near enough to the overlay, Emacs applies the face or face attributes specified by the
mouse-faceproperty instead. See Overlay Properties.
When multiple overlays cover one character, an overlay with higher priority overrides those with lower priority. See Overlays.
mouse-faceproperty, Emacs applies the specified faces and face attributes. See Special Properties. (This is how Font Lock mode faces are applied. See Font Lock Mode.)
mode-lineface. For the mode line of a non-selected window, Emacs applies the
mode-line-inactiveface. For a header line, Emacs applies the
header-lineface. For a tab line, Emacs applies the
after-stringproperties (see Overlay Properties), or from a display string (see Other Display Specs), and the string doesn’t contain a
mouse-faceproperty, or these properties leave some face attributes undefined, but the buffer text affected by the overlay/display property does define a face or those attributes, Emacs applies the face attributes of the “underlying” buffer text. Note that this is so even if the overlay or display string is displayed in the display margins (see Display Margins).
At each stage, if a face has a valid
Emacs treats any attribute with an
unspecified value as having
the corresponding value drawn from the parent face(s). see Face Attributes. Note that the parent face(s) may also leave the
attribute unspecified; in that case, the attribute remains unspecified
at the next level of face merging.