Make spacemacs/cycle-spacemacs-theme work with themes with keywords

Themes can now contain keywords in addition to just the theme name like

   dotspacemacs-themes '((name :location (recipe :fetcher github
                                                    :repo "user/repo"))
                         solarized-light
                         solarized-dark)

However, for theme cycling, we first try to detect whether the current
theme (spacemacs--cur-theme) is in the list of cycleable themes and go on from
there. Since spacemacs--cur-theme is just a name, this fails when
spacemacs--cur-theme is the name of a theme that's specified with additional
keywords in dotspacemacs-themes.

To fix this, check if spacemacs--cur-theme is in the list of theme names.
This commit is contained in:
Wieland Hoffmann 2020-04-15 10:19:10 +02:00 committed by Maximilian Wolff
parent c191f06235
commit ed8fc556da
No known key found for this signature in database
GPG key ID: 2DD07025BFDBD89A

View file

@ -390,7 +390,8 @@ THEME."
"Cycle through themes defined in `dotspacemacs-themes'. "Cycle through themes defined in `dotspacemacs-themes'.
When BACKWARD is non-nil, or with universal-argument, cycle backwards." When BACKWARD is non-nil, or with universal-argument, cycle backwards."
(interactive "P") (interactive "P")
(let* ((themes (if backward (reverse dotspacemacs-themes) dotspacemacs-themes)) (let* ((theme-names (mapcar 'spacemacs//get-theme-name dotspacemacs-themes))
(themes (if backward (reverse theme-names) theme-names))
(next-theme (car (or (cdr (memq spacemacs--cur-theme themes)) (next-theme (car (or (cdr (memq spacemacs--cur-theme themes))
;; if current theme isn't in cycleable themes, start ;; if current theme isn't in cycleable themes, start
;; over ;; over