Add arch taglines
[bpt/emacs.git] / man / custom.texi
index f183580..cca5a53 100644 (file)
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001
+@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001,2002
 @c  Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Customization, Quitting, Amusements, Top
@@ -19,25 +19,27 @@ between sessions unless you save the customization in a file such as
 customizations for future sessions, this actually works by editing
 @file{.emacs} for you.
 
+  Another means of customization is the keyboard macro, which is a
+sequence of keystrokes to be replayed with a single command.
+@xref{Keyboard Macros}, for full instruction how to record, manage, and
+replay sequences of keys.
+
 @menu
 * Minor Modes::                Each minor mode is one feature you can turn on
                          independently of any others.
 * Variables::          Many Emacs commands examine Emacs variables
                          to decide what to do; by setting variables,
                          you can control their functioning.
-* Keyboard Macros::    A keyboard macro records a sequence of
-                         keystrokes to be replayed with a single
-                         command. 
 * 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. 
+                          substitute another code.
 * Syntax::             The syntax table controls how words and
                           expressions are parsed.
 * Init File::          How to write common customizations in the
-                         @file{.emacs} file. 
+                         @file{.emacs} file.
 @end menu
 
 @node Minor Modes
@@ -300,6 +302,7 @@ active fields and other features.
 * Groups: Customization Groups.
                              How options are classified in a structure.
 * Changing an Option::       How to edit a value and set an option.
+* Saving Customizations::    Details of saving customizations.
 * Face Customization::       How to edit the attributes of a face.
 * Specific Customization::   Making a customization buffer for specific
                                 options, faces, or groups.
@@ -327,10 +330,10 @@ 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] 
+Editing group: [Go to Group]
 Basic text editing facilities.
 
-External group: [Go to Group] 
+External group: [Go to Group]
 Interfacing to external utilities.
 
 @var{more second-level groups}
@@ -517,21 +520,15 @@ editable field, use @kbd{C-o} or @kbd{C-q C-j}.
 @cindex saving option value
 @cindex customized options, saving
   Setting the option changes its value in the current Emacs session;
-@dfn{saving} the value changes it for future sessions as well.  This
-works by writing code into your @file{~/.emacs} file so as to set the
-option variable again each time you start Emacs.  To save the option,
-invoke @samp{[State]} and select the @samp{Save for Future Sessions}
-operation.
-
-  If Emacs was invoked with the @option{-q} or @option{--no-init-file}
-options (@pxref{Initial Options}), it will not let you save your
-customizations in your @file{~/.emacs} init file.  This is because
-saving customizations from such a session would wipe out all the other
-customizations you might have on your init file.
+@dfn{saving} the value changes it for future sessions as well.  To
+save the option, invoke @samp{[State]} and select the @samp{Save for
+Future Sessions} operation.  This works by writing code so as to set
+the option variable again each time you start Emacs (@pxref{Saving
+Customizations}).
 
   You can also restore the option to its standard value by invoking
-@samp{[State]} and selecting the @samp{Erase Customization}
-operation.  There are actually three reset operations:
+@samp{[State]} and selecting the @samp{Erase Customization} operation.
+There are actually three reset operations:
 
 @table @samp
 @item Reset
@@ -547,6 +544,12 @@ and updates the text accordingly.
 This sets the option to its standard value, and updates the text
 accordingly.  This also eliminates any saved value for the option,
 so that you will get the standard value in future Emacs sessions.
+
+@item Use Backup Value
+This sets the option to a previous value that was set in the
+customization buffer in this session.  If you customize a variable
+and then reset the variable, which discards the customized value,
+you can get the customized value back again with this operation.
 @end table
 
 @cindex comments on customized options
@@ -579,6 +582,38 @@ Each of the other fields performs an operation---set, save or
 reset---on each of the items in the buffer that could meaningfully be
 set, saved or reset.
 
+@node Saving Customizations
+@subsubsection Saving Customizations
+
+@vindex custom-file
+  The customization buffer normally saves customizations in
+@file{~/.emacs}.  If you wish, you can save customizations in another
+file instead.  To make this work, your @file{~/.emacs} should set
+@code{custom-file} to the name of that file.  Emacs loads the file
+right after your @file{.emacs} if you did not load it already.  For
+example:
+
+@example
+(setq custom-file "~/.emacs-custom")
+@end example
+
+  The variable @code{custom-file} is useful if you want to have
+different customizations for different Emacs versions:
+
+@example
+(if (< emacs-major-version 21)
+    ;; @r{Emacs 20 customization.}
+    (setq custom-file "~/.custom-20.el")
+  ;; @r{Emacs 21 customization.}
+  (setq custom-file "~/.custom-21.el"))
+@end example
+
+  If Emacs was invoked with the @option{-q} or @option{--no-init-file}
+options (@pxref{Initial Options}), it will not let you save your
+customizations in your @file{~/.emacs} init file.  This is because
+saving customizations from such a session would wipe out all the other
+customizations you might have on your init file.
+
 @node Face Customization
 @subsubsection Customizing Faces
 @cindex customizing faces
