emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/modus-themes 3c69034e87 2/2: Refactor modus-themes--tog


From: ELPA Syncer
Subject: [elpa] externals/modus-themes 3c69034e87 2/2: Refactor modus-themes--toggle-theme-p
Date: Tue, 17 Dec 2024 06:59:04 -0500 (EST)

branch: externals/modus-themes
commit 3c69034e87861e47fe1471b537798a954ebceac9
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Refactor modus-themes--toggle-theme-p
    
    It was returning modus-themes-to-toggle before, but the 'if' statement
    inside of the mapc was not doing what it was stating (mapc does not
    accumulate results).
    
    This is a cleaner design.
---
 modus-themes.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index cfa9a9d756..31a86734c1 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -1232,13 +1232,13 @@ Disable other themes per 
`modus-themes-disable-other-themes'."
 
 (defun modus-themes--toggle-theme-p ()
   "Return non-nil if `modus-themes-to-toggle' are valid."
-  (mapc
-   (lambda (theme)
-     (if (or (memq theme modus-themes-items)
-             (memq theme (modus-themes--list-known-themes)))
-         theme
-       (user-error "`%s' is not part of `modus-themes-items'" theme)))
-   modus-themes-to-toggle))
+  (condition-case nil
+      (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 modus-themes-to-toggle)))
 
 ;;;###autoload
 (defun modus-themes-toggle ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]