diff options
| -rw-r--r-- | dotfiles-darwin/emacs/init.el | 2 | ||||
| -rw-r--r-- | emacs/functions.el | 20 |
2 files changed, 15 insertions, 7 deletions
diff --git a/dotfiles-darwin/emacs/init.el b/dotfiles-darwin/emacs/init.el index d5cb41d..c64e5cc 100644 --- a/dotfiles-darwin/emacs/init.el +++ b/dotfiles-darwin/emacs/init.el @@ -11,5 +11,7 @@ (when (or window-system (daemonp)) (my/with-add-hook 'after-init-hook + (when my/day-theme (load-theme my/day-theme :no-confirm :no-enable)) + (when my/night-theme (load-theme my/night-theme :no-confirm :no-enable)) (run-at-time nil (* 15 60) #'my/maybe-switch-theme my/day-theme my/night-theme #'my/macos-dark-p))) 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 |
