@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2011
@c Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
-@node Customization, Quitting, Amusements, Top
+@node Customization
@chapter Customization
@cindex customization
Text mode and other modes based on Text mode:
@example
-(add-hook 'text-mode-hook 'turn-on-auto-fill)
+(add-hook 'text-mode-hook 'auto-fill-mode)
@end example
Here is another example, showing how to use a hook to customize the
can clear out individual functions by calling @code{remove-hook}, or
do @code{(setq @var{hook-variable} nil)} to remove everything.
+@cindex buffer-local hooks
+ If the hook variable is buffer-local, the buffer-local variable will
+be used instead of the global variable. However, if the buffer-local
+variable contains the element @code{t}, the global hook variable will
+be run as well.
+
@node Locals
@subsection Local Variables
redefine the second mouse button to split the current window:
@example
-(global-set-key [mouse-2] 'split-window-vertically)
+(global-set-key [mouse-2] 'split-window-below)
@end example
The symbols for drag events are similar, but have the prefix
keys.'' For example, if you click the mouse in the mode line, you get
the prefix key @code{mode-line} before the ordinary mouse-button symbol.
Thus, here is how to define the command for clicking the first button in
-a mode line to run @code{scroll-up}:
+a mode line to run @code{scroll-up-command}:
@example
-(global-set-key [mode-line mouse-1] 'scroll-up)
+(global-set-key [mode-line mouse-1] 'scroll-up-command)
@end example
Here is the complete list of these dummy prefix keys and their
Turn on Auto Fill mode automatically in Text mode and related modes.
@example
-(add-hook 'text-mode-hook
- '(lambda () (auto-fill-mode 1)))
+(add-hook 'text-mode-hook 'auto-fill-mode)
@end example
This shows how to add a hook function to a normal hook variable
@code{lambda}, with a single-quote in front of it to make it a list
constant rather than an expression.
-It's beyond the scope of this manual to explain Lisp functions, but for
-this example it is enough to know that the effect is to execute
-@code{(auto-fill-mode 1)} when Text mode is entered. You can replace
-that with any other expression that you like, or with several
-expressions in a row.
-
-Emacs comes with a function named @code{turn-on-auto-fill} whose
-definition is @code{(lambda () (auto-fill-mode 1))}. Thus, a simpler
-way to write the above example is as follows:
-
-@example
-(add-hook 'text-mode-hook 'turn-on-auto-fill)
-@end example
+It's beyond the scope of this manual to explain Lisp functions, but
+for this example it is enough to know that the effect is to execute
+the @code{auto-fill-mode} function when Text mode is entered.
@item
Load the installed Lisp library named @file{foo} (actually a file