Subject: Re: bug#54598: 27.2; Bad interraction between modus-theme and hs-minor-mode

From: Pierre Téchoueyres <[email-masked]>
Date: Thu, 31 Mar 2022 21:24:16 +0200

Hello Protesilaos,
Le jeudi 31 mars 2022 à 16:08, Protesilaos Stavrou 
<[email-masked]> a écrit :
> ...
> Pierre, your suggestion to filter the custom-enabled-themes is 
> better
> than what we have.  Do you want to send it to me as a patch?
What dou you think of the attached one ?

> All the best,
Same here :-)
> Prot

Apart from that, do you know why the vertical line doesn't look 
the
same on Windows ?

>From 2e9802aceb9e2e77dd91f54a7727177038a35aec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pierre=20T=C3=A9choueyres?= <[email-masked]>
Date: Thu, 31 Mar 2022 21:16:42 +0200
Subject: [PATCH] Filter modus themes on modus-themes--current-theme

When custom-enabled-themes contains many themes, we're only
interrested by the first modus-* one.  This avoid a crash when
modus-themes--palette is called which complains that the first
theme returned by modus-themes--current-theme isn't either
modus-operandi or modus-vivendi (pcase use).
---
 modus-themes.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index 3f0e098..3a9a26e 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3191,8 +3191,9 @@ Those are stored in `modus-themes-faces' and
        (custom-theme-set-variables ',name ,@modus-themes-custom-variables))))
 
 (defun modus-themes--current-theme ()
-  "Return current theme."
-  (car custom-enabled-themes))
+  "Return current modus theme."
+  (car (seq-filter (lambda (arg) (string-match-p "^modus" (symbol-name arg)))
+                   custom-enabled-themes)))
 
 ;; Helper functions that are meant to ease the implementation of the
 ;; above customization variables.
-- 
2.35.1