Subject: bug#77928: 31.0.50; ebcde0f90f6 (bug#77928) breaks :custom-face for themed faces

From: Michael Shields <[email-masked]>
Date: Sun, 8 Jun 2025 11:27:37 -0700

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 <[email-masked]> wrote:

> >>>>> Steven Allen <[email-masked]> 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
>