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

    Refine how we disable other themes
    
    We do not need to actually disable other Modus themes because their
    palettes have the same entries, so the active theme will anyway take
    effect over the others. And if another Modus theme has more colours in
    its palette, then the user probably wants to keep those around.
---
 modus-themes.el | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index 8c601cfd89..015c95f7e0 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3896,13 +3896,10 @@ for the user-defined palette extension.
 If THEME is unknown, return nil.  Else return (append OVERRIDES USER CORE)."
   (modus-themes--get-theme-palette-subr (or theme 
(modus-themes-get-current-theme)) with-overrides with-user-palette))
 
-(defun modus-themes--disable-themes ()
-  "Disable themes per `modus-themes-disable-other-themes'."
-  (mapc
-   #'disable-theme
-   (if modus-themes-disable-other-themes
-       custom-enabled-themes
-     (modus-themes-get-themes))))
+(defun modus-themes--disable-themes (themes)
+  "Disable THEMES per `modus-themes-disable-other-themes'."
+  (when modus-themes-disable-other-themes
+    (mapc #'disable-theme themes)))
 
 (defun modus-themes-load-theme (theme &optional hook)
   "Load THEME while disabling other themes.
@@ -3914,8 +3911,8 @@ Run the `modus-themes-after-load-theme-hook' as the final 
step
 after loading the THEME.  If HOOK, then call that instead.
 
 Return THEME."
-  (modus-themes--disable-themes)
   (load-theme theme :no-confirm)
+  (modus-themes--disable-themes (remq theme custom-enabled-themes))
   (run-hooks (or hook 'modus-themes-after-load-theme-hook))
   theme)
 

Reply via email to