GNU bug report logs - #64725
30.0.50; set-face-foreground shows background colors

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Wed, 19 Jul 2023 07:10:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Helmut Eller <eller.helmut <at> gmail.com>
To: 64725 <at> debbugs.gnu.org
Subject: bug#64725: 30.0.50; set-face-foreground shows background colors
Date: Wed, 19 Jul 2023 09:09:11 +0200
[Message part 1 (text/plain, inline)]
When I try to set the foreground color of a face, e.g. with:

  M-x set-face-foreground RET font-lock-string-face RET

and then press TAB to see the available colors, then Emacs displays the
list of colors as background with text in the default foreground.

It would be more useful to see the text with the candidate color as
foreground on the default background.

Maybe you could consider this patch:

[faces.patch (text/x-diff, inline)]
diff --git a/lisp/faces.el b/lisp/faces.el
index 44d64c743ba..6233afb0d4d 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1340,10 +1340,11 @@ read-face-attribute
 		       (format "%s" old-value))))
 	     (setq new-value
                    (if (memq attribute '(:foreground :background))
-                       (let ((color
-                              (read-color
-                               (format-prompt "%s for face `%s'"
-                                              default attribute-name face))))
+                       (let* ((prompt (format-prompt
+                                       "%s for face `%s'"
+                                       default attribute-name face))
+                              (fg (eq attribute ':foreground))
+                              (color (read-color prompt nil nil nil fg)))
                          (if (equal (string-trim color) "")
                              default
                            color))
[Message part 3 (text/plain, inline)]


In GNU Emacs 30.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-07-19 built on caladan
Repository revision: 8b1c92da79f967172afc3214bc9ee58bd08ddc17
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-xpm=ifavailable --with-jpeg=ifavailable
 --with-gif=ifavailable --with-tiff=ifavailable'

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

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

This bug report was last modified 1 year and 290 days ago.

Previous Next


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