From c5fd3dac043c838666fc28d3db5bb0ca95a4a066 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Sat, 11 Feb 2017 17:19:41 -0500 Subject: [PATCH] core: fix theme application Force theme do be disabled when applying them at the end of loading. Fix computation of theme package directory when theme is a symbol. Fixes #8319 --- core/core-spacemacs.el | 3 ++- core/core-themes-support.el | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/core/core-spacemacs.el b/core/core-spacemacs.el index 3f23a6ef5..9f700ef5c 100644 --- a/core/core-spacemacs.el +++ b/core/core-spacemacs.el @@ -210,7 +210,8 @@ defer call using `spacemacs-post-user-config-hook'." (with-current-buffer "*scratch*" (funcall dotspacemacs-scratch-mode))) (when spacemacs--delayed-user-theme - (spacemacs/load-theme spacemacs--delayed-user-theme)) + (spacemacs/load-theme spacemacs--delayed-user-theme + spacemacs--fallback-theme t)) (configuration-layer/display-summary emacs-start-time) (spacemacs-buffer//startup-hook) (spacemacs/check-for-new-version nil spacemacs-version-check-interval) diff --git a/core/core-themes-support.el b/core/core-themes-support.el index dcad5d887..99b8f952e 100644 --- a/core/core-themes-support.el +++ b/core/core-themes-support.el @@ -167,16 +167,16 @@ package name does not match theme name + `-theme' suffix.") (defvar spacemacs-post-theme-change-hook nil "Hook run after theme has changed.") -(defun spacemacs/get-theme-package-name (theme) +(defun spacemacs/get-theme-package-name (theme-name) "Returns the package theme for the given THEME name." (cond ;; built-in - ((memq theme emacs-built-in-themes) nil) + ((memq theme-name emacs-built-in-themes) nil) ;; from explicit alist - ((assq theme spacemacs-theme-name-to-package) - (cdr (assq theme spacemacs-theme-name-to-package))) + ((assq theme-name spacemacs-theme-name-to-package) + (cdr (assq theme-name spacemacs-theme-name-to-package))) ;; fallback to -theme - (t (intern (format "%S-theme" theme))))) + (t (intern (format "%S-theme" theme-name))))) (defun spacemacs//get-theme-name (theme) "Return the name of THEME." @@ -188,10 +188,11 @@ package name does not match theme name + `-theme' suffix.") "Return the THEME location on disk." (let* ((theme-name (spacemacs//get-theme-name theme)) (pkg-name (spacemacs/get-theme-package-name theme-name)) - (dir (configuration-layer/get-location-directory - pkg-name - (plist-get (cdr theme) :location) - 'dotfile))) + (dir (when (listp theme) + (configuration-layer/get-location-directory + pkg-name + (plist-get (cdr theme) :location) + 'dotfile)))) (unless dir ;; fallback to elpa directory (setq dir (configuration-layer/get-elpa-package-install-directory @@ -235,6 +236,7 @@ THEME." (setq-default spacemacs--cur-theme theme-name) (setq-default spacemacs--cycle-themes (cdr dotspacemacs-themes))) ('error + (message "error: %s" err) (if fallback-theme ;; fallback to Spacemacs default theme (progn