aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2006-03-31 15:32:07 +0000
committerRichard M. Stallman2006-03-31 15:32:07 +0000
commitf73dbd9463f67a5fbab6d1e14a240917885303b0 (patch)
tree95e11f619311d54b7a537d5c2f1e05df2bbf6901
parent1dafafa38422b38fd5796793a03ad3f69856bb74 (diff)
downloademacs-f73dbd9463f67a5fbab6d1e14a240917885303b0.tar.gz
emacs-f73dbd9463f67a5fbab6d1e14a240917885303b0.zip
Many cleanups.
(Minor Modes): Don't mention ISO Accents Mode. (Examining): Update C-h v output example. (Hooks): Add index and xref for add-hook. (Locals): Delete list of vars that are always per-buffer. Rearrange. (Local Keymaps): Don't mention lisp-mode-map, c-mode-map.
-rw-r--r--man/custom.texi327
1 files changed, 160 insertions, 167 deletions
diff --git a/man/custom.texi b/man/custom.texi
index db88f64f839..8429ddaae74 100644
--- a/man/custom.texi
+++ b/man/custom.texi
@@ -7,7 +7,7 @@
7@cindex customization 7@cindex customization
8 8
9 This chapter talks about various topics relevant to adapting the 9 This chapter talks about various topics relevant to adapting the
10behavior of Emacs in minor ways. 10behavior of Emacs in ways we have anticipated.
11@iftex 11@iftex
12See @cite{The Emacs Lisp Reference Manual} 12See @cite{The Emacs Lisp Reference Manual}
13@end iftex 13@end iftex
@@ -15,14 +15,14 @@ See @cite{The Emacs Lisp Reference Manual}
15@xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp 15@xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp
16Reference Manual}, 16Reference Manual},
17@end ifnottex 17@end ifnottex
18for how to make more far-reaching changes. @xref{X Resources}, 18for how to make more far-reaching and open-ended changes. @xref{X
19for information on using X resources to customize Emacs. 19Resources}, for information on using X resources to customize Emacs.
20 20
21 Customization that you do within Emacs normally affects only the 21 Customization that you do within Emacs normally affects only the
22particular Emacs session that you do it in---it does not persist 22particular Emacs session that you do it in---it does not persist
23between sessions unless you save the customization in a file such as 23between sessions unless you save the customization in a file such as
24@file{.emacs} or @file{.Xdefaults} that will affect future sessions. 24your init file (@file{.emacs}) that will affect future sessions.
25@xref{Init File}. In the customization buffer, when you save 25(@xref{Init File}.) When you tell the customization buffer to save
26customizations for future sessions, this actually works by editing 26customizations for future sessions, this actually works by editing
27@file{.emacs} for you. 27@file{.emacs} for you.
28 28
@@ -55,17 +55,19 @@ replay sequences of keys.
55example, Auto Fill mode is a minor mode in which @key{SPC} breaks lines 55example, Auto Fill mode is a minor mode in which @key{SPC} breaks lines
56between words as you type. All the minor modes are independent of each 56between words as you type. All the minor modes are independent of each
57other and of the selected major mode. Most minor modes say in the mode 57other and of the selected major mode. Most minor modes say in the mode
58line when they are on; for example, @samp{Fill} in the mode line means 58line when they are enabled; for example, @samp{Fill} in the mode line means
59that Auto Fill mode is on. 59that Auto Fill mode is enabled.
60 60
61 Append @code{-mode} to the name of a minor mode to get the name of a 61 You should append @code{-mode} to the name of a minor mode to
62command that turns the mode on or off. Thus, the command to 62produce the name of the command that turns the mode on or off. Thus,
63enable or disable Auto Fill mode is called @code{auto-fill-mode}. These 63the command to enable or disable Auto Fill mode is called
64commands are usually invoked with @kbd{M-x}, but you can bind keys to them 64@code{auto-fill-mode}. These commands are usually invoked with
65if you wish. With no argument, the function turns the mode on if it was 65@kbd{M-x}, but you can bind keys to them if you wish.
66off and off if it was on. This is known as @dfn{toggling}. A positive 66
67argument always turns the mode on, and an explicit zero argument or a 67 With no argument, the minor mode function turns the mode on if it
68negative argument always turns it off. 68was off, and off if it was on. This is known as @dfn{toggling}. A
69positive argument always turns the mode on, and an explicit zero
70argument or a negative argument always turns it off.
69 71
70 Some minor modes are global: while enabled, they affect everything 72 Some minor modes are global: while enabled, they affect everything
71you do in the Emacs session, in all buffers. Other minor modes are 73you do in the Emacs session, in all buffers. Other minor modes are
@@ -94,8 +96,8 @@ a matter of user preference---other users editing the same file might
94not want the same minor modes you prefer. 96not want the same minor modes you prefer.
95 97
96 The most useful buffer-local minor modes include Abbrev mode, Auto 98 The most useful buffer-local minor modes include Abbrev mode, Auto
97Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, ISO Accents 99Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, Outline minor
98mode, Outline minor mode, Overwrite mode, and Binary Overwrite mode. 100mode, Overwrite mode, and Binary Overwrite mode.
99 101
100 Abbrev mode allows you to define abbreviations that automatically expand 102 Abbrev mode allows you to define abbreviations that automatically expand
101as you type them. For example, @samp{amd} might expand to @samp{abbrev 103as you type them. For example, @samp{amd} might expand to @samp{abbrev
@@ -105,9 +107,8 @@ mode}. @xref{Abbrevs}, for full information.
105explicitly. Emacs inserts newlines as necessary to prevent lines from 107explicitly. Emacs inserts newlines as necessary to prevent lines from
106becoming too long. @xref{Filling}. 108becoming too long. @xref{Filling}.
107 109
108 Auto Save mode causes the contents of a buffer to be saved 110 Auto Save mode saves the buffer contents periodically to reduce the
109periodically to reduce the amount of work you can lose in case of a 111amount of work you can lose in case of a crash. @xref{Auto Save}.
110system crash. @xref{Auto Save}.
111 112
112 Enriched mode enables editing and saving of formatted text. 113 Enriched mode enables editing and saving of formatted text.
113@xref{Formatted Text}. 114@xref{Formatted Text}.
@@ -115,16 +116,18 @@ system crash. @xref{Auto Save}.
115 Flyspell mode automatically highlights misspelled words. 116 Flyspell mode automatically highlights misspelled words.
116@xref{Spelling}. 117@xref{Spelling}.
117 118
118 Font-Lock mode automatically highlights certain textual units found in 119 Font-Lock mode automatically highlights certain textual units found
119programs, such as comments, strings, and function names being defined. 120in programs, such as comments, strings, and function names being
120This requires a graphical display that can show multiple fonts. 121defined. This requires a display that can show multiple fonts or
121@xref{Faces}. 122colors. @xref{Faces}.
122 123
124@ignore
123 ISO Accents mode makes the characters @samp{`}, @samp{'}, @samp{"}, 125 ISO Accents mode makes the characters @samp{`}, @samp{'}, @samp{"},
124@samp{^}, @samp{/} and @samp{~} combine with the following letter, to 126@samp{^}, @samp{/} and @samp{~} combine with the following letter, to
125produce an accented letter in the ISO Latin-1 character set. The 127produce an accented letter in the ISO Latin-1 character set. The
126newer and more general feature of input methods more or less 128newer and more general feature of input methods more or less
127supersedes ISO Accents mode. @xref{Unibyte Mode}. 129supersedes ISO Accents mode. @xref{Unibyte Mode}.
130@end ignore
128 131
129 Outline minor mode provides the same facilities as the major mode 132 Outline minor mode provides the same facilities as the major mode
130called Outline mode; but since it is a minor mode instead, you can 133called Outline mode; but since it is a minor mode instead, you can
@@ -286,15 +289,15 @@ settings. This command creates a special customization buffer which
286shows only the names of groups and settings, and puts them in a 289shows only the names of groups and settings, and puts them in a
287structure. 290structure.
288 291
289 In this buffer, you can show the contents of a group by invoking 292 In this buffer, you can show the contents of a group by invoking the
290@samp{[+]}. When the group contents are visible, this button changes to 293@samp{[+]} button. When the group contents are visible, this button
291@samp{[-]}; invoking that hides the group contents. 294changes to @samp{[-]}; invoking that hides the group contents again.
292 295
293 Each setting in this buffer has a link which says @samp{[Group]}, 296 Each group or setting in this buffer has a link which says
294@samp{[Option]} or @samp{[Face]}. Invoking this link creates an 297@samp{[Group]}, @samp{[Option]} or @samp{[Face]}. Invoking this link
295ordinary customization buffer showing just that group and its 298creates an ordinary customization buffer showing just that group and
296contents, just that user option, or just that face. This is the way 299its contents, just that user option, or just that face. This is the
297to change settings that you find with @kbd{M-x customize-browse}. 300way to change settings that you find with @kbd{M-x customize-browse}.
298 301
299 If you can guess part of the name of the settings you are interested 302 If you can guess part of the name of the settings you are interested
300in, @kbd{M-x customize-apropos} is another way to search for settings. 303in, @kbd{M-x customize-apropos} is another way to search for settings.
@@ -343,6 +346,8 @@ value:
343 save it. 346 save it.
344@end smallexample 347@end smallexample
345 348
349@cindex user options, how to set
350@cindex variables, how to set
346@cindex settings, how to set 351@cindex settings, how to set
347 Editing the value does not actually set the variable. To do that, 352 Editing the value does not actually set the variable. To do that,
348you must @dfn{set} the variable. To do this, invoke the 353you must @dfn{set} the variable. To do this, invoke the
@@ -415,8 +420,8 @@ instance, to specify a function instead of a pair of coding systems.
415To delete an association from the list, invoke the @samp{[DEL]} button 420To delete an association from the list, invoke the @samp{[DEL]} button
416for that item. To add an association, invoke @samp{[INS]} at the 421for that item. To add an association, invoke @samp{[INS]} at the
417position where you want to add it. There is an @samp{[INS]} button 422position where you want to add it. There is an @samp{[INS]} button
418between each pair of association, another at the beginning and another 423between each pair of associations, another at the beginning and another
419at the end, so you can add the new association at any position in the 424at the end, so you can add a new association at any position in the
420list. 425list.
421 426
422@kindex TAB @r{(customization buffer)} 427@kindex TAB @r{(customization buffer)}
@@ -469,7 +474,7 @@ and then reset it, which discards the customized value,
469you can get the customized value back again with this operation. 474you can get the customized value back again with this operation.
470@end table 475@end table
471 476
472@cindex comments on customized options 477@cindex comments on customized settings
473 Sometimes it is useful to record a comment about a specific 478 Sometimes it is useful to record a comment about a specific
474customization. Use the @samp{Add Comment} item from the 479customization. Use the @samp{Add Comment} item from the
475@samp{[State]} menu to create a field for entering the comment. The 480@samp{[State]} menu to create a field for entering the comment. The
@@ -494,13 +499,17 @@ buffer according to the setting of the option
494Each of the other buttons performs an operation---set, save or 499Each of the other buttons performs an operation---set, save or
495reset---on each of the settings in the buffer that could meaningfully 500reset---on each of the settings in the buffer that could meaningfully
496be set, saved or reset. They do not operate on settings whose values 501be set, saved or reset. They do not operate on settings whose values
497are hidden, nor on subgroups not visible in the buffer. 502are hidden, nor on subgroups which are hidden or not visible in the buffer.
498 503
499@node Saving Customizations 504@node Saving Customizations
500@subsection Saving Customizations 505@subsection Saving Customizations
501 506
507 Saving customizations from the customization buffer works by writing
508code that future sessions will read, code to set up those
509customizations again.
510
502@vindex custom-file 511@vindex custom-file
503 The customization buffer normally saves customizations in 512 Normally this saves customizations in your init file,
504@file{~/.emacs}. If you wish, you can save customizations in another 513@file{~/.emacs}. If you wish, you can save customizations in another
505file instead. To make this work, your @file{~/.emacs} should set 514file instead. To make this work, your @file{~/.emacs} should set
506@code{custom-file} to the name of that file. Then you should load the 515@code{custom-file} to the name of that file. Then you should load the
@@ -511,8 +520,8 @@ file by calling @code{load}. For example:
511(load custom-file) 520(load custom-file)
512@end example 521@end example
513 522
514 You can also use @code{custom-file} to specify different 523 You can use @code{custom-file} to specify different customization
515customization files for different Emacs versions, like this: 524files for different Emacs versions, like this:
516 525
517@example 526@example
518(cond ((< emacs-major-version 21) 527(cond ((< emacs-major-version 21)
@@ -650,9 +659,9 @@ on the character after point.
650@findex customize-group 659@findex customize-group
651 You can also set up the customization buffer with a specific group, 660 You can also set up the customization buffer with a specific group,
652using @kbd{M-x customize-group}. The immediate contents of the chosen 661using @kbd{M-x customize-group}. The immediate contents of the chosen
653group, including variables, faces, and other groups, all appear 662group, including settings (variables and faces), and other groups, all
654as well (even if not already loaded). However, the subgroups' own 663appear as well (even if not already loaded). However, the subgroups'
655contents are not included. 664own contents are not included.
656 665
657@findex customize-apropos 666@findex customize-apropos
658 To control more precisely what to customize, you can use @kbd{M-x 667 To control more precisely what to customize, you can use @kbd{M-x
@@ -663,13 +672,13 @@ specify an empty regular expression, this includes @emph{all} loaded
663groups and settings---which takes a long time to set up. 672groups and settings---which takes a long time to set up.
664 673
665@findex customize-changed 674@findex customize-changed
666 When you upgrade to a new Emacs version, you might want to customize 675 When you upgrade to a new Emacs version, you might want to consider
667new settings and settings whose meanings or default values have 676customizing new settings, and settings whose meanings or default
668changed. To do this, use @kbd{M-x customize-changed} and 677values have changed. To do this, use @kbd{M-x customize-changed} and
669specify a previous Emacs version number using the minibuffer. It 678specify a previous Emacs version number using the minibuffer. It
670creates a customization buffer which shows all the settings and groups 679creates a customization buffer which shows all the settings and groups
671whose definitions have been changed since the specified version, loading 680whose definitions have been changed since the specified version,
672them if necessary. 681loading them if necessary.
673 682
674@findex customize-saved 683@findex customize-saved
675@findex customize-customized 684@findex customize-customized
@@ -712,7 +721,7 @@ by visiting the ``special'' theme named @samp{user}. This theme, which
712records all the options that you set in the ordinary customization 721records all the options that you set in the ordinary customization
713buffer, is always enabled, and always takes precedence over all other 722buffer, is always enabled, and always takes precedence over all other
714enabled Custom themes. Additionally, the @samp{user} theme is 723enabled Custom themes. Additionally, the @samp{user} theme is
715recorded in your @file{.emacs} file, rather than a 724recorded with code in your @file{.emacs} file, rather than a
716@file{user-theme.el} file. 725@file{user-theme.el} file.
717 726
718@vindex custom-enabled-themes 727@vindex custom-enabled-themes
@@ -734,7 +743,7 @@ theme occurring earlier in @code{custom-enabled-themes} takes effect.
734 You can temporarily enable a Custom theme with @kbd{M-x 743 You can temporarily enable a Custom theme with @kbd{M-x
735enable-theme}. This prompts for a theme name in the minibuffer, loads 744enable-theme}. This prompts for a theme name in the minibuffer, loads
736the theme from the theme file if necessary, and enables the theme. 745the theme from the theme file if necessary, and enables the theme.
737You can @dfn{disabled} any enabled theme with the command @kbd{M-x 746You can @dfn{disable} any enabled theme with the command @kbd{M-x
738disable-theme}; this returns the options specified in the theme to 747disable-theme}; this returns the options specified in the theme to
739their original values. To re-enable the theme, type @kbd{M-x 748their original values. To re-enable the theme, type @kbd{M-x
740enable-theme} again. If a theme file is changed during your Emacs 749enable-theme} again. If a theme file is changed during your Emacs
@@ -755,7 +764,7 @@ have a documentation string which describes what kind of value it should
755have and how the value will be used. 764have and how the value will be used.
756 765
757 Emacs Lisp allows any variable (with a few exceptions) to have any 766 Emacs Lisp allows any variable (with a few exceptions) to have any
758kind of value, but most variables that Emacs uses need a value of a 767kind of value, but most variables that Emacs uses expect a value of a
759certain type. Often the value should always be a string, or should 768certain type. Often the value should always be a string, or should
760always be a number. Sometimes we say that a certain feature is turned 769always be a number. Sometimes we say that a certain feature is turned
761on if a variable is ``non-@code{nil},'' meaning that if the variable's 770on if a variable is ``non-@code{nil},'' meaning that if the variable's
@@ -766,11 +775,11 @@ variable---is @code{t}.
766 775
767 Emacs uses many Lisp variables for internal record keeping, but the 776 Emacs uses many Lisp variables for internal record keeping, but the
768most interesting variables for a non-programmer user are those meant 777most interesting variables for a non-programmer user are those meant
769for users to change---the @dfn{user options}. 778for users to change---these are called @dfn{user options}.
770 779
771 Each user option that you can set with the customization buffer is 780 Each user option that you can set with the customization buffer is
772in fact a Lisp variable. Emacs does not (usually) change the values 781in fact a Lisp variable. Emacs does not (usually) change the values
773of these variables; instead, you set the values, and thereby alter and 782of these variables on its own; instead, you set the values in order to
774control the behavior of certain Emacs commands. Use of the 783control the behavior of certain Emacs commands. Use of the
775customization buffer is explained above (@pxref{Easy Customization}); 784customization buffer is explained above (@pxref{Easy Customization});
776here we describe other aspects of Emacs variables. 785here we describe other aspects of Emacs variables.
@@ -808,21 +817,27 @@ C-h v fill-column @key{RET}
808displays something like this: 817displays something like this:
809 818
810@smallexample 819@smallexample
820fill-column is a variable defined in `C source code'.
811fill-column's value is 70 821fill-column's value is 70
822Local in buffer custom.texi; global value is 70
823Automatically becomes buffer-local when set in any fashion.
812 824
813Documentation: 825Documentation:
814*Column beyond which automatic line-wrapping should happen. 826*Column beyond which automatic line-wrapping should happen.
815Automatically becomes buffer-local when set in any fashion. 827Interactively, you can set the buffer local value using C-x f.
828
829You can customize this variable.
816@end smallexample 830@end smallexample
817 831
818@noindent 832@noindent
819The star at the beginning of the documentation indicates that this 833The line that says you can customize the variable indicates that this
820variable is a user option. @kbd{C-h v} is not restricted to user 834variable is a user option. (The star also indicates this, but it is
821options; it allows any variable name. 835an obsolete indicator that may eventually disappear.) @kbd{C-h v} is
836not restricted to user options; it allows any variable name.
822 837
823@findex set-variable 838@findex set-variable
824 The most convenient way to set a specific user option variable is 839The most convenient way to set a specific user option variable is with
825with @kbd{M-x set-variable}. This reads the variable name with the 840@kbd{M-x set-variable}. This reads the variable name with the
826minibuffer (with completion), and then reads a Lisp expression for the 841minibuffer (with completion), and then reads a Lisp expression for the
827new value using the minibuffer a second time (you can insert the old 842new value using the minibuffer a second time (you can insert the old
828value into the minibuffer for editing via @kbd{M-n}). For example, 843value into the minibuffer for editing via @kbd{M-n}). For example,
@@ -889,13 +904,11 @@ as soon as one hook function returns a non-@code{nil} value, the rest
889are not called at all. The documentation of each abnormal hook variable 904are not called at all. The documentation of each abnormal hook variable
890explains in detail what is peculiar about it. 905explains in detail what is peculiar about it.
891 906
907@findex add-hook
892 You can set a hook variable with @code{setq} like any other Lisp 908 You can set a hook variable with @code{setq} like any other Lisp
893variable, but the recommended way to add a hook function to a hook 909variable, but the recommended way to add a hook function to a hook
894(either normal or abnormal) is by calling @code{add-hook}. You can 910(either normal or abnormal) is by calling @code{add-hook}.
895specify any valid Lisp function as the hook function, provided it can 911@xref{Hooks,,, elisp, The Emacs Lisp Reference Manual}.
896handle the proper number of arguments (zero arguments, in the case of
897a normal hook). Of course, not every Lisp function is @emph{useful}
898in any particular hook.
899 912
900 For example, here's how to set up a hook to turn on Auto Fill mode 913 For example, here's how to set up a hook to turn on Auto Fill mode
901when entering Text mode and other modes based on Text mode: 914when entering Text mode and other modes based on Text mode:
@@ -936,11 +949,12 @@ they are executed does not matter. Any dependence on the order is
936``asking for trouble.'' However, the order is predictable: the most 949``asking for trouble.'' However, the order is predictable: the most
937recently added hook functions are executed first. 950recently added hook functions are executed first.
938 951
952@findex remove-hook
939 If you play with adding various different versions of a hook 953 If you play with adding various different versions of a hook
940function by calling @code{add-hook} over and over, remember that all 954function by calling @code{add-hook} over and over, remember that all
941the versions you added will remain in the hook variable together. You 955the versions you added will remain in the hook variable together. You
942can clear out individual functions with @code{remove-hook}, or do 956can clear out individual functions by calling @code{remove-hook}, or
943@code{(setq @var{hook-variable} nil)} to remove everything. 957do @code{(setq @var{hook-variable} nil)} to remove everything.
944 958
945@node Locals 959@node Locals
946@subsection Local Variables 960@subsection Local Variables
@@ -963,46 +977,41 @@ buffer. Every other Emacs variable has a @dfn{global} value which is in
963effect in all buffers that have not made the variable local. 977effect in all buffers that have not made the variable local.
964 978
965@findex make-local-variable 979@findex make-local-variable
966 @kbd{M-x make-local-variable} reads the name of a variable and makes it 980 @kbd{M-x make-local-variable} reads the name of a variable and makes
967local to the current buffer. Further changes in this buffer will not 981it local to the current buffer. Changing its value subsequently in
968affect others, and further changes in the global value will not affect this 982this buffer will not affect others, and changes in its global value
969buffer. 983will not affect this buffer.
970 984
971@findex make-variable-buffer-local 985@findex make-variable-buffer-local
972@cindex per-buffer variables 986@cindex per-buffer variables
973 @kbd{M-x make-variable-buffer-local} reads the name of a variable and 987 @kbd{M-x make-variable-buffer-local} marks a variable so it will
974changes the future behavior of the variable so that it will become local 988become local automatically whenever it is set. More precisely, once a
975automatically when it is set. More precisely, once a variable has been 989variable has been marked in this way, the usual ways of setting the
976marked in this way, the usual ways of setting the variable automatically 990variable automatically do @code{make-local-variable} first. We call
977do @code{make-local-variable} first. We call such variables 991such variables @dfn{per-buffer} variables. Many variables in Emacs
978@dfn{per-buffer} variables. 992are normally per-buffer; the variable's document string tells you when
993this is so. A per-buffer variable's global value is normally never
994effective in any buffer, but it still has a meaning: it is the initial
995value of the variable for each new buffer.
979 996
980 Major modes (@pxref{Major Modes}) always make variables local to the 997 Major modes (@pxref{Major Modes}) always make variables local to the
981buffer before setting the variables. This is why changing major modes 998buffer before setting the variables. This is why changing major modes
982in one buffer has no effect on other buffers. Minor modes also work by 999in one buffer has no effect on other buffers. Minor modes also work
983setting variables---normally, each minor mode has one controlling 1000by setting variables---normally, each minor mode has one controlling
984variable which is non-@code{nil} when the mode is enabled (@pxref{Minor 1001variable which is non-@code{nil} when the mode is enabled
985Modes}). For most minor modes, the controlling variable is per buffer. 1002(@pxref{Minor Modes}). For many minor modes, the controlling variable
986 1003is per buffer, and thus always buffer-local. Otherwise, you can make
987 Emacs contains a number of variables that are always per-buffer. 1004it local in a specific buffer like any other variable.
988These include @code{abbrev-mode}, @code{auto-fill-function},
989@code{case-fold-search}, @code{comment-column}, @code{ctl-arrow},
990@code{fill-column}, @code{fill-prefix}, @code{indent-tabs-mode},
991@code{left-margin}, @code{mode-line-format}, @code{overwrite-mode},
992@code{selective-display-ellipses}, @code{selective-display},
993@code{tab-width}, and @code{truncate-lines}. Some other variables are
994always local in every buffer, but they are used for internal
995purposes.@refill
996 1005
997 A few variables cannot be local to a buffer because they are always 1006 A few variables cannot be local to a buffer because they are always
998local to each display instead (@pxref{Multiple Displays}). If you try to 1007local to each display instead (@pxref{Multiple Displays}). If you try to
999make one of these variables buffer-local, you'll get an error message. 1008make one of these variables buffer-local, you'll get an error message.
1000 1009
1001@findex kill-local-variable 1010@findex kill-local-variable
1002 @kbd{M-x kill-local-variable} reads the name of a variable and makes 1011 @kbd{M-x kill-local-variable} makes a specified variable cease to be
1003it cease to be local to the current buffer. The global value of the 1012local to the current buffer. The global value of the variable
1004variable henceforth is in effect in this buffer. Setting the major mode 1013henceforth is in effect in this buffer. Setting the major mode kills
1005kills all the local variables of the buffer except for a few variables 1014all the local variables of the buffer except for a few variables
1006specially marked as @dfn{permanent locals}. 1015specially marked as @dfn{permanent locals}.
1007 1016
1008@findex setq-default 1017@findex setq-default
@@ -1082,9 +1091,9 @@ the first line as well.
1082 1091
1083@cindex shell scripts, and local file variables 1092@cindex shell scripts, and local file variables
1084 In shell scripts, the first line is used to identify the script 1093 In shell scripts, the first line is used to identify the script
1085interpreter, so you cannot put any local variables there. To accommodate 1094interpreter, so you cannot put any local variables there. To
1086for this, when Emacs visits a shell script, it looks for local variable 1095accommodate this, Emacs looks for local variable specifications in the
1087specifications in the @emph{second} line. 1096@emph{second} line when the first line specifies an interpreter.
1088 1097
1089 A @dfn{local variables list} goes near the end of the file, in the 1098 A @dfn{local variables list} goes near the end of the file, in the
1090last page. (It is often best to put it on a page by itself.) The local 1099last page. (It is often best to put it on a page by itself.) The local
@@ -1108,9 +1117,9 @@ variables list afterward.
1108;;; End: *** 1117;;; End: ***
1109@end example 1118@end example
1110 1119
1111 As you see, each line starts with the prefix @samp{;;; } and each line 1120 Each line starts with the prefix @samp{;;; } and each line ends with
1112ends with the suffix @samp{ ***}. Emacs recognizes these as the prefix 1121the suffix @samp{ ***}. Emacs recognizes these as the prefix and
1113and suffix based on the first line of the list, by finding them 1122suffix based on the first line of the list, by finding them
1114surrounding the magic string @samp{Local Variables:}; then it 1123surrounding the magic string @samp{Local Variables:}; then it
1115automatically discards them from the other lines of the list. 1124automatically discards them from the other lines of the list.
1116 1125
@@ -1155,8 +1164,7 @@ as part of their initialization.
1155as the major modes; in fact, you can use it more than once, first to 1164as the major modes; in fact, you can use it more than once, first to
1156set the major mode and then to set minor modes which are specific to 1165set the major mode and then to set minor modes which are specific to
1157particular buffers. But most minor modes should not be specified in 1166particular buffers. But most minor modes should not be specified in
1158the file at all, regardless of how, because they represent user 1167the file at all, because they represent user preferences.
1159preferences.
1160 1168
1161 For example, you may be tempted to try to turn on Auto Fill mode with 1169 For example, you may be tempted to try to turn on Auto Fill mode with
1162a local variable list. That is a mistake. The choice of Auto Fill mode 1170a local variable list. That is a mistake. The choice of Auto Fill mode
@@ -1197,10 +1205,10 @@ answer @samp{n}.
1197 1205
1198 Emacs normally recognizes certain variables/value pairs as safe. 1206 Emacs normally recognizes certain variables/value pairs as safe.
1199For instance, it is safe to give @code{comment-column} or 1207For instance, it is safe to give @code{comment-column} or
1200@code{fill-column} any integer value. If a file specifies only safe 1208@code{fill-column} any integer value. If a file specifies only
1201variable/value pairs, Emacs does not ask for confirmation before 1209known-safe variable/value pairs, Emacs does not ask for confirmation
1202setting them. Otherwise, you can tell Emacs to record that all the 1210before setting them. Otherwise, you can tell Emacs to record all the
1203variable/value pairs in the file are safe, by typing @kbd{!} at the 1211variable/value pairs in this file as safe, by typing @kbd{!} at the
1204confirmation prompt. When Emacs encounters these variable/value pairs 1212confirmation prompt. When Emacs encounters these variable/value pairs
1205subsequently, in the same file or others, it will assume they are 1213subsequently, in the same file or others, it will assume they are
1206safe. 1214safe.
@@ -1232,9 +1240,10 @@ is neither @code{t} nor @code{nil}, so normally Emacs does ask for
1232confirmation about processes @code{eval} variables. 1240confirmation about processes @code{eval} variables.
1233 1241
1234@vindex safe-local-eval-forms 1242@vindex safe-local-eval-forms
1235 The @code{safe-local-eval-forms} is a customizable list of eval 1243 But there is an exception. The @code{safe-local-eval-forms} is a
1236forms which are safe to eval, so Emacs should not ask for 1244customizable list of eval forms which are safe. Emacs does not ask
1237confirmation to evaluate these forms. 1245for confirmation when it finds these forms for the @code{eval}
1246variable.
1238 1247
1239@node Key Bindings 1248@node Key Bindings
1240@section Customizing Key Bindings 1249@section Customizing Key Bindings
@@ -1246,7 +1255,7 @@ to customize key bindings.
1246 1255
1247 Recall that a command is a Lisp function whose definition provides for 1256 Recall that a command is a Lisp function whose definition provides for
1248interactive use. Like every Lisp function, a command has a function 1257interactive use. Like every Lisp function, a command has a function
1249name which usually consists of lower-case letters and hyphens. 1258name, which usually consists of lower-case letters and hyphens.
1250 1259
1251@menu 1260@menu
1252* Keymaps:: Generalities. The global keymap. 1261* Keymaps:: Generalities. The global keymap.
@@ -1405,19 +1414,6 @@ mode.
1405in effect, the definitions in its keymap override both the major 1414in effect, the definitions in its keymap override both the major
1406mode's local keymap and the global keymap. 1415mode's local keymap and the global keymap.
1407 1416
1408@vindex c-mode-map
1409@vindex lisp-mode-map
1410 The local keymaps for Lisp mode and several other major modes always
1411exist even when not in use. These are kept in variables named
1412@code{lisp-mode-map} and so on. For major modes less often used, the
1413local keymap is normally constructed only when the mode is used for the
1414first time in a session. This is to save space. If you wish to change
1415one of these keymaps, you must use the major mode's @dfn{mode
1416hook}---see below.
1417
1418 All minor mode keymaps are created in advance. There is no way to
1419defer their creation until the first time the minor mode is enabled.
1420
1421 A local keymap can locally redefine a key as a prefix key by defining 1417 A local keymap can locally redefine a key as a prefix key by defining
1422it as a prefix keymap. If the key is also defined globally as a prefix, 1418it as a prefix keymap. If the key is also defined globally as a prefix,
1423then its local and global definitions (both keymaps) effectively 1419then its local and global definitions (both keymaps) effectively
@@ -1433,17 +1429,16 @@ sequence by looking in several keymaps, one by one, for a binding of the
1433whole key sequence. First it checks the minor mode keymaps for minor 1429whole key sequence. First it checks the minor mode keymaps for minor
1434modes that are enabled, then it checks the major mode's keymap, and then 1430modes that are enabled, then it checks the major mode's keymap, and then
1435it checks the global keymap. This is not precisely how key lookup 1431it checks the global keymap. This is not precisely how key lookup
1436works, but it's good enough for understanding ordinary circumstances. 1432works, but it's good enough for understanding the results in ordinary
1433circumstances.
1437 1434
1438@cindex rebinding major mode keys 1435@cindex rebinding major mode keys
1439@findex define-key 1436 Most major modes construct their keymaps when the mode is used for
1440 To change the local bindings of a major mode, you must change the 1437the first time in a session. If you wish to change one of these
1441mode's local keymap. Normally you must wait until the first time the 1438keymaps, you must use the major mode's @dfn{mode hook}
1442mode is used, because most major modes don't create their keymaps until 1439(@pxref{Hooks}).
1443then. If you want to specify something in your @file{~/.emacs} file to
1444change a major mode's bindings, you must use the mode's mode hook to
1445delay the change until the mode is first used.
1446 1440
1441@findex define-key
1447 For example, the command @code{texinfo-mode} to select Texinfo mode 1442 For example, the command @code{texinfo-mode} to select Texinfo mode
1448runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook 1443runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook
1449to add local bindings (not very useful, we admit) for @kbd{C-c n} and 1444to add local bindings (not very useful, we admit) for @kbd{C-c n} and
@@ -1458,8 +1453,6 @@ to add local bindings (not very useful, we admit) for @kbd{C-c n} and
1458 'forward-paragraph))) 1453 'forward-paragraph)))
1459@end example 1454@end example
1460 1455
1461 @xref{Hooks}.
1462
1463@node Minibuffer Maps 1456@node Minibuffer Maps
1464@subsection Minibuffer Keymaps 1457@subsection Minibuffer Keymaps
1465 1458
@@ -1545,10 +1538,10 @@ key to rebind.
1545 You can rebind a key that contains more than one event in the same 1538 You can rebind a key that contains more than one event in the same
1546way. Emacs keeps reading the key to rebind until it is a complete key 1539way. Emacs keeps reading the key to rebind until it is a complete key
1547(that is, not a prefix key). Thus, if you type @kbd{C-f} for 1540(that is, not a prefix key). Thus, if you type @kbd{C-f} for
1548@var{key}, that's the end; the minibuffer is entered immediately to 1541@var{key}, that's the end; it enters the minibuffer immediately to
1549read @var{cmd}. But if you type @kbd{C-x}, another character is read; 1542read @var{cmd}. But if you type @kbd{C-x}, since that's a prefix, it
1550if that is @kbd{4}, another character is read, and so on. For 1543reads another character; if that is @kbd{4}, another prefix character,
1551example, 1544it reads one more character, and so on. For example,
1552 1545
1553@example 1546@example
1554M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET} 1547M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET}
@@ -1572,9 +1565,9 @@ definition (or lack of one) come back into effect in that major mode.
1572 If you have redefined (or undefined) a key and you subsequently wish 1565 If you have redefined (or undefined) a key and you subsequently wish
1573to retract the change, undefining the key will not do the job---you need 1566to retract the change, undefining the key will not do the job---you need
1574to redefine the key with its standard definition. To find the name of 1567to redefine the key with its standard definition. To find the name of
1575the standard definition of a key, go to a Fundamental mode buffer and 1568the standard definition of a key, go to a Fundamental mode buffer in a
1576use @kbd{C-h c}. The documentation of keys in this manual also lists 1569fresh Emacs and use @kbd{C-h c}. The documentation of keys in this
1577their command names. 1570manual also lists their command names.
1578 1571
1579 If you want to prevent yourself from invoking a command by mistake, it 1572 If you want to prevent yourself from invoking a command by mistake, it
1580is better to disable the command than to undefine the key. A disabled 1573is better to disable the command than to undefine the key. A disabled
@@ -1669,8 +1662,8 @@ rewrite the first six examples above to use vectors:
1669 1662
1670@noindent 1663@noindent
1671As you see, you represent a multi-character key sequence with a vector 1664As you see, you represent a multi-character key sequence with a vector
1672by listing all of the characters in order within the square brackets that 1665by listing all of the characters, in order, within the square brackets
1673delimit the vector. 1666that delimit the vector.
1674 1667
1675 Language and coding systems can cause problems with key bindings 1668 Language and coding systems can cause problems with key bindings
1676for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}. 1669for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}.
@@ -1819,10 +1812,10 @@ because the terminal sends the same character in both cases.
1819@cindex rebinding non-@acronym{ASCII} keys 1812@cindex rebinding non-@acronym{ASCII} keys
1820@cindex non-@acronym{ASCII} keys, binding 1813@cindex non-@acronym{ASCII} keys, binding
1821 1814
1822If your keyboard has keys that send non-@acronym{ASCII} 1815 If your keyboard has keys that send non-@acronym{ASCII}
1823characters, such as accented letters, rebinding these keys 1816characters, such as accented letters, rebinding these keys
1824must be done by using a vector like this@footnote{Note that 1817must be done by using a vector like this@footnote{You must
1825you should avoid the string syntax for binding 1818avoid the string syntax for binding
1826non-@acronym{ASCII} characters, since they will be 1819non-@acronym{ASCII} characters, since they will be
1827interpreted as meta keys. @xref{Strings of Events,,,elisp, 1820interpreted as meta keys. @xref{Strings of Events,,,elisp,
1828The Emacs Lisp Reference Manual}.}: 1821The Emacs Lisp Reference Manual}.}:
@@ -1834,11 +1827,11 @@ The Emacs Lisp Reference Manual}.}:
1834@noindent 1827@noindent
1835Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. 1828Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}.
1836 1829
1837Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, 1830 Since this puts a non-@acronym{ASCII} character in the @file{.emacs},
1838you should specify a coding system for that file that supports the 1831you should specify a coding system for that file that supports the
1839character in question. @xref{Init Syntax}. 1832character in question. @xref{Init Non-ASCII}.
1840 1833
1841@strong{Warning:} if you change the keyboard encoding, or change 1834 @strong{Warning:} if you change the keyboard encoding, or change
1842between multibyte and unibyte mode, or anything that would alter which 1835between multibyte and unibyte mode, or anything that would alter which
1843code @kbd{C-q} would insert for that character, you'll need to edit 1836code @kbd{C-q} would insert for that character, you'll need to edit
1844the Lisp expression accordingly, to use the character code generated 1837the Lisp expression accordingly, to use the character code generated
@@ -1980,19 +1973,19 @@ usual to do so.
1980@subsection Disabling Commands 1973@subsection Disabling Commands
1981@cindex disabled command 1974@cindex disabled command
1982 1975
1983 Disabling a command marks the command as requiring confirmation before it 1976 Disabling a command menas it requires confirmation before it can be
1984can be executed. The purpose of disabling a command is to prevent 1977executed. The purpose of disabling a command is to prevent users from
1985beginning users from executing it by accident and being confused. 1978executing it by accident and being confused.
1986 1979
1987 An attempt to invoke a disabled command interactively in Emacs 1980 An attempt to invoke a disabled command interactively in Emacs
1988displays a window containing the command's name, its documentation, and 1981displays a window containing the command's name, its documentation,
1989some instructions on what to do immediately; then Emacs asks for input 1982and some instructions on what to do immediately; then Emacs asks for
1990saying whether to execute the command as requested, enable it and 1983input saying whether to execute the command as requested, enable it
1991execute it, or cancel. If you decide to enable the command, you are 1984and execute it, or cancel. If you decide to enable the command, you
1992asked whether to do this permanently or just for the current session. 1985must then answer another question---whether to do this permanently, or
1993(Enabling permanently works by automatically editing your @file{.emacs} 1986just for the current session. (Enabling permanently works by
1994file.) You can also type @kbd{!} to enable @emph{all} commands, 1987automatically editing your @file{.emacs} file.) You can also type
1995for the current session only. 1988@kbd{!} to enable @emph{all} commands, for the current session only.
1996 1989
1997 The direct mechanism for disabling a command is to put a 1990 The direct mechanism for disabling a command is to put a
1998non-@code{nil} @code{disabled} property on the Lisp symbol for the 1991non-@code{nil} @code{disabled} property on the Lisp symbol for the
@@ -2013,15 +2006,14 @@ is included in the message displayed when the command is used:
2013@findex disable-command 2006@findex disable-command
2014@findex enable-command 2007@findex enable-command
2015 You can make a command disabled either by editing the @file{.emacs} 2008 You can make a command disabled either by editing the @file{.emacs}
2016file directly or with the command @kbd{M-x disable-command}, which edits 2009file directly, or with the command @kbd{M-x disable-command}, which edits
2017the @file{.emacs} file for you. Likewise, @kbd{M-x enable-command} 2010the @file{.emacs} file for you. Likewise, @kbd{M-x enable-command}
2018edits @file{.emacs} to enable a command permanently. @xref{Init File}. 2011edits @file{.emacs} to enable a command permanently. @xref{Init File}.
2019 2012
2020 If Emacs was invoked with the @option{-q} or @option{--no-init-file} 2013 If Emacs was invoked with the @option{-q} or @option{--no-init-file}
2021options (@pxref{Initial Options}), it will not edit your 2014options (@pxref{Initial Options}), it will not edit your
2022@file{~/.emacs} init file. This is because editing the init file from 2015@file{~/.emacs} init file. Doing so could lose information
2023such a session might overwrite the lines you might have on your init 2016because Emacs has not read your init file.
2024file which enable and disable commands.
2025 2017
2026 Whether a command is disabled is independent of what key is used to 2018 Whether a command is disabled is independent of what key is used to
2027invoke it; disabling also applies if the command is invoked using 2019invoke it; disabling also applies if the command is invoked using
@@ -2040,7 +2032,7 @@ one of fifteen-odd @dfn{syntax classes}. In some cases it specifies
2040some additional information also. 2032some additional information also.
2041 2033
2042 Each major mode has its own syntax table (though related major modes 2034 Each major mode has its own syntax table (though related major modes
2043sometimes share one syntax table) which it installs in each buffer 2035sometimes share one syntax table), which it installs in each buffer
2044that uses the mode. The syntax table installed in the current buffer 2036that uses the mode. The syntax table installed in the current buffer
2045is the one that all commands use, so we call it ``the'' syntax table. 2037is the one that all commands use, so we call it ``the'' syntax table.
2046 2038
@@ -2048,7 +2040,7 @@ is the one that all commands use, so we call it ``the'' syntax table.
2048@findex describe-syntax 2040@findex describe-syntax
2049 To display a description of the contents of the current syntax 2041 To display a description of the contents of the current syntax
2050table, type @kbd{C-h s} (@code{describe-syntax}). The description of 2042table, type @kbd{C-h s} (@code{describe-syntax}). The description of
2051each character includes both the string you would have to give to 2043each character includes the string you would have to give to
2052@code{modify-syntax-entry} to set up that character's current syntax, 2044@code{modify-syntax-entry} to set up that character's current syntax,
2053starting with the character which designates its syntax class, plus 2045starting with the character which designates its syntax class, plus
2054some English text to explain its meaning. 2046some English text to explain its meaning.
@@ -2176,7 +2168,8 @@ a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for
2176 2168
2177@cindex international characters in @file{.emacs} 2169@cindex international characters in @file{.emacs}
2178@cindex non-@acronym{ASCII} characters in @file{.emacs} 2170@cindex non-@acronym{ASCII} characters in @file{.emacs}
2179If you want to include non-@acronym{ASCII} characters in strings in your init 2171@anchor{Init Non-ASCII}If you want to include non-@acronym{ASCII}
2172characters in strings in your init
2180file, you should consider putting a @w{@samp{-*-coding: 2173file, you should consider putting a @w{@samp{-*-coding:
2181@var{coding-system}-*-}} tag on the first line which states the coding 2174@var{coding-system}-*-}} tag on the first line which states the coding
2182system used to save your @file{.emacs}, as explained in @ref{Recognize 2175system used to save your @file{.emacs}, as explained in @ref{Recognize
@@ -2241,7 +2234,7 @@ is not what you probably want to do in an init file.
2241Specify your own email address, if Emacs can't figure it out correctly. 2234Specify your own email address, if Emacs can't figure it out correctly.
2242 2235
2243@example 2236@example
2244(setq user-mail-address "coon@@yoyodyne.com") 2237(setq user-mail-address "rumsfeld@@torture.gov")
2245@end example 2238@end example
2246 2239
2247Various Emacs packages that need your own email address use the value of 2240Various Emacs packages that need your own email address use the value of