Subject: 31.0.50; [PATCH] gnus: fix logo color customization
From: Trevor Arjeski <[email-masked]>
To: [email-masked]
Date: Wed, 27 Nov 2024 10:41:57 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

1. Add the following code to an init.el:

   (use-package gnus
     :ensure nil
     :custom
     (gnus-logo-color-style 'neutral))

2. Start emacs, M-x gnus, and notice that the logo does not change to
the neutral gray colors.

This does not seem to happen when using the Customization interface
which puts `custom-set-variables' in your init.el:

      (custom-set-variables
       '(gnus-logo-color-style 'neutral))

I'm not sure if this is related to use-package's :custom keyword, but I
have not come across this issue while using any other built-in emacs
packages.

Please see the attached patch file for a possible fix and minor
improvement.

Thanks,
Trevor

From f3d26de73e4362db837d20a3b0aa871f8b4ed345 Mon Sep 17 00:00:00 2001
From: Trevor Arjeski <[email-masked]>
Date: Wed, 27 Nov 2024 10:12:07 +0300
Subject: [PATCH] gnus: fix logo color customization

Fixes a bug where customizing `gnus-logo-color-style' from use-package's
:custom keyword did not set `gnus-logo-colors' before gnus is launched.

This patch does the following:
- Implements a :set keyword on `gnus-logo-color-style' which will
correctly set `gnus-logo-colors'
- Exposes `gnus-logo-colors' using `defcustom' for more fine-grained
customization
- Uses :set-after on `gnus-logo-colors' so that it is set after
`gnus-logo-color-style'
---
 lisp/gnus/gnus.el | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 62a090bd9df..ef07f34ca07 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -757,16 +757,22 @@ gnus-logo-color-alist
     (september "#bf9900" "#ffcc00"))
   "Color alist used for the Gnus logo.")
 
+(defcustom gnus-logo-colors nil
+  "Colors used for the Gnus logo."
+  :set-after '(gnus-logo-color-style)
+  :type '(list color color)
+  :group 'gnus-xmas)
+
 (defcustom gnus-logo-color-style 'ma
   "Color styles used for the Gnus logo."
   :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
 			   gnus-logo-color-alist))
+  :set (lambda (sym val)
+         (set-default-toplevel-value sym val)
+         (set-default-toplevel-value 'gnus-logo-colors
+                                     (cdr (assq val gnus-logo-color-alist))))
   :group 'gnus-xmas)
 
-(defvar gnus-logo-colors
-  (cdr (assq gnus-logo-color-style gnus-logo-color-alist))
-  "Colors used for the Gnus logo.")
-
 (defvar image-load-path)
 (declare-function image-size "image.c" (spec &optional pixels frame))
 
-- 
2.47.1

In GNU Emacs 31.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2024-11-14 built on trevarch
Repository revision: b83a45eab53b8e6d8f3be45c0acb9a42a5262cb0
Repository branch: makepkg
Windowing system distributor 'The X.Org Foundation', version 11.0.12101014
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-modules --without-m17n-flt --without-gconf
 --with-native-compilation=yes --with-xinput2 --with-x-toolkit=gtk3
 --without-xaw3d --with-sound=no --with-tree-sitter --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -Wno-implicit-function-declaration -g
 -ffile-prefix-map=/home/trev/Workspace/emacs-git/src=/usr/src/debug/emacs-git
 -flto=auto' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common -Wl,--as-needed
 -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto''

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

Important settings:
  value of $LC_ALL: en_US.UTF-8
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  server-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-spelling-mode: t
  erc-ring-mode: t
  erc-netsplit-mode: t
  erc-menu-mode: t
  erc-match-mode: t
  erc-list-mode: t
  erc-irccontrols-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  erc-imenu-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-networks-mode: t
  diff-hl-flydiff-mode: t
  global-diff-hl-mode: t
  diff-hl-mode: t
  bug-reference-prog-mode: t
  paredit-mode: t
  display-line-numbers-mode: t
  ligature-mode: t
  rainbow-delimiters-mode: t
  format-all-mode: t
  global-treesit-auto-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  savehist-mode: t
  vertico-mode: t
  undo-fu-session-global-mode: t
  undo-fu-session-mode: t
  which-key-mode: t
  electric-pair-mode: t
  global-auto-revert-mode: t
  desktop-save-mode: t
  recentf-mode: t
  save-place-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
