Enhance theme handling

- Restrict default theme code to spaceacs/load-theme
- Don't download package for default
- Explicitly call post-theme-init for default
- Explicitly disable existing themes when loading
This commit is contained in:
Eivind Fonn 2016-01-23 14:40:24 +01:00
parent 86dd7926b7
commit 2d29953200
2 changed files with 13 additions and 8 deletions

View File

@ -73,8 +73,7 @@
(configuration-layer/initialize)
;; default theme
(let ((default-theme (car dotspacemacs-themes)))
(unless (string= "default" (car dotspacemacs-themes))
(spacemacs/load-theme default-theme))
(spacemacs/load-theme default-theme)
;; protect used themes from deletion as orphans
(setq configuration-layer--protected-packages
(append

View File

@ -9,7 +9,7 @@
;;
;;; License: GPLv3
(defconst emacs-built-in-themes (custom-available-themes)
(defconst emacs-built-in-themes (cons 'default (custom-available-themes))
"List of emacs built-in themes")
(defface org-kbd
@ -167,7 +167,8 @@ package name does not match theme name + `-theme' suffix.")
(eq 'solarized-dark theme))
(spacemacs/load-or-install-package 'dash))
;; Unless Emacs stock themes
(unless (memq theme (custom-available-themes))
(unless (or (memq theme (custom-available-themes))
(eq 'default theme))
(cond
;; themes with explicitly declared package names
((assq theme spacemacs-theme-name-to-package)
@ -184,10 +185,15 @@ package name does not match theme name + `-theme' suffix.")
;; if not we will handle the special themes as we get issues in the tracker.
(let ((pkg (spacemacs//get-theme-package theme)))
(spacemacs/load-or-install-package pkg)))))
(load-theme theme t)
;; explicitly reload the theme for the first GUI client
(eval `(spacemacs|do-after-display-system-init
(load-theme ',theme t))))
(mapc 'disable-theme custom-enabled-themes)
(if (eq 'default theme)
(progn
(setq spacemacs--cur-theme 'default)
(spacemacs/post-theme-init 'default))
(load-theme theme t)
;; explicitly reload the theme for the first GUI client
(eval `(spacemacs|do-after-display-system-init
(load-theme ',theme t)))))
(defun spacemacs/cycle-spacemacs-theme ()
"Cycle through themes defined in `dotspacemacs-themes.'"