From c5e5e1dfb808efa8724a993771e5258e728f83d1 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 26 Apr 2026 18:01:30 -0500 Subject: fix: omit :foreground from emoji icon face when no color provided The font branch of wttrin--make-emoji-icon built its face plist with `:foreground foreground` even when foreground was nil, producing a literal `(:family ... :height 1.0 :foreground nil)`. The mode-line redisplays many times per second, and Emacs validates faces on every redisplay. A single fresh-cache state produced hundreds of "Invalid face attribute :foreground nil" warnings in *Messages*. The bug's been live since 2026-02-21 (b74b98f). The 130bbc07 helper extraction kept it in place. Switch to backquote splicing so the :foreground key is included only when foreground is non-nil. Behavior is identical on the colored path. On the nil path the emoji renders with the default mode-line color, the same visible result as before, without the warning flood. --- wttrin.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wttrin.el b/wttrin.el index d09a64a..0f84f7a 100644 --- a/wttrin.el +++ b/wttrin.el @@ -597,12 +597,15 @@ user's original casing so tooltips display what the user expects." (defun wttrin--make-emoji-icon (emoji &optional foreground) "Create EMOJI string with optional font face and FOREGROUND color. -Uses `wttrin-mode-line-emoji-font' when configured." +Uses `wttrin-mode-line-emoji-font' when configured. +Omits `:foreground' from the face plist when FOREGROUND is nil — a literal +`:foreground nil' entry triggers \"Invalid face attribute\" warnings on every +redisplay." (if wttrin-mode-line-emoji-font (propertize emoji - 'face (list :family wttrin-mode-line-emoji-font - :height 1.0 - :foreground foreground)) + 'face `(:family ,wttrin-mode-line-emoji-font + :height 1.0 + ,@(when foreground (list :foreground foreground)))) (if foreground (propertize emoji 'face (list :foreground foreground)) emoji))) -- cgit v1.2.3