unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Overriding inherited face attributes
Date: Wed, 28 Nov 2018 13:24:51 +0100	[thread overview]
Message-ID: <87in0h1jak.fsf@rub.de> (raw)
In-Reply-To: <83sgzlg1w7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 28 Nov 2018 08:19:20 +0200")

On Wed, 28 Nov 2018 08:19:20 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Date: Tue, 27 Nov 2018 22:33:23 +0100
>> Cc: help-gnu-emacs@gnu.org
>> 
>> 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.
>
> Is it really not clear?  What part(s) make(s) the above text not
> clear about the order in which the face attributes are applied?

The text itself is clear in the abstract, and when I apply it to the
example Boris gave, it seems to explain the observed result.  That is,
given this form:

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

and given that "Faces occurring earlier in the list have higher
priority", I would expect the displayed face to be red, as Boris did.
But it's different with the `inherit' property: "Attributes from
inherited faces are merged into the face like an underlying face would
be, with higher priority than underlying faces".  So that explains why
the face is displayed as orange.  But then I observed that merely
switching the order:

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

makes the face display as red, and this seems to conflict with the above
documentation.  Maybe I'm misunderstanding the doc, but in any case,
because of the difference from switching the order of the properties,
it's not clear to me.

(The same seems to go for form Boris gave in his followup, which you
suggested is syntactically incorrect, but does evaluate without error
and displays a red face; as Boris noted, that syntax is the same as the
result of applying add-face-text-property.)

Steve Berman



  reply	other threads:[~2018-11-28 12:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 20:18 Overriding inherited face attributes Boris Buliga
2018-11-27 21:33 ` Stephen Berman
2018-11-28  6:19   ` Eli Zaretskii
2018-11-28 12:24     ` Stephen Berman [this message]
2018-11-28 13:06       ` Eli Zaretskii
2018-11-28 13:13         ` Stephen Berman
2018-11-28 16:18           ` Eli Zaretskii
2018-11-28 20:01             ` Stephen Berman
2018-11-28 20:35               ` Eli Zaretskii
2018-11-28 21:34                 ` Stephen Berman
2018-11-29  7:14                   ` Eli Zaretskii
2018-11-29 17:30                     ` Stephen Berman
2018-11-28 21:44                 ` Boris Buliga
2018-11-29  7:08                   ` Eli Zaretskii
2018-11-28  7:39   ` Boris Buliga
2018-11-28  7:51     ` Eli Zaretskii
2018-11-28  8:42       ` Boris Buliga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87in0h1jak.fsf@rub.de \
    --to=stephen.berman@gmx.net \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).