Automatic face re-application with frame-set-background-mode

Antonio Romano <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Hello,

I’m experimenting with themes on Emacs (using master branch) and
noticed some behavior related to `frame-set-background-mode` that I’d
like to clarify. 

I created a minimal working example theme as follows:

```
;; -*- lexical-binding: t; -*-
(deftheme mve-theme "Minimal MVE")

(custom-theme-set-faces
 'default
 `(default
   ((((background light)) :background "white" :foreground "black")
    (((background dark))  :background "black" :foreground "white")))
 `(mode-line
   ((((background light)) :background "yellow" :foreground "black")
    (((background dark))  :background "red" :foreground "white"))))

(provide-theme 'mve-theme)
```

Steps I performed:

Run `emacs -Q`
Load the theme with `M-x load-theme mve-theme`.
Call `(setopt frame-background-mode 'dark)`.

Notable observations:

* The fringe (unspecified in this theme) changes to black.
* The mode-line stays yellow.
* The default face does not change. This is true even with the
`default` theme.
* Syntax highlighting colors in emacs-lisp-mode update according to
background-mode.

It seems that some faces do get re-applied after a `background-mode`
switch, while others do not. Even when they do, they do not honor my
`custom-theme-set-faces` settings.

I’m trying to understand:

What conditions determine which faces are automatically recalculated
when `frame-set-background-mode` is called?
Is this behavior hardcoded for built-in faces only?
Are there plans or best practices for making theme faces reactive to
background-mode changes without manually reapplying the theme?

Thank you for any clarification or guidance.
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----

iIYEABYKAC4WIQQkAzVP7AL4iVYNHpAlonIBEqf0zwUCadpQPBAcY2lkcmFAcG9z
dGVvLml0AAoJECWicgESp/TPTykA/1kKuuRfbR8DdNkfn+udV5E7do4F9pAEtetR
rw/ptHQSAP0TrweK0oftlOwpoJgAOY6yAw+USaeOxI6Va+0m+5f0Dg==
=9FE0
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.