Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M-x toggle-theme' née theme-choose-variant' ignores modus hooks. #112

Open
11fdriver opened this issue Jul 13, 2024 · 3 comments
Open

M-x toggle-theme' née theme-choose-variant' ignores modus hooks. #112

11fdriver opened this issue Jul 13, 2024 · 3 comments

Comments

@11fdriver
Copy link

The built-in function toggle-theme does not run hooks in modus-themes-after-load-theme-hook. It's probably not a big enough issue to be put into the modus package, but it did cause me a touch of confusion earlier today.

Perhaps a quick note could be put in the documentation? I advised theme-choose-variant to get what I wanted:

(defun maybe-run-modus-themes-after-load-theme-hooks ()
  (when (modus-themes--current-theme))
    (run-hooks 'modus-themes-after-load-theme-hook)))

(advice-add 'theme-choose-variant :after #'maybe-run-modus-themes-after-load-theme-hooks)

Cheers for all your work on the modus themes; I'm always deeply impressed when using them!

@protesilaos
Copy link
Owner

protesilaos commented Jul 17, 2024 via email

@11fdriver
Copy link
Author

Ah, an abnormal hook! (C-h v's words, not mine). It passes the current theme, so I've modified my stuff. Seeing as this is just a hook, would it make sense to add this into modus? It synchronises the behaviour of modus' own toggling commands and the built-in commands.

(defun maybe-run-modus-theme-hooks (theme)
  (when (memq theme '(modus-vivendi modus-operandi))
    (run-hooks 'modus-themes-after-load-theme-hook)))
(add-hook 'enable-theme-functions #'maybe-run-modus-theme-hooks)

@protesilaos
Copy link
Owner

protesilaos commented Jul 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants