[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: face-attribute returns wrong foreground color for inheriting face.
From: |
Miles Bader |
Subject: |
Re: face-attribute returns wrong foreground color for inheriting face. |
Date: |
28 Oct 2001 16:50:54 +0900 |
Hi David,
A long time ago you sent a bug report complaining that `face-attribute',
`face-foreground', etc. returned `unspecified' for faces that inherit
an attribute through their :inherit attribute.
Since it didn't seem to be an urgent problem, addressing this was
postponed until after 21.1 was released.
The following is my proposed change to the `face-attribute' function to
provide a solution to this problem. I basically added the INHERIT
parameter:
(defun face-attribute (face attribute &optional frame inherit)
"Return the value of FACE's ATTRIBUTE on FRAME.
If the optional argument FRAME is given, report on face FACE in that frame.
If FRAME is t, report on the defaults for face FACE (for new frames).
If FRAME is omitted or nil, use the selected frame.
If INHERIT is nil, only attributes directly defined by FACE are considered,
so the return value may be `unspecified', or a relative value.
If INHERIT is non-nil, FACE's definition of ATTRIBUTE is merged with
the faces specified by its `:inherit' attribute; however the return
value may still be `unspecified' or relative.
If INHERIT is a face or a list of faces, then the result is further merged
with that face (or faces), until it becomes specified and absolute.
To ensure that the return value is always specified and absolute, use a
value of `default' for INHERIT; this will resolve any unspecified or
relative values by merging with the `default' face (which is always
completely specified)."
...)
[`face-foreground', `face-background', and `face-stipple' are similarly
changed]
Does this seem like it addresses your problem?
Thanks,
-Miles
--
`Cars give people wonderful freedom and increase their opportunities.
But they also destroy the environment, to an extent so drastic that
they kill all social life' (from _A Pattern Language_)
- Re: face-attribute returns wrong foreground color for inheriting face.,
Miles Bader <=