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

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

bug#54156: 28.0.91; set-face-attribute with a nil FRAME doesn't change t


From: Eli Zaretskii
Subject: bug#54156: 28.0.91; set-face-attribute with a nil FRAME doesn't change the default
Date: Fri, 25 Feb 2022 15:03:02 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: damien@cassou.me,  54156@debbugs.gnu.org
> Date: Fri, 25 Feb 2022 13:30:14 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Does this issue happen only with the nil values of :background?  If
> > so, may I ask what do you and Damien think should be the effect of
> > setting the background color of a face to nil?
> 
> That there is no background colour on the face -- that's the effect of
> doing that (but only on existing frames).

But that's not what nil does in this case.  It means the same as
'unspecified': that you have nothing to say about that particular
attribute.  So Emacs does nothing.

Think about it: any face attribute not explicitly mentioned in a
defface is set to 'unspecified' by the low-level code.  This is basic
in how faces are handled in Emacs; we cannot easily change that
without breaking gobs of code.

Moreover, attributes of the faces for future frames, the ones you get
by calling face-attribute with FRAME = t, are documented to be
'unspecified' by default.

The correct way to do what Damien wants (AFAIU) is this:

  (set-face-attribute 'region nil :background 'unspecified)
  (set-face-attribute 'region t :background 'unspecified)

That is, one must explicitly call set-face-attribute with FRAME = t
(as well as nil), and pass 'unspecified' (NOT nil!) as the value.
Maybe we should document that, although it is a obscure and unusual
thing to do.





reply via email to

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