@c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002,2004,2005
-@c Free Software Foundation, Inc.
+@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
+@c 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Customization, Quitting, Amusements, Top
@chapter Customization
@menu
* Minor Modes:: Each minor mode is one feature you can turn on
independently of any others.
-* Easy Customization::
- Convenient way to browse and change user options.
+* Easy Customization:: Convenient way to browse and change user options.
* Variables:: Many Emacs commands examine Emacs variables
to decide what to do; by setting variables,
you can control their functioning.
* Key Bindings:: The keymaps say what command each key runs.
By changing them, you can "redefine keys".
-* Keyboard Translations::
- If your keyboard passes an undesired code
- for a key, you can tell Emacs to
- substitute another code.
* Syntax:: The syntax table controls how words and
- expressions are parsed.
+ expressions are parsed.
* Init File:: How to write common customizations in the
@file{.emacs} file.
@end menu
given minor mode works this way, use @kbd{C-h v} to ask for
documentation on the variable name.
- These minor-mode variables provide a good way for Lisp programs to turn
-minor modes on and off; they are also useful in a file's local variables
-list. But please think twice before setting minor modes with a local
-variables list, because most minor modes are a matter of user
-preference---other users editing the same file might not want the same
-minor modes you prefer.
+ These minor-mode variables provide a good way for Lisp programs to
+turn minor modes on and off; they are also useful in a file's local
+variables list (@pxref{File Variables}). But please think twice
+before setting minor modes with a local variables list, because most
+minor modes are a matter of user preference---other users editing the
+same file might not want the same minor modes you prefer.
- The buffer-local minor modes include Abbrev mode, Auto Fill mode,
-Auto Save mode, Font-Lock mode, Glasses mode, ISO Accents mode,
-Outline minor mode, Overwrite mode, and Binary Overwrite mode.
+ The most useful buffer-local minor modes include Abbrev mode, Auto
+Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, ISO Accents
+mode, Outline minor mode, Overwrite mode, and Binary Overwrite mode.
Abbrev mode allows you to define abbreviations that automatically expand
as you type them. For example, @samp{amd} might expand to @samp{abbrev
In Binary Overwrite mode, digits after @kbd{C-q} specify an
octal character code, as usual.
- The following minor modes normally apply to all buffers at once.
-Since each is enabled or disabled by the value of a variable, you
-@emph{can} set them differently for particular buffers, by explicitly
-making the corresponding variables local in those buffers.
-@xref{Locals}.
+ Here are some useful minor modes that normally apply to all buffers
+at once. Since each is enabled or disabled by the value of a
+variable, you @emph{can} set them differently for particular buffers,
+by explicitly making the corresponding variables local in those
+buffers. @xref{Locals}.
Icomplete mode displays an indication of available completions when
you are in the minibuffer and completion is active. @xref{Completion
@findex customize
@cindex customization buffer
- You can browse interactively through the the user options and change
+ You can browse interactively through the user options and change
some of them using @kbd{M-x customize}. This command creates a
@dfn{customization buffer}, which offers commands to navigate through
a logically organized structure of the Emacs user options; you can
* Face Customization:: How to edit the attributes of a face.
* Specific Customization:: Making a customization buffer for specific
variables, faces, or groups.
+* Custom Themes:: How to define collections of customized options
+ that can be loaded and unloaded together.
@end menu
@node Customization Groups
Customization of the One True Editor.
See also [Manual].
-Confirm Kill Emacs: [Hide] [Value Menu] Don't confirm
- [State]: this option is unchanged from its standard setting.
-How to ask for confirmation when leaving Emacs. [More]
-
Editing group: [Go to Group]
Basic text editing facilities.
you have saved. Use @kbd{M-x customize-customized} to look at the
options that you have set but not saved.
+@node Custom Themes
+@subsection Customization Themes
+@cindex custom themes
+
+@dfn{Custom themes} are collections of customized options 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.
+
+@findex customize-create-theme
+To define a Custom theme, use the command
+@kbd{M-x customize-create-theme}, which brings up a buffer named
+@samp{*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 @samp{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 @samp{Done} to save the Custom
+theme.
+
+@vindex custom-theme-directory
+Saving a Custom theme named @var{foo} writes its definition into the
+file @file{@var{foo}-theme.el}, in the directory @file{~/.emacs.d/}
+(you can specify the directory by setting
+@code{custom-theme-directory}).
+
+@findex load-theme
+@findex enable-theme
+@findex disable-theme
+You can load the themes you've previously defined with the command
+@code{load-theme}. It prompts for a theme name in the minibuffer,
+then loads that theme if it isn't already loaded. It also
+@dfn{enables} the theme, which means putting its settings into effect.
+An enabled theme can be @dfn{disabled} with the command
+@kbd{M-x disable-theme}; this returns the options specified in the
+theme to their original values. To re-enable the theme, use the
+command @kbd{M-x enable-theme}.
+
+To enable a Custom theme named @var{foo} whenever Emacs is started up,
+add the line @code{(load-theme '@var{foo})} to your @file{.emacs} file
+(@pxref{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
+takes effect.
+
+The options that you set in the ordinary customization buffer
+(@pxref{Easy Customization}) are also considered part of a Custom
+theme, called @samp{user}. The @samp{user} theme is always enabled,
+and always takes precedence over all other enabled Custom themes.
+Additionally, the @samp{user} theme is recorded in your @file{.emacs}
+file, rather than a @file{user-theme.el} file.
+
@node Variables
@section Variables
@cindex variable
If you play with adding various different versions of a hook
function by calling @code{add-hook} over and over, remember that all
-the versions you added will remain in the hook variable together.
-To clear them out, you can do @code{(setq @var{hook-variable} nil)}.
+the versions you added will remain in the hook variable together. You
+can clear out individual functions with @code{remove-hook}, or do
+@code{(setq @var{hook-variable} nil)} to remove everything.
@node Locals
@subsection Local Variables
Many keyboards have a ``numeric keypad'' on the right hand side.
The numeric keys in the keypad double up as cursor motion keys,
toggled by a key labelled @samp{Num Lock}. By default, Emacs
-translates these keys to the corresponding keys in the main keyboard
-(@pxref{Keyboard Translations}). For example, when @samp{Num Lock} is
-on, the key labelled @samp{8} on the numeric keypad produces
-@code{kp-8}, which is translated to @kbd{8}; when @samp{Num Lock} is
-off, the same key produces @code{kp-up}, which is translated to
-@key{UP}. If you rebind a key such as @kbd{8} or @key{UP}, it affects
-the equivalent keypad key too. However, if you rebind a @samp{kp-}
-key directly, that won't affect its non-keypad equivalent.
+translates these keys to the corresponding keys in the main keyboard.
+For example, when @samp{Num Lock} is on, the key labelled @samp{8} on
+the numeric keypad produces @code{kp-8}, which is translated to
+@kbd{8}; when @samp{Num Lock} is off, the same key produces
+@code{kp-up}, which is translated to @key{UP}. If you rebind a key
+such as @kbd{8} or @key{UP}, it affects the equivalent keypad key too.
+However, if you rebind a @samp{kp-} key directly, that won't affect
+its non-keypad equivalent.
Emacs provides a convenient method for binding the numeric keypad
keys, using the variables @code{keypad-setup},
@kbd{M-x}. Disabling a command has no effect on calling it as a
function from Lisp programs.
-@node Keyboard Translations
-@section Keyboard Translations
-
- Some keyboards do not make it convenient to send all the special
-characters that Emacs uses. The most common problem case is the
-@key{DEL} character. Some keyboards provide no convenient way to type
-this very important character---usually because they were designed to
-expect the character @kbd{C-h} to be used for deletion. On these
-keyboards, if you press the key normally used for deletion, Emacs handles
-the @kbd{C-h} as a prefix character and offers you a list of help
-options, which is not what you want.
-
-@cindex keyboard translations
-@findex keyboard-translate
- You can work around this problem within Emacs by setting up keyboard
-translations to turn @kbd{C-h} into @key{DEL} and @key{DEL} into
-@kbd{C-h}, as follows:
-
-@example
-;; @r{Translate @kbd{C-h} to @key{DEL}.}
-(keyboard-translate ?\C-h ?\C-?)
-
-;; @r{Translate @key{DEL} to @kbd{C-h}.}
-(keyboard-translate ?\C-? ?\C-h)
-@end example
-
- Keyboard translations are not the same as key bindings in keymaps
-(@pxref{Keymaps}). Emacs contains numerous keymaps that apply in
-different situations, but there is only one set of keyboard
-translations, and it applies to every character that Emacs reads from
-the terminal. Keyboard translations take place at the lowest level of
-input processing; the keys that are looked up in keymaps contain the
-characters that result from keyboard translation.
-
- On a window system, the keyboard key named @key{DELETE} is a function
-key and is distinct from the @acronym{ASCII} character named @key{DEL}.
-@xref{Named ASCII Chars}. Keyboard translations affect only @acronym{ASCII}
-character input, not function keys; thus, the above example used on a
-window system does not affect the @key{DELETE} key. However, the
-translation above isn't necessary on window systems, because Emacs can
-also distinguish between the @key{BACKSPACE} key and @kbd{C-h}; and it
-normally treats @key{BACKSPACE} as @key{DEL}.
-
- For full information about how to use keyboard translations, see
-@ref{Translating Input,,,elisp, The Emacs Lisp Reference Manual}.
-
@node Syntax
@section The Syntax Table
@cindex syntax table
@end example
@item
-Adjusting the configuration to various contexts.
-
-In most of the cases, people want their Emacs to behave the same on
-all their machines, so their configuration should be the same, no
-matter whether it's GNU/Linux or not, under X11 or on a tty, with one
-version of Emacs or another, ...
+Adjusting the configuration to various platforms and Emacs versions.
-What can happen, tho, is that depending on the circumstance some
-features may or may not be available. In that case just prepend each
-such customization with a little test that ensures that the feature
-can be used. The best tests are usually checking that the feature is
-available, rather than checking what kind of environment is
-being used.
+Users typically want Emacs to behave the same on all systems, so the
+same init file is right for all platforms. However, sometimes it
+happens that a function you use for customizing Emacs is not available
+on some platforms or in older Emacs versions. To deal with that
+situation, put the customization inside a conditional that tests whether
+the function or facility is available, like this:
@example
-(if (fboundp 'blinking-cursor-mode)
- (blinking-cursor-mode 0))
-@end example
+(if (fboundp 'blink-cursor-mode)
+ (blink-cursor-mode 0))
-@example
(if (boundp 'coding-category-utf-8)
- (set-coding-priority '(coding-category-utf-8)))
+ (set-coding-priority '(coding-category-utf-8)))
@end example
+@noindent
+You can also simply disregard the errors that occur if the
+function is not defined.
+
@example
-(require 'cl) ; To define `ignore-errors'.
-(ignore-errors (set-face-background 'region "grey75"))
+(condition case ()
+ (set-face-background 'region "grey75")
+ (error nil))
@end example
-Note also that a @code{setq} on a variable which does not exist is
-generally harmless, so those usually do not need to be made
-conditional on any kind of test.
-
+A @code{setq} on a variable which does not exist is generally
+harmless, so those do not need a conditional.
@end itemize
-
@node Terminal Init
@subsection Terminal-specific Initialization