GNU bug report logs - #57652
29.0.50; Warning setting attribute of face ‘term’

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Wed, 7 Sep 2022 18:50:01 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Akib Azmain Turja <akib <at> disroot.org>
To: David Ponce <da_vid <at> orange.fr>
Cc: Po Lu <luangruo <at> yahoo.com>, 57652 <at> debbugs.gnu.org, gregory <at> heytings.org
Subject: bug#57652: 29.0.50; Warning setting attribute of face ‘term’
Date: Thu, 08 Sep 2022 17:44:28 +0600
[Message part 1 (text/plain, inline)]
David Ponce <da_vid <at> orange.fr> writes:

> On 08/09/2022 07:02, Po Lu wrote:
>> David Ponce <da_vid <at> orange.fr> writes:
>> 
>>> diff --git a/term.el b/term.el
>>> index 797fb18074..c564a5429a 100644
>>> --- a/term.el
>>> +++ b/term.el
>>> @@ -755,17 +755,19 @@ ansi-term-color-vector
>>>      term-color-bright-cyan
>>>      term-color-bright-white])
>>>
>>> -(defcustom term-default-fg-color nil
>>> -  "If non-nil, default color for foreground in Term mode."
>>> +(defcustom term-default-fg-color 'unspecified
>>> +  "Default color for foreground in Term mode."
>>>     :group 'term
>>> -  :type '(choice (const nil) (string :tag "color")))
>>> +  :type '(choice (const unspecified)
>>> +                 (string :tag "color")))
>> Doesn't that change behavior?
>> i.e. wouldn't it be better to test that term-default-fg-color is not
>> nil
>> wherever the face is actually made that color?
>
> To be honest I don't know.  I reread the spec that says:
>
>    "Apart from the values given below, each face attribute can have the
> value ‘unspecified’.  This special value means that the face doesn’t
> specify that attribute directly.  An ‘unspecified’ attribute tells Emacs
> to refer instead to a parent face (see the description ‘:inherit’
> attribute below); or, failing that, to an underlying face (*note
> Displaying Faces::).  (However, ‘unspecified’ is not a valid value in
> ‘defface’.)"
>
> So it seems that unspecified is not allowed in defface.  So, how to
> specify a missing attribute excepted by using nil in the defface used
> in term.el?
>
> (defface term
>   `((t
>      :foreground ,term-default-fg-color
>      :background ,term-default-bg-color
>      :inherit default))
>   "Default face to use in Term mode."
>   :group 'term)
>
> Thanks!
>
>
>
>

How about the following?

--8<---------------cut here---------------start------------->8---
(defface term
  `((t
     ,@(when term-default-fg-color
         '(:foreground ,term-default-fg-color))
     ,@(when term-default-bg-color
         '(:background ,term-default-bg-color))
     :inherit default))
  "Default face to use in Term mode."
  :group 'term)
--8<---------------cut here---------------end--------------->8---

It would not mention the attributes if the colors are nil.

-- 
Akib Azmain Turja

Find me on Mastodon at @akib <at> hostux.social.

This message is signed by me with my GnuPG key.  Its fingerprint is:

    7001 8CE5 819F 17A3 BBA6  66AF E74F 0EFA 922A E7F5
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 2 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.