@@ -592,23 +627,24 @@ the faces in the group appear in the customization buffer.  Here is an
 example of how a face looks:
 
 @smallexample
-Custom Changed Face: (sample) [Hide]
+Custom Changed Face:(sample) [Hide]
    [State]: this face is unchanged from its standard setting.
-Parent groups: [Custom Magic Faces]
-Attributes: [ ] Font family: [Value Menu] *
-            [ ] Width: [Value Menu] *
-            [ ] Height: [Value Menu] *
-            [ ] Weight: [Value Menu] *
-            [ ] Slant: [Value Menu] *
-            [ ] Underline: [Value Menu] *
-            [ ] Overline: [Value Menu] *
-            [ ] Strike-through: [Value Menu] *
-            [ ] Box around text: [Value Menu] *
-            [ ] Inverse-video: [Value Menu] *
-            [X] Foreground: [Value Menu] Color: white       (sample)
-            [X] Background: [Value Menu] Color: blue        (sample)
-            [ ] Stipple: [Value Menu] *
-            [ ] Inherit:
+Face used when the customize item has been changed.
+Parent groups: => Custom Magic Faces
+Attributes: [ ] Font Family: *
+            [ ] Width: *
+            [ ] Height: *
+            [ ] Weight: *
+            [ ] Slant: *
+            [ ] Underline: *
+            [ ] Overline: *
+            [ ] Strike-through: *
+            [ ] Box around text: *
+            [ ] Inverse-video: *
+            [X] Foreground: white       (sample)
+            [X] Background: blue        (sample)
+            [ ] Stipple: *
+            [ ] Inherit: *
 @end smallexample
 
   Each face attribute has its own line.  The @samp{[@var{x}]} field
@@ -659,7 +695,7 @@ that match @var{regexp}.
 @item M-x customize-changed-options @key{RET} @var{version} @key{RET}
 Set up a customization buffer with all the options, faces and groups
 whose meaning has changed since Emacs version @var{version}.
-@item M-x customize-saved 
+@item M-x customize-saved
 Set up a customization buffer containing all options and faces that you
 have saved with customization buffers.
 @item M-x customize-customized
@@ -677,7 +713,8 @@ only for the specified option.
 
 @findex customize-face
   Likewise, you can modify a specific face, chosen by name, using
-@kbd{M-x customize-face}.
+@kbd{M-x customize-face}.  By default it operates on the face used
+on the character after point.
 
 @findex customize-group
   You can also set up the customization buffer with a specific group,
@@ -743,7 +780,7 @@ in @samp{-hooks} or @samp{-functions}, instead of @samp{-hook}.  What
 makes these hooks abnormal is that there is something peculiar about the
 way its functions are called---perhaps they are given arguments, or
 perhaps the values they return are used in some way.  For example,
-@code{find-file-not-found-hooks} (@pxref{Visiting}) is abnormal because
+@code{find-file-not-found-functions} (@pxref{Visiting}) is abnormal because
 as soon as one hook function returns a non-@code{nil} value, the rest
 are not called at all.  The documentation of each abnormal hook variable
 explains in detail what is peculiar about it.
@@ -1023,231 +1060,6 @@ value are @code{t}, @code{nil}, and anything else, just as for
 neither @code{t} nor @code{nil}, so normally Emacs does ask for
 confirmation about file settings for these variables.
 
