Sync with r21-2-33 and r21-2-33-utf-2000.
[chise/xemacs-chise.git-] / info / xemacs.info-17
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
2 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: Keymaps,  Next: Rebinding,  Up: Key Bindings
34
35 Keymaps
36 -------
37
38    The bindings between characters and command functions are recorded in
39 data structures called "keymaps".  Emacs has many of these.  One, the
40 "global" keymap, defines the meanings of the single-character keys that
41 are defined regardless of major mode.  It is the value of the variable
42 `global-map'.
43
44    Each major mode has another keymap, its "local keymap", which
45 contains overriding definitions for the single-character keys that are
46 redefined in that mode.  Each buffer records which local keymap is
47 installed for it at any time, and the current buffer's local keymap is
48 the only one that directly affects command execution.  The local keymaps
49 for Lisp mode, C mode, and many other major modes always exist even when
50 not in use.  They are the values of the variables `lisp-mode-map',
51 `c-mode-map', and so on.  For less frequently used major modes, the
52 local keymap is sometimes constructed only when the mode is used for the
53 first time in a session, to save space.
54
55    There are local keymaps for the minibuffer, too; they contain various
56 completion and exit commands.
57
58    * `minibuffer-local-map' is used for ordinary input (no completion).
59
60    * `minibuffer-local-ns-map' is similar, except that <SPC> exits just
61      like <RET>.  This is used mainly for Mocklisp compatibility.
62
63    * `minibuffer-local-completion-map' is for permissive completion.
64
65    * `minibuffer-local-must-match-map' is for strict completion and for
66      cautious completion.
67
68    * `repeat-complex-command-map' is for use in `C-x <ESC>'.
69
70    * `isearch-mode-map' contains the bindings of the special keys which
71      are bound in the pseudo-mode entered with `C-s' and `C-r'.
72
73    Finally, each prefix key has a keymap which defines the key sequences
74 that start with it.  For example, `ctl-x-map' is the keymap used for
75 characters following a `C-x'.
76
77    * `ctl-x-map' is the variable name for the map used for characters
78      that follow `C-x'.
79
80    * `help-map' is used for characters that follow `C-h'.
81
82    * `esc-map' is for characters that follow <ESC>. All Meta characters
83      are actually defined by this map.
84
85    * `ctl-x-4-map' is for characters that follow `C-x 4'.
86
87    * `mode-specific-map' is for characters that follow `C-c'.
88
89    The definition of a prefix key is the keymap to use for looking up
90 the following character.  Sometimes the definition is actually a Lisp
91 symbol whose function definition is the following character keymap.  The
92 effect is the same, but it provides a command name for the prefix key
93 that you can use as a description of what the prefix key is for.  Thus
94 the binding of `C-x' is the symbol `Ctl-X-Prefix', whose function
95 definition is the keymap for `C-x' commands, the value of `ctl-x-map'.
96
97    Prefix key definitions can appear in either the global map or a
98 local map.  The definitions of `C-c', `C-x', `C-h', and <ESC> as prefix
99 keys appear in the global map, so these prefix keys are always
100 available.  Major modes can locally redefine a key as a prefix by
101 putting a prefix key definition for it in the local map.
102
103    A mode can also put a prefix definition of a global prefix character
104 such as `C-x' into its local map.  This is how major modes override the
105 definitions of certain keys that start with `C-x'.  This case is
106 special, because the local definition does not entirely replace the
107 global one.  When both the global and local definitions of a key are
108 other keymaps, the next character is looked up in both keymaps, with
109 the local definition overriding the global one.  The character after the
110 `C-x' is looked up in both the major mode's own keymap for redefined
111 `C-x' commands and in `ctl-x-map'.  If the major mode's own keymap for
112 `C-x' commands contains `nil', the definition from the global keymap
113 for `C-x' commands is used.
114
115 \1f
116 File: xemacs.info,  Node: Rebinding,  Next: Disabling,  Prev: Keymaps,  Up: Key Bindings
117
118 Changing Key Bindings
119 ---------------------
120
121    You can redefine an Emacs key by changing its entry in a keymap.
122 You can change the global keymap, in which case the change is effective
123 in all major modes except those that have their own overriding local
124 definitions for the same key.  Or you can change the current buffer's
125 local map, which affects all buffers using the same major mode.
126
127 * Menu:
128
129 * Interactive Rebinding::      Changing Key Bindings Interactively
130 * Programmatic Rebinding::     Changing Key Bindings Programmatically
131 * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
132
133 \1f
134 File: xemacs.info,  Node: Interactive Rebinding,  Next: Programmatic Rebinding,  Up: Rebinding
135
136 Changing Key Bindings Interactively
137 ...................................
138
139 `M-x global-set-key <RET> KEY CMD <RET>'
140      Defines KEY globally to run CMD.
141
142 `M-x local-set-key <RET> KEYS CMD <RET>'
143      Defines KEY locally (in the major mode now in effect) to run CMD.
144
145 `M-x local-unset-key <RET> KEYS <RET>'
146      Removes the local binding of KEY.
147
148    CMD is a symbol naming an interactively-callable function.
149
150    When called interactively, KEY is the next complete key sequence
151 that you type.  When called as a function, KEY is a string, a vector of
152 events, or a vector of key-description lists as described in the
153 `define-key' function description.  The binding goes in the current
154 buffer's local map, which is shared with other buffers in the same
155 major mode.
156
157    The following example:
158
159      M-x global-set-key <RET> C-f next-line <RET>
160
161 redefines `C-f' to move down a line.  The fact that CMD is read second
162 makes it serve as a kind of confirmation for KEY.
163
164    These functions offer no way to specify a particular prefix keymap as
165 the one to redefine in, but that is not necessary, as you can include
166 prefixes in KEY.  KEY is read by reading characters one by one until
167 they amount to a complete key (that is, not a prefix key).  Thus, if
168 you type `C-f' for KEY, Emacs enters the minibuffer immediately to read
169 CMD.  But if you type `C-x', another character is read; if that
170 character is `4', another character is read, and so on.  For example,
171
172      M-x global-set-key <RET> C-x 4 $ spell-other-window <RET>
173
174 redefines `C-x 4 $' to run the (fictitious) command
175 `spell-other-window'.
176
177    The most general way to modify a keymap is the function
178 `define-key', used in Lisp code (such as your `.emacs' file).
179 `define-key' takes three arguments: the keymap, the key to modify in
180 it, and the new definition.  *Note Init File::, for an example.
181 `substitute-key-definition' is used similarly; it takes three
182 arguments, an old definition, a new definition, and a keymap, and
183 redefines in that keymap all keys that were previously defined with the
184 old definition to have the new definition instead.
185
186 \1f
187 File: xemacs.info,  Node: Programmatic Rebinding,  Next: Key Bindings Using Strings,  Prev: Interactive Rebinding,  Up: Rebinding
188
189 Changing Key Bindings Programmatically
190 ......................................
191
192    You can use the functions `global-set-key' and `define-key' to
193 rebind keys under program control.
194
195 ``(global-set-key KEYS CMD)''
196      Defines KEYS globally to run CMD.
197
198 ``(define-key KEYMAP KEYS DEF)''
199      Defines KEYS to run DEF in the keymap KEYMAP.
200
201    KEYMAP is a keymap object.
202
203    KEYS is the sequence of keystrokes to bind.
204
205    DEF is anything that can be a key's definition:
206
207    * `nil', meaning key is undefined in this keymap
208
209    * A command, that is, a Lisp function suitable for interactive
210      calling
211
212    * A string or key sequence vector, which is treated as a keyboard
213      macro
214
215    * A keymap to define a prefix key
216
217    * A symbol so that when the key is looked up, the symbol stands for
218      its function definition, which should at that time be one of the
219      above, or another symbol whose function definition is used, and so
220      on
221
222    * A cons, `(string . defn)', meaning that DEFN is the definition
223      (DEFN should be a valid definition in its own right)
224
225    * A cons, `(keymap . char)', meaning use the definition of CHAR in
226      map KEYMAP
227
228    For backward compatibility, XEmacs allows you to specify key
229 sequences as strings.  However, the preferred method is to use the
230 representations of key sequences as vectors of keystrokes.  *Note
231 Keystrokes::, for more information about the rules for constructing key
232 sequences.
233
234    Emacs allows you to abbreviate representations for key sequences in
235 most places where there is no ambiguity.  Here are some rules for
236 abbreviation:
237
238    * The keysym by itself is equivalent to a list of just that keysym,
239      i.e., `f1' is equivalent to `(f1)'.
240
241    * A keystroke by itself is equivalent to a vector containing just
242      that keystroke, i.e.,  `(control a)' is equivalent to `[(control
243      a)]'.
244
245    * You can use ASCII codes for keysyms that have them. i.e., `65' is
246      equivalent to `A'. (This is not so much an abbreviation as an
247      alternate representation.)
248
249    Here are some examples of programmatically binding keys:
250
251
252      ;;;  Bind `my-command' to <f1>
253      (global-set-key 'f1 'my-command)
254      
255      ;;;  Bind `my-command' to Shift-f1
256      (global-set-key '(shift f1) 'my-command)
257      
258      ;;; Bind `my-command' to C-c Shift-f1
259      (global-set-key '[(control c) (shift f1)] 'my-command)
260      
261      ;;; Bind `my-command' to the middle mouse button.
262      (global-set-key 'button2 'my-command)
263      
264      ;;; Bind `my-command' to <META> <CTL> <Right Mouse Button>
265      ;;; in the keymap that is in force when you are running `dired'.
266      (define-key dired-mode-map '(meta control button3) 'my-command)
267
268 \1f
269 File: xemacs.info,  Node: Key Bindings Using Strings,  Prev: Programmatic Rebinding,  Up: Rebinding
270
271 Using Strings for Changing Key Bindings
272 .......................................
273
274    For backward compatibility, you can still use strings to represent
275 key sequences.  Thus you can use commands like the following:
276
277      ;;; Bind `end-of-line' to C-f
278      (global-set-key "\C-f" 'end-of-line)
279
280    Note, however, that in some cases you may be binding more than one
281 key sequence by using a single command.  This situation can arise
282 because in ASCII, `C-i' and <TAB> have the same representation.
283 Therefore, when Emacs sees:
284
285      (global-set-key "\C-i" 'end-of-line)
286
287    it is unclear whether the user intended to bind `C-i' or <TAB>.  The
288 solution XEmacs adopts is to bind both of these key sequences.
289
290    After binding a command to two key sequences with a form like:
291
292              (define-key global-map "\^X\^I" 'command-1)
293
294    it is possible to redefine only one of those sequences like so:
295
296              (define-key global-map [(control x) (control i)] 'command-2)
297              (define-key global-map [(control x) tab] 'command-3)
298
299    This applies only when running under a window system.  If you are
300 talking to Emacs through an ASCII-only channel, you do not get any of
301 these features.
302
303    Here is a table of pairs of key sequences that behave in a similar
304 fashion:
305
306              control h      backspace
307              control l      clear
308              control i      tab
309              control m      return
310              control j      linefeed
311              control [      escape
312              control @      control space
313
314 \1f
315 File: xemacs.info,  Node: Disabling,  Prev: Rebinding,  Up: Key Bindings
316
317 Disabling Commands
318 ------------------
319
320    Disabling a command marks it as requiring confirmation before it can
321 be executed.  The purpose of disabling a command is to prevent
322 beginning users from executing it by accident and being confused.
323
324    The direct mechanism for disabling a command is to have a non-`nil'
325 `disabled' property on the Lisp symbol for the command.  These
326 properties are normally set by the user's `.emacs' file with Lisp
327 expressions such as:
328
329      (put 'delete-region 'disabled t)
330
331    If the value of the `disabled' property is a string, that string is
332 included in the message printed when the command is used:
333
334      (put 'delete-region 'disabled
335           "Text deleted this way cannot be yanked back!\n")
336
337    You can disable a command either by editing the `.emacs' file
338 directly or with the command `M-x disable-command', which edits the
339 `.emacs' file for you.  *Note Init File::.
340
341    When you attempt to invoke a disabled command interactively in Emacs,
342 a window is displayed containing the command's name, its documentation,
343 and some instructions on what to do next; then Emacs asks for input
344 saying whether to execute the command as requested, enable it and
345 execute, or cancel it.  If you decide to enable the command, you are
346 asked whether to do this permanently or just for the current session.
347 Enabling permanently works by automatically editing your `.emacs' file.
348 You can use `M-x enable-command' at any time to enable any command
349 permanently.
350
351    Whether a command is disabled is independent of what key is used to
352 invoke it; it also applies if the command is invoked using `M-x'.
353 Disabling a command has no effect on calling it as a function from Lisp
354 programs.
355
356 \1f
357 File: xemacs.info,  Node: Syntax,  Next: Init File,  Prev: Key Bindings,  Up: Customization
358
359 The Syntax Table
360 ================
361
362    All the Emacs commands which parse words or balance parentheses are
363 controlled by the "syntax table".  The syntax table specifies which
364 characters are opening delimiters, which are parts of words, which are
365 string quotes, and so on.  Actually, each major mode has its own syntax
366 table (though sometimes related major modes use the same one) which it
367 installs in each buffer that uses that major mode.  The syntax table
368 installed in the current buffer is the one that all commands use, so we
369 call it "the" syntax table.  A syntax table is a Lisp object, a vector
370 of length 256 whose elements are numbers.
371
372 * Menu:
373
374 * Entry: Syntax Entry.    What the syntax table records for each character.
375 * Change: Syntax Change.  How to change the information.
376
377 \1f
378 File: xemacs.info,  Node: Syntax Entry,  Next: Syntax Change,  Up: Syntax
379
380 Information About Each Character
381 --------------------------------
382
383    The syntax table entry for a character is a number that encodes six
384 pieces of information:
385
386    * The syntactic class of the character, represented as a small
387      integer
388
389    * The matching delimiter, for delimiter characters only (the
390      matching delimiter of `(' is `)', and vice versa)
391
392    * A flag saying whether the character is the first character of a
393      two-character comment starting sequence
394
395    * A flag saying whether the character is the second character of a
396      two-character comment starting sequence
397
398    * A flag saying whether the character is the first character of a
399      two-character comment ending sequence
400
401    * A flag saying whether the character is the second character of a
402      two-character comment ending sequence
403
404    The syntactic classes are stored internally as small integers, but
405 are usually described to or by the user with characters.  For example,
406 `(' is used to specify the syntactic class of opening delimiters.  Here
407 is a table of syntactic classes, with the characters that specify them.
408
409 ` '
410      The class of whitespace characters.
411
412 `w'
413      The class of word-constituent characters.
414
415 `_'
416      The class of characters that are part of symbol names but not
417      words.  This class is represented by `_' because the character `_'
418      has this class in both C and Lisp.
419
420 `.'
421      The class of punctuation characters that do not fit into any other
422      special class.
423
424 `('
425      The class of opening delimiters.
426
427 `)'
428      The class of closing delimiters.
429
430 `''
431      The class of expression-adhering characters.  These characters are
432      part of a symbol if found within or adjacent to one, and are part
433      of a following expression if immediately preceding one, but are
434      like whitespace if surrounded by whitespace.
435
436 `"'
437      The class of string-quote characters.  They match each other in
438      pairs, and the characters within the pair all lose their syntactic
439      significance except for the `\' and `/' classes of escape
440      characters, which can be used to include a string-quote inside the
441      string.
442
443 `$'
444      The class of self-matching delimiters.  This is intended for TeX's
445      `$', which is used both to enter and leave math mode.  Thus, a
446      pair of matching `$' characters surround each piece of math mode
447      TeX input.  A pair of adjacent `$' characters act like a single
448      one for purposes of matching.
449
450 `/'
451      The class of escape characters that always just deny the following
452      character its special syntactic significance.  The character after
453      one of these escapes is always treated as alphabetic.
454
455 `\'
456      The class of C-style escape characters.  In practice, these are
457      treated just like `/'-class characters, because the extra
458      possibilities for C escapes (such as being followed by digits)
459      have no effect on where the containing expression ends.
460
461 `<'
462      The class of comment-starting characters.  Only single-character
463      comment starters (such as `;' in Lisp mode) are represented this
464      way.
465
466 `>'
467      The class of comment-ending characters.  Newline has this syntax in
468      Lisp mode.
469
470    The characters flagged as part of two-character comment delimiters
471 can have other syntactic functions most of the time.  For example, `/'
472 and `*' in C code, when found separately, have nothing to do with
473 comments.  The comment-delimiter significance overrides when the pair of
474 characters occur together in the proper order.  Only the list and sexp
475 commands use the syntax table to find comments; the commands
476 specifically for comments have other variables that tell them where to
477 find comments.  Moreover, the list and sexp commands notice comments
478 only if `parse-sexp-ignore-comments' is non-`nil'.  This variable is set
479 to `nil' in modes where comment-terminator sequences are liable to
480 appear where there is no comment, for example, in Lisp mode where the
481 comment terminator is a newline but not every newline ends a comment.
482
483 \1f
484 File: xemacs.info,  Node: Syntax Change,  Prev: Syntax Entry,  Up: Syntax
485
486 Altering Syntax Information
487 ---------------------------
488
489    It is possible to alter a character's syntax table entry by storing
490 a new number in the appropriate element of the syntax table, but it
491 would be hard to determine what number to use.  Emacs therefore
492 provides a command that allows you to specify the syntactic properties
493 of a character in a convenient way.
494
495    `M-x modify-syntax-entry' is the command to change a character's
496 syntax.  It can be used interactively and is also used by major modes
497 to initialize their own syntax tables.  Its first argument is the
498 character to change.  The second argument is a string that specifies the
499 new syntax.  When called from Lisp code, there is a third, optional
500 argument, which specifies the syntax table in which to make the change.
501 If not supplied, or if this command is called interactively, the third
502 argument defaults to the current buffer's syntax table.
503
504   1. The first character in the string specifies the syntactic class.
505      It is one of the characters in the previous table (*note Syntax
506      Entry::).
507
508   2. The second character is the matching delimiter.  For a character
509      that is not an opening or closing delimiter, this should be a
510      space, and may be omitted if no following characters are needed.
511
512   3. The remaining characters are flags.  The flag characters allowed
513      are:
514
515     `1'
516           Flag this character as the first of a two-character comment
517           starting sequence.
518
519     `2'
520           Flag this character as the second of a two-character comment
521           starting sequence.
522
523     `3'
524           Flag this character as the first of a two-character comment
525           ending sequence.
526
527     `4'
528           Flag this character as the second of a two-character comment
529           ending sequence.
530
531    Use `C-h s' (`describe-syntax') to display a description of the
532 contents of the current syntax table.  The description of each
533 character includes both the string you have to pass to
534 `modify-syntax-entry' to set up that character's current syntax, and
535 some English to explain that string if necessary.
536
537 \1f
538 File: xemacs.info,  Node: Init File,  Next: Audible Bell,  Prev: Syntax,  Up: Customization
539
540 The Init File, .emacs
541 =====================
542
543    When you start Emacs, it normally loads the file `.emacs' in your
544 home directory.  This file, if it exists, should contain Lisp code.  It
545 is called your initialization file or "init file".  Use the command
546 line switch `-q' to tell Emacs whether to load an init file (*note
547 Entering Emacs::).  Use the command line switch `-user-init-file'
548 (*note Command Switches::) to tell Emacs to load a different file
549 instead of `~/.emacs'.
550
551    When the `.emacs' file is read, the variable `user-init-file' says
552 which init file was loaded.
553
554    At some sites there is a "default init file", which is the library
555 named `default.el', found via the standard search path for libraries.
556 The Emacs distribution contains no such library; your site may create
557 one for local customizations.  If this library exists, it is loaded
558 whenever you start Emacs.  But your init file, if any, is loaded first;
559 if it sets `inhibit-default-init' non-`nil', then `default' is not
560 loaded.
561
562    If you have a large amount of code in your `.emacs' file, you should
563 move it into another file named `SOMETHING.el', byte-compile it (*note
564 Lisp Libraries::), and load that file from your `.emacs' file using
565 `load'.
566
567 * Menu:
568
569 * Init Syntax::     Syntax of constants in Emacs Lisp.
570 * Init Examples::   How to do some things with an init file.
571 * Terminal Init::   Each terminal type can have an init file.
572
573 \1f
574 File: xemacs.info,  Node: Init Syntax,  Next: Init Examples,  Up: Init File
575
576 Init File Syntax
577 ----------------
578
579    The `.emacs' file contains one or more Lisp function call
580 expressions.  Each consists of a function name followed by arguments,
581 all surrounded by parentheses.  For example, `(setq fill-column 60)'
582 represents a call to the function `setq' which is used to set the
583 variable `fill-column' (*note Filling::) to 60.
584
585    The second argument to `setq' is an expression for the new value of
586 the variable.  This can be a constant, a variable, or a function call
587 expression.  In `.emacs', constants are used most of the time.  They
588 can be:
589
590 Numbers
591      Integers are written in decimal, with an optional initial minus
592      sign.
593
594      If a sequence of digits is followed by a period and another
595      sequence of digits, it is interpreted as a floating point number.
596
597      The number prefixes `#b', `#o', and `#x' are supported to
598      represent numbers in binary, octal, and hexadecimal notation (or
599      radix).
600
601 Strings
602      Lisp string syntax is the same as C string syntax with a few extra
603      features.  Use a double-quote character to begin and end a string
604      constant.
605
606      Newlines and special characters may be present literally in
607      strings.  They can also be represented as backslash sequences:
608      `\n' for newline, `\b' for backspace, `\r' for return, `\t' for
609      tab, `\f' for formfeed (control-l), `\e' for escape, `\\' for a
610      backslash, `\"' for a double-quote, or `\OOO' for the character
611      whose octal code is OOO.  Backslash and double-quote are the only
612      characters for which backslash sequences are mandatory.
613
614      You can use `\C-' as a prefix for a control character, as in
615      `\C-s' for ASCII Control-S, and `\M-' as a prefix for a Meta
616      character, as in `\M-a' for Meta-A or `\M-\C-a' for Control-Meta-A.
617
618 Characters
619      Lisp character constant syntax consists of a `?' followed by
620      either a character or an escape sequence starting with `\'.
621      Examples: `?x', `?\n', `?\"', `?\)'.  Note that strings and
622      characters are not interchangeable in Lisp; some contexts require
623      one and some contexts require the other.
624
625 True
626      `t' stands for `true'.
627
628 False
629      `nil' stands for `false'.
630
631 Other Lisp objects
632      Write a single-quote (') followed by the Lisp object you want.
633
634 \1f
635 File: xemacs.info,  Node: Init Examples,  Next: Terminal Init,  Prev: Init Syntax,  Up: Init File
636
637 Init File Examples
638 ------------------
639
640    Here are some examples of doing certain commonly desired things with
641 Lisp expressions:
642
643    * Make <TAB> in C mode just insert a tab if point is in the middle
644      of a line.
645
646           (setq c-tab-always-indent nil)
647
648      Here we have a variable whose value is normally `t' for `true' and
649      the alternative is `nil' for `false'.
650
651    * Make searches case sensitive by default (in all buffers that do not
652      override this).
653
654           (setq-default case-fold-search nil)
655
656      This sets the default value, which is effective in all buffers
657      that do not have local values for the variable.  Setting
658      `case-fold-search' with `setq' affects only the current buffer's
659      local value, which is probably not what you want to do in an init
660      file.
661
662    * Make Text mode the default mode for new buffers.
663
664           (setq default-major-mode 'text-mode)
665
666      Note that `text-mode' is used because it is the command for
667      entering the mode we want.  A single-quote is written before it to
668      make a symbol constant; otherwise, `text-mode' would be treated as
669      a variable name.
670
671    * Turn on Auto Fill mode automatically in Text mode and related
672      modes.
673
674           (setq text-mode-hook
675             '(lambda () (auto-fill-mode 1)))
676
677      Here we have a variable whose value should be a Lisp function.  The
678      function we supply is a list starting with `lambda', and a single
679      quote is written in front of it to make it (for the purpose of this
680      `setq') a list constant rather than an expression.  Lisp functions
681      are not explained here; for mode hooks it is enough to know that
682      `(auto-fill-mode 1)' is an expression that will be executed when
683      Text mode is entered.  You could replace it with any other
684      expression that you like, or with several expressions in a row.
685
686           (setq text-mode-hook 'turn-on-auto-fill)
687
688      This is another way to accomplish the same result.
689      `turn-on-auto-fill' is a symbol whose function definition is
690      `(lambda () (auto-fill-mode 1))'.
691
692    * Load the installed Lisp library named `foo' (actually a file
693      `foo.elc' or `foo.el' in a standard Emacs directory).
694
695           (load "foo")
696
697      When the argument to `load' is a relative pathname, not starting
698      with `/' or `~', `load' searches the directories in `load-path'
699      (*note Loading::).
700
701    * Load the compiled Lisp file `foo.elc' from your home directory.
702
703           (load "~/foo.elc")
704
705      Here an absolute file name is used, so no searching is done.
706
707    * Rebind the key `C-x l' to run the function `make-symbolic-link'.
708
709           (global-set-key "\C-xl" 'make-symbolic-link)
710
711      or
712
713           (define-key global-map "\C-xl" 'make-symbolic-link)
714
715      Note once again the single-quote used to refer to the symbol
716      `make-symbolic-link' instead of its value as a variable.
717
718    * Do the same thing for C mode only.
719
720           (define-key c-mode-map "\C-xl" 'make-symbolic-link)
721
722    * Bind the function key <F1> to a command in C mode.  Note that the
723      names of function keys must be lower case.
724
725           (define-key c-mode-map 'f1 'make-symbolic-link)
726
727    * Bind the shifted version of <F1> to a command.
728
729           (define-key c-mode-map '(shift f1) 'make-symbolic-link)
730
731    * Redefine all keys which now run `next-line' in Fundamental mode to
732      run `forward-line' instead.
733
734           (substitute-key-definition 'next-line 'forward-line
735                                      global-map)
736
737    * Make `C-x C-v' undefined.
738
739           (global-unset-key "\C-x\C-v")
740
741      One reason to undefine a key is so that you can make it a prefix.
742      Simply defining `C-x C-v ANYTHING' would make `C-x C-v' a prefix,
743      but `C-x C-v' must be freed of any non-prefix definition first.
744
745    * Make `$' have the syntax of punctuation in Text mode.  Note the
746      use of a character constant for `$'.
747
748           (modify-syntax-entry ?\$ "." text-mode-syntax-table)
749
750    * Enable the use of the command `eval-expression' without
751      confirmation.
752
753           (put 'eval-expression 'disabled nil)
754
755 \1f
756 File: xemacs.info,  Node: Terminal Init,  Prev: Init Examples,  Up: Init File
757
758 Terminal-Specific Initialization
759 --------------------------------
760
761    Each terminal type can have a Lisp library to be loaded into Emacs
762 when it is run on that type of terminal.  For a terminal type named
763 TERMTYPE, the library is called `term/TERMTYPE' and it is found by
764 searching the directories `load-path' as usual and trying the suffixes
765 `.elc' and `.el'.  Normally it appears in the subdirectory `term' of
766 the directory where most Emacs libraries are kept.
767
768    The usual purpose of the terminal-specific library is to define the
769 escape sequences used by the terminal's function keys using the library
770 `keypad.el'.  See the file `term/vt100.el' for an example of how this
771 is done.
772
773    When the terminal type contains a hyphen, only the part of the name
774 before the first hyphen is significant in choosing the library name.
775 Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
776 `term/aaa'.  The code in the library can use `(getenv "TERM")' to find
777 the full terminal type name.
778
779    The library's name is constructed by concatenating the value of the
780 variable `term-file-prefix' and the terminal type.  Your `.emacs' file
781 can prevent the loading of the terminal-specific library by setting
782 `term-file-prefix' to `nil'.
783
784    The value of the variable `term-setup-hook', if not `nil', is called
785 as a function of no arguments at the end of Emacs initialization, after
786 both your `.emacs' file and any terminal-specific library have been
787 read.  You can set the value in the `.emacs' file to override part of
788 any of the terminal-specific libraries and to define initializations
789 for terminals that do not have a library.
790
791 \1f
792 File: xemacs.info,  Node: Audible Bell,  Next: Faces,  Prev: Init File,  Up: Customization
793
794 Changing the Bell Sound
795 =======================
796
797    You can now change how the audible bell sounds using the variable
798 `sound-alist'.
799
800    `sound-alist''s value is an list associating symbols with, among
801 other things, strings of audio-data.  When `ding' is called with one of
802 the symbols, the associated sound data is played instead of the
803 standard beep.  This only works if you are logged in on the console of a
804 machine with audio hardware. To listen to a sound of the provided type,
805 call the function `play-sound' with the argument SOUND. You can also
806 set the volume of the sound with the optional argument VOLUME.
807
808    Each element of `sound-alist' is a list describing a sound.  The
809 first element of the list is the name of the sound being defined.
810 Subsequent elements of the list are alternating keyword/value pairs:
811
812 `sound'
813      A string of raw sound data, or the name of another sound to play.
814      The symbol `t' here means use the default X beep.
815
816 `volume'
817      An integer from 0-100, defaulting to `bell-volume'.
818
819 `pitch'
820      If using the default X beep, the pitch (Hz) to generate.
821
822 `duration'
823      If using the default X beep, the duration (milliseconds).
824
825    For compatibility, elements of `sound-alist' may also be of the form:
826
827      ( SOUND-NAME . <SOUND> )
828      ( SOUND-NAME <VOLUME> <SOUND> )
829
830    You should probably add things to this list by calling the function
831 `load-sound-file'.
832
833    Note that you can only play audio data if running on the console
834 screen of a machine with audio hardware which emacs understands, which
835 at this time means a Sun SparcStation, SGI, or HP9000s700.
836
837    Also note that the pitch, duration, and volume options are available
838 everywhere, but most X servers ignore the `pitch' option.
839
840    The variable `bell-volume' should be an integer from 0 to 100, with
841 100 being loudest, which controls how loud the sounds emacs makes
842 should be.  Elements of the `sound-alist' may override this value.
843 This variable applies to the standard X bell sound as well as sound
844 files.
845
846    If the symbol `t' is in place of a sound-string, Emacs uses the
847 default X beep.  This allows you to define beep-types of different
848 volumes even when not running on the console.
849
850    You can add things to this list by calling the function
851 `load-sound-file', which reads in an audio-file and adds its data to
852 the sound-alist. You can specify the sound with the SOUND-NAME argument
853 and the file into which the sounds are loaded with the FILENAME
854 argument. The optional VOLUME argument sets the volume.
855
856    `load-sound-file (FILENAME SOUND-NAME &optional VOLUME)'
857
858    To load and install some sound files as beep-types, use the function
859 `load-default-sounds' (note that this only works if you are on display
860 0 of a machine with audio hardware).
861
862    The following beep-types are used by Emacs itself. Other Lisp
863 packages may use other beep types, but these are the ones that the C
864 kernel of Emacs uses.
865
866 `auto-save-error'
867      An auto-save does not succeed
868
869 `command-error'
870      The Emacs command loop catches an error
871
872 `undefined-key'
873      You type a key that is undefined
874
875 `undefined-click'
876      You use an undefined mouse-click combination
877
878 `no-completion'
879      Completion was not possible
880
881 `y-or-n-p'
882      You type something other than the required `y' or `n'
883
884 `yes-or-no-p'
885      You type something other than `yes' or `no'
886
887 \1f
888 File: xemacs.info,  Node: Faces,  Next: Frame Components,  Prev: Audible Bell,  Up: Customization
889
890 Faces
891 =====
892
893    XEmacs has objects called extents and faces.  An "extent" is a
894 region of text and a "face" is a collection of textual attributes, such
895 as fonts and colors.  Every extent is displayed in some face;
896 therefore, changing the properties of a face immediately updates the
897 display of all associated extents.  Faces can be frame-local: you can
898 have a region of text that displays with completely different
899 attributes when its buffer is viewed from a different X window.
900
901    The display attributes of faces may be specified either in Lisp or
902 through the X resource manager.
903
904 Customizing Faces
905 -----------------
906
907    You can change the face of an extent with the functions in this
908 section.  All the functions prompt for a FACE as an argument; use
909 completion for a list of possible values.
910
911 `M-x invert-face'
912      Swap the foreground and background colors of the given FACE.
913
914 `M-x make-face-bold'
915      Make the font of the given FACE bold.  When called from a program,
916      returns `nil' if this is not possible.
917
918 `M-x make-face-bold-italic'
919      Make the font of the given FACE bold italic.  When called from a
920      program, returns `nil' if not possible.
921
922 `M-x make-face-italic'
923      Make the font of the given FACE italic.  When called from a
924      program, returns `nil' if not possible.
925
926 `M-x make-face-unbold'
927      Make the font of the given FACE non-bold.  When called from a
928      program, returns `nil' if not possible.
929
930 `M-x make-face-unitalic'
931      Make the font of the given FACE non-italic.  When called from a
932      program, returns `nil' if not possible.
933
934 `M-x make-face-larger'
935      Make the font of the given FACE a little larger.  When called from
936      a program, returns `nil' if not possible.
937
938 `M-x make-face-smaller'
939      Make the font of the given FACE a little smaller.  When called
940      from a program, returns `nil' if not possible.
941
942 `M-x set-face-background'
943      Change the background color of the given FACE.
944
945 `M-x set-face-background-pixmap'
946      Change the background pixmap of the given FACE.
947
948 `M-x set-face-font'
949      Change the font of the given FACE.
950
951 `M-x set-face-foreground'
952      Change the foreground color of the given FACE.
953
954 `M-x set-face-underline-p'
955      Change whether the given FACE is underlined.
956
957    You can exchange the foreground and background color of the selected
958 FACE with the function `invert-face'. If the face does not specify both
959 foreground and background, then its foreground and background are set
960 to the background and foreground of the default face.  When calling
961 this from a program, you can supply the optional argument FRAME to
962 specify which frame is affected; otherwise, all frames are affected.
963
964    You can set the background color of the specified FACE with the
965 function `set-face-background'.  The argument `color' should be a
966 string, the name of a color.  When called from a program, if the
967 optional FRAME argument is provided, the face is changed only in that
968 frame; otherwise, it is changed in all frames.
969
970    You can set the background pixmap of the specified FACE with the
971 function `set-face-background-pixmap'.  The pixmap argument NAME should
972 be a string, the name of a file of pixmap data.  The directories listed
973 in the `x-bitmap-file-path' variable are searched.  The bitmap may also
974 be a list of the form `(WIDTH HEIGHT DATA)', where WIDTH and HEIGHT are
975 the size in pixels, and DATA is a string containing the raw bits of the
976 bitmap.  If the optional FRAME argument is provided, the face is
977 changed only in that frame; otherwise, it is changed in all frames.
978
979    The variable `x-bitmap-file-path' takes as a value a list of the
980 directories in which X bitmap files may be found.  If the value is
981 `nil', the list is initialized from the `*bitmapFilePath' resource.
982
983    If the environment variable XBMLANGPATH is set, then it is consulted
984 before the `x-bitmap-file-path' variable.
985
986    You can set the font of the specified FACE with the function
987 `set-face-font'.  The FONT argument should be a string, the name of a
988 font.  When called from a program, if the optional FRAME argument is
989 provided, the face is changed only in that frame; otherwise, it is
990 changed in all frames.
991
992    You can set the foreground color of the specified FACE with the
993 function `set-face-foreground'.  The argument COLOR should be a string,
994 the name of a color.  If the optional FRAME argument is provided, the
995 face is changed only in that frame; otherwise, it is changed in all
996 frames.
997
998    You can set underline the specified FACE with the function
999 `set-face-underline-p'. The argument UNDERLINE-P can be used to make
1000 underlining an attribute of the face or not. If the optional FRAME
1001 argument is provided, the face is changed only in that frame;
1002 otherwise, it is changed in all frames.
1003
1004 \1f
1005 File: xemacs.info,  Node: Frame Components,  Next: X Resources,  Prev: Faces,  Up: Customization
1006
1007 Frame Components
1008 ================
1009
1010    You can control the presence and position of most frame components,
1011 such as the menubar, toolbars, and gutters.
1012
1013    This section is not written yet.  Try the Lisp Reference Manual:
1014 *Note Menubar: (lispref)Menubar, *Note Toolbar Intro: (lispref)Toolbar
1015 Intro, and *Note Gutter Intro: (lispref)Gutter Intro.
1016
1017 \1f
1018 File: xemacs.info,  Node: X Resources,  Prev: Frame Components,  Up: Customization
1019
1020 X Resources
1021 ===========
1022
1023    Historically, XEmacs has used the X resource application class
1024 `Emacs' for its resources.  Unfortunately, GNU Emacs uses the same
1025 application class, and resources are not compatible between the two
1026 Emacsen.  This sharing of the application class often leads to trouble
1027 if you want to run both variants.
1028
1029    Starting with XEmacs 21, XEmacs uses the class `XEmacs' if it finds
1030 any XEmacs resources in the resource database when the X connection is
1031 initialized.  Otherwise, it will use the class `Emacs' for backwards
1032 compatibility.  The variable X-EMACS-APPLICATION-CLASS may be consulted
1033 to determine the application class being used.
1034
1035    The examples in this section assume the application class is `Emacs'.
1036
1037    The Emacs resources are generally set per-frame. Each Emacs frame
1038 can have its own name or the same name as another, depending on the
1039 name passed to the `make-frame' function.
1040
1041    You can specify resources for all frames with the syntax:
1042
1043      Emacs*parameter: value
1044
1045 or
1046
1047      Emacs*EmacsFrame.parameter:value
1048
1049 You can specify resources for a particular frame with the syntax:
1050
1051      Emacs*FRAME-NAME.parameter: value
1052
1053 * Menu:
1054
1055 * Geometry Resources::     Controlling the size and position of frames.
1056 * Iconic Resources::       Controlling whether frames come up iconic.
1057 * Resource List::          List of resources settable on a frame or device.
1058 * Face Resources::         Controlling faces using resources.
1059 * Widgets::                The widget hierarchy for XEmacs.
1060 * Menubar Resources::      Specifying resources for the menubar.
1061
1062 \1f
1063 File: xemacs.info,  Node: Geometry Resources,  Next: Iconic Resources,  Up: X Resources
1064
1065 Geometry Resources
1066 ------------------
1067
1068    To make the default size of all Emacs frames be 80 columns by 55
1069 lines, do this:
1070
1071      Emacs*EmacsFrame.geometry: 80x55
1072
1073 To set the geometry of a particular frame named `fred', do this:
1074
1075      Emacs*fred.geometry: 80x55
1076
1077 Important! Do not use the following syntax:
1078
1079      Emacs*geometry: 80x55
1080
1081 You should never use `*geometry' with any X application. It does not
1082 say "make the geometry of Emacs be 80 columns by 55 lines."  It really
1083 says, "make Emacs and all subwindows thereof be 80x55 in whatever units
1084 they care to measure in."  In particular, that is both telling the
1085 Emacs text pane to be 80x55 in characters, and telling the menubar pane
1086 to be 80x55 pixels, which is surely not what you want.
1087
1088    As a special case, this geometry specification also works (and sets
1089 the default size of all Emacs frames to 80 columns by 55 lines):
1090
1091      Emacs.geometry: 80x55
1092
1093 since that is the syntax used with most other applications (since most
1094 other applications have only one top-level window, unlike Emacs).  In
1095 general, however, the top-level shell (the unmapped ApplicationShell
1096 widget named `Emacs' that is the parent of the shell widgets that
1097 actually manage the individual frames) does not have any interesting
1098 resources on it, and you should set the resources on the frames instead.
1099
1100    The `-geometry' command-line argument sets only the geometry of the
1101 initial frame created by Emacs.
1102
1103    A more complete explanation of geometry-handling is
1104
1105    * The `-geometry' command-line option sets the `Emacs.geometry'
1106      resource, that is, the geometry of the ApplicationShell.
1107
1108    * For the first frame created, the size of the frame is taken from
1109      the ApplicationShell if it is specified, otherwise from the
1110      geometry of the frame.
1111
1112    * For subsequent frames, the order is reversed: First the frame, and
1113      then the ApplicationShell.
1114
1115    * For the first frame created, the position of the frame is taken
1116      from the ApplicationShell (`Emacs.geometry') if it is specified,
1117      otherwise from the geometry of the frame.
1118
1119    * For subsequent frames, the position is taken only from the frame,
1120      and never from the ApplicationShell.
1121
1122    This is rather complicated, but it does seem to provide the most
1123 intuitive behavior with respect to the default sizes and positions of
1124 frames created in various ways.
1125
1126 \1f
1127 File: xemacs.info,  Node: Iconic Resources,  Next: Resource List,  Prev: Geometry Resources,  Up: X Resources
1128
1129 Iconic Resources
1130 ----------------
1131
1132    Analogous to `-geometry', the `-iconic' command-line option sets the
1133 iconic flag of the ApplicationShell (`Emacs.iconic') and always applies
1134 to the first frame created regardless of its name.  However, it is
1135 possible to set the iconic flag on particular frames (by name) by using
1136 the `Emacs*FRAME-NAME.iconic' resource.
1137
1138 \1f
1139 File: xemacs.info,  Node: Resource List,  Next: Face Resources,  Prev: Iconic Resources,  Up: X Resources
1140
1141 Resource List
1142 -------------
1143
1144    Emacs frames accept the following resources:
1145
1146 `geometry' (class `Geometry'): string
1147      Initial geometry for the frame.  *Note Geometry Resources::, for a
1148      complete discussion of how this works.
1149
1150 `iconic' (class `Iconic'): boolean
1151      Whether this frame should appear in the iconified state.
1152
1153 `internalBorderWidth' (class `InternalBorderWidth'): int
1154      How many blank pixels to leave between the text and the edge of the
1155      window.
1156
1157 `interline' (class `Interline'): int
1158      How many pixels to leave between each line (may not be
1159      implemented).
1160
1161 `menubar' (class `Menubar'): boolean
1162      Whether newly-created frames should initially have a menubar.  Set
1163      to true by default.
1164
1165 `initiallyUnmapped' (class `InitiallyUnmapped'): boolean
1166      Whether XEmacs should leave the initial frame unmapped when it
1167      starts up.  This is useful if you are starting XEmacs as a server
1168      (e.g. in conjunction with gnuserv or the external client widget).
1169      You can also control this with the `-unmapped' command-line option.
1170
1171 `barCursor' (class `BarColor'): boolean
1172      Whether the cursor should be displayed as a bar, or the
1173      traditional box.
1174
1175 `cursorColor' (class `CursorColor'): color-name
1176      The color of the text cursor.
1177
1178 `scrollBarWidth' (class `ScrollBarWidth'): integer
1179      How wide the vertical scrollbars should be, in pixels; 0 means no
1180      vertical scrollbars.  You can also use a resource specification of
1181      the form `*scrollbar.width', or the usual toolkit scrollbar
1182      resources: `*XmScrollBar.width' (Motif), `*XlwScrollBar.width'
1183      (Lucid), or `*Scrollbar.thickness' (Athena).  We don't recommend
1184      that you use the toolkit resources, though, because they're
1185      dependent on how exactly your particular build of XEmacs was
1186      configured.
1187
1188 `scrollBarHeight' (class `ScrollBarHeight'): integer
1189      How high the horizontal scrollbars should be, in pixels; 0 means no
1190      horizontal scrollbars.  You can also use a resource specification
1191      of the form `*scrollbar.height', or the usual toolkit scrollbar
1192      resources: `*XmScrollBar.height' (Motif), `*XlwScrollBar.height'
1193      (Lucid), or `*Scrollbar.thickness' (Athena).  We don't recommend
1194      that you use the toolkit resources, though, because they're
1195      dependent on how exactly your particular build of XEmacs was
1196      configured.
1197
1198 `scrollBarPlacement' (class `ScrollBarPlacement'): string
1199      Where the horizontal and vertical scrollbars should be positioned.
1200      This should be one of the four strings `BOTTOM_LEFT',
1201      `BOTTOM_RIGHT', `TOP_LEFT', and `TOP_RIGHT'.  Default is
1202      `BOTTOM_RIGHT' for the Motif and Lucid scrollbars and
1203      `BOTTOM_LEFT' for the Athena scrollbars.
1204
1205 `topToolBarHeight' (class `TopToolBarHeight'): integer
1206 `bottomToolBarHeight' (class `BottomToolBarHeight'): integer
1207 `leftToolBarWidth' (class `LeftToolBarWidth'): integer
1208 `rightToolBarWidth' (class `RightToolBarWidth'): integer
1209      Height and width of the four possible toolbars.
1210
1211 `topToolBarShadowColor' (class `TopToolBarShadowColor'): color-name
1212 `bottomToolBarShadowColor' (class `BottomToolBarShadowColor'): color-name
1213      Color of the top and bottom shadows for the toolbars.  NOTE: These
1214      resources do _not_ have anything to do with the top and bottom
1215      toolbars (i.e. the toolbars at the top and bottom of the frame)!
1216      Rather, they affect the top and bottom shadows around the edges of
1217      all four kinds of toolbars.
1218
1219 `topToolBarShadowPixmap' (class `TopToolBarShadowPixmap'): pixmap-name
1220 `bottomToolBarShadowPixmap' (class `BottomToolBarShadowPixmap'): pixmap-name
1221      Pixmap of the top and bottom shadows for the toolbars.  If set,
1222      these resources override the corresponding color resources. NOTE:
1223      These resources do _not_ have anything to do with the top and
1224      bottom toolbars (i.e. the toolbars at the top and bottom of the
1225      frame)!  Rather, they affect the top and bottom shadows around the
1226      edges of all four kinds of toolbars.
1227
1228 `toolBarShadowThickness' (class `ToolBarShadowThickness'): integer
1229      Thickness of the shadows around the toolbars, in pixels.
1230
1231 `visualBell' (class `VisualBell'): boolean
1232      Whether XEmacs should flash the screen rather than making an
1233      audible beep.
1234
1235 `bellVolume' (class `BellVolume'): integer
1236      Volume of the audible beep.
1237
1238 `useBackingStore' (class `UseBackingStore'): boolean
1239      Whether XEmacs should set the backing-store attribute of the X
1240      windows it creates.  This increases the memory usage of the X
1241      server but decreases the amount of X traffic necessary to update
1242      the screen, and is useful when the connection to the X server goes
1243      over a low-bandwidth line such as a modem connection.
1244
1245    Emacs devices accept the following resources:
1246
1247 `textPointer' (class `Cursor'): cursor-name
1248      The cursor to use when the mouse is over text.  This resource is
1249      used to initialize the variable `x-pointer-shape'.
1250
1251 `selectionPointer' (class `Cursor'): cursor-name
1252      The cursor to use when the mouse is over a selectable text region
1253      (an extent with the `highlight' property; for example, an Info
1254      cross-reference).  This resource is used to initialize the variable
1255      `x-selection-pointer-shape'.
1256
1257 `spacePointer' (class `Cursor'): cursor-name
1258      The cursor to use when the mouse is over a blank space in a buffer
1259      (that is, after the end of a line or after the end-of-file).  This
1260      resource is used to initialize the variable
1261      `x-nontext-pointer-shape'.
1262
1263 `modeLinePointer' (class `Cursor'): cursor-name
1264      The cursor to use when the mouse is over a modeline.  This
1265      resource is used to initialize the variable `x-mode-pointer-shape'.
1266
1267 `gcPointer' (class `Cursor'): cursor-name
1268      The cursor to display when a garbage-collection is in progress.
1269      This resource is used to initialize the variable
1270      `x-gc-pointer-shape'.
1271
1272 `scrollbarPointer' (class `Cursor'): cursor-name
1273      The cursor to use when the mouse is over the scrollbar.  This
1274      resource is used to initialize the variable
1275      `x-scrollbar-pointer-shape'.
1276
1277 `pointerColor' (class `Foreground'): color-name
1278 `pointerBackground' (class `Background'): color-name
1279      The foreground and background colors of the mouse cursor.  These
1280      resources are used to initialize the variables
1281      `x-pointer-foreground-color' and `x-pointer-background-color'.
1282