Document 'margin' face as base for margin display strings (Bug#80693)

* doc/lispref/display.texi (Displaying Faces): Note that the
underlying-text rule does not apply to strings displayed in the
display margins, and reword the margin-face bullet to describe
'margin' as the base.
(Basic Faces): Note that the 'margin' face also provides the base
attributes for strings displayed in the margins.
(Display Margins): Drop a sentence that restated the preceding one
about unspecified attributes inheriting from 'margin'.
* etc/NEWS: Document the change for margin strings.

Suggested by F. Jason Park <jp@neverwas.me>.
This commit is contained in:
Andrea Alberti 2026-05-31 23:11:02 +02:00 committed by Eli Zaretskii
parent cff9c8bc00
commit e33e9f7e85
2 changed files with 18 additions and 12 deletions

View file

@ -3535,13 +3535,14 @@ contain a @code{face} or @code{mouse-face} property, 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 (@pxref{Display Margins}).
buffer text. This does not apply to strings displayed in the display
margins, which use the @code{margin} face as the base instead
(@pxref{Display Margins}).
@item
If the text is to be shown in the display margins, and any given
attribute has not been specified during the preceding steps, Emacs
applies the attribute of the @code{margin} face.
If the text is to be shown in the display margins, Emacs uses the
@code{margin} face as the base, so any attribute not specified by the
string's own face is taken from @code{margin}.
@item
If any given attribute has not been specified during the preceding
@ -3825,7 +3826,9 @@ The basic face used for the text cursor.
@item margin
The basic face used for window margins, both on the left and on the
right. It is commonly used to customize the background of the empty
areas of the margins. It inherits from the @code{default} face.
areas of the margins, and it also provides the base attributes for
strings displayed in the margins (@pxref{Display Margins}). It
inherits from the @code{default} face.
@item mouse
The basic face used for displaying mouse-sensitive text when the mouse
@ -5921,12 +5924,9 @@ the before-string.
Note that if the string to be displayed in the margin doesn't fully
specify its face, the nonspecified attributes are inherited from the
@code{margin} face (@pxref{Basic Faces}). The face merging mechanism
ensures that the margin background remains consistent when margin
annotations specify only a foreground color. If you want a margin
string to have a specific appearance independent of the @code{margin}
face, make sure the string has a face specifying all required
attributes.
@code{margin} face (@pxref{Basic Faces}). If you want a margin string
to have a specific appearance independent of the @code{margin} face,
make sure the string has a face specifying all required attributes.
Before the display margins can display anything, you must give
them a nonzero width. The usual way to do that is to set these

View file

@ -95,6 +95,12 @@ left and right margin areas, which are used by various packages for
per-line annotations. Its background defaults to the frame default, so
existing behavior is unchanged for users who do not customize it.
Margin strings that do not fully specify their face now inherit the
unspecified attributes from the 'margin' face. If your code relied on
the face of the underlying buffer text to specify the face attributes of
strings displayed in the margin, you must now set their face on the margin
string itself via 'propertize'.
+++
** 'prettify-symbols-mode' attempts to ignore undisplayable characters.
Previously, such characters would be rendered as, e.g., white boxes.