Subject: bug#57652: 29.0.50; Warning setting attribute of face ‘term’

From: David Ponce <[email-masked]>
Date: Wed, 7 Sep 2022 20:49:06 +0200

Hello,

Since below commit:

Gregory Heytings <[email-masked]>	2022-09-02 22:30:25 +0200
commit	d0a66f3e0e668d8c12c54436740c62f8e238a664
Display a warning for some uses of nil in face attributes.
* src/xfaces.c (HANDLE_INVALID_NIL_VALUE): New macro, which displays
a warning for invalid uses of nil as a face attribute value.
(Finternal_set_lisp_face_attribute): Use the macro for the attributes
:foreground, :distant-foreground and :background.

When opening a term window (M-x term) for the 1st time, the below 
messages are displayed in the *Messages* buffer:

Warning: setting attribute ‘:foreground’ of face ‘term’: nil value is 
invalid, use ‘unspecified’ instead.
Warning: setting attribute ‘:background’ of face ‘term’: nil value is 
invalid, use ‘unspecified’ instead.

The small patch below fixed the issue for me:

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")))
  (make-obsolete-variable 'term-default-fg-color "use the face `term' 
instead."
                          "24.3")

-(defcustom term-default-bg-color nil
-  "If non-nil, default color for foreground in Term mode."
+(defcustom term-default-bg-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")))
  (make-obsolete-variable 'term-default-bg-color "use the face `term' 
instead."
                          "24.3")

Thanks!

Configured using:
  'configure --with-x-toolkit=gtk3 --with-cairo
  PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LC_TIME: fr_FR.utf8
   value of $LANG: fr_FR.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
   shell-dirtrack-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.