GNU bug report logs - #77928
[PATCH] use-package :custom-face is meant to behave like custom-set-face

Previous Next

Package: emacs;

Reported by: Michael Shields <shields <at> msrl.com>

Date: Sat, 19 Apr 2025 20:42:02 UTC

Severity: normal

Tags: patch

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: Michael Shields <shields <at> msrl.com>
To: John Wiegley <johnw <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Steven Allen <steven <at> stebalien.com>, 77928 <at> debbugs.gnu.org
Subject: bug#77928: 31.0.50; ebcde0f90f6 (bug#77928) breaks :custom-face for themed faces
Date: Sun, 8 Jun 2025 11:27:37 -0700
[Message part 1 (text/plain, inline)]
I don't use themes either, but I can describe my use case.

I refactored much of my Emacs config into use-package. Most of that went
straightforwardly into :init, :bind, :hook, etc. Custom variables moved to
:custom, and custom faces moved to :custom-face. But this caused some faces
to change, because custom-set-faces effectively replaces the face
definition, while :custom-face overlaid it.

If I understand the history, :custom-face initially called
custom-set-faces, so it behaved identically to having custom-set-faces in
custom.el. But this confusingly resulted in :custom-face definitions being
written to custom.el as if the user had configured them through M-x
customize. https://github.com/jwiegley/use-package/pull/1004 fixed that,
unintentionally also changing the semantics of :custom-face.

With my patch applied, :custom-face should be equivalent in behavior to
custom-set-faces, but without the settings appearing as if they were
user-set.

I don't know how this should interact with themes. Maybe the right approach
there is to define a new personal theme and configure faces there instead
of using :custom-face. Or maybe it is simplest to call face-spec-set
explicitly from :config.


On Sun, Jun 8, 2025 at 10:46 AM John Wiegley <johnw <at> gnu.org> wrote:

> >>>>> Steven Allen <steven <at> stebalien.com> writes:
>
> > It would help to better understand how it was intended to behave:
>
> > - Should :custom-face override the theme or should the theme override
> >   :custom-face?
>
> I’ve never used themes before, so I wasn’t thinking of them at all when the
> feature was added. Someone who uses themes a lot, and customizes them,
> should
> be asked this question.
>
> > - Should customizations made via :custom-face be merged with the original
> >   face definition (as with `custom-set-faces') or should they completely
> >   replace the underlying face.
>
> I would expect the behavior to be whatever `custom-set-faces' does. Since
> use-package is only intended to expand to “best practice” Emacs Lisp, it
> shouldn’t add any new behavior in my opinion.
>
> --
> John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2
>
[Message part 2 (text/html, inline)]

This bug report was last modified 42 days ago.

Previous Next


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