57.2.7 Customization Themes
Custom themes are collections of settings that can be enabled
or disabled as a unit. You can use Custom themes to switch quickly
and easily between various collections of settings, and to transfer
such collections from one computer to another.
To define a Custom theme, use the command M-x
customize-create-theme, which brings up a buffer named ‘*New
Custom Theme*’. At the top of the buffer is an editable field where
you can specify the name of the theme. To add a customization option
to the theme, click on the ‘INS’ button to open up a field where
you can insert the name of the option. The current value of that
option is applied to the theme. After adding as many options as you
like, click on ‘Done’ to save the Custom theme.
Saving a Custom theme named foo writes its definition into the
file foo-theme.el, in the directory ~/.emacs.d/
(you can specify the directory by setting
You can load the themes you've previously defined with the command
load-theme. It prompts for a theme name in the minibuffer, and
loads that theme from the theme file. It also enables the
theme, which means putting its settings into effect. An enabled theme
can be disabled with the command M-x disable-theme; this
returns the options specified in the theme to their original values.
To re-enable the theme, use the command M-x enable-theme.
To enable a Custom theme named foo whenever Emacs is started up,
add the line
) to your .emacs file
(see Init File).
Enabling a custom theme does not disable the themes already enabled;
instead, they are all enabled together. If two enabled Custom themes
specify different values for an option, the last theme to be enabled
The options that you set in the ordinary customization buffer
(see Easy Customization) are also considered part of a Custom
theme, called ‘user’. The ‘user’ theme is always enabled,
and always takes precedence over all other enabled Custom themes.
Additionally, the ‘user’ theme is recorded in your .emacs
file, rather than a user-theme.el file.