Subject: 29.4; Bad face definitions in shell.el
From: Anders Lindgren <[email-masked]>
To: [email-masked]
Date: Mon, 20 Jan 2025 23:29:07 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

In `shell.el', there are a number of face definitions on the form:

(defface shell-highlight-undef-alias-face
  '((t :inherit 'font-lock-variable-name-face))
  "Face used for shell command aliases."
  :group 'shell
  :version "29.1")

Note that `font-lock-variable-name-face' is quoted, which it shouldn't be.

On one hand, Emacs seems to be able to display the face properly. On the
other hand, when trying to retrieve the face properties using
`face-attribute', it fails.

In the example below, this is demonstrated. If you evaluate each line in
*scratch* you will see this. (When inserting TEST into be buffer, the
'font-lock-face' property is used since the `face' property would
immediately be overwritten by font-lock.)

-------------------
(defface correct-inherit
  '((t :inherit font-lock-variable-name-face))
  "Correct inherited definition.")

(insert (propertize "TEST" 'font-lock-face 'correct-inherit))

(message "%s" (face-attribute 'correct-inherit :foreground nil t))

;; -----

(defface bad-inherit
  '((t :inherit 'font-lock-variable-name-face))
  "Correct inherited definition.")

(insert (propertize "TEST" 'font-lock-face 'bad-inherit))

(message "%s" (face-attribute 'bad-inherit :foreground nil t))
-------------------

I guess the main priority is to fix `shell.el', but it would be nice if
`face-attributes' would be able to retrieve the attribute values.

Sincerely,
    Anders Lindgren

Ps. I'm a long time Emacs user and developer with good knowledge regarding
faces.

In GNU Emacs 29.4 (build 1, aarch64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6.6 (Build 21G646)) of 2024-08-02 built on
 armbob.lan
Windowing system distributor 'Apple', version 10.3.2575
System Description:  macOS 15.1.1

Configured using:
 'configure --with-ns '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp' --with-modules 'CFLAGS=-DFD_SETSIZE=10000
 -DDARWIN_UNLIMITED_SELECT' --with-x-toolkit=no'

Configured features:
ACL GLIB GMP GNUTLS JPEG JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER
PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER ZLIB

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

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-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.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/ns-win ns-win ucs-normalize mule-util term/common-win 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 kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 37908 7520)
 (symbols 48 5047 0)
 (strings 32 13106 1867)
 (string-bytes 1 376429)
 (vectors 16 10396)
 (vector-slots 8 163820 11918)
 (floats 8 22 25)
 (intervals 56 304 0)
 (buffers 984 11))