manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 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. Click on the button labelled ‘Insert Variable’ to add a variable to the theme, and click on ‘Insert Face’ to add a face. You can edit these values in the ‘*New Custom Theme*’ buffer like in an ordinary Customize buffer. To remove an option from the theme, click on its ‘State’ button and select ‘Delete’.

After adding the desired options, click on ‘Save Theme’ to save the Custom theme. This writes the theme definition to a file ‘foo-theme.el’ (where foo is the theme name you supplied), in the directory ‘~/.emacs.d/’. You can specify the directory by setting custom-theme-directory.

You can view and edit the settings of a previously-defined theme by clicking on ‘Visit Theme’ and specifying the theme name. You can also import the variables and faces that you have set using Customize by visiting the “special” theme named ‘user’. This theme, which records all the options that you set in the ordinary customization buffer, is always enabled, and always takes precedence over all other enabled Custom themes. Additionally, the ‘user’ theme is recorded with code in your ‘.emacs’ file, rather than a ‘user-theme.el’ file.

Once you have defined a Custom theme, you can use it by customizing the variable custom-enabled-themes. This is a list of Custom themes that are enabled, or put into effect. If you set custom-enabled-themes using the Customize interface, the theme definitions are automatically loaded from the theme files, if they aren't already. If you save the value of custom-enabled-themes for future Emacs sessions, those Custom themes will be enabled whenever Emacs is started up.

If two enabled themes specify different values for an option, the theme occurring earlier in custom-enabled-themes takes effect.

You can temporarily enable a Custom theme with M-x enable-theme. This prompts for a theme name in the minibuffer, loads the theme from the theme file if necessary, and enables the theme. You can disable any enabled theme with the command M-x disable-theme; this returns the options specified in the theme to their original values. To re-enable the theme, type M-x enable-theme again. If a theme file is changed during your Emacs session, you can reload it by typing M-x load-theme. (This also enables the theme.)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2024
Individual documents may contain additional copyright information.