-@node Keyboard Macros
-@section Keyboard Macros
-
-@cindex defining keyboard macros
-@cindex keyboard macro
-  A @dfn{keyboard macro} is a command defined by the user to stand for
-another sequence of keys.  For example, if you discover that you are
-about to type @kbd{C-n C-d} forty times, you can speed your work by
-defining a keyboard macro to do @kbd{C-n C-d} and calling it with a
-repeat count of forty.
-
-@table @kbd
-@item C-x (
-Start defining a keyboard macro (@code{start-kbd-macro}).
-@item C-x )
-End the definition of a keyboard macro (@code{end-kbd-macro}).
-@item C-x e
-Execute the most recent keyboard macro (@code{call-last-kbd-macro}).
-@item C-u C-x (
-Re-execute last keyboard macro, then add more keys to its definition.
-@item C-x q
-When this point is reached during macro execution, ask for confirmation
-(@code{kbd-macro-query}).
-@item M-x name-last-kbd-macro
-Give a command name (for the duration of the session) to the most
-recently defined keyboard macro.
-@item M-x insert-kbd-macro
-Insert in the buffer a keyboard macro's definition, as Lisp code.
-@item C-x C-k
-Edit a previously defined keyboard macro (@code{edit-kbd-macro}).
-@item M-x apply-macro-to-region-lines
-Run the last keyboard macro on each complete line in the region.
-@end table
-
-  Keyboard macros differ from ordinary Emacs commands in that they are
-written in the Emacs command language rather than in Lisp.  This makes it
-easier for the novice to write them, and makes them more convenient as
-temporary hacks.  However, the Emacs command language is not powerful
-enough as a programming language to be useful for writing anything
-intelligent or general.  For such things, Lisp must be used.
-
-  You define a keyboard macro while executing the commands which are the
-definition.  Put differently, as you define a keyboard macro, the
-definition is being executed for the first time.  This way, you can see
-what the effects of your commands are, so that you don't have to figure
-them out in your head.  When you are finished, the keyboard macro is
-defined and also has been, in effect, executed once.  You can then do the
-whole thing over again by invoking the macro.
-
-@menu
-* Basic Kbd Macro::     Defining and running keyboard macros.
-* Save Kbd Macro::      Giving keyboard macros names; saving them in files.
-* Kbd Macro Query::     Making keyboard macros do different things each time.
-@end menu
-
-@node Basic Kbd Macro
-@subsection Basic Use
-
-@kindex C-x (
-@kindex C-x )
-@kindex C-x e
-@findex start-kbd-macro
-@findex end-kbd-macro
-@findex call-last-kbd-macro
-  To start defining a keyboard macro, type the @kbd{C-x (} command
-(@code{start-kbd-macro}).  From then on, your keys continue to be
-executed, but also become part of the definition of the macro.  @samp{Def}
-appears in the mode line to remind you of what is going on.  When you are
-finished, the @kbd{C-x )} command (@code{end-kbd-macro}) terminates the
-definition (without becoming part of it!).  For example,
-
-@example
-C-x ( M-f foo C-x )
-@end example
-
-@noindent
-defines a macro to move forward a word and then insert @samp{foo}.
-
-  The macro thus defined can be invoked again with the @kbd{C-x e}
-command (@code{call-last-kbd-macro}), which may be given a repeat count
-as a numeric argument to execute the macro many times.  @kbd{C-x )} can
-also be given a repeat count as an argument, in which case it repeats
-the macro that many times right after defining it, but defining the
-macro counts as the first repetition (since it is executed as you define
-it).  Therefore, giving @kbd{C-x )} an argument of 4 executes the macro
-immediately 3 additional times.  An argument of zero to @kbd{C-x e} or
-@kbd{C-x )} means repeat the macro indefinitely (until it gets an error
-or you type @kbd{C-g} or, on MS-DOS, @kbd{C-@key{BREAK}}).
-
-  If you wish to repeat an operation at regularly spaced places in the
-text, define a macro and include as part of the macro the commands to move
-to the next place you want to use it.  For example, if you want to change
-each line, you should position point at the start of a line, and define a
-macro to change that line and leave point at the start of the next line.
-Then repeating the macro will operate on successive lines.
-
-  When a command reads an argument with the minibuffer, your
-minibuffer input becomes part of the macro along with the command.  So
-when you replay the macro, the command gets the same argument as
-when you entered the macro.  For example,
-
-@example
-C-x ( C-a C-@key{SPC} C-n M-w C-x b f o o @key{RET} C-y C-x b @key{RET} C-x )
-@end example
-
-@noindent
-defines a macro that copies the current line into the buffer
-@samp{foo}, then returns to the original buffer.
-
-  You can use function keys in a keyboard macro, just like keyboard
-keys.  You can even use mouse events, but be careful about that: when
-the macro replays the mouse event, it uses the original mouse position
-of that event, the position that the mouse had while you were defining
-the macro.  The effect of this may be hard to predict.  (Using the
-current mouse position would be even less predictable.)
-
-  One thing that doesn't always work well in a keyboard macro is the
-command @kbd{C-M-c} (@code{exit-recursive-edit}).  When this command
-exits a recursive edit that started within the macro, it works as you'd
-expect.  But if it exits a recursive edit that started before you
-invoked the keyboard macro, it also necessarily exits the keyboard macro
-as part of the process.
-
-  After you have terminated the definition of a keyboard macro, you can add
-to the end of its definition by typing @kbd{C-u C-x (}.  This is equivalent
-to plain @kbd{C-x (} followed by retyping the whole definition so far.  As
-a consequence it re-executes the macro as previously defined.
-
-@findex edit-kbd-macro
-@kindex C-x C-k
-  You can edit a keyboard macro already defined by typing @kbd{C-x C-k}
-(@code{edit-kbd-macro}).  Follow that with the keyboard input that you
-would use to invoke the macro---@kbd{C-x e} or @kbd{M-x @var{name}} or
-some other key sequence.  This formats the macro definition in a buffer
-and enters a specialized major mode for editing it.  Type @kbd{C-h m}
-once in that buffer to display details of how to edit the macro.  When
-you are finished editing, type @kbd{C-c C-c}.
-
-@findex apply-macro-to-region-lines
-  The command @kbd{M-x apply-macro-to-region-lines} repeats the last
-defined keyboard macro on each complete line within the current region.
-It does this line by line, by moving point to the beginning of the line
-and then executing the macro.
-
-@node Save Kbd Macro
-@subsection Naming and Saving Keyboard Macros
-
-@cindex saving keyboard macros
-@findex name-last-kbd-macro
-  If you wish to save a keyboard macro for longer than until you define the
-next one, you must give it a name using @kbd{M-x name-last-kbd-macro}.
-This reads a name as an argument using the minibuffer and defines that name
-to execute the macro.  The macro name is a Lisp symbol, and defining it in
-this way makes it a valid command name for calling with @kbd{M-x} or for
-binding a key to with @code{global-set-key} (@pxref{Keymaps}).  If you
-specify a name that has a prior definition other than another keyboard
-macro, an error message is shown and nothing is changed.
-
-@findex insert-kbd-macro
-  Once a macro has a command name, you can save its definition in a file.
-Then it can be used in another editing session.  First, visit the file
-you want to save the definition in.  Then use this command:
-
-@example
-M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
-@end example
-
-@noindent
-This inserts some Lisp code that, when executed later, will define the
-same macro with the same definition it has now.  (You need not
-understand Lisp code to do this, because @code{insert-kbd-macro} writes
-the Lisp code for you.)  Then save the file.  You can load the file
-later with @code{load-file} (@pxref{Lisp Libraries}).  If the file you
-save in is your init file @file{~/.emacs} (@pxref{Init File}) then the
-macro will be defined each time you run Emacs.
-
-  If you give @code{insert-kbd-macro} a numeric argument, it makes
-additional Lisp code to record the keys (if any) that you have bound to the
-keyboard macro, so that the macro will be reassigned the same keys when you
-load the file.
-
-@node Kbd Macro Query
-@subsection Executing Macros with Variations
-
-@kindex C-x q
-@findex kbd-macro-query
-  Using @kbd{C-x q} (@code{kbd-macro-query}), you can get an effect
-similar to that of @code{query-replace}, where the macro asks you each
-time around whether to make a change.  While defining the macro,
-type @kbd{C-x q} at the point where you want the query to occur.  During
-macro definition, the @kbd{C-x q} does nothing, but when you run the
-macro later, @kbd{C-x q} asks you interactively whether to continue.
-
-  The valid responses when @kbd{C-x q} asks are @key{SPC} (or @kbd{y}),
-@key{DEL} (or @kbd{n}), @key{RET} (or @kbd{q}), @kbd{C-l} and @kbd{C-r}.
-The answers are the same as in @code{query-replace}, though not all of
-the @code{query-replace} options are meaningful.
-
-  These responses include @key{SPC} to continue, and @key{DEL} to skip
-the remainder of this repetition of the macro and start right away with
-the next repetition.  @key{RET} means to skip the remainder of this
-repetition and cancel further repetitions.  @kbd{C-l} redraws the screen
-and asks you again for a character to say what to do.
-
-  @kbd{C-r} enters a recursive editing level, in which you can perform
-editing which is not part of the macro.  When you exit the recursive
-edit using @kbd{C-M-c}, you are asked again how to continue with the
-keyboard macro.  If you type a @key{SPC} at this time, the rest of the
-macro definition is executed.  It is up to you to leave point and the
-text in a state such that the rest of the macro will do what you
-want.@refill
-
-  @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument,
-performs a completely different function.  It enters a recursive edit
-reading input from the keyboard, both when you type it during the
-definition of the macro, and when it is executed from the macro.  During
-definition, the editing you do inside the recursive edit does not become
-part of the macro.  During macro execution, the recursive edit gives you
-a chance to do some particularized editing on each repetition.
-@xref{Recursive Edit}.
-
-  Another way to vary the behavior of a keyboard macro is to use a
-register as a counter, incrementing it on each repetition of the macro.
-@xref{RegNumbers}.
-
 @node Key Bindings
 @section Customizing Key Bindings
 @cindex key bindings
@@ -1348,12 +1160,12 @@ events with keyboard events, but we recommend against it, because such
 key sequences are inconvenient to use.
 
   As a user, you can redefine any key; but it is usually best to stick
-to key sequences that consist of @kbd{C-c} followed by a letter.
-These keys are ``reserved for users,'' so they won't conflict with any
-properly designed Emacs extension.  The function keys @key{F5} through
-@key{F9} are also reserved for users.  If you redefine some other key,
-your definition may be overridden by certain extensions or major modes
-which redefine the same key.
+to key sequences that consist of @kbd{C-c} followed by a letter (upper
+or lower case).  These keys are ``reserved for users,'' so they won't
+conflict with any properly designed Emacs extension.  The function
+keys @key{F5} through @key{F9} are also reserved for users.  If you
+redefine some other key, your definition may be overridden by certain
+extensions or major modes which redefine the same key.
 
 @node Prefix Keymaps
 @subsection Prefix Keymaps
@@ -1540,7 +1352,7 @@ press the key, a message like this appears so that you can confirm that
 you are binding the key you want:
 
 @example
-Set key C-z to command: 
+Set key C-z to command:
 @end example
 
   You can redefine function keys and mouse events in the same way; just
@@ -1677,6 +1489,9 @@ As you see, you represent a multi-character key sequence with a vector
 by listing each of the characters within the square brackets that
 delimit the vector.
 
+  Language and coding systems can cause problems with key bindings
+for non-ASCII characters.  @xref{Non-ASCII Rebinding}.
+
 @node Function Keys
 @subsection Rebinding Function Keys
 
@@ -1814,10 +1629,15 @@ Events,,,elisp, The Emacs Lisp Reference Manual}.}, like this:
 @noindent
 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}.
 
