Revert "Tweak how the modus-themes-toggle is done"

This reverts commit c9fa2b8d83.
This commit is contained in:
Protesilaos Stavrou 2025-09-28 20:16:30 +03:00
parent 69d949fb27
commit cf88cc5b13
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -1147,17 +1147,15 @@ Disable other themes per `modus-themes-disable-other-themes'."
;;;;; Toggle between two themes
(defun modus-themes-known-p (themes)
"Return THEMES if they are known.
Known themes are members of the `modus-themes-items' or the
`modus-themes-registered-items'."
(defun modus-themes--toggle-theme-p ()
"Return non-nil if `modus-themes-to-toggle' are valid."
(condition-case nil
(dolist (theme themes)
(or (memq theme modus-themes-registered-items)
(memq theme modus-themes-items)
(error "`%s' is not part of `modus-themes-items' or `modus-themes-registered-items'" theme)))
(dolist (theme modus-themes-to-toggle)
(or (memq theme modus-themes-items)
(memq theme (modus-themes--list-known-themes))
(error "`%s' is not part of `modus-themes-items'" theme)))
(error nil)
(:success themes)))
(:success modus-themes-to-toggle)))
;;;###autoload
(defun modus-themes-toggle ()
@ -1170,7 +1168,7 @@ Run `modus-themes-after-load-theme-hook' after loading the theme.
Disable other themes per `modus-themes-disable-other-themes'."
(declare (interactive-only t))
(interactive)
(if-let* ((themes (modus-themes-known-p modus-themes-to-toggle))
(if-let* ((themes (modus-themes--toggle-theme-p))
(one (car themes))
(two (cadr themes)))
(modus-themes-load-theme (if (eq (car custom-enabled-themes) one) two one))