emacs-devel
[Top][All Lists]
Advanced

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

RE: About the :distant-foreground face attribute


From: Drew Adams
Subject: RE: About the :distant-foreground face attribute
Date: Wed, 8 Jan 2014 08:57:53 -0800 (PST)

The foreground attribute for a face should always reflect the actual
appearance of that face (in isolation - this is not about the effects
of combining faces etc.).  Anything different from that is asking for
trouble.

IIUC, this change was made because on some platforms the default
color for the `region' face background is inappropriate, given
the default color for its foreground.

To me, that sounds like the kind of thing that Eli recently
declared to be not-an-Emacs-problem.  But so be it - if Emacs can
reasonably work around that problem, why not?

If Emacs wants to make an attempt to compensate for that bad
defaulting behavior, then I would think that the right approach
would be to automatically tweak the color of the `region' face's
foreground attribute itself.  And preferably only for those
situations where the problem actually arises.

Adding a variable, as Yidong suggested, just spreads the
pollution of this misguided fix across all faces.  And it still
does not sync the attribute value with the appearance.  What the
attribute says you should get is not what you get.  The color is
being changed behind the back of the face spec.

If the face attribute value does not reflect the face appearance
for an attribute, code that examines that attribute, e.g., to base
its behavior on what the face's foreground is, will likely not DTRT.
And code that modifies the face's foreground attribute will likewise
likely not do what it is expected to do.  Code becomes less
transparent and dependable.

Foreground attribute and actual foreground should be and remain
one-to-one - no surprises (again, not counting face mergings etc.).

Can't you please find a way to keep the foreground attribute in
sync with the actual foreground color you need in this scenario?
Can't you perform whatever machinations are needed to change the
foreground attribute itself so that you get the visual effect
needed?

OK, so changing the attribute overrides whatever setting the user
might fix for the attribute.  But that would be done only when
the problem arises.  And it should be done only with the user's
permission.

IOW, I agree with Stefan (almost mentioned it myself) that users
and Lisp code should be able, for whatever reason, to specify
that the foreground and background for a given face are the
exact same color.  IOW, any automatic overriding of what the
face definition specifies should be optional, under user control.

And that user control should be *per face*.  One should not be
obliged to choose either preventing the overriding or allowing it
for all faces.  The choice should be a function of the particular
face.  Now *that* could be done using a new face attribute, if you
want.  (Or a function.)

The important thing is to preserve the correspondence between
each face's current appearance and its current attribute values.



reply via email to

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