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

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
> From: Antonio Romano <[email protected]>
> Cc: [email protected]
> Date: Mon, 24 Aug 2026 09:13:12 +0000
> 
> 
> To my previous message:
> 
> Antonio Romano <[email protected]> writes:
> > It says it does recalculate faces, but that's not always the case as
> > we've just said that reloading the theme is needed.

If you can suggest a more accurate documentation, based on everything
you've learned, feel free.

> I'm adding that I've been browsing custom theme codes over the web and
> found this[1] in solarized-theme.el:
> 
> --8<---------------cut here---------------start------------->8---
> (cl-defun solarized-update-background-mode
>     (appearance &optional (frames (frame-list)))
>   "Set the APPEARANCE of all frames to either 'light or 'dark.
> This is not specific to Solarized – it will update the appearance of any theme
> that observes the background characteristic."
>   (setq frame-background-mode appearance)
>   (mapc #'frame-set-background-mode frames)
>   ;; Supposedly #'frame-set-background-mode updates the faces, but it doesn’t
>   ;; seem to actually., so re-enable all the themes.
>   (mapc #'enable-theme (reverse custom-enabled-themes))
>   ;; For some reason, ‘enable-theme’ (or maybe ‘solarized’?) is resetting the
>   ;; ‘frame-background-mode’, so reset it here.
>   (setq frame-background-mode appearance))
> --8<---------------cut here---------------end--------------->8---
> 
> So it seems that reloading the theme is the way to go, and also that I'm
> not the only one confused by the way `frame-set-background-mode` operates.

Feel free to report a bug, if you think that's what it is.  I
personally won't touch this with a 3-mile pole, as this stuff is
already devilishly complex, what with all the possible ways of
customizing faces, but maybe some other brave soul will...
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.