-If you don't specify the keyboard coding system, that approach won't
+Since this puts a non-ASCII character in the @file{.emacs}, you should
+specify the proper coding system for that file.  @xref{Init Syntax}.
+Specify the same coding system for the file that you use for your
+keyboard.
+
+If you don't specify a keyboard coding system, that approach won't
 work.  Instead, you need to find out the actual code that the terminal
-sends.  The easiest way to do this in Emacs is to create an empty buffer
-with @kbd{C-x b temp @key{RET}}, make it unibyte with @kbd{M-x
+sends.  The easiest way to do this in Emacs is to create an empty
+buffer with @kbd{C-x b temp @key{RET}}, make it unibyte with @kbd{M-x
 toggle-enable-multibyte-characters @key{RET}}, then type the key to
 insert the character into this buffer.
 
@@ -2002,6 +1822,12 @@ file directly or with the command @kbd{M-x disable-command}, which edits
 the @file{.emacs} file for you.  Likewise, @kbd{M-x enable-command}
 edits @file{.emacs} to enable a command permanently.  @xref{Init File}.
 
+  If Emacs was invoked with the @option{-q} or @option{--no-init-file}
+options (@pxref{Initial Options}), it will not edit your
+@file{~/.emacs} init file.  This is because editing the init file from
+such a session might overwrite the lines you might have on your init
+file which enable and disable commands.
+
   Whether a command is disabled is independent of what key is used to
 invoke it; disabling also applies if the command is invoked using
 @kbd{M-x}.  Disabling a command has no effect on calling it as a
@@ -2096,7 +1922,7 @@ Reference Manual}.
 file your @dfn{init file} because it specifies how to initialize Emacs
 for you.  You can use the command line switch @samp{-q} to prevent
 loading your init file, and @samp{-u} (or @samp{--user}) to specify a
-different user's init file (@pxref{Entering Emacs}).
+different user's init file (@pxref{Initial Options}).
 
 @cindex @file{default.el}, the default init file
   There can also be a @dfn{default init file}, which is the library
@@ -2461,3 +2287,7 @@ If that user name matches the real user-ID, then Emacs uses @env{HOME};
 otherwise, it looks up the home directory corresponding to that user
 name in the system's data base of users.
 @c  LocalWords:  backtab
+
+@ignore
+   arch-tag: c68abddb-4410-4fb5-925f-63394e971d93
+@end ignore