Sync up with r21-2-27.
[chise/xemacs-chise.git] / info / xemacs.info-16
1 This is Info file ../info/xemacs.info, produced by Makeinfo version
2 1.68 from the input file xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
25
26    Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
31
32 \1f
33 File: xemacs.info,  Node: Minor Modes,  Next: Variables,  Up: Customization
34
35 Minor Modes
36 ===========
37
38    Minor modes are options which you can use or not.  For example, Auto
39 Fill mode is a minor mode in which <SPC> breaks lines between words as
40 you type.  All the minor modes are independent of each other and of the
41 selected major mode.  Most minor modes inform you in the mode line when
42 they are on; for example, `Fill' in the mode line means that Auto Fill
43 mode is on.
44
45    Append `-mode' to the name of a minor mode to get the name of a
46 command function that turns the mode on or off.  Thus, the command to
47 enable or disable Auto Fill mode is called `M-x auto-fill-mode'.  These
48 commands are usually invoked with `M-x', but you can bind keys to them
49 if you wish.  With no argument, the function turns the mode on if it was
50 off and off if it was on.  This is known as "toggling".  A positive
51 argument always turns the mode on, and an explicit zero argument or a
52 negative argument always turns it off.
53
54    Auto Fill mode allows you to enter filled text without breaking lines
55 explicitly.  Emacs inserts newlines as necessary to prevent lines from
56 becoming too long.  *Note Filling::.
57
58    Overwrite mode causes ordinary printing characters to replace
59 existing text instead of moving it to the right.  For example, if point
60 is in front of the `B' in `FOOBAR', and you type a `G' in Overwrite
61 mode, it changes to `FOOGAR', instead of `FOOGBAR'.
62
63    Abbrev mode allows you to define abbreviations that automatically
64 expand as you type them.  For example, `amd' might expand to `abbrev
65 mode'.  *Note Abbrevs::, for full information.
66
67 \1f
68 File: xemacs.info,  Node: Variables,  Next: Keyboard Macros,  Prev: Minor Modes,  Up: Customization
69
70 Variables
71 =========
72
73    A "variable" is a Lisp symbol which has a value.  Variable names can
74 contain any characters, but by convention they are words separated by
75 hyphens.  A variable can also have a documentation string, which
76 describes what kind of value it should have and how the value will be
77 used.
78
79    Lisp allows any variable to have any kind of value, but most
80 variables that Emacs uses require a value of a certain type.  Often the
81 value has to be a string or a number.  Sometimes we say that a certain
82 feature is turned on if a variable is "non-`nil'," meaning that if the
83 variable's value is `nil', the feature is off, but the feature is on
84 for any other value.  The conventional value to turn on the
85 feature--since you have to pick one particular value when you set the
86 variable--is `t'.
87
88    Emacs uses many Lisp variables for internal recordkeeping, as any
89 Lisp program must, but the most interesting variables for you are the
90 ones that exist for the sake of customization.  Emacs does not
91 (usually) change the values of these variables; instead, you set the
92 values, and thereby alter and control the behavior of certain Emacs
93 commands.  These variables are called "options".  Most options are
94 documented in this manual and appear in the Variable Index (*note
95 Variable Index::.).
96
97    One example of a variable which is an option is `fill-column', which
98 specifies the position of the right margin (as a number of characters
99 from the left margin) to be used by the fill commands (*note
100 Filling::.).
101
102 * Menu:
103
104 * Examining::           Examining or setting one variable's value.
105 * Easy Customization::  Convenient and easy customization of variables.
106 * Edit Options::        Examining or editing list of all variables' values.
107 * Locals::              Per-buffer values of variables.
108 * File Variables::      How files can specify variable values.
109
110 \1f
111 File: xemacs.info,  Node: Examining,  Next: Easy Customization,  Up: Variables
112
113 Examining and Setting Variables
114 -------------------------------
115
116 `C-h v'
117 `M-x describe-variable'
118      Print the value and documentation of a variable.
119
120 `M-x set-variable'
121      Change the value of a variable.
122
123    To examine the value of a single variable, use `C-h v'
124 (`describe-variable'), which reads a variable name using the
125 minibuffer, with completion.  It prints both the value and the
126 documentation of the variable.
127
128      C-h v fill-column <RET>
129
130 prints something like:
131
132      fill-column's value is 75
133      
134      Documentation:
135      *Column beyond which automatic line-wrapping should happen.
136      Automatically becomes local when set in any fashion.
137
138 The star at the beginning of the documentation indicates that this
139 variable is an option.  `C-h v' is not restricted to options; it allows
140 any variable name.
141
142    If you know which option you want to set, you can use `M-x
143 set-variable' to set it.  This prompts for the variable name in the
144 minibuffer (with completion), and then prompts for a Lisp expression
145 for the new value using the minibuffer a second time.  For example,
146
147      M-x set-variable <RET> fill-column <RET> 75 <RET>
148
149 sets `fill-column' to 75, as if you had executed the Lisp expression
150 `(setq fill-column 75)'.
151
152    Setting variables in this way, like all means of customizing Emacs
153 except where explicitly stated, affects only the current Emacs session.
154
155 \1f
156 File: xemacs.info,  Node: Easy Customization,  Next: Edit Options,  Prev: Examining,  Up: Variables
157
158 Easy Customization Interface
159 ----------------------------
160
161    A convenient way to find the user option variables that you want to
162 change, and then change them, is with `M-x customize'.  This command
163 creates a "customization buffer" with which you can browse through the
164 Emacs user options in a logically organized structure, then edit and
165 set their values.  You can also use the customization buffer to save
166 settings permanently.  (Not all Emacs user options are included in this
167 structure as of yet, but we are adding the rest.)
168
169 * Menu:
170
171 * Groups: Customization Groups.
172                              How options are classified in a structure.
173 * Changing an Option::       How to edit a value and set an option.
174 * Face Customization::       How to edit the attributes of a face.
175 * Specific Customization::   Making a customization buffer for specific
176                                 options, faces, or groups.
177
178 \1f
179 File: xemacs.info,  Node: Customization Groups,  Next: Changing an Option,  Up: Easy Customization
180
181 Customization Groups
182 ....................
183
184    For customization purposes, user options are organized into "groups"
185 to help you find them.  Groups are collected into bigger groups, all
186 the way up to a master group called `Emacs'.
187
188    `M-x customize' creates a customization buffer that shows the
189 top-level `Emacs' group and the second-level groups immediately under
190 it.  It looks like this, in part:
191
192      /- Emacs group: ---------------------------------------------------\
193            [State]: visible group members are all at standard settings.
194         Customization of the One True Editor.
195         See also [Manual].
196      
197       [Open] Editing group
198      Basic text editing facilities.
199      
200       [Open] External group
201      Interfacing to external utilities.
202      
203      MORE SECOND-LEVEL GROUPS
204      
205      \- Emacs group end ------------------------------------------------/
206
207 This says that the buffer displays the contents of the `Emacs' group.
208 The other groups are listed because they are its contents.  But they
209 are listed differently, without indentation and dashes, because *their*
210 contents are not included.  Each group has a single-line documentation
211 string; the `Emacs' group also has a `[State]' line.
212
213    Most of the text in the customization buffer is read-only, but it
214 typically includes some "editable fields" that you can edit.  There are
215 also "active fields"; this means a field that does something when you
216 "invoke" it.  To invoke an active field, either click on it with
217 `Mouse-1', or move point to it and type <RET>.
218
219    For example, the phrase `[Open]' that appears in a second-level
220 group is an active field.  Invoking the `[Open]' field for a group
221 opens up a new customization buffer, which shows that group and its
222 contents.  This field is a kind of hypertext link to another group.
223
224    The `Emacs' group does not include any user options itself, but
225 other groups do.  By examining various groups, you will eventually find
226 the options and faces that belong to the feature you are interested in
227 customizing.  Then you can use the customization buffer to set them.
228
229    You can view the structure of customization groups on a larger scale
230 with `M-x customize-browse'.  This command creates a special kind of
231 customization buffer which shows only the names of the groups (and
232 options and faces), and their structure.
233
234    In this buffer, you can show the contents of a group by invoking
235 `[+]'.  When the group contents are visible, this button changes to
236 `[-]'; invoking that hides the group contents.
237
238    Each group, option or face name in this buffer has an active field
239 which says `[Group]', `[Option]' or `[Face]'.  Invoking that active
240 field creates an ordinary customization buffer showing just that group
241 and its contents, just that option, or just that face.  This is the way
242 to set values in it.
243
244 \1f
245 File: xemacs.info,  Node: Changing an Option,  Next: Face Customization,  Prev: Customization Groups,  Up: Easy Customization
246
247 Changing an Option
248 ..................
249
250    Here is an example of what a user option looks like in the
251 customization buffer:
252
253      Kill Ring Max: [Hide] 30
254         [State]: this option is unchanged from its standard setting.
255      Maximum length of kill ring before oldest elements are thrown away.
256
257    The text following `[Hide]', `30' in this case, indicates the
258 current value of the option.  If you see `[Show]' instead of `[Hide]',
259 it means that the value is hidden; the customization buffer initially
260 hides values that take up several lines.  Invoke `[Show]' to show the
261 value.
262
263    The line after the option name indicates the "customization state"
264 of the option: in the example above, it says you have not changed the
265 option yet.  The word `[State]' at the beginning of this line is
266 active; you can get a menu of various operations by invoking it with
267 `Mouse-1' or <RET>.  These operations are essential for customizing the
268 variable.
269
270    The line after the `[State]' line displays the beginning of the
271 option's documentation string.  If there are more lines of
272 documentation, this line ends with `[More]'; invoke this to show the
273 full documentation string.
274
275    To enter a new value for `Kill Ring Max', move point to the value
276 and edit it textually.  For example, you can type `M-d', then insert
277 another number.
278
279    When you begin to alter the text, you will see the `[State]' line
280 change to say that you have edited the value:
281
282      [State]: you have edited the value as text, but not set the option.
283
284    Editing the value does not actually set the option variable.  To do
285 that, you must "set" the option.  To do this, invoke the word `[State]'
286 and choose `Set for Current Session'.
287
288    The state of the option changes visibly when you set it:
289
290      [State]: you have set this option, but not saved it for future sessions.
291
292    You don't have to worry about specifying a value that is not valid;
293 setting the option checks for validity and will not really install an
294 unacceptable value.
295
296    While editing a value or field that is a file name, directory name,
297 command name, or anything else for which completion is defined, you can
298 type `M-<TAB>' (`widget-complete') to do completion.
299
300    Some options have a small fixed set of possible legitimate values.
301 These options don't let you edit the value textually.  Instead, an
302 active field `[Value Menu]' appears before the value; invoke this field
303 to edit the value.  For a boolean "on or off" value, the active field
304 says `[Toggle]', and it changes to the other value.  `[Value Menu]' and
305 `[Toggle]' edit the buffer; the changes take effect when you use the
306 `Set for Current Session' operation.
307
308    Some options have values with complex structure.  For example, the
309 value of `load-path' is a list of directories.  Here is how it appears
310 in the customization buffer:
311
312      Load Path:
313      [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/site-lisp
314      [INS] [DEL] [Current dir?]: /usr/local/share/emacs/site-lisp
315      [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/leim
316      [INS] [DEL] [Current dir?]: /usr/local/share/emacs/19.34.94/lisp
317      [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp
318      [INS] [DEL] [Current dir?]: /build/emacs/e19/lisp/gnus
319      [INS]
320         [State]: this item has been changed outside the customization buffer.
321      List of directories to search for files to load....
322
323 Each directory in the list appears on a separate line, and each line has
324 several editable or active fields.
325
326    You can edit any of the directory names.  To delete a directory from
327 the list, invoke `[DEL]' on that line.  To insert a new directory in
328 the list, invoke `[INS]' at the point where you want to insert it.
329
330    You can also invoke `[Current dir?]' to switch between including a
331 specific named directory in the path, and including `nil' in the path.
332 (`nil' in a search path means "try the current directory.")
333
334    Two special commands, <TAB> and `S-<TAB>', are useful for moving
335 through the customization buffer.  <TAB> (`widget-forward') moves
336 forward to the next active or editable field; `S-<TAB>'
337 (`widget-backward') moves backward to the previous active or editable
338 field.
339
340    Typing <RET> on an editable field also moves forward, just like
341 <TAB>.  The reason for this is that people have a tendency to type
342 <RET> when they are finished editing a field.  If you have occasion to
343 insert a newline in an editable field, use `C-o' or `C-q C-j',
344
345    Setting the option changes its value in the current Emacs session;
346 "saving" the value changes it for future sessions as well.  This works
347 by writing code into your `~/.emacs' file so as to set the option
348 variable again each time you start Emacs.  To save the option, invoke
349 `[State]' and select the `Save for Future Sessions' operation.
350
351    You can also restore the option to its standard value by invoking
352 `[State]' and selecting the `Reset' operation.  There are actually
353 three reset operations:
354
355 `Reset to Current'
356      If you have made some modifications and not yet set the option,
357      this restores the text in the customization buffer to match the
358      actual value.
359
360 `Reset to Saved'
361      This restores the value of the option to the last saved value, and
362      updates the text accordingly.
363
364 `Reset to Standard Settings'
365      This sets the option to its standard value, and updates the text
366      accordingly.  This also eliminates any saved value for the option,
367      so that you will get the standard value in future Emacs sessions.
368
369    The state of a group indicates whether anything in that group has
370 been edited, set or saved.  You can select `Set for Current Session',
371 `Save for Future Sessions' and the various kinds of `Reset' operation
372 for the group; these operations on the group apply to all options in
373 the group and its subgroups.
374
375    Near the top of the customization buffer there are two lines
376 containing several active fields:
377
378       [Set] [Save] [Reset]  [Done]
379
380 Invoking `[Done]' buries this customization buffer.  Each of the other
381 fields performs an operation--set, save or reset--on each of the items
382 in the buffer that could meaningfully be set, saved or reset.
383
384 \1f
385 File: xemacs.info,  Node: Face Customization,  Next: Specific Customization,  Prev: Changing an Option,  Up: Easy Customization
386
387 Customizing Faces
388 .................
389
390    In addition to user options, some customization groups also include
391 faces.  When you show the contents of a group, both the user options and
392 the faces in the group appear in the customization buffer.  Here is an
393 example of how a face looks:
394
395      Custom Changed Face: (sample)
396         [State]: this face is unchanged from its standard setting.
397      Face used when the customize item has been changed.
398      Parent groups: [Custom Magic Faces]
399      Attributes: [ ] Bold: [Toggle]  off (nil)
400                  [ ] Italic: [Toggle]  off (nil)
401                  [ ] Underline: [Toggle]  off (nil)
402                  [ ] Foreground: white       (sample)
403                  [ ] Background: blue        (sample)
404                  [ ] Inverse: [Toggle]  off (nil)
405                  [ ] Stipple:
406                  [ ] Font Family:
407                  [ ] Size:
408                  [ ] Strikethru: off
409
410    Each face attribute has its own line.  The `[X]' field before the
411 attribute name indicates whether the attribute is "enabled"; `X' means
412 that it is.  You can enable or disable the attribute by invoking that
413 field.  When the attribute is enabled, you can change the attribute
414 value in the usual ways.
415
416    Setting, saving and resetting a face work like the same operations
417 for options (*note Changing an Option::.).
418
419    A face can specify different appearances for different types of
420 display.  For example, a face can make text red on a color display, but
421 use a bold font on a monochrome display.  To specify multiple
422 appearances for a face, select `Show Display Types' in the menu you get
423 from invoking `[State]'.
424
425 \1f
426 File: xemacs.info,  Node: Specific Customization,  Prev: Face Customization,  Up: Easy Customization
427
428 Customizing Specific Items
429 ..........................
430
431    Instead of finding the options you want to change by moving down
432 through the structure of groups, you can specify the particular option,
433 face or group that you want to customize.
434
435 `M-x customize-option <RET> OPTION <RET>'
436      Set up a customization buffer with just one option, OPTION.
437
438 `M-x customize-face <RET> FACE <RET>'
439      Set up a customization buffer with just one face, FACE.
440
441 `M-x customize-group <RET> GROUP <RET>'
442      Set up a customization buffer with just one group, GROUP.
443
444 `M-x customize-apropos <RET> REGEXP <RET>'
445      Set up a customization buffer with all the options, faces and
446      groups that match REGEXP.
447
448 `M-x customize-saved'
449      Set up a customization buffer containing all options and faces
450      that you have saved with customization buffers.
451
452 `M-x customize-customized'
453      Set up a customization buffer containing all options and faces
454      that you have customized but not saved.
455
456    If you want to alter a particular user option variable with the
457 customization buffer, and you know its name, you can use the command
458 `M-x customize-option' and specify the option name.  This sets up the
459 customization buffer with just one option--the one that you asked for.
460 Editing, setting and saving the value work as described above, but only
461 for the specified option.
462
463    Likewise, you can modify a specific face, chosen by name, using `M-x
464 customize-face'.
465
466    You can also set up the customization buffer with a specific group,
467 using `M-x customize-group'.  The immediate contents of the chosen
468 group, including option variables, faces, and other groups, all appear
469 as well.  However, these subgroups' own contents start out hidden.  You
470 can show their contents in the usual way, by invoking `[Show]'.
471
472    To control more precisely what to customize, you can use `M-x
473 customize-apropos'.  You specify a regular expression as argument; then
474 all options, faces and groups whose names match this regular expression
475 are set up in the customization buffer.  If you specify an empty regular
476 expression, this includes *all* groups, options and faces in the
477 customization buffer (but that takes a long time).
478
479    If you change option values and then decide the change was a mistake,
480 you can use two special commands to revisit your previous changes.  Use
481 `customize-saved' to look at the options and faces that you have saved.
482 Use `M-x customize-customized' to look at the options and faces that
483 you have set but not saved.
484
485 \1f
486 File: xemacs.info,  Node: Edit Options,  Next: Locals,  Prev: Easy Customization,  Up: Variables
487
488 Editing Variable Values
489 -----------------------
490
491 `M-x list-options'
492      Display a buffer listing names, values, and documentation of all
493      options.
494
495 `M-x edit-options'
496      Change option values by editing a list of options.
497
498    `M-x list-options' displays a list of all Emacs option variables in
499 an Emacs buffer named `*List Options*'.  Each option is shown with its
500 documentation and its current value.  Here is what a portion of it might
501 look like:
502
503      ;; exec-path:
504      ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
505      *List of directories to search programs to run in subprocesses.
506      Each element is a string (directory name)
507      or nil (try the default directory).
508      ;;
509      ;; fill-column:
510      75
511      *Column beyond which automatic line-wrapping should happen.
512      Automatically becomes local when set in any fashion.
513      ;;
514
515    `M-x edit-options' goes one step further and immediately selects the
516 `*List Options*' buffer; this buffer uses the major mode Options mode,
517 which provides commands that allow you to point at an option and change
518 its value:
519
520 `s'
521      Set the variable point is in or near to a new value read using the
522      minibuffer.
523
524 `x'
525      Toggle the variable point is in or near: if the value was `nil',
526      it becomes `t'; otherwise it becomes `nil'.
527
528 `1'
529      Set the variable point is in or near to `t'.
530
531 `0'
532      Set the variable point is in or near to `nil'.
533
534 `n'
535 `p'
536      Move to the next or previous variable.
537
538 \1f
539 File: xemacs.info,  Node: Locals,  Next: File Variables,  Prev: Edit Options,  Up: Variables
540
541 Local Variables
542 ---------------
543
544 `M-x make-local-variable'
545      Make a variable have a local value in the current buffer.
546
547 `M-x kill-local-variable'
548      Make a variable use its global value in the current buffer.
549
550 `M-x make-variable-buffer-local'
551      Mark a variable so that setting it will make it local to the
552      buffer that is current at that time.
553
554    You can make any variable "local" to a specific Emacs buffer.  This
555 means that the variable's value in that buffer is independent of its
556 value in other buffers.  A few variables are always local in every
557 buffer.  All other Emacs variables have a "global" value which is in
558 effect in all buffers that have not made the variable local.
559
560    Major modes always make the variables they set local to the buffer.
561 This is why changing major modes in one buffer has no effect on other
562 buffers.
563
564    `M-x make-local-variable' reads the name of a variable and makes it
565 local to the current buffer.  Further changes in this buffer will not
566 affect others, and changes in the global value will not affect this
567 buffer.
568
569    `M-x make-variable-buffer-local' reads the name of a variable and
570 changes the future behavior of the variable so that it automatically
571 becomes local when it is set.  More precisely, once you have marked a
572 variable in this way, the usual ways of setting the variable will
573 automatically invoke `make-local-variable' first.  We call such
574 variables "per-buffer" variables.
575
576    Some important variables have been marked per-buffer already.  They
577 include `abbrev-mode', `auto-fill-function', `case-fold-search',
578 `comment-column', `ctl-arrow', `fill-column', `fill-prefix',
579 `indent-tabs-mode', `left-margin',
580 `mode-line-format', `overwrite-mode', `selective-display-ellipses',
581 `selective-display', `tab-width', and `truncate-lines'.  Some other
582 variables are always local in every buffer, but they are used for
583 internal purposes.
584
585    Note: the variable `auto-fill-function' was formerly named
586 `auto-fill-hook'.
587
588    If you want a variable to cease to be local to the current buffer,
589 call `M-x kill-local-variable' and provide the name of a variable to
590 the prompt.  The global value of the variable is again in effect in
591 this buffer.  Setting the major mode kills all the local variables of
592 the buffer.
593
594    To set the global value of a variable, regardless of whether the
595 variable has a local value in the current buffer, you can use the Lisp
596 function `setq-default'.  It works like `setq'.  If there is a local
597 value in the current buffer, the local value is not affected by
598 `setq-default'; thus, the new global value may not be visible until you
599 switch to another buffer, as in the case of:
600
601      (setq-default fill-column 75)
602
603 `setq-default' is the only way to set the global value of a variable
604 that has been marked with `make-variable-buffer-local'.
605
606    Programs can look at a variable's default value with `default-value'.
607 This function takes a symbol as an argument and returns its default
608 value.  The argument is evaluated; usually you must quote it
609 explicitly, as in the case of:
610
611      (default-value 'fill-column)
612
613 \1f
614 File: xemacs.info,  Node: File Variables,  Prev: Locals,  Up: Variables
615
616 Local Variables in Files
617 ------------------------
618
619    A file can contain a "local variables list", which specifies the
620 values to use for certain Emacs variables when that file is edited.
621 Visiting the file checks for a local variables list and makes each
622 variable in the list local to the buffer in which the file is visited,
623 with the value specified in the file.
624
625    A local variables list goes near the end of the file, in the last
626 page.  (It is often best to put it on a page by itself.)  The local
627 variables list starts with a line containing the string `Local
628 Variables:', and ends with a line containing the string `End:'.  In
629 between come the variable names and values, one set per line, as
630 `VARIABLE: VALUE'.  The VALUEs are not evaluated; they are used
631 literally.
632
633    The line which starts the local variables list does not have to say
634 just `Local Variables:'.  If there is other text before `Local
635 Variables:', that text is called the "prefix", and if there is other
636 text after, that is called the "suffix".  If a prefix or suffix are
637 present, each entry in the local variables list should have the prefix
638 before it and the suffix after it.  This includes the `End:' line.  The
639 prefix and suffix are included to disguise the local variables list as
640 a comment so the compiler or text formatter  will ignore it.  If you do
641 not need to disguise the local variables list as a comment in this way,
642 there is no need to include a prefix or a suffix.
643
644    Two "variable" names are special in a local variables list: a value
645 for the variable `mode' sets the major mode, and a value for the
646 variable `eval' is simply evaluated as an expression and the value is
647 ignored.  These are not real variables; setting them in any other
648 context does not have the same effect.  If `mode' is used in a local
649 variables list, it should be the first entry in the list.
650
651    Here is an example of a local variables list:
652      ;;; Local Variables: ***
653      ;;; mode:lisp ***
654      ;;; comment-column:0 ***
655      ;;; comment-start: ";;; "  ***
656      ;;; comment-end:"***" ***
657      ;;; End: ***
658
659    Note that the prefix is `;;; ' and the suffix is ` ***'.  Note also
660 that comments in the file begin with and end with the same strings.
661 Presumably the file contains code in a language which is enough like
662 Lisp for Lisp mode to be useful but in which comments start and end
663 differently.  The prefix and suffix are used in the local variables
664 list to make the list look like several lines of comments when the
665 compiler or interpreter for that language reads the file.
666
667    The start of the local variables list must be no more than 3000
668 characters from the end of the file, and must be in the last page if the
669 file is divided into pages.  Otherwise, Emacs will not notice it is
670 there.  The purpose is twofold: a stray `Local Variables:' not in the
671 last page does not confuse Emacs, and Emacs never needs to search a
672 long file that contains no page markers and has no local variables list.
673
674    You may be tempted to turn on Auto Fill mode with a local variable
675 list.  That is inappropriate.  Whether you use Auto Fill mode or not is
676 a matter of personal taste, not a matter of the contents of particular
677 files.  If you want to use Auto Fill, set up major mode hooks with your
678 `.emacs' file to turn it on (when appropriate) for you alone (*note
679 Init File::.).  Don't try to use a local variable list that would
680 impose your taste on everyone working with the file.
681
682    XEmacs allows you to specify local variables in the first line of a
683 file, in addition to specifying them in the `Local Variables' section
684 at the end of a file.
685
686    If the first line of a file contains two occurrences of ``-*-'',
687 XEmacs uses the information between them to determine what the major
688 mode and variable settings should be.  For example, these are all legal:
689
690         ;;; -*- mode: emacs-lisp -*-
691         ;;; -*- mode: postscript; version-control: never -*-
692         ;;; -*- tags-file-name: "/foo/bar/TAGS" -*-
693
694    For historical reasons, the syntax ``-*- modename -*-'' is allowed
695 as well; for example, you can use:
696
697         ;;; -*- emacs-lisp -*-
698
699    The variable `enable-local-variables' controls the use of local
700 variables lists in files you visit.  The value can be `t', `nil', or
701 something else.  A value of `t' means local variables lists are obeyed;
702 `nil' means they are ignored; anything else means query.
703
704    The command `M-x normal-mode' always obeys local variables lists and
705 ignores this variable.
706
707 \1f
708 File: xemacs.info,  Node: Keyboard Macros,  Next: Key Bindings,  Prev: Variables,  Up: Customization
709
710 Keyboard Macros
711 ===============
712
713    A "keyboard macro" is a command defined by the user to abbreviate a
714 sequence of keys.  For example, if you discover that you are about to
715 type `C-n C-d' forty times, you can speed your work by defining a
716 keyboard macro to invoke `C-n C-d' and calling it with a repeat count
717 of forty.
718
719 `C-x ('
720      Start defining a keyboard macro (`start-kbd-macro').
721
722 `C-x )'
723      End the definition of a keyboard macro (`end-kbd-macro').
724
725 `C-x e'
726      Execute the most recent keyboard macro (`call-last-kbd-macro').
727
728 `C-u C-x ('
729      Re-execute last keyboard macro, then add more keys to its
730      definition.
731
732 `C-x q'
733      When this point is reached during macro execution, ask for
734      confirmation (`kbd-macro-query').
735
736 `M-x name-last-kbd-macro'
737      Give a command name (for the duration of the session) to the most
738      recently defined keyboard macro.
739
740 `M-x insert-kbd-macro'
741      Insert in the buffer a keyboard macro's definition, as Lisp code.
742
743    Keyboard macros differ from other Emacs commands in that they are
744 written in the Emacs command language rather than in Lisp.  This makes
745 it easier for the novice to write them and makes them more convenient as
746 temporary hacks.  However, the Emacs command language is not powerful
747 enough as a programming language to be useful for writing anything
748 general or complex.  For such things, Lisp must be used.
749
750    You define a keyboard macro by executing the commands which are its
751 definition.  Put differently, as you are defining a keyboard macro, the
752 definition is being executed for the first time.  This way, you see
753 what the effects of your commands are, and don't have to figure them
754 out in your head.  When you are finished, the keyboard macro is defined
755 and also has been executed once.  You can then execute the same set of
756 commands again by invoking the macro.
757
758 * Menu:
759
760 * Basic Kbd Macro::     Defining and running keyboard macros.
761 * Save Kbd Macro::      Giving keyboard macros names; saving them in files.
762 * Kbd Macro Query::     Keyboard macros that do different things each use.
763
764 \1f
765 File: xemacs.info,  Node: Basic Kbd Macro,  Next: Save Kbd Macro,  Up: Keyboard Macros
766
767 Basic Use
768 ---------
769
770    To start defining a keyboard macro, type `C-x ('
771 (`start-kbd-macro').  From then on, anything you type continues to be
772 executed, but also becomes part of the definition of the macro.  `Def'
773 appears in the mode line to remind you of what is going on.  When you
774 are finished, the `C-x )' command (`end-kbd-macro') terminates the
775 definition, without becoming part of it.
776
777    For example,
778
779      C-x ( M-f foo C-x )
780
781 defines a macro to move forward a word and then insert `foo'.
782
783    You can give `C-x )' a repeat count as an argument, in which case it
784 repeats the macro that many times right after defining it, but defining
785 the macro counts as the first repetition (since it is executed as you
786 define it).  If you give `C-x )' an argument of 4, it executes the
787 macro immediately 3 additional times.  An argument of zero to `C-x e'
788 or `C-x )' means repeat the macro indefinitely (until it gets an error
789 or you type `C-g').
790
791    Once you have defined a macro, you can invoke it again with the `C-x
792 e' command (`call-last-kbd-macro').  You can give the command a repeat
793 count numeric argument to execute the macro many times.
794
795    To repeat an operation at regularly spaced places in the text,
796 define a macro and include as part of the macro the commands to move to
797 the next place you want to use it.  For example, if you want to change
798 each line, you should position point at the start of a line, and define
799 a macro to change that line and leave point at the start of the next
800 line.  Repeating the macro will then operate on successive lines.
801
802    After you have terminated the definition of a keyboard macro, you
803 can add to the end of its definition by typing `C-u C-x ('.  This is
804 equivalent to plain `C-x (' followed by retyping the whole definition
805 so far.  As a consequence it re-executes the macro as previously
806 defined.
807
808 \1f
809 File: xemacs.info,  Node: Save Kbd Macro,  Next: Kbd Macro Query,  Prev: Basic Kbd Macro,  Up: Keyboard Macros
810
811 Naming and Saving Keyboard Macros
812 ---------------------------------
813
814    To save a keyboard macro for longer than until you define the next
815 one, you must give it a name using `M-x name-last-kbd-macro'.  This
816 reads a name as an argument using the minibuffer and defines that name
817 to execute the macro.  The macro name is a Lisp symbol, and defining it
818 in this way makes it a valid command name for calling with `M-x' or for
819 binding a key to with `global-set-key' (*note Keymaps::.).  If you
820 specify a name that has a prior definition other than another keyboard
821 macro, Emacs prints an error message and nothing is changed.
822
823    Once a macro has a command name, you can save its definition in a
824 file.  You can then use it in another editing session.  First visit the
825 file you want to save the definition in.  Then use the command:
826
827      M-x insert-kbd-macro <RET> MACRONAME <RET>
828
829 This inserts some Lisp code that, when executed later, will define the
830 same macro with the same definition it has now.  You need not
831 understand Lisp code to do this, because `insert-kbd-macro' writes the
832 Lisp code for you.  Then save the file.  You can load the file with
833 `load-file' (*note Lisp Libraries::.).  If the file you save in is your
834 initialization file `~/.emacs' (*note Init File::.), then the macro
835 will be defined each time you run Emacs.
836
837    If you give `insert-kbd-macro' a prefix argument, it creates
838 additional Lisp code to record the keys (if any) that you have bound to
839 the keyboard macro, so that the macro is reassigned the same keys when
840 you load the file.
841
842 \1f
843 File: xemacs.info,  Node: Kbd Macro Query,  Prev: Save Kbd Macro,  Up: Keyboard Macros
844
845 Executing Macros With Variations
846 --------------------------------
847
848    You can use `C-x q' (`kbd-macro-query'), to get an effect similar to
849 that of `query-replace'.  The macro asks you  each time whether to make
850 a change.  When you are defining the macro, type `C-x q' at the point
851 where you want the query to occur.  During macro definition, the `C-x
852 q' does nothing, but when you invoke the macro, `C-x q' reads a
853 character from the terminal to decide whether to continue.
854
855    The special answers to a `C-x q' query are <SPC>, <DEL>, `C-d',
856 `C-l', and `C-r'.  Any other character terminates execution of the
857 keyboard macro and is then read as a command.  <SPC> means to continue.
858 <DEL> means to skip the remainder of this repetition of the macro,
859 starting again from the beginning in the next repetition.  `C-d' means
860 to skip the remainder of this repetition and cancel further repetition.
861 `C-l' redraws the frame and asks you again for a character to specify
862 what to do.  `C-r' enters a recursive editing level, in which you can
863 perform editing that is not part of the macro.  When you exit the
864 recursive edit using `C-M-c', you are asked again how to continue with
865 the keyboard macro.  If you type a <SPC> at this time, the rest of the
866 macro definition is executed.  It is up to you to leave point and the
867 text in a state such that the rest of the macro will do what you want.
868
869    `C-u C-x q', which is `C-x q' with a numeric argument, performs a
870 different function.  It enters a recursive edit reading input from the
871 keyboard, both when you type it during the definition of the macro and
872 when it is executed from the macro.  During definition, the editing you
873 do inside the recursive edit does not become part of the macro.  During
874 macro execution, the recursive edit gives you a chance to do some
875 particularized editing.  *Note Recursive Edit::.
876
877 \1f
878 File: xemacs.info,  Node: Key Bindings,  Next: Syntax,  Prev: Keyboard Macros,  Up: Customization
879
880 Customizing Key Bindings
881 ========================
882
883    This section deals with the "keymaps" that define the bindings
884 between keys and functions, and shows how you can customize these
885 bindings.
886
887    A command is a Lisp function whose definition provides for
888 interactive use.  Like every Lisp function, a command has a function
889 name, which is a Lisp symbol whose name usually consists of lower case
890 letters and hyphens.
891
892 * Menu:
893
894 * Keymaps::    Definition of the keymap data structure.
895                Names of Emacs's standard keymaps.
896 * Rebinding::  How to redefine one key's meaning conveniently.
897 * Disabling::  Disabling a command means confirmation is required
898                 before it can be executed.  This is done to protect
899                 beginners from surprises.
900
901 \1f
902 File: xemacs.info,  Node: Keymaps,  Next: Rebinding,  Up: Key Bindings
903
904 Keymaps
905 -------
906
907    The bindings between characters and command functions are recorded in
908 data structures called "keymaps".  Emacs has many of these.  One, the
909 "global" keymap, defines the meanings of the single-character keys that
910 are defined regardless of major mode.  It is the value of the variable
911 `global-map'.
912
913    Each major mode has another keymap, its "local keymap", which
914 contains overriding definitions for the single-character keys that are
915 redefined in that mode.  Each buffer records which local keymap is
916 installed for it at any time, and the current buffer's local keymap is
917 the only one that directly affects command execution.  The local keymaps
918 for Lisp mode, C mode, and many other major modes always exist even when
919 not in use.  They are the values of the variables `lisp-mode-map',
920 `c-mode-map', and so on.  For less frequently used major modes, the
921 local keymap is sometimes constructed only when the mode is used for the
922 first time in a session, to save space.
923
924    There are local keymaps for the minibuffer, too; they contain various
925 completion and exit commands.
926
927    * `minibuffer-local-map' is used for ordinary input (no completion).
928
929    * `minibuffer-local-ns-map' is similar, except that <SPC> exits just
930      like <RET>.  This is used mainly for Mocklisp compatibility.
931
932    * `minibuffer-local-completion-map' is for permissive completion.
933
934    * `minibuffer-local-must-match-map' is for strict completion and for
935      cautious completion.
936
937    * `repeat-complex-command-map' is for use in `C-x <ESC>'.
938
939    * `isearch-mode-map' contains the bindings of the special keys which
940      are bound in the pseudo-mode entered with `C-s' and `C-r'.
941
942    Finally, each prefix key has a keymap which defines the key sequences
943 that start with it.  For example, `ctl-x-map' is the keymap used for
944 characters following a `C-x'.
945
946    * `ctl-x-map' is the variable name for the map used for characters
947      that follow `C-x'.
948
949    * `help-map' is used for characters that follow `C-h'.
950
951    * `esc-map' is for characters that follow <ESC>. All Meta characters
952      are actually defined by this map.
953
954    * `ctl-x-4-map' is for characters that follow `C-x 4'.
955
956    * `mode-specific-map' is for characters that follow `C-c'.
957
958    The definition of a prefix key is the keymap to use for looking up
959 the following character.  Sometimes the definition is actually a Lisp
960 symbol whose function definition is the following character keymap.  The
961 effect is the same, but it provides a command name for the prefix key
962 that you can use as a description of what the prefix key is for.  Thus
963 the binding of `C-x' is the symbol `Ctl-X-Prefix', whose function
964 definition is the keymap for `C-x' commands, the value of `ctl-x-map'.
965
966    Prefix key definitions can appear in either the global map or a
967 local map.  The definitions of `C-c', `C-x', `C-h', and <ESC> as prefix
968 keys appear in the global map, so these prefix keys are always
969 available.  Major modes can locally redefine a key as a prefix by
970 putting a prefix key definition for it in the local map.
971
972    A mode can also put a prefix definition of a global prefix character
973 such as `C-x' into its local map.  This is how major modes override the
974 definitions of certain keys that start with `C-x'.  This case is
975 special, because the local definition does not entirely replace the
976 global one.  When both the global and local definitions of a key are
977 other keymaps, the next character is looked up in both keymaps, with
978 the local definition overriding the global one.  The character after the
979 `C-x' is looked up in both the major mode's own keymap for redefined
980 `C-x' commands and in `ctl-x-map'.  If the major mode's own keymap for
981 `C-x' commands contains `nil', the definition from the global keymap
982 for `C-x' commands is used.
983
984 \1f
985 File: xemacs.info,  Node: Rebinding,  Next: Disabling,  Prev: Keymaps,  Up: Key Bindings
986
987 Changing Key Bindings
988 ---------------------
989
990    You can redefine an Emacs key by changing its entry in a keymap.
991 You can change the global keymap, in which case the change is effective
992 in all major modes except those that have their own overriding local
993 definitions for the same key.  Or you can change the current buffer's
994 local map, which affects all buffers using the same major mode.
995
996 * Menu:
997
998 * Interactive Rebinding::      Changing Key Bindings Interactively
999 * Programmatic Rebinding::     Changing Key Bindings Programmatically
1000 * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
1001
1002 \1f
1003 File: xemacs.info,  Node: Interactive Rebinding,  Next: Programmatic Rebinding,  Up: Rebinding
1004
1005 Changing Key Bindings Interactively
1006 ...................................
1007
1008 `M-x global-set-key <RET> KEY CMD <RET>'
1009      Defines KEY globally to run CMD.
1010
1011 `M-x local-set-key <RET> KEYS CMD <RET>'
1012      Defines KEY locally (in the major mode now in effect) to run CMD.
1013
1014 `M-x local-unset-key <RET> KEYS <RET>'
1015      Removes the local binding of KEY.
1016
1017    CMD is a symbol naming an interactively-callable function.
1018
1019    When called interactively, KEY is the next complete key sequence
1020 that you type.  When called as a function, KEY is a string, a vector of
1021 events, or a vector of key-description lists as described in the
1022 `define-key' function description.  The binding goes in the current
1023 buffer's local map, which is shared with other buffers in the same
1024 major mode.
1025
1026    The following example:
1027
1028      M-x global-set-key <RET> C-f next-line <RET>
1029
1030 redefines `C-f' to move down a line.  The fact that CMD is read second
1031 makes it serve as a kind of confirmation for KEY.
1032
1033    These functions offer no way to specify a particular prefix keymap as
1034 the one to redefine in, but that is not necessary, as you can include
1035 prefixes in KEY.  KEY is read by reading characters one by one until
1036 they amount to a complete key (that is, not a prefix key).  Thus, if
1037 you type `C-f' for KEY, Emacs enters the minibuffer immediately to read
1038 CMD.  But if you type `C-x', another character is read; if that
1039 character is `4', another character is read, and so on.  For example,
1040
1041      M-x global-set-key <RET> C-x 4 $ spell-other-window <RET>
1042
1043 redefines `C-x 4 $' to run the (fictitious) command
1044 `spell-other-window'.
1045
1046    The most general way to modify a keymap is the function
1047 `define-key', used in Lisp code (such as your `.emacs' file).
1048 `define-key' takes three arguments: the keymap, the key to modify in
1049 it, and the new definition.  *Note Init File::, for an example.
1050 `substitute-key-definition' is used similarly; it takes three
1051 arguments, an old definition, a new definition, and a keymap, and
1052 redefines in that keymap all keys that were previously defined with the
1053 old definition to have the new definition instead.
1054
1055 \1f
1056 File: xemacs.info,  Node: Programmatic Rebinding,  Next: Key Bindings Using Strings,  Prev: Interactive Rebinding,  Up: Rebinding
1057
1058 Changing Key Bindings Programmatically
1059 ......................................
1060
1061    You can use the functions `global-set-key' and `define-key' to
1062 rebind keys under program control.
1063
1064 ``(global-set-key KEYS CMD)''
1065      Defines KEYS globally to run CMD.
1066
1067 ``(define-key KEYMAP KEYS DEF)''
1068      Defines KEYS to run DEF in the keymap KEYMAP.
1069
1070    KEYMAP is a keymap object.
1071
1072    KEYS is the sequence of keystrokes to bind.
1073
1074    DEF is anything that can be a key's definition:
1075
1076    * `nil', meaning key is undefined in this keymap
1077
1078    * A command, that is, a Lisp function suitable for interactive
1079      calling
1080
1081    * A string or key sequence vector, which is treated as a keyboard
1082      macro
1083
1084    * A keymap to define a prefix key
1085
1086    * A symbol so that when the key is looked up, the symbol stands for
1087      its function definition, which should at that time be one of the
1088      above, or another symbol whose function definition is used, and so
1089      on
1090
1091    * A cons, `(string . defn)', meaning that DEFN is the definition
1092      (DEFN should be a valid definition in its own right)
1093
1094    * A cons, `(keymap . char)', meaning use the definition of CHAR in
1095      map KEYMAP
1096
1097    For backward compatibility, XEmacs allows you to specify key
1098 sequences as strings.  However, the preferred method is to use the
1099 representations of key sequences as vectors of keystrokes.  *Note
1100 Keystrokes::, for more information about the rules for constructing key
1101 sequences.
1102
1103    Emacs allows you to abbreviate representations for key sequences in
1104 most places where there is no ambiguity.  Here are some rules for
1105 abbreviation:
1106
1107    * The keysym by itself is equivalent to a list of just that keysym,
1108      i.e., `f1' is equivalent to `(f1)'.
1109
1110    * A keystroke by itself is equivalent to a vector containing just
1111      that keystroke, i.e.,  `(control a)' is equivalent to `[(control
1112      a)]'.
1113
1114    * You can use ASCII codes for keysyms that have them. i.e., `65' is
1115      equivalent to `A'. (This is not so much an abbreviation as an
1116      alternate representation.)
1117
1118    Here are some examples of programmatically binding keys:
1119
1120
1121      ;;;  Bind `my-command' to <f1>
1122      (global-set-key 'f1 'my-command)
1123      
1124      ;;;  Bind `my-command' to Shift-f1
1125      (global-set-key '(shift f1) 'my-command)
1126      
1127      ;;; Bind `my-command' to C-c Shift-f1
1128      (global-set-key '[(control c) (shift f1)] 'my-command)
1129      
1130      ;;; Bind `my-command' to the middle mouse button.
1131      (global-set-key 'button2 'my-command)
1132      
1133      ;;; Bind `my-command' to <META> <CTL> <Right Mouse Button>
1134      ;;; in the keymap that is in force when you are running `dired'.
1135      (define-key dired-mode-map '(meta control button3) 'my-command)
1136
1137 \1f
1138 File: xemacs.info,  Node: Key Bindings Using Strings,  Prev: Programmatic Rebinding,  Up: Rebinding
1139
1140 Using Strings for Changing Key Bindings
1141 .......................................
1142
1143    For backward compatibility, you can still use strings to represent
1144 key sequences.  Thus you can use commands like the following:
1145
1146      ;;; Bind `end-of-line' to C-f
1147      (global-set-key "\C-f" 'end-of-line)
1148
1149    Note, however, that in some cases you may be binding more than one
1150 key sequence by using a single command.  This situation can arise
1151 because in ASCII, `C-i' and <TAB> have the same representation.
1152 Therefore, when Emacs sees:
1153
1154      (global-set-key "\C-i" 'end-of-line)
1155
1156    it is unclear whether the user intended to bind `C-i' or <TAB>.  The
1157 solution XEmacs adopts is to bind both of these key sequences.
1158
1159    After binding a command to two key sequences with a form like:
1160
1161         (define-key global-map "\^X\^I" 'command-1)
1162
1163    it is possible to redefine only one of those sequences like so:
1164
1165         (define-key global-map [(control x) (control i)] 'command-2)
1166         (define-key global-map [(control x) tab] 'command-3)
1167
1168    This applies only when running under a window system.  If you are
1169 talking to Emacs through an ASCII-only channel, you do not get any of
1170 these features.
1171
1172    Here is a table of pairs of key sequences that behave in a similar
1173 fashion:
1174
1175              control h      backspace
1176              control l      clear
1177              control i      tab
1178              control m      return
1179              control j      linefeed
1180              control [      escape
1181              control @      control space
1182