comparison man/custom.texi @ 90377:482dfed28bee

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-51 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 188-189) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 73) - Update from CVS
author Miles Bader <miles@gnu.org>
date Sun, 02 Apr 2006 01:10:03 +0000
parents 9e490faa9f6b 5b3262d81466
children c156f6a9e7b5
comparison
equal deleted inserted replaced
90376:1ad066d533a9 90377:482dfed28bee
5 @node Customization, Quitting, Amusements, Top 5 @node Customization, Quitting, Amusements, Top
6 @chapter Customization 6 @chapter Customization
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
10 behavior of Emacs in minor ways. 10 behavior of Emacs in ways we have anticipated.
11 @iftex 11 @iftex
12 See @cite{The Emacs Lisp Reference Manual} 12 See @cite{The Emacs Lisp Reference Manual}
13 @end iftex 13 @end iftex
14 @ifnottex 14 @ifnottex
15 @xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp 15 @xref{Top, Emacs Lisp, Emacs Lisp, elisp, The Emacs Lisp
16 Reference Manual}, 16 Reference Manual},
17 @end ifnottex 17 @end ifnottex
18 for how to make more far-reaching changes. @xref{X Resources}, 18 for how to make more far-reaching and open-ended changes. @xref{X
19 for information on using X resources to customize Emacs. 19 Resources}, 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
22 particular Emacs session that you do it in---it does not persist 22 particular Emacs session that you do it in---it does not persist
23 between sessions unless you save the customization in a file such as 23 between sessions unless you save the customization in a file such as
24 @file{.emacs} or @file{.Xdefaults} that will affect future sessions. 24 your 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
26 customizations for future sessions, this actually works by editing 26 customizations for future sessions, this actually works by editing
27 @file{.emacs} for you. 27 @file{.emacs} for you.
28 28
29 Another means of customization is the keyboard macro, which is a 29 Another means of customization is the keyboard macro, which is a
30 sequence of keystrokes to be replayed with a single command. 30 sequence of keystrokes to be replayed with a single command.
53 53
54 Minor modes are optional features which you can turn on or off. For 54 Minor modes are optional features which you can turn on or off. For
55 example, Auto Fill mode is a minor mode in which @key{SPC} breaks lines 55 example, Auto Fill mode is a minor mode in which @key{SPC} breaks lines
56 between words as you type. All the minor modes are independent of each 56 between words as you type. All the minor modes are independent of each
57 other and of the selected major mode. Most minor modes say in the mode 57 other and of the selected major mode. Most minor modes say in the mode
58 line when they are on; for example, @samp{Fill} in the mode line means 58 line when they are enabled; for example, @samp{Fill} in the mode line means
59 that Auto Fill mode is on. 59 that 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
62 command that turns the mode on or off. Thus, the command to 62 produce the name of the command that turns the mode on or off. Thus,
63 enable or disable Auto Fill mode is called @code{auto-fill-mode}. These 63 the command to enable or disable Auto Fill mode is called
64 commands 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
65 if 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.
66 off and off if it was on. This is known as @dfn{toggling}. A positive 66
67 argument 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
68 negative argument always turns it off. 68 was off, and off if it was on. This is known as @dfn{toggling}. A
69 positive argument always turns the mode on, and an explicit zero
70 argument 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
71 you do in the Emacs session, in all buffers. Other minor modes are 73 you do in the Emacs session, in all buffers. Other minor modes are
72 buffer-local; they apply only to the current buffer, so you can enable 74 buffer-local; they apply only to the current buffer, so you can enable
73 the mode in certain buffers and not others. 75 the mode in certain buffers and not others.
92 minor modes with a local variables list, because most minor modes are 94 minor modes with a local variables list, because most minor modes are
93 a matter of user preference---other users editing the same file might 95 a matter of user preference---other users editing the same file might
94 not want the same minor modes you prefer. 96 not 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
97 Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, ISO Accents 99 Fill mode, Auto Save mode, Font-Lock mode, Glasses mode, Outline minor
98 mode, Outline minor mode, Overwrite mode, and Binary Overwrite mode. 100 mode, 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
101 as you type them. For example, @samp{amd} might expand to @samp{abbrev 103 as you type them. For example, @samp{amd} might expand to @samp{abbrev
102 mode}. @xref{Abbrevs}, for full information. 104 mode}. @xref{Abbrevs}, for full information.
103 105
104 Auto Fill mode allows you to enter filled text without breaking lines 106 Auto Fill mode allows you to enter filled text without breaking lines
105 explicitly. Emacs inserts newlines as necessary to prevent lines from 107 explicitly. Emacs inserts newlines as necessary to prevent lines from
106 becoming too long. @xref{Filling}. 108 becoming 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
109 periodically to reduce the amount of work you can lose in case of a 111 amount of work you can lose in case of a crash. @xref{Auto Save}.
110 system 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}.
114 115
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
119 programs, such as comments, strings, and function names being defined. 120 in programs, such as comments, strings, and function names being
120 This requires a graphical display that can show multiple fonts. 121 defined. This requires a display that can show multiple fonts or
121 @xref{Faces}. 122 colors. @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
125 produce an accented letter in the ISO Latin-1 character set. The 127 produce an accented letter in the ISO Latin-1 character set. The
126 newer and more general feature of input methods more or less 128 newer and more general feature of input methods more or less
127 supersedes ISO Accents mode. @xref{Unibyte Mode}. 129 supersedes 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
130 called Outline mode; but since it is a minor mode instead, you can 133 called Outline mode; but since it is a minor mode instead, you can
131 combine it with any major mode. @xref{Outline Mode}. 134 combine it with any major mode. @xref{Outline Mode}.
132 135
284 @kbd{M-x customize-browse} is another way to browse the available 287 @kbd{M-x customize-browse} is another way to browse the available
285 settings. This command creates a special customization buffer which 288 settings. This command creates a special customization buffer which
286 shows only the names of groups and settings, and puts them in a 289 shows only the names of groups and settings, and puts them in a
287 structure. 290 structure.
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. 294 changes 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
295 ordinary customization buffer showing just that group and its 298 creates an ordinary customization buffer showing just that group and
296 contents, just that user option, or just that face. This is the way 299 its contents, just that user option, or just that face. This is the
297 to change settings that you find with @kbd{M-x customize-browse}. 300 way 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
300 in, @kbd{M-x customize-apropos} is another way to search for settings. 303 in, @kbd{M-x customize-apropos} is another way to search for settings.
301 However, unlike @code{customize} and @code{customize-browse}, 304 However, unlike @code{customize} and @code{customize-browse},
302 @code{customize-apropos} can only find groups and settings that are 305 @code{customize-apropos} can only find groups and settings that are
341 @smallexample 344 @smallexample
342 [State]: EDITED, shown value does not take effect until you set or @r{@dots{}} 345 [State]: EDITED, shown value does not take effect until you set or @r{@dots{}}
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,
348 you must @dfn{set} the variable. To do this, invoke the 353 you must @dfn{set} the variable. To do this, invoke the
349 @samp{[State]} button and choose @samp{Set for Current Session}. 354 @samp{[State]} button and choose @samp{Set for Current Session}.
350 355
413 instance, to specify a function instead of a pair of coding systems. 418 instance, to specify a function instead of a pair of coding systems.
414 419
415 To delete an association from the list, invoke the @samp{[DEL]} button 420 To delete an association from the list, invoke the @samp{[DEL]} button
416 for that item. To add an association, invoke @samp{[INS]} at the 421 for that item. To add an association, invoke @samp{[INS]} at the
417 position where you want to add it. There is an @samp{[INS]} button 422 position where you want to add it. There is an @samp{[INS]} button
418 between each pair of association, another at the beginning and another 423 between each pair of associations, another at the beginning and another
419 at the end, so you can add the new association at any position in the 424 at the end, so you can add a new association at any position in the
420 list. 425 list.
421 426
422 @kindex TAB @r{(customization buffer)} 427 @kindex TAB @r{(customization buffer)}
423 @kindex S-TAB @r{(customization buffer)} 428 @kindex S-TAB @r{(customization buffer)}
424 @findex widget-forward 429 @findex widget-forward
467 customization buffer in this session. If you customize a variable 472 customization buffer in this session. If you customize a variable
468 and then reset it, which discards the customized value, 473 and then reset it, which discards the customized value,
469 you can get the customized value back again with this operation. 474 you 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
474 customization. Use the @samp{Add Comment} item from the 479 customization. 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
476 comment you enter will be saved, and displayed again if you again view 481 comment you enter will be saved, and displayed again if you again view
477 the same variable in a customization buffer, even in another session. 482 the same variable in a customization buffer, even in another session.
492 buffer according to the setting of the option 497 buffer according to the setting of the option
493 @code{custom-buffer-done-kill}; the default is to bury the buffer. 498 @code{custom-buffer-done-kill}; the default is to bury the buffer.
494 Each of the other buttons performs an operation---set, save or 499 Each of the other buttons performs an operation---set, save or
495 reset---on each of the settings in the buffer that could meaningfully 500 reset---on each of the settings in the buffer that could meaningfully
496 be set, saved or reset. They do not operate on settings whose values 501 be set, saved or reset. They do not operate on settings whose values
497 are hidden, nor on subgroups not visible in the buffer. 502 are 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
508 code that future sessions will read, code to set up those
509 customizations 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
505 file instead. To make this work, your @file{~/.emacs} should set 514 file 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
507 file by calling @code{load}. For example: 516 file by calling @code{load}. For example:
508 517
509 @example 518 @example
510 (setq custom-file "~/.emacs-custom.el") 519 (setq custom-file "~/.emacs-custom.el")
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
515 customization files for different Emacs versions, like this: 524 files for different Emacs versions, like this:
516 525
517 @example 526 @example
518 (cond ((< emacs-major-version 21) 527 (cond ((< emacs-major-version 21)
519 ;; @r{Emacs 20 customization.} 528 ;; @r{Emacs 20 customization.}
520 (setq custom-file "~/.custom-20.el")) 529 (setq custom-file "~/.custom-20.el"))
648 on the character after point. 657 on the character after point.
649 658
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,
652 using @kbd{M-x customize-group}. The immediate contents of the chosen 661 using @kbd{M-x customize-group}. The immediate contents of the chosen
653 group, including variables, faces, and other groups, all appear 662 group, including settings (variables and faces), and other groups, all
654 as well (even if not already loaded). However, the subgroups' own 663 appear as well (even if not already loaded). However, the subgroups'
655 contents are not included. 664 own 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
659 customize-apropos}. You specify a regular expression as argument; 668 customize-apropos}. You specify a regular expression as argument;
660 then all @emph{loaded} settings and groups whose names match this 669 then all @emph{loaded} settings and groups whose names match this
661 regular expression are set up in the customization buffer. If you 670 regular expression are set up in the customization buffer. If you
662 specify an empty regular expression, this includes @emph{all} loaded 671 specify an empty regular expression, this includes @emph{all} loaded
663 groups and settings---which takes a long time to set up. 672 groups 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
667 new settings and settings whose meanings or default values have 676 customizing new settings, and settings whose meanings or default
668 changed. To do this, use @kbd{M-x customize-changed} and 677 values have changed. To do this, use @kbd{M-x customize-changed} and
669 specify a previous Emacs version number using the minibuffer. It 678 specify a previous Emacs version number using the minibuffer. It
670 creates a customization buffer which shows all the settings and groups 679 creates a customization buffer which shows all the settings and groups
671 whose definitions have been changed since the specified version, loading 680 whose definitions have been changed since the specified version,
672 them if necessary. 681 loading them if necessary.
673 682
674 @findex customize-saved 683 @findex customize-saved
675 @findex customize-customized 684 @findex customize-customized
676 If you change settings and then decide the change was a mistake, you 685 If you change settings and then decide the change was a mistake, you
677 can use two special commands to revisit your previous changes. Use 686 can use two special commands to revisit your previous changes. Use
710 also import the variables and faces that you have set using Customize 719 also import the variables and faces that you have set using Customize
711 by visiting the ``special'' theme named @samp{user}. This theme, which 720 by visiting the ``special'' theme named @samp{user}. This theme, which
712 records all the options that you set in the ordinary customization 721 records all the options that you set in the ordinary customization
713 buffer, is always enabled, and always takes precedence over all other 722 buffer, is always enabled, and always takes precedence over all other
714 enabled Custom themes. Additionally, the @samp{user} theme is 723 enabled Custom themes. Additionally, the @samp{user} theme is
715 recorded in your @file{.emacs} file, rather than a 724 recorded 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
719 Once you have defined a Custom theme, you can use it by customizing 728 Once you have defined a Custom theme, you can use it by customizing
720 the variable @code{custom-enabled-themes}. This is a list of Custom 729 the variable @code{custom-enabled-themes}. This is a list of Custom
732 @findex enable-theme 741 @findex enable-theme
733 @findex disable-theme 742 @findex disable-theme
734 You can temporarily enable a Custom theme with @kbd{M-x 743 You can temporarily enable a Custom theme with @kbd{M-x
735 enable-theme}. This prompts for a theme name in the minibuffer, loads 744 enable-theme}. This prompts for a theme name in the minibuffer, loads
736 the theme from the theme file if necessary, and enables the theme. 745 the theme from the theme file if necessary, and enables the theme.
737 You can @dfn{disabled} any enabled theme with the command @kbd{M-x 746 You can @dfn{disable} any enabled theme with the command @kbd{M-x
738 disable-theme}; this returns the options specified in the theme to 747 disable-theme}; this returns the options specified in the theme to
739 their original values. To re-enable the theme, type @kbd{M-x 748 their original values. To re-enable the theme, type @kbd{M-x
740 enable-theme} again. If a theme file is changed during your Emacs 749 enable-theme} again. If a theme file is changed during your Emacs
741 session, you can reload it by typing @kbd{M-x load-theme}. (This also 750 session, you can reload it by typing @kbd{M-x load-theme}. (This also
742 enables the theme.) 751 enables the theme.)
753 variable names consist of words separated by hyphens. A variable can 762 variable names consist of words separated by hyphens. A variable can
754 have a documentation string which describes what kind of value it should 763 have a documentation string which describes what kind of value it should
755 have and how the value will be used. 764 have 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
758 kind of value, but most variables that Emacs uses need a value of a 767 kind of value, but most variables that Emacs uses expect a value of a
759 certain type. Often the value should always be a string, or should 768 certain type. Often the value should always be a string, or should
760 always be a number. Sometimes we say that a certain feature is turned 769 always be a number. Sometimes we say that a certain feature is turned
761 on if a variable is ``non-@code{nil},'' meaning that if the variable's 770 on if a variable is ``non-@code{nil},'' meaning that if the variable's
762 value is @code{nil}, the feature is off, but the feature is on for 771 value is @code{nil}, the feature is off, but the feature is on for
763 @emph{any} other value. The conventional value to use to turn on the 772 @emph{any} other value. The conventional value to use to turn on the
764 feature---since you have to pick one particular value when you set the 773 feature---since you have to pick one particular value when you set the
765 variable---is @code{t}. 774 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
768 most interesting variables for a non-programmer user are those meant 777 most interesting variables for a non-programmer user are those meant
769 for users to change---the @dfn{user options}. 778 for 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
772 in fact a Lisp variable. Emacs does not (usually) change the values 781 in fact a Lisp variable. Emacs does not (usually) change the values
773 of these variables; instead, you set the values, and thereby alter and 782 of these variables on its own; instead, you set the values in order to
774 control the behavior of certain Emacs commands. Use of the 783 control the behavior of certain Emacs commands. Use of the
775 customization buffer is explained above (@pxref{Easy Customization}); 784 customization buffer is explained above (@pxref{Easy Customization});
776 here we describe other aspects of Emacs variables. 785 here we describe other aspects of Emacs variables.
777 786
778 @menu 787 @menu
806 815
807 @noindent 816 @noindent
808 displays something like this: 817 displays something like this:
809 818
810 @smallexample 819 @smallexample
820 fill-column is a variable defined in `C source code'.
811 fill-column's value is 70 821 fill-column's value is 70
822 Local in buffer custom.texi; global value is 70
823 Automatically becomes buffer-local when set in any fashion.
812 824
813 Documentation: 825 Documentation:
814 *Column beyond which automatic line-wrapping should happen. 826 *Column beyond which automatic line-wrapping should happen.
815 Automatically becomes buffer-local when set in any fashion. 827 Interactively, you can set the buffer local value using C-x f.
828
829 You can customize this variable.
816 @end smallexample 830 @end smallexample
817 831
818 @noindent 832 @noindent
819 The star at the beginning of the documentation indicates that this 833 The line that says you can customize the variable indicates that this
820 variable is a user option. @kbd{C-h v} is not restricted to user 834 variable is a user option. (The star also indicates this, but it is
821 options; it allows any variable name. 835 an obsolete indicator that may eventually disappear.) @kbd{C-h v} is
836 not 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 839 The most convenient way to set a specific user option variable is with
825 with @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
826 minibuffer (with completion), and then reads a Lisp expression for the 841 minibuffer (with completion), and then reads a Lisp expression for the
827 new value using the minibuffer a second time (you can insert the old 842 new value using the minibuffer a second time (you can insert the old
828 value into the minibuffer for editing via @kbd{M-n}). For example, 843 value into the minibuffer for editing via @kbd{M-n}). For example,
829 844
830 @example 845 @example
887 @code{find-file-not-found-functions} (@pxref{Visiting}) is abnormal because 902 @code{find-file-not-found-functions} (@pxref{Visiting}) is abnormal because
888 as soon as one hook function returns a non-@code{nil} value, the rest 903 as soon as one hook function returns a non-@code{nil} value, the rest
889 are not called at all. The documentation of each abnormal hook variable 904 are not called at all. The documentation of each abnormal hook variable
890 explains in detail what is peculiar about it. 905 explains 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
893 variable, but the recommended way to add a hook function to a hook 909 variable, 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}.
895 specify any valid Lisp function as the hook function, provided it can 911 @xref{Hooks,,, elisp, The Emacs Lisp Reference Manual}.
896 handle the proper number of arguments (zero arguments, in the case of
897 a normal hook). Of course, not every Lisp function is @emph{useful}
898 in 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
901 when entering Text mode and other modes based on Text mode: 914 when entering Text mode and other modes based on Text mode:
902 915
903 @example 916 @example
934 It is best to design your hook functions so that the order in which 947 It is best to design your hook functions so that the order in which
935 they are executed does not matter. Any dependence on the order is 948 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
937 recently added hook functions are executed first. 950 recently 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
940 function by calling @code{add-hook} over and over, remember that all 954 function by calling @code{add-hook} over and over, remember that all
941 the versions you added will remain in the hook variable together. You 955 the versions you added will remain in the hook variable together. You
942 can clear out individual functions with @code{remove-hook}, or do 956 can clear out individual functions by calling @code{remove-hook}, or
943 @code{(setq @var{hook-variable} nil)} to remove everything. 957 do @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
947 961
948 @table @kbd 962 @table @kbd
961 value in other buffers. A few variables are always local in every 975 value in other buffers. A few variables are always local in every
962 buffer. Every other Emacs variable has a @dfn{global} value which is in 976 buffer. Every other Emacs variable has a @dfn{global} value which is in
963 effect in all buffers that have not made the variable local. 977 effect 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
967 local to the current buffer. Further changes in this buffer will not 981 it local to the current buffer. Changing its value subsequently in
968 affect others, and further changes in the global value will not affect this 982 this buffer will not affect others, and changes in its global value
969 buffer. 983 will 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
974 changes the future behavior of the variable so that it will become local 988 become local automatically whenever it is set. More precisely, once a
975 automatically when it is set. More precisely, once a variable has been 989 variable has been marked in this way, the usual ways of setting the
976 marked in this way, the usual ways of setting the variable automatically 990 variable automatically do @code{make-local-variable} first. We call
977 do @code{make-local-variable} first. We call such variables 991 such variables @dfn{per-buffer} variables. Many variables in Emacs
978 @dfn{per-buffer} variables. 992 are normally per-buffer; the variable's document string tells you when
993 this is so. A per-buffer variable's global value is normally never
994 effective in any buffer, but it still has a meaning: it is the initial
995 value 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
981 buffer before setting the variables. This is why changing major modes 998 buffer before setting the variables. This is why changing major modes
982 in one buffer has no effect on other buffers. Minor modes also work by 999 in one buffer has no effect on other buffers. Minor modes also work
983 setting variables---normally, each minor mode has one controlling 1000 by setting variables---normally, each minor mode has one controlling
984 variable which is non-@code{nil} when the mode is enabled (@pxref{Minor 1001 variable which is non-@code{nil} when the mode is enabled
985 Modes}). For most minor modes, the controlling variable is per buffer. 1002 (@pxref{Minor Modes}). For many minor modes, the controlling variable
986 1003 is per buffer, and thus always buffer-local. Otherwise, you can make
987 Emacs contains a number of variables that are always per-buffer. 1004 it local in a specific buffer like any other variable.
988 These 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
994 always local in every buffer, but they are used for internal
995 purposes.@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
998 local to each display instead (@pxref{Multiple Displays}). If you try to 1007 local to each display instead (@pxref{Multiple Displays}). If you try to
999 make one of these variables buffer-local, you'll get an error message. 1008 make 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
1003 it cease to be local to the current buffer. The global value of the 1012 local to the current buffer. The global value of the variable
1004 variable henceforth is in effect in this buffer. Setting the major mode 1013 henceforth is in effect in this buffer. Setting the major mode kills
1005 kills all the local variables of the buffer except for a few variables 1014 all the local variables of the buffer except for a few variables
1006 specially marked as @dfn{permanent locals}. 1015 specially marked as @dfn{permanent locals}.
1007 1016
1008 @findex setq-default 1017 @findex setq-default
1009 To set the global value of a variable, regardless of whether the 1018 To set the global value of a variable, regardless of whether the
1010 variable has a local value in the current buffer, you can use the Lisp 1019 variable has a local value in the current buffer, you can use the Lisp
1080 The @code{eval} pseudo-variable, described below, can be specified in 1089 The @code{eval} pseudo-variable, described below, can be specified in
1081 the first line as well. 1090 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
1085 interpreter, so you cannot put any local variables there. To accommodate 1094 interpreter, so you cannot put any local variables there. To
1086 for this, when Emacs visits a shell script, it looks for local variable 1095 accommodate this, Emacs looks for local variable specifications in the
1087 specifications 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
1090 last page. (It is often best to put it on a page by itself.) The local 1099 last page. (It is often best to put it on a page by itself.) The local
1091 variables list starts with a line containing the string @samp{Local 1100 variables list starts with a line containing the string @samp{Local
1092 Variables:}, and ends with a line containing the string @samp{End:}. In 1101 Variables:}, and ends with a line containing the string @samp{End:}. In
1106 ;;; comment-start: ";;; " *** 1115 ;;; comment-start: ";;; " ***
1107 ;;; comment-end:"***" *** 1116 ;;; comment-end:"***" ***
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
1112 ends with the suffix @samp{ ***}. Emacs recognizes these as the prefix 1121 the suffix @samp{ ***}. Emacs recognizes these as the prefix and
1113 and suffix based on the first line of the list, by finding them 1122 suffix based on the first line of the list, by finding them
1114 surrounding the magic string @samp{Local Variables:}; then it 1123 surrounding the magic string @samp{Local Variables:}; then it
1115 automatically discards them from the other lines of the list. 1124 automatically discards them from the other lines of the list.
1116 1125
1117 The usual reason for using a prefix and/or suffix is to embed the 1126 The usual reason for using a prefix and/or suffix is to embed the
1118 local variables list in a comment, so it won't confuse other programs 1127 local variables list in a comment, so it won't confuse other programs
1153 1162
1154 You can use the @code{mode} ``variable'' to set minor modes as well 1163 You can use the @code{mode} ``variable'' to set minor modes as well
1155 as the major modes; in fact, you can use it more than once, first to 1164 as the major modes; in fact, you can use it more than once, first to
1156 set the major mode and then to set minor modes which are specific to 1165 set the major mode and then to set minor modes which are specific to
1157 particular buffers. But most minor modes should not be specified in 1166 particular buffers. But most minor modes should not be specified in
1158 the file at all, regardless of how, because they represent user 1167 the file at all, because they represent user preferences.
1159 preferences.
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
1162 a local variable list. That is a mistake. The choice of Auto Fill mode 1170 a local variable list. That is a mistake. The choice of Auto Fill mode
1163 or not is a matter of individual taste, not a matter of the contents of 1171 or not is a matter of individual taste, not a matter of the contents of
1164 particular files. If you want to use Auto Fill, set up major mode hooks 1172 particular files. If you want to use Auto Fill, set up major mode hooks
1195 (@pxref{Initial Options}), it can't really ask you, so it assumes the 1203 (@pxref{Initial Options}), it can't really ask you, so it assumes the
1196 answer @samp{n}. 1204 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.
1199 For instance, it is safe to give @code{comment-column} or 1207 For 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
1201 variable/value pairs, Emacs does not ask for confirmation before 1209 known-safe variable/value pairs, Emacs does not ask for confirmation
1202 setting them. Otherwise, you can tell Emacs to record that all the 1210 before setting them. Otherwise, you can tell Emacs to record all the
1203 variable/value pairs in the file are safe, by typing @kbd{!} at the 1211 variable/value pairs in this file as safe, by typing @kbd{!} at the
1204 confirmation prompt. When Emacs encounters these variable/value pairs 1212 confirmation prompt. When Emacs encounters these variable/value pairs
1205 subsequently, in the same file or others, it will assume they are 1213 subsequently, in the same file or others, it will assume they are
1206 safe. 1214 safe.
1207 1215
1208 @vindex safe-local-variable-values 1216 @vindex safe-local-variable-values
1230 for @code{enable-local-variables}. The default is @code{maybe}, which 1238 for @code{enable-local-variables}. The default is @code{maybe}, which
1231 is neither @code{t} nor @code{nil}, so normally Emacs does ask for 1239 is neither @code{t} nor @code{nil}, so normally Emacs does ask for
1232 confirmation about processes @code{eval} variables. 1240 confirmation 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
1236 forms which are safe to eval, so Emacs should not ask for 1244 customizable list of eval forms which are safe. Emacs does not ask
1237 confirmation to evaluate these forms. 1245 for confirmation when it finds these forms for the @code{eval}
1246 variable.
1238 1247
1239 @node Key Bindings 1248 @node Key Bindings
1240 @section Customizing Key Bindings 1249 @section Customizing Key Bindings
1241 @cindex key bindings 1250 @cindex key bindings
1242 1251
1244 and @dfn{keymaps}, which record key bindings. It also explains how 1253 and @dfn{keymaps}, which record key bindings. It also explains how
1245 to customize key bindings. 1254 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
1248 interactive use. Like every Lisp function, a command has a function 1257 interactive use. Like every Lisp function, a command has a function
1249 name which usually consists of lower-case letters and hyphens. 1258 name, 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.
1253 * Prefix Keymaps:: Keymaps for prefix keys. 1262 * Prefix Keymaps:: Keymaps for prefix keys.
1254 * Local Keymaps:: Major and minor modes have their own keymaps. 1263 * Local Keymaps:: Major and minor modes have their own keymaps.
1403 @cindex minor mode keymap 1412 @cindex minor mode keymap
1404 Minor modes can also have local keymaps. Whenever a minor mode is 1413 Minor modes can also have local keymaps. Whenever a minor mode is
1405 in effect, the definitions in its keymap override both the major 1414 in effect, the definitions in its keymap override both the major
1406 mode's local keymap and the global keymap. 1415 mode'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
1411 exist 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
1413 local keymap is normally constructed only when the mode is used for the
1414 first time in a session. This is to save space. If you wish to change
1415 one of these keymaps, you must use the major mode's @dfn{mode
1416 hook}---see below.
1417
1418 All minor mode keymaps are created in advance. There is no way to
1419 defer 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
1422 it as a prefix keymap. If the key is also defined globally as a prefix, 1418 it as a prefix keymap. If the key is also defined globally as a prefix,
1423 then its local and global definitions (both keymaps) effectively 1419 then its local and global definitions (both keymaps) effectively
1424 combine: both of them are used to look up the event that follows the 1420 combine: both of them are used to look up the event that follows the
1425 prefix key. Thus, if the mode's local keymap defines @kbd{C-c} as 1421 prefix key. Thus, if the mode's local keymap defines @kbd{C-c} as
1431 Another way to think of this is that Emacs handles a multi-event key 1427 Another way to think of this is that Emacs handles a multi-event key
1432 sequence by looking in several keymaps, one by one, for a binding of the 1428 sequence by looking in several keymaps, one by one, for a binding of the
1433 whole key sequence. First it checks the minor mode keymaps for minor 1429 whole key sequence. First it checks the minor mode keymaps for minor
1434 modes that are enabled, then it checks the major mode's keymap, and then 1430 modes that are enabled, then it checks the major mode's keymap, and then
1435 it checks the global keymap. This is not precisely how key lookup 1431 it checks the global keymap. This is not precisely how key lookup
1436 works, but it's good enough for understanding ordinary circumstances. 1432 works, but it's good enough for understanding the results in ordinary
1433 circumstances.
1437 1434
1438 @cindex rebinding major mode keys 1435 @cindex rebinding major mode keys
1436 Most major modes construct their keymaps when the mode is used for
1437 the first time in a session. If you wish to change one of these
1438 keymaps, you must use the major mode's @dfn{mode hook}
1439 (@pxref{Hooks}).
1440
1439 @findex define-key 1441 @findex define-key
1440 To change the local bindings of a major mode, you must change the
1441 mode's local keymap. Normally you must wait until the first time the
1442 mode is used, because most major modes don't create their keymaps until
1443 then. If you want to specify something in your @file{~/.emacs} file to
1444 change a major mode's bindings, you must use the mode's mode hook to
1445 delay the change until the mode is first used.
1446
1447 For example, the command @code{texinfo-mode} to select Texinfo mode 1442 For example, the command @code{texinfo-mode} to select Texinfo mode
1448 runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook 1443 runs the hook @code{texinfo-mode-hook}. Here's how you can use the hook
1449 to add local bindings (not very useful, we admit) for @kbd{C-c n} and 1444 to add local bindings (not very useful, we admit) for @kbd{C-c n} and
1450 @kbd{C-c p} in Texinfo mode: 1445 @kbd{C-c p} in Texinfo mode:
1451 1446
1455 (define-key texinfo-mode-map "\C-cp" 1450 (define-key texinfo-mode-map "\C-cp"
1456 'backward-paragraph) 1451 'backward-paragraph)
1457 (define-key texinfo-mode-map "\C-cn" 1452 (define-key texinfo-mode-map "\C-cn"
1458 'forward-paragraph))) 1453 'forward-paragraph)))
1459 @end example 1454 @end example
1460
1461 @xref{Hooks}.
1462 1455
1463 @node Minibuffer Maps 1456 @node Minibuffer Maps
1464 @subsection Minibuffer Keymaps 1457 @subsection Minibuffer Keymaps
1465 1458
1466 @cindex minibuffer keymaps 1459 @cindex minibuffer keymaps
1543 key to rebind. 1536 key to rebind.
1544 1537
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
1546 way. Emacs keeps reading the key to rebind until it is a complete key 1539 way. 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
1549 read @var{cmd}. But if you type @kbd{C-x}, another character is read; 1542 read @var{cmd}. But if you type @kbd{C-x}, since that's a prefix, it
1550 if that is @kbd{4}, another character is read, and so on. For 1543 reads another character; if that is @kbd{4}, another prefix character,
1551 example, 1544 it reads one more character, and so on. For example,
1552 1545
1553 @example 1546 @example
1554 M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET} 1547 M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET}
1555 @end example 1548 @end example
1556 1549
1570 definition (or lack of one) come back into effect in that major mode. 1563 definition (or lack of one) come back into effect in that major mode.
1571 1564
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
1573 to retract the change, undefining the key will not do the job---you need 1566 to retract the change, undefining the key will not do the job---you need
1574 to redefine the key with its standard definition. To find the name of 1567 to redefine the key with its standard definition. To find the name of
1575 the standard definition of a key, go to a Fundamental mode buffer and 1568 the standard definition of a key, go to a Fundamental mode buffer in a
1576 use @kbd{C-h c}. The documentation of keys in this manual also lists 1569 fresh Emacs and use @kbd{C-h c}. The documentation of keys in this
1577 their command names. 1570 manual 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
1580 is better to disable the command than to undefine the key. A disabled 1573 is better to disable the command than to undefine the key. A disabled
1581 command is less work to invoke when you really want to. 1574 command is less work to invoke when you really want to.
1582 @xref{Disabling}. 1575 @xref{Disabling}.
1667 (global-set-key [?\C-x ?\e ?\e] 'repeat-complex-command) 1660 (global-set-key [?\C-x ?\e ?\e] 'repeat-complex-command)
1668 @end example 1661 @end example
1669 1662
1670 @noindent 1663 @noindent
1671 As you see, you represent a multi-character key sequence with a vector 1664 As you see, you represent a multi-character key sequence with a vector
1672 by listing all of the characters in order within the square brackets that 1665 by listing all of the characters, in order, within the square brackets
1673 delimit the vector. 1666 that 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
1676 for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}. 1669 for non-@acronym{ASCII} characters. @xref{Non-ASCII Rebinding}.
1677 1670
1678 @node Function Keys 1671 @node Function Keys
1817 @node Non-ASCII Rebinding 1810 @node Non-ASCII Rebinding
1818 @subsection Non-@acronym{ASCII} Characters on the Keyboard 1811 @subsection Non-@acronym{ASCII} Characters on the Keyboard
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
1822 If your keyboard has keys that send non-@acronym{ASCII} 1815 If your keyboard has keys that send non-@acronym{ASCII}
1823 characters, such as accented letters, rebinding these keys 1816 characters, such as accented letters, rebinding these keys
1824 must be done by using a vector like this@footnote{Note that 1817 must be done by using a vector like this@footnote{You must
1825 you should avoid the string syntax for binding 1818 avoid the string syntax for binding
1826 non-@acronym{ASCII} characters, since they will be 1819 non-@acronym{ASCII} characters, since they will be
1827 interpreted as meta keys. @xref{Strings of Events,,,elisp, 1820 interpreted as meta keys. @xref{Strings of Events,,,elisp,
1828 The Emacs Lisp Reference Manual}.}: 1821 The Emacs Lisp Reference Manual}.}:
1829 1822
1830 @example 1823 @example
1832 @end example 1825 @end example
1833 1826
1834 @noindent 1827 @noindent
1835 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. 1828 Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}.
1836 1829
1837 Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, 1830 Since this puts a non-@acronym{ASCII} character in the @file{.emacs},
1838 you should specify a coding system for that file that supports the 1831 you should specify a coding system for that file that supports the
1839 character in question. @xref{Init Syntax}. 1832 character 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
1842 between multibyte and unibyte mode, or anything that would alter which 1835 between multibyte and unibyte mode, or anything that would alter which
1843 code @kbd{C-q} would insert for that character, you'll need to edit 1836 code @kbd{C-q} would insert for that character, you'll need to edit
1844 the Lisp expression accordingly, to use the character code generated 1837 the Lisp expression accordingly, to use the character code generated
1845 by @kbd{C-q} in the new mode. 1838 by @kbd{C-q} in the new mode.
1846 1839
1978 1971
1979 @node Disabling 1972 @node Disabling
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
1984 can be executed. The purpose of disabling a command is to prevent 1977 executed. The purpose of disabling a command is to prevent users from
1985 beginning users from executing it by accident and being confused. 1978 executing 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
1988 displays a window containing the command's name, its documentation, and 1981 displays a window containing the command's name, its documentation,
1989 some instructions on what to do immediately; then Emacs asks for input 1982 and some instructions on what to do immediately; then Emacs asks for
1990 saying whether to execute the command as requested, enable it and 1983 input saying whether to execute the command as requested, enable it
1991 execute it, or cancel. If you decide to enable the command, you are 1984 and execute it, or cancel. If you decide to enable the command, you
1992 asked whether to do this permanently or just for the current session. 1985 must then answer another question---whether to do this permanently, or
1993 (Enabling permanently works by automatically editing your @file{.emacs} 1986 just for the current session. (Enabling permanently works by
1994 file.) You can also type @kbd{!} to enable @emph{all} commands, 1987 automatically editing your @file{.emacs} file.) You can also type
1995 for 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
1998 non-@code{nil} @code{disabled} property on the Lisp symbol for the 1991 non-@code{nil} @code{disabled} property on the Lisp symbol for the
1999 command. Here is the Lisp program to do this: 1992 command. Here is the Lisp program to do this:
2000 1993
2011 @end example 2004 @end example
2012 2005
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}
2016 file directly or with the command @kbd{M-x disable-command}, which edits 2009 file directly, or with the command @kbd{M-x disable-command}, which edits
2017 the @file{.emacs} file for you. Likewise, @kbd{M-x enable-command} 2010 the @file{.emacs} file for you. Likewise, @kbd{M-x enable-command}
2018 edits @file{.emacs} to enable a command permanently. @xref{Init File}. 2011 edits @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}
2021 options (@pxref{Initial Options}), it will not edit your 2014 options (@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
2023 such a session might overwrite the lines you might have on your init 2016 because Emacs has not read your init file.
2024 file 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
2027 invoke it; disabling also applies if the command is invoked using 2019 invoke it; disabling also applies if the command is invoked using
2028 @kbd{M-x}. Disabling a command has no effect on calling it as a 2020 @kbd{M-x}. Disabling a command has no effect on calling it as a
2029 function from Lisp programs. 2021 function from Lisp programs.
2038 string quotes, and so on. It does this by assigning each character to 2030 string quotes, and so on. It does this by assigning each character to
2039 one of fifteen-odd @dfn{syntax classes}. In some cases it specifies 2031 one of fifteen-odd @dfn{syntax classes}. In some cases it specifies
2040 some additional information also. 2032 some 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
2043 sometimes share one syntax table) which it installs in each buffer 2035 sometimes share one syntax table), which it installs in each buffer
2044 that uses the mode. The syntax table installed in the current buffer 2036 that uses the mode. The syntax table installed in the current buffer
2045 is the one that all commands use, so we call it ``the'' syntax table. 2037 is the one that all commands use, so we call it ``the'' syntax table.
2046 2038
2047 @kindex C-h s 2039 @kindex C-h s
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
2050 table, type @kbd{C-h s} (@code{describe-syntax}). The description of 2042 table, type @kbd{C-h s} (@code{describe-syntax}). The description of
2051 each character includes both the string you would have to give to 2043 each 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,
2053 starting with the character which designates its syntax class, plus 2045 starting with the character which designates its syntax class, plus
2054 some English text to explain its meaning. 2046 some English text to explain its meaning.
2055 2047
2056 A syntax table is actually a Lisp object, a char-table, whose 2048 A syntax table is actually a Lisp object, a char-table, whose
2174 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for 2166 a Meta character, as in @samp{\M-a} for @kbd{Meta-A} or @samp{\M-\C-a} for
2175 @kbd{Control-Meta-A}.@refill 2167 @kbd{Control-Meta-A}.@refill
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}
2179 If 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}
2172 characters in strings in your init
2180 file, you should consider putting a @w{@samp{-*-coding: 2173 file, 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
2182 system used to save your @file{.emacs}, as explained in @ref{Recognize 2175 system used to save your @file{.emacs}, as explained in @ref{Recognize
2183 Coding}. This is because the defaults for decoding non-@acronym{ASCII} text might 2176 Coding}. This is because the defaults for decoding non-@acronym{ASCII} text might
2184 not yet be set up by the time Emacs reads those parts of your init file 2177 not yet be set up by the time Emacs reads those parts of your init file
2239 @item 2232 @item
2240 @vindex user-mail-address 2233 @vindex user-mail-address
2241 Specify your own email address, if Emacs can't figure it out correctly. 2234 Specify 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
2247 Various Emacs packages that need your own email address use the value of 2240 Various Emacs packages that need your own email address use the value of
2248 @code{user-mail-address}. 2241 @code{user-mail-address}.
2249 2242