bug#81534: [PATCH] elisp-scope: Improve support for :inherit face specs

zach shaftel via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]> Sat, 01 Aug 2026 21:44:08 -0400
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
--=-=-=
Content-Type: text/plain

Tags: patch

This patches elisp-scope--match-spec-to-arg to recursively process
:inherit face specs, so now even complicated face specs like
(:inherit (:inherit (bold (:inherit underline)))) are correctly parsed.
I noticed this after defface forms inheriting from a list of faces
weren't being fontified the same as with a single inherited face name. I
changed a couple uses of (symbol . face) output specs to just `face' so
they utilize this.

-Zach

In GNU Emacs 32.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.52, cairo version 1.18.4) of 2026-06-26 built on arch-thinkpad
Repository revision: 98f3bfe7e1cbd8bc43fcfd62bf985471aa255e34
Repository branch: master
System Description: Arch Linux

Configured using:
 'configure --with-pgtk --with-native-compilation --with-tree-sitter
 --with-modules --without-gconf --without-gsettings --with-rsvg
 --without-compress-install 'CFLAGS=-O2 -g -mtune=native -march=native
 -fuse-ld=mold' 'CC=ccache gcc''


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-elisp-scope-Improve-support-for-inherit-face-specs.patch

From 49cc53ef6353293daaffa53dc1705039b80c00bc Mon Sep 17 00:00:00 2001
From: Zach Shaftel <[email protected]>
Date: Sat, 1 Aug 2026 21:33:40 -0400
Subject: [PATCH] elisp-scope: Improve support for :inherit face specs

* lisp/emacs-lisp/elisp-scope.el (elisp-scope--match-spec-to-arg):
Recursively parse :inherit properties in face plists. Replace some uses
of (symbol . face) specs with just `face'.
---
 lisp/emacs-lisp/elisp-scope.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/elisp-scope.el b/lisp/emacs-lisp/elisp-scope.el
index a81a7dfacaf..444813a7751 100644
--- a/lisp/emacs-lisp/elisp-scope.el
+++ b/lisp/emacs-lisp/elisp-scope.el
@@ -1818,7 +1818,7 @@ custom-declare-group
 
 (elisp-scope-define-function-analyzer custom-declare-face (face spec doc &rest args)
   (elisp-scope-1 face '(symbol . defface))
-  (elisp-scope-1 spec '(repeat . (cons t . (plist (:inherit . (symbol . face))))))
+  (elisp-scope-1 spec '(repeat . (cons t . (plist (:inherit . face)))))
   (elisp-scope-1 doc)
   (while-let ((kw (car-safe args))
               (bkw (elisp-scope--sym-bare kw))
@@ -1831,7 +1831,7 @@ custom-declare-face
 (elisp-scope-define-function-spec cl-typep (nil cl-type))
 
 (elisp-scope-define-function-spec pulse-momentary-highlight-region
-  (nil nil (symbol . face)))
+  (nil nil face))
 
 (elisp-scope--define-function-analyzer throw (&optional tag val) non-local-exit
   (elisp-scope-1 tag '(symbol . throw-tag))
@@ -2495,10 +2495,9 @@ elisp-scope--match-spec-to-arg
    (if (consp arg)
        (if (keywordp (elisp-scope--sym-bare (car arg)))
            ;; One face, given as a plist of face attributes.
-           '(plist (:inherit . (symbol . face)))
+           '(plist (:inherit . face))
          ;; Multiple faces.
-         '(repeat . (or (symbol . face)
-                        (plist (:inherit . (symbol . face))))))
+         '(repeat . face))
      '(symbol . face))
    arg))
 
-- 
2.55.0


--=-=-=--