branch: externals/modus-themes
commit 01080b292b8a034476f8804b4fe35997fc9bd61e
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Rewrite modus-themes--activate for clarity
---
 modus-themes.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index c54bc2de99..82aaabbc60 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3789,10 +3789,14 @@ Also see `modus-themes-get-themes'.")
   ;; NOTE 2025-09-29: We need to do this instead of pushing to the
   ;; `custom-known-themes' because loading the theme has the desired
   ;; side effect of adding the relevant `theme-properties' to it.
-  (unless (and (memq theme modus-themes--activated-themes)
-               (custom-theme-p theme))
-    (load-theme theme t t)
-    (add-to-list 'modus-themes--activated-themes theme)))
+  (let ((not-registered-p (not (memq theme modus-themes--activated-themes))))
+    (cond
+     ((or (and (memq theme custom-enabled-themes) not-registered-p)
+          (and (custom-theme-p theme) not-registered-p))
+      (add-to-list 'modus-themes--activated-themes theme))
+     ((not (memq theme modus-themes--activated-themes))
+      (load-theme theme t t)
+      (add-to-list 'modus-themes--activated-themes theme)))))
 
 (defun modus-themes--belongs-to-family-p (theme family)
   "Return non-nil if THEME has FAMILY property."

Reply via email to