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

    Change the logic of modus-themes-get-current-theme
    
    The previous one was faulty because we would get "the first enabled
    Modus theme", even if it was not the current one. Whereas I want the
    "first enabled only if it is a Modus theme".
---
 modus-themes.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index fadfbafe3f..82ecd48435 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3845,8 +3845,10 @@ With optional SHOW-ERROR, throw an error instead of 
returning nil."
       themes)))
 
 (defun modus-themes-get-current-theme ()
-  "Return first enabled Modus theme."
-  (car (modus-themes--list-enabled-themes)))
+  "Return current enabled Modus theme."
+  (let ((current (car custom-enabled-themes)))
+    (when (memq current (modus-themes-get-themes))
+      current)))
 
 (defun modus-themes--get-theme-palette-subr (theme with-overrides 
with-user-palette)
   "Get THEME palette without `modus-themes-known-p'.

Reply via email to