Previous: DIY Add support for solaire-mode, Up: Advanced customization [Index]
Many of the Do-It-Yourself (DIY) snippets provided herein make use of
a hook to apply the desired changes. In most examples, this hook is
the modus-themes-after-load-theme-hook
(alias modus-themes-post-load-hook
).
This hook is provided by the Modus themes and is called at the end of
one the following:
modus-themes-toggle
modus-themes-select
Select a Modus theme using minibuffer completion and then load it.
modus-themes-load-theme
Called only from Lisp, such as
in the user’s init file, with the quoted symbol of a Modus theme as
an argument (Option for disabling other themes while loading Modus).
This function is used internally by modus-themes-toggle
and
modus-themes-select
.
Users who switch between themes that are not limited to the Modus
collection cannot benefit from the aforementioned hook: it only works
with the Modus themes. A theme-agnostic hook is needed in such a case.
Before Emacs 29, this had to be set up manually (DIY A theme-agnostic hook for theme loading).
Starting with Emacs 29, the special hook enable-theme-functions
works with anything that uses the basic enable-theme
function.
To use the enable-theme-functions
just add the given function to it
the way it is done with every hook:
(add-hook 'enable-theme-functions 'MY-FUNCTION-HERE)
Functions added to enable-theme-functions
accept a single ‘THEME’
argument. The examples shown in this manual use the pattern ‘(&rest
_)’, which is how a function accepts one or more arguments but
declares it will not use them (in plain terms, the code works with or
without enable-theme-functions
).
Previous: DIY Add support for solaire-mode, Up: Advanced customization [Index]