I have the follow hl-todo configuration in my init.el file:
(use-package hl-todo
:ensure t
:custom
(hl-todo-keyword-faces '(("TODO" . "#ff0000")
("HACK" . "#ff0000")
("XXX" . "#ff0000")
("PERF" . "#ff0000")
("NB" . "#ff0000")
("NOTE" . "#ff0000")))
:config
(global-hl-todo-mode 1))
When I use the command `M-x modus-themes-toggle`, my color settings are
overridden by modus. I believe this happens in modus-themes.el at line
7470.
Extra information:
- GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
cairo version 1.17.6) of 2022-05-14
- M-x modus-themes-version: 2.4.0-dev
Hello Vincent!
> From: Vincent Foley <vincent@era.co>> Date: Wed, 25 May 2022 12:58:46 -0400>> I have the follow hl-todo configuration in my init.el file:>> [... 11 lines elided]>> When I use the command `M-x modus-themes-toggle`, my color settings are> overridden by modus. I believe this happens in modus-themes.el at line> 7470.
Please try this:
(defun my-modus-themes-hl-todo-faces ()
(setq hl-todo-keyword-faces '(("TODO" . "#ff0000")
("HACK" . "#ff0000")
("XXX" . "#ff0000")
("PERF" . "#ff0000")
("NB" . "#ff0000")
("NOTE" . "#ff0000"))))
(add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-hl-todo-faces)
Does it work for you?
* * *
We normally don't configure user options, but we have to do it for
hl-todo-keyword-faces because (i) it is about colours which to the
end-user look like any other face and (ii) the colours used by default
are not always legible enough.
--
Protesilaos Stavrou
https://protesilaos.com
> Does it work for you?
This is how I made it work:
(use-package hl-todo
:ensure t
:after modus-themes
:config
(defun vfb/hl-todo-colors ()
(interactive)
(setq hl-todo-keyword-faces '(("TODO" . "#ff0000")
("HACK" . "#ff0000")
("XXX" . "#ff0000")
("PERF" . "#ff0000")
("NB" . "#ff0000")
("NOTE" . "#ff0000"))))
(add-hook 'modus-themes-after-load-theme-hook #'vfb/hl-todo-colors)
(vfb/hl-todo-colors)
(global-hl-todo-mode 1))
Not the prettiest, but it works.
Thanks for the help,
Vincent.
> From: Vincent Foley <vincent@era.co>> Date: Wed, 25 May 2022 20:33:02 -0400>>> Does it work for you?>> This is how I made it work:>> [... 16 lines elided]>> Not the prettiest, but it works.
I see. I cannot think of a cleaner way to reconcile these competing
priorities: (i) let the theme provide reasonable defaults and (ii) allow
the user to customise/override them. If you have any ideas, please let
me know.
> Thanks for the help,
You are welcome!
--
Protesilaos Stavrou
https://protesilaos.com
> From: Christian Tietze <me@christiantietze.de>> Date: Thu, 26 May 2022 08:34:22 +0200>> FWIW, I have similar functions and overrides that use the> `modus-themes-after-load-theme-hook'. It's not that bad in sum.
Thanks for sharing!
This one is a tricky case because we normally do not interfere with user
options or other variables for that matter. We mostly deal with faces.
--
Protesilaos Stavrou
https://protesilaos.com