Rewrite modus-themes--activate for clarity

This commit is contained in:
Protesilaos Stavrou 2025-11-25 13:13:58 +02:00
parent 1d0348fc64
commit 01080b292b
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA

View file

@ -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."