reddit / emacs

cutsom-theme-set-faces changes don't persist reloading my config

WallyMetropolis · 2022-06-30 01:36
Relevant part of my config is here: (use-package modus-themes :config (modus-themes-load-themes) (modus-themes-load-operandi)) (custom-theme-set-faces 'modus-operandi '(org-block ((t (:background "#cfd8dc"))))) (custom-theme-set-faces 'modus-operandi '(org-block-begin-line ((t (:background "#cfd8dc"))))) (custom-theme-set-faces 'modus-operandi '(org-block-end-line ((t (:background "#cfd8dc"))))) Starting emacs, I get the desired effect: nicely colored org src blocks. But if I re-load the config (which a do with a keybinding that calls `(load-file "personal-config.el")`) the customization is no longer applied. Inspecting the org-block face, it shows the background to be unspecified. [This emacs.stackechange question](https://emacs.stackexchange.com/questions/28940/how-to-overwrite-properly-a-face-for-a-particular-theme) proposes a solution but it seems weird to me to handle things this way. Can anyone explain *why* this happens? It feels as though reloading the config shouldn't cause this to happen. Nor should changing themes with the `theme-looper` package with just wraps disabling one theme and enabling the next into a single command. I just noticed that if I: 1. reload emacs config 2. eval the custom-theme-set-faces 3. enable modus-operandi then the colored org blocks appear again. I commented out everything in my init apart from bootstrapping use-package and this portion setting up the themes and the early-init that does stuff like inhibiting the startup screen and turning off the menu bar, tool bar, and scroll bar.
0xMii · 2022-07-01 18:30
Could this be why: https://emacs.stackexchange.com/questions/48365/custom-theme-set-faces-does-not-work-in-emacs-27 For what it’s worth, I customize my themes with `use-package`’s `:custom-face` keyword and that works fine even on reload. Maybe give that a try. The syntax is the same as for `custom-theme-set-faces`.
WallyMetropolis · 2022-07-06 17:12
This is a promising lead. I'll have to learn more about enable vs load for themes, and what the user theme is.