help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding inherited face attributes


From: Stephen Berman
Subject: Re: Overriding inherited face attributes
Date: Tue, 27 Nov 2018 22:33:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Tue, 27 Nov 2018 22:18:45 +0200 Boris Buliga <boris@d12frosted.io> wrote:

> Hi everyone,
>
> Sorry if this question was answered somewhere before. I searched and didn't
> find any working solution, so here I am.
>
> Problem. Override a face attribute that is defined in an inherited face.
>
> For example, open up a new buffer in the fundamental mode and evaulate the
> following experssion:
>
> (insert (propertize "hello" 'face '(:foreground "red" :inherit (:foreground
> "orange"))))
>
> I expect the word 'hello' to be red, but instead, it is orange.
>
> So two questions:
>
> 1. Am I right to expect the text to be red?
> 2. How to achieve this?

I don't know the answer to your first questions, but the answer to the
second question appears to be: switch the order.  At least, when I
evaluate the following in fundamental mode, 'hello' is red:

(insert (propertize "hello" 'face '(:inherit (:foreground "orange")
:foreground "red")))

In (info "(elisp) Special Properties") it says this: "The value of the
[`face'] property can be... A list of faces... Faces occurring earlier
in the list have higher priority."  And in (info "(elisp) Face
Attributes") it says: "Attributes from inherited faces are merged into
the face like an underlying face would be, with higher priority than
underlying faces."  Whether this implies the above observed behavior is
not clear to me.

Steve Berman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]