fix(themes/doom): correctly load theme when running in terminal

On macOS when running Emacs in a terminal, the ns-system-appearance
variable is defined, but set to nil. We now cater for that, and simply
default to loading the dark theme.
This commit is contained in:
2022-08-10 21:25:47 +01:00
parent 84fa1c39eb
commit e1fe7ef4e9

View File

@@ -29,12 +29,11 @@
(nlinum-highlight-current-line t)
:config
(if (boundp 'ns-system-appearance)
(progn
(siren-doom-themes-set-appearance ns-system-appearance)
(add-hook 'ns-system-appearance-change-functions
'siren-doom-themes-set-appearance))
(siren-doom-themes-set-appearance 'dark))
(if (not (siren-ns-system-appearance))
(siren-doom-themes-set-appearance 'dark)
(siren-doom-themes-set-appearance ns-system-appearance)
(add-hook 'ns-system-appearance-change-functions
'siren-doom-themes-set-appearance))
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
@@ -46,6 +45,16 @@
(doom-themes-org-config)
:preface
(defun siren-ns-system-appearance()
"Return the system appearance, either `dark', `light', or `nil'.
A return value of `nil' means that the system appearance is could
not be determined. This happens on non-macOS systems, or on macOS
if running Emacs in a terminal."
(if (boundp 'ns-system-appearance)
ns-system-appearance
nil))
(defgroup siren-doom-themes nil
"siren-doom-themes customizations."
:group 'doom-themes)