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

    Reinstate what we were doing with load-theme
    
    This undoes what I was trying to do with commits ef3e0e5 (use 'load'
    instead of 'load-themes') and 67b6db3 (let bind hooks to nil).
    
    What I did before was wrong. I was thrown off by the fact that
    'enable-theme-functions' works with all themes, not just colour
    themes. This includes 'user'. In some tests I also got other
    configuration themes like 'use-package' or even the ones that come
    from my 'fontaine' and 'spacious-padding' packages. But I did not
    bother to figure out when those themes would show up. By default,
    at least 'user' is passed to the 'enable-theme-functions'.
    
    With 'emacs -Q':
    
        (defun test (theme)
          (message "Current theme is `%s'" theme))
    
        (add-hook 'enable-theme-functions #'test)
    
        (load-theme 'modus-operandi)
    
        ;; ;; From the *Messages*:
        ;;
        ;; Current theme is ‘user’
        ;; Current theme is ‘modus-operandi’
---
 modus-themes.el | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index 06b0d3f635..6967ef30bf 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -3779,11 +3779,8 @@ Also see `modus-themes-get-themes'.")
   ;; `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))
-    (let ((file (locate-file (concat (symbol-name theme) "-theme.el")
-                             (custom-theme--load-path)
-                             '("" "c"))))
-      (load file nil t))
+              (custom-theme-p theme))
+    (load-theme theme t t)
     (add-to-list 'modus-themes--activated-themes theme)))
 
 (defun modus-themes--belongs-to-family-p (theme family)

Reply via email to