~/.emacs.d//lisp/aoc hides /home/trev/.emacs.d/elpa/aoc-1.0.0/aoc
~/.emacs.d//lisp/launch-program hides /home/trev/.emacs.d/elpa/launch-program-1.0.0/launch-program
~/.emacs.d//lisp/my-secrets hides /home/trev/.emacs.d/elpa/my-secrets-1.0.0/my-secrets
/home/trev/.emacs.d/elpa/transient-20241115.2034/transient hides /usr/share/emacs/31.0.50/lisp/transient

Features:
(shadow sort mail-extr emacsbug ibuf-ext ibuffer ibuffer-loaddefs
nndraft nnmh gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-cache
gnus-sum shr pixel-fill kinsoku url-file svg dom gnutls nntp gnus-group
gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail
mail-source utf7 nnoo parse-time iso8601 gnus-spec gnus-int gnus-range
gnus-win magit-patch magit-extras face-remap magit-bookmark
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode git-commit magit-core magit-autorevert magit-margin
magit-transient magit-process with-editor shell server magit-mode
transient benchmark magit-git magit-base magit-section cursor-sensor crm
noutline outline lisp-mnt cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cape-char undo-fu whitespace cape shortdoc
reveal ace-window avy jka-compr comp comp-cstr warnings comp-run
comp-common helpful cc-langs cc-vars cc-defs trace cl-print edebug debug
backtrace info-look f elisp-refs s dash misearch multi-isearch pulse
help-fns radix-tree find-func xref project consult bookmark
network-stream nsm erc-track erc-spelling flyspell ispell erc-ring
erc-nicks erc-netsplit erc-menu erc-match erc-list erc-goodies erc-imenu
imenu erc-pcomplete pcomplete erc-button erc-fill erc-stamp erc-join
my-secrets cus-start epa-file erc format-spec erc-backend erc-networks
erc-common erc-compat erc-loaddefs mule-util orderless rainbow-mode
color diff-hl-flydiff diff diff-hl log-view log-edit message sendmail
yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader add-log
pcvs-util vc-dir ewoc vc vc-git diff-mode track-changes files-x
vc-dispatcher bug-reference thingatpt paredit display-line-numbers rx
ligature rainbow-delimiters format-all language-id inheritenv init gnus
nnheader gnus-util time-date mail-utils range mm-util mail-prsvr
cus-edit pp treesit-auto treesit corfu-popupinfo corfu marginalia
savehist vertico compat grep compile text-property-search comint
ansi-osc ansi-color ring cus-load finder-inf undo-fu-session which-key
diminish doom-themes-ext-org doom-nord-theme pcase doom-themes
doom-themes-base edmacro kmacro elec-pair autorevert filenotify desktop
frameset recentf tree-widget wid-edit saveplace use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source eieio eieio-core icons password-cache json subr-x map
byte-opt url-vars cl-macs gv cl-extra help-mode cl-seq use-package-core
cl-loaddefs cl-lib bytecomp byte-compile info ace-window-autoloads
aoc-autoloads avy-autoloads cape-autoloads consult-autoloads
corfu-autoloads debbugs-autoloads diff-hl-autoloads diminish-autoloads
doom-themes-autoloads eat-autoloads elfeed-autoloads envrc-autoloads
format-all-autoloads geiser-guile-autoloads geiser-autoloads
git-modes-autoloads helpful-autoloads elisp-refs-autoloads f-autoloads
inheritenv-autoloads language-id-autoloads launch-program-autoloads
leetcode-autoloads aio-autoloads ligature-autoloads log4e-autoloads
magit-autoloads magit-section-autoloads dash-autoloads
marginalia-autoloads markdown-mode-autoloads my-secrets-autoloads
nerd-icons-dired-autoloads nerd-icons-autoloads orderless-autoloads
paredit-autoloads rainbow-delimiters-autoloads rainbow-mode-autoloads
request-autoloads rust-mode-autoloads s-autoloads sly-autoloads
transient-autoloads treesit-auto-autoloads undo-fu-autoloads
undo-fu-session-autoloads vertico-autoloads with-editor-autoloads
ws-butler-autoloads early-init rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo gtk
x-toolkit xinput2 x multi-tty move-toolbar make-network-process
native-compile emacs)

Memory information:
((conses 16 917542 482327) (symbols 48 37245 16) (strings 32 163700 24966)
 (string-bytes 1 6520673) (vectors 16 77967) (vector-slots 8 1694574 293787)
 (floats 8 857 8668) (intervals 56 59063 1370) (buffers 992 39))