diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-02-12 13:51:23 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-02-12 13:54:46 +0000 |
| commit | 6a5c0258141fc49b3b53db70e46f271ee7efc059 (patch) | |
| tree | 6474895c1b2ea4d8c53c0a052b3ec79add328a32 /emacs/functions.el | |
| parent | b3162b3adb75dd7856329d7bebf8b91bcbbf47ed (diff) | |
emacs: Allow nil themes in ‘my/maybe-switch-theme’
Also, load themes separately.
Diffstat (limited to 'emacs/functions.el')
| -rw-r--r-- | emacs/functions.el | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/emacs/functions.el b/emacs/functions.el index 37686b3..11db1ee 100644 --- a/emacs/functions.el +++ b/emacs/functions.el @@ -44,15 +44,21 @@ of the region if it is active." If ENABLE-DARK-THEME-P returns a non-nil value, then DARK-THEME is enabled and LIGHT-THEME is disabled, unless DARK-THEME is -already enabled. The opposite happens if ENABLE-DARK-THEME-P -returns nil." +already enabled, undefined, or nil. The opposite happens if +ENABLE-DARK-THEME-P returns nil, unless if LIGHT-THEME is nil, in +which case only DARK-THEME is disabled, and nothing else is +enabled." (if (funcall enable-dark-theme-p) - (unless (member dark-theme custom-enabled-themes) - (load-theme dark-theme :no-confirm) + (when (and (custom-theme-p dark-theme) + (not (custom-theme-enabled-p dark-theme))) + (enable-theme dark-theme) (disable-theme light-theme)) - (unless (member light-theme custom-enabled-themes) - (load-theme light-theme :no-confirm) - (disable-theme dark-theme)))) + (if (and (not light-theme) (custom-theme-enabled-p dark-theme)) + (disable-theme dark-theme) + (when (and (custom-theme-p light-theme) + (not (custom-theme-enabled-p light-theme))) + (enable-theme light-theme) + (disable-theme dark-theme))))) ;; “Window Management” Functions |
