1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
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.
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.
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.
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.
33 File: xemacs.info, Node: Kbd Macro Query, Prev: Save Kbd Macro, Up: Keyboard Macros
35 Executing Macros With Variations
36 --------------------------------
38 You can use `C-x q' (`kbd-macro-query'), to get an effect similar to
39 that of `query-replace'. The macro asks you each time whether to make
40 a change. When you are defining the macro, type `C-x q' at the point
41 where you want the query to occur. During macro definition, the `C-x
42 q' does nothing, but when you invoke the macro, `C-x q' reads a
43 character from the terminal to decide whether to continue.
45 The special answers to a `C-x q' query are <SPC>, <DEL>, `C-d',
46 `C-l', and `C-r'. Any other character terminates execution of the
47 keyboard macro and is then read as a command. <SPC> means to continue.
48 <DEL> means to skip the remainder of this repetition of the macro,
49 starting again from the beginning in the next repetition. `C-d' means
50 to skip the remainder of this repetition and cancel further repetition.
51 `C-l' redraws the frame and asks you again for a character to specify
52 what to do. `C-r' enters a recursive editing level, in which you can
53 perform editing that is not part of the macro. When you exit the
54 recursive edit using `C-M-c', you are asked again how to continue with
55 the keyboard macro. If you type a <SPC> at this time, the rest of the
56 macro definition is executed. It is up to you to leave point and the
57 text in a state such that the rest of the macro will do what you want.
59 `C-u C-x q', which is `C-x q' with a numeric argument, performs a
60 different function. It enters a recursive edit reading input from the
61 keyboard, both when you type it during the definition of the macro and
62 when it is executed from the macro. During definition, the editing you
63 do inside the recursive edit does not become part of the macro. During
64 macro execution, the recursive edit gives you a chance to do some
65 particularized editing. *Note Recursive Edit::.
68 File: xemacs.info, Node: Key Bindings, Next: Syntax, Prev: Keyboard Macros, Up: Customization
70 Customizing Key Bindings
71 ========================
73 This section deals with the "keymaps" that define the bindings
74 between keys and functions, and shows how you can customize these
77 A command is a Lisp function whose definition provides for
78 interactive use. Like every Lisp function, a command has a function
79 name, which is a Lisp symbol whose name usually consists of lower case
84 * Keymaps:: Definition of the keymap data structure.
85 Names of Emacs's standard keymaps.
86 * Rebinding:: How to redefine one key's meaning conveniently.
87 * Disabling:: Disabling a command means confirmation is required
88 before it can be executed. This is done to protect
89 beginners from surprises.
92 File: xemacs.info, Node: Keymaps, Next: Rebinding, Up: Key Bindings
97 The bindings between characters and command functions are recorded in
98 data structures called "keymaps". Emacs has many of these. One, the
99 "global" keymap, defines the meanings of the single-character keys that
100 are defined regardless of major mode. It is the value of the variable
103 Each major mode has another keymap, its "local keymap", which
104 contains overriding definitions for the single-character keys that are
105 redefined in that mode. Each buffer records which local keymap is
106 installed for it at any time, and the current buffer's local keymap is
107 the only one that directly affects command execution. The local keymaps
108 for Lisp mode, C mode, and many other major modes always exist even when
109 not in use. They are the values of the variables `lisp-mode-map',
110 `c-mode-map', and so on. For less frequently used major modes, the
111 local keymap is sometimes constructed only when the mode is used for the
112 first time in a session, to save space.
114 There are local keymaps for the minibuffer, too; they contain various
115 completion and exit commands.
117 * `minibuffer-local-map' is used for ordinary input (no completion).
119 * `minibuffer-local-ns-map' is similar, except that <SPC> exits just
120 like <RET>. This is used mainly for Mocklisp compatibility.
122 * `minibuffer-local-completion-map' is for permissive completion.
124 * `minibuffer-local-must-match-map' is for strict completion and for
127 * `repeat-complex-command-map' is for use in `C-x <ESC>'.
129 * `isearch-mode-map' contains the bindings of the special keys which
130 are bound in the pseudo-mode entered with `C-s' and `C-r'.
132 Finally, each prefix key has a keymap which defines the key sequences
133 that start with it. For example, `ctl-x-map' is the keymap used for
134 characters following a `C-x'.
136 * `ctl-x-map' is the variable name for the map used for characters
139 * `help-map' is used for characters that follow `C-h'.
141 * `esc-map' is for characters that follow <ESC>. All Meta characters
142 are actually defined by this map.
144 * `ctl-x-4-map' is for characters that follow `C-x 4'.
146 * `mode-specific-map' is for characters that follow `C-c'.
148 The definition of a prefix key is the keymap to use for looking up
149 the following character. Sometimes the definition is actually a Lisp
150 symbol whose function definition is the following character keymap. The
151 effect is the same, but it provides a command name for the prefix key
152 that you can use as a description of what the prefix key is for. Thus
153 the binding of `C-x' is the symbol `Ctl-X-Prefix', whose function
154 definition is the keymap for `C-x' commands, the value of `ctl-x-map'.
156 Prefix key definitions can appear in either the global map or a
157 local map. The definitions of `C-c', `C-x', `C-h', and <ESC> as prefix
158 keys appear in the global map, so these prefix keys are always
159 available. Major modes can locally redefine a key as a prefix by
160 putting a prefix key definition for it in the local map.
162 A mode can also put a prefix definition of a global prefix character
163 such as `C-x' into its local map. This is how major modes override the
164 definitions of certain keys that start with `C-x'. This case is
165 special, because the local definition does not entirely replace the
166 global one. When both the global and local definitions of a key are
167 other keymaps, the next character is looked up in both keymaps, with
168 the local definition overriding the global one. The character after the
169 `C-x' is looked up in both the major mode's own keymap for redefined
170 `C-x' commands and in `ctl-x-map'. If the major mode's own keymap for
171 `C-x' commands contains `nil', the definition from the global keymap
172 for `C-x' commands is used.
175 File: xemacs.info, Node: Rebinding, Next: Disabling, Prev: Keymaps, Up: Key Bindings
177 Changing Key Bindings
178 ---------------------
180 You can redefine an Emacs key by changing its entry in a keymap.
181 You can change the global keymap, in which case the change is effective
182 in all major modes except those that have their own overriding local
183 definitions for the same key. Or you can change the current buffer's
184 local map, which affects all buffers using the same major mode.
188 * Interactive Rebinding:: Changing Key Bindings Interactively
189 * Programmatic Rebinding:: Changing Key Bindings Programmatically
190 * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
193 File: xemacs.info, Node: Interactive Rebinding, Next: Programmatic Rebinding, Up: Rebinding
195 Changing Key Bindings Interactively
196 ...................................
198 `M-x global-set-key <RET> KEY CMD <RET>'
199 Defines KEY globally to run CMD.
201 `M-x local-set-key <RET> KEYS CMD <RET>'
202 Defines KEY locally (in the major mode now in effect) to run CMD.
204 `M-x local-unset-key <RET> KEYS <RET>'
205 Removes the local binding of KEY.
207 CMD is a symbol naming an interactively-callable function.
209 When called interactively, KEY is the next complete key sequence
210 that you type. When called as a function, KEY is a string, a vector of
211 events, or a vector of key-description lists as described in the
212 `define-key' function description. The binding goes in the current
213 buffer's local map, which is shared with other buffers in the same
216 The following example:
218 M-x global-set-key <RET> C-f next-line <RET>
220 redefines `C-f' to move down a line. The fact that CMD is read second
221 makes it serve as a kind of confirmation for KEY.
223 These functions offer no way to specify a particular prefix keymap as
224 the one to redefine in, but that is not necessary, as you can include
225 prefixes in KEY. KEY is read by reading characters one by one until
226 they amount to a complete key (that is, not a prefix key). Thus, if
227 you type `C-f' for KEY, Emacs enters the minibuffer immediately to read
228 CMD. But if you type `C-x', another character is read; if that
229 character is `4', another character is read, and so on. For example,
231 M-x global-set-key <RET> C-x 4 $ spell-other-window <RET>
233 redefines `C-x 4 $' to run the (fictitious) command
234 `spell-other-window'.
236 The most general way to modify a keymap is the function
237 `define-key', used in Lisp code (such as your `.emacs' file).
238 `define-key' takes three arguments: the keymap, the key to modify in
239 it, and the new definition. *Note Init File::, for an example.
240 `substitute-key-definition' is used similarly; it takes three
241 arguments, an old definition, a new definition, and a keymap, and
242 redefines in that keymap all keys that were previously defined with the
243 old definition to have the new definition instead.
246 File: xemacs.info, Node: Programmatic Rebinding, Next: Key Bindings Using Strings, Prev: Interactive Rebinding, Up: Rebinding
248 Changing Key Bindings Programmatically
249 ......................................
251 You can use the functions `global-set-key' and `define-key' to
252 rebind keys under program control.
254 ``(global-set-key KEYS CMD)''
255 Defines KEYS globally to run CMD.
257 ``(define-key KEYMAP KEYS DEF)''
258 Defines KEYS to run DEF in the keymap KEYMAP.
260 KEYMAP is a keymap object.
262 KEYS is the sequence of keystrokes to bind.
264 DEF is anything that can be a key's definition:
266 * `nil', meaning key is undefined in this keymap
268 * A command, that is, a Lisp function suitable for interactive
271 * A string or key sequence vector, which is treated as a keyboard
274 * A keymap to define a prefix key
276 * A symbol so that when the key is looked up, the symbol stands for
277 its function definition, which should at that time be one of the
278 above, or another symbol whose function definition is used, and so
281 * A cons, `(string . defn)', meaning that DEFN is the definition
282 (DEFN should be a valid definition in its own right)
284 * A cons, `(keymap . char)', meaning use the definition of CHAR in
287 For backward compatibility, XEmacs allows you to specify key
288 sequences as strings. However, the preferred method is to use the
289 representations of key sequences as vectors of keystrokes. *Note
290 Keystrokes::, for more information about the rules for constructing key
293 Emacs allows you to abbreviate representations for key sequences in
294 most places where there is no ambiguity. Here are some rules for
297 * The keysym by itself is equivalent to a list of just that keysym,
298 i.e., `f1' is equivalent to `(f1)'.
300 * A keystroke by itself is equivalent to a vector containing just
301 that keystroke, i.e., `(control a)' is equivalent to `[(control
304 * You can use ASCII codes for keysyms that have them. i.e., `65' is
305 equivalent to `A'. (This is not so much an abbreviation as an
306 alternate representation.)
308 Here are some examples of programmatically binding keys:
311 ;;; Bind `my-command' to <f1>
312 (global-set-key 'f1 'my-command)
314 ;;; Bind `my-command' to Shift-f1
315 (global-set-key '(shift f1) 'my-command)
317 ;;; Bind `my-command' to C-c Shift-f1
318 (global-set-key '[(control c) (shift f1)] 'my-command)
320 ;;; Bind `my-command' to the middle mouse button.
321 (global-set-key 'button2 'my-command)
323 ;;; Bind `my-command' to <META> <CTL> <Right Mouse Button>
324 ;;; in the keymap that is in force when you are running `dired'.
325 (define-key dired-mode-map '(meta control button3) 'my-command)
328 File: xemacs.info, Node: Key Bindings Using Strings, Prev: Programmatic Rebinding, Up: Rebinding
330 Using Strings for Changing Key Bindings
331 .......................................
333 For backward compatibility, you can still use strings to represent
334 key sequences. Thus you can use commands like the following:
336 ;;; Bind `end-of-line' to C-f
337 (global-set-key "\C-f" 'end-of-line)
339 Note, however, that in some cases you may be binding more than one
340 key sequence by using a single command. This situation can arise
341 because in ASCII, `C-i' and <TAB> have the same representation.
342 Therefore, when Emacs sees:
344 (global-set-key "\C-i" 'end-of-line)
346 it is unclear whether the user intended to bind `C-i' or <TAB>. The
347 solution XEmacs adopts is to bind both of these key sequences.
349 After binding a command to two key sequences with a form like:
351 (define-key global-map "\^X\^I" 'command-1)
353 it is possible to redefine only one of those sequences like so:
355 (define-key global-map [(control x) (control i)] 'command-2)
356 (define-key global-map [(control x) tab] 'command-3)
358 This applies only when running under a window system. If you are
359 talking to Emacs through an ASCII-only channel, you do not get any of
362 Here is a table of pairs of key sequences that behave in a similar
371 control @ control space
374 File: xemacs.info, Node: Disabling, Prev: Rebinding, Up: Key Bindings
379 Disabling a command marks it as requiring confirmation before it can
380 be executed. The purpose of disabling a command is to prevent
381 beginning users from executing it by accident and being confused.
383 The direct mechanism for disabling a command is to have a non-`nil'
384 `disabled' property on the Lisp symbol for the command. These
385 properties are normally set by the user's `.emacs' file with Lisp
388 (put 'delete-region 'disabled t)
390 If the value of the `disabled' property is a string, that string is
391 included in the message printed when the command is used:
393 (put 'delete-region 'disabled
394 "Text deleted this way cannot be yanked back!\n")
396 You can disable a command either by editing the `.emacs' file
397 directly or with the command `M-x disable-command', which edits the
398 `.emacs' file for you. *Note Init File::.
400 When you attempt to invoke a disabled command interactively in Emacs,
401 a window is displayed containing the command's name, its documentation,
402 and some instructions on what to do next; then Emacs asks for input
403 saying whether to execute the command as requested, enable it and
404 execute, or cancel it. If you decide to enable the command, you are
405 asked whether to do this permanently or just for the current session.
406 Enabling permanently works by automatically editing your `.emacs' file.
407 You can use `M-x enable-command' at any time to enable any command
410 Whether a command is disabled is independent of what key is used to
411 invoke it; it also applies if the command is invoked using `M-x'.
412 Disabling a command has no effect on calling it as a function from Lisp
416 File: xemacs.info, Node: Syntax, Next: Init File, Prev: Key Bindings, Up: Customization
421 All the Emacs commands which parse words or balance parentheses are
422 controlled by the "syntax table". The syntax table specifies which
423 characters are opening delimiters, which are parts of words, which are
424 string quotes, and so on. Actually, each major mode has its own syntax
425 table (though sometimes related major modes use the same one) which it
426 installs in each buffer that uses that major mode. The syntax table
427 installed in the current buffer is the one that all commands use, so we
428 call it "the" syntax table. A syntax table is a Lisp object, a vector
429 of length 256 whose elements are numbers.
433 * Entry: Syntax Entry. What the syntax table records for each character.
434 * Change: Syntax Change. How to change the information.
437 File: xemacs.info, Node: Syntax Entry, Next: Syntax Change, Up: Syntax
439 Information About Each Character
440 --------------------------------
442 The syntax table entry for a character is a number that encodes six
443 pieces of information:
445 * The syntactic class of the character, represented as a small
448 * The matching delimiter, for delimiter characters only (the
449 matching delimiter of `(' is `)', and vice versa)
451 * A flag saying whether the character is the first character of a
452 two-character comment starting sequence
454 * A flag saying whether the character is the second character of a
455 two-character comment starting sequence
457 * A flag saying whether the character is the first character of a
458 two-character comment ending sequence
460 * A flag saying whether the character is the second character of a
461 two-character comment ending sequence
463 The syntactic classes are stored internally as small integers, but
464 are usually described to or by the user with characters. For example,
465 `(' is used to specify the syntactic class of opening delimiters. Here
466 is a table of syntactic classes, with the characters that specify them.
469 The class of whitespace characters.
472 The class of word-constituent characters.
475 The class of characters that are part of symbol names but not
476 words. This class is represented by `_' because the character `_'
477 has this class in both C and Lisp.
480 The class of punctuation characters that do not fit into any other
484 The class of opening delimiters.
487 The class of closing delimiters.
490 The class of expression-adhering characters. These characters are
491 part of a symbol if found within or adjacent to one, and are part
492 of a following expression if immediately preceding one, but are
493 like whitespace if surrounded by whitespace.
496 The class of string-quote characters. They match each other in
497 pairs, and the characters within the pair all lose their syntactic
498 significance except for the `\' and `/' classes of escape
499 characters, which can be used to include a string-quote inside the
503 The class of self-matching delimiters. This is intended for TeX's
504 `$', which is used both to enter and leave math mode. Thus, a
505 pair of matching `$' characters surround each piece of math mode
506 TeX input. A pair of adjacent `$' characters act like a single
507 one for purposes of matching.
510 The class of escape characters that always just deny the following
511 character its special syntactic significance. The character after
512 one of these escapes is always treated as alphabetic.
515 The class of C-style escape characters. In practice, these are
516 treated just like `/'-class characters, because the extra
517 possibilities for C escapes (such as being followed by digits)
518 have no effect on where the containing expression ends.
521 The class of comment-starting characters. Only single-character
522 comment starters (such as `;' in Lisp mode) are represented this
526 The class of comment-ending characters. Newline has this syntax in
529 The characters flagged as part of two-character comment delimiters
530 can have other syntactic functions most of the time. For example, `/'
531 and `*' in C code, when found separately, have nothing to do with
532 comments. The comment-delimiter significance overrides when the pair of
533 characters occur together in the proper order. Only the list and sexp
534 commands use the syntax table to find comments; the commands
535 specifically for comments have other variables that tell them where to
536 find comments. Moreover, the list and sexp commands notice comments
537 only if `parse-sexp-ignore-comments' is non-`nil'. This variable is set
538 to `nil' in modes where comment-terminator sequences are liable to
539 appear where there is no comment, for example, in Lisp mode where the
540 comment terminator is a newline but not every newline ends a comment.
543 File: xemacs.info, Node: Syntax Change, Prev: Syntax Entry, Up: Syntax
545 Altering Syntax Information
546 ---------------------------
548 It is possible to alter a character's syntax table entry by storing
549 a new number in the appropriate element of the syntax table, but it
550 would be hard to determine what number to use. Emacs therefore
551 provides a command that allows you to specify the syntactic properties
552 of a character in a convenient way.
554 `M-x modify-syntax-entry' is the command to change a character's
555 syntax. It can be used interactively and is also used by major modes
556 to initialize their own syntax tables. Its first argument is the
557 character to change. The second argument is a string that specifies the
558 new syntax. When called from Lisp code, there is a third, optional
559 argument, which specifies the syntax table in which to make the change.
560 If not supplied, or if this command is called interactively, the third
561 argument defaults to the current buffer's syntax table.
563 1. The first character in the string specifies the syntactic class.
564 It is one of the characters in the previous table (*note Syntax
567 2. The second character is the matching delimiter. For a character
568 that is not an opening or closing delimiter, this should be a
569 space, and may be omitted if no following characters are needed.
571 3. The remaining characters are flags. The flag characters allowed
575 Flag this character as the first of a two-character comment
579 Flag this character as the second of a two-character comment
583 Flag this character as the first of a two-character comment
587 Flag this character as the second of a two-character comment
590 Use `C-h s' (`describe-syntax') to display a description of the
591 contents of the current syntax table. The description of each
592 character includes both the string you have to pass to
593 `modify-syntax-entry' to set up that character's current syntax, and
594 some English to explain that string if necessary.
597 File: xemacs.info, Node: Init File, Next: Audible Bell, Prev: Syntax, Up: Customization
599 The Init File, .emacs
600 =====================
602 When you start Emacs, it normally loads the file `.emacs' in your
603 home directory. This file, if it exists, should contain Lisp code. It
604 is called your initialization file or "init file". Use the command
605 line switch `-q' to tell Emacs whether to load an init file (*note
606 Entering Emacs::). Use the command line switch `-user-init-file'
607 (*note Command Switches::) to tell Emacs to load a different file
608 instead of `~/.emacs'.
610 When the `.emacs' file is read, the variable `user-init-file' says
611 which init file was loaded.
613 At some sites there is a "default init file", which is the library
614 named `default.el', found via the standard search path for libraries.
615 The Emacs distribution contains no such library; your site may create
616 one for local customizations. If this library exists, it is loaded
617 whenever you start Emacs. But your init file, if any, is loaded first;
618 if it sets `inhibit-default-init' non-`nil', then `default' is not
621 If you have a large amount of code in your `.emacs' file, you should
622 move it into another file named `SOMETHING.el', byte-compile it (*note
623 Lisp Libraries::), and load that file from your `.emacs' file using
628 * Init Syntax:: Syntax of constants in Emacs Lisp.
629 * Init Examples:: How to do some things with an init file.
630 * Terminal Init:: Each terminal type can have an init file.
633 File: xemacs.info, Node: Init Syntax, Next: Init Examples, Up: Init File
638 The `.emacs' file contains one or more Lisp function call
639 expressions. Each consists of a function name followed by arguments,
640 all surrounded by parentheses. For example, `(setq fill-column 60)'
641 represents a call to the function `setq' which is used to set the
642 variable `fill-column' (*note Filling::) to 60.
644 The second argument to `setq' is an expression for the new value of
645 the variable. This can be a constant, a variable, or a function call
646 expression. In `.emacs', constants are used most of the time. They
650 Integers are written in decimal, with an optional initial minus
653 If a sequence of digits is followed by a period and another
654 sequence of digits, it is interpreted as a floating point number.
656 The number prefixes `#b', `#o', and `#x' are supported to
657 represent numbers in binary, octal, and hexadecimal notation (or
661 Lisp string syntax is the same as C string syntax with a few extra
662 features. Use a double-quote character to begin and end a string
665 Newlines and special characters may be present literally in
666 strings. They can also be represented as backslash sequences:
667 `\n' for newline, `\b' for backspace, `\r' for return, `\t' for
668 tab, `\f' for formfeed (control-l), `\e' for escape, `\\' for a
669 backslash, `\"' for a double-quote, or `\OOO' for the character
670 whose octal code is OOO. Backslash and double-quote are the only
671 characters for which backslash sequences are mandatory.
673 You can use `\C-' as a prefix for a control character, as in
674 `\C-s' for ASCII Control-S, and `\M-' as a prefix for a Meta
675 character, as in `\M-a' for Meta-A or `\M-\C-a' for Control-Meta-A.
678 Lisp character constant syntax consists of a `?' followed by
679 either a character or an escape sequence starting with `\'.
680 Examples: `?x', `?\n', `?\"', `?\)'. Note that strings and
681 characters are not interchangeable in Lisp; some contexts require
682 one and some contexts require the other.
685 `t' stands for `true'.
688 `nil' stands for `false'.
691 Write a single-quote (') followed by the Lisp object you want.
694 File: xemacs.info, Node: Init Examples, Next: Terminal Init, Prev: Init Syntax, Up: Init File
699 Here are some examples of doing certain commonly desired things with
702 * Make <TAB> in C mode just insert a tab if point is in the middle
705 (setq c-tab-always-indent nil)
707 Here we have a variable whose value is normally `t' for `true' and
708 the alternative is `nil' for `false'.
710 * Make searches case sensitive by default (in all buffers that do not
713 (setq-default case-fold-search nil)
715 This sets the default value, which is effective in all buffers
716 that do not have local values for the variable. Setting
717 `case-fold-search' with `setq' affects only the current buffer's
718 local value, which is probably not what you want to do in an init
721 * Make Text mode the default mode for new buffers.
723 (setq default-major-mode 'text-mode)
725 Note that `text-mode' is used because it is the command for
726 entering the mode we want. A single-quote is written before it to
727 make a symbol constant; otherwise, `text-mode' would be treated as
730 * Turn on Auto Fill mode automatically in Text mode and related
734 '(lambda () (auto-fill-mode 1)))
736 Here we have a variable whose value should be a Lisp function. The
737 function we supply is a list starting with `lambda', and a single
738 quote is written in front of it to make it (for the purpose of this
739 `setq') a list constant rather than an expression. Lisp functions
740 are not explained here; for mode hooks it is enough to know that
741 `(auto-fill-mode 1)' is an expression that will be executed when
742 Text mode is entered. You could replace it with any other
743 expression that you like, or with several expressions in a row.
745 (setq text-mode-hook 'turn-on-auto-fill)
747 This is another way to accomplish the same result.
748 `turn-on-auto-fill' is a symbol whose function definition is
749 `(lambda () (auto-fill-mode 1))'.
751 * Load the installed Lisp library named `foo' (actually a file
752 `foo.elc' or `foo.el' in a standard Emacs directory).
756 When the argument to `load' is a relative pathname, not starting
757 with `/' or `~', `load' searches the directories in `load-path'
760 * Load the compiled Lisp file `foo.elc' from your home directory.
764 Here an absolute file name is used, so no searching is done.
766 * Rebind the key `C-x l' to run the function `make-symbolic-link'.
768 (global-set-key "\C-xl" 'make-symbolic-link)
772 (define-key global-map "\C-xl" 'make-symbolic-link)
774 Note once again the single-quote used to refer to the symbol
775 `make-symbolic-link' instead of its value as a variable.
777 * Do the same thing for C mode only.
779 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
781 * Bind the function key <F1> to a command in C mode. Note that the
782 names of function keys must be lower case.
784 (define-key c-mode-map 'f1 'make-symbolic-link)
786 * Bind the shifted version of <F1> to a command.
788 (define-key c-mode-map '(shift f1) 'make-symbolic-link)
790 * Redefine all keys which now run `next-line' in Fundamental mode to
791 run `forward-line' instead.
793 (substitute-key-definition 'next-line 'forward-line
796 * Make `C-x C-v' undefined.
798 (global-unset-key "\C-x\C-v")
800 One reason to undefine a key is so that you can make it a prefix.
801 Simply defining `C-x C-v ANYTHING' would make `C-x C-v' a prefix,
802 but `C-x C-v' must be freed of any non-prefix definition first.
804 * Make `$' have the syntax of punctuation in Text mode. Note the
805 use of a character constant for `$'.
807 (modify-syntax-entry ?\$ "." text-mode-syntax-table)
809 * Enable the use of the command `eval-expression' without
812 (put 'eval-expression 'disabled nil)
815 File: xemacs.info, Node: Terminal Init, Prev: Init Examples, Up: Init File
817 Terminal-Specific Initialization
818 --------------------------------
820 Each terminal type can have a Lisp library to be loaded into Emacs
821 when it is run on that type of terminal. For a terminal type named
822 TERMTYPE, the library is called `term/TERMTYPE' and it is found by
823 searching the directories `load-path' as usual and trying the suffixes
824 `.elc' and `.el'. Normally it appears in the subdirectory `term' of
825 the directory where most Emacs libraries are kept.
827 The usual purpose of the terminal-specific library is to define the
828 escape sequences used by the terminal's function keys using the library
829 `keypad.el'. See the file `term/vt100.el' for an example of how this
832 When the terminal type contains a hyphen, only the part of the name
833 before the first hyphen is significant in choosing the library name.
834 Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
835 `term/aaa'. The code in the library can use `(getenv "TERM")' to find
836 the full terminal type name.
838 The library's name is constructed by concatenating the value of the
839 variable `term-file-prefix' and the terminal type. Your `.emacs' file
840 can prevent the loading of the terminal-specific library by setting
841 `term-file-prefix' to `nil'.
843 The value of the variable `term-setup-hook', if not `nil', is called
844 as a function of no arguments at the end of Emacs initialization, after
845 both your `.emacs' file and any terminal-specific library have been
846 read. You can set the value in the `.emacs' file to override part of
847 any of the terminal-specific libraries and to define initializations
848 for terminals that do not have a library.
851 File: xemacs.info, Node: Audible Bell, Next: Faces, Prev: Init File, Up: Customization
853 Changing the Bell Sound
854 =======================
856 You can now change how the audible bell sounds using the variable
859 `sound-alist''s value is an list associating symbols with, among
860 other things, strings of audio-data. When `ding' is called with one of
861 the symbols, the associated sound data is played instead of the
862 standard beep. This only works if you are logged in on the console of a
863 machine with audio hardware. To listen to a sound of the provided type,
864 call the function `play-sound' with the argument SOUND. You can also
865 set the volume of the sound with the optional argument VOLUME.
867 Each element of `sound-alist' is a list describing a sound. The
868 first element of the list is the name of the sound being defined.
869 Subsequent elements of the list are alternating keyword/value pairs:
872 A string of raw sound data, or the name of another sound to play.
873 The symbol `t' here means use the default X beep.
876 An integer from 0-100, defaulting to `bell-volume'.
879 If using the default X beep, the pitch (Hz) to generate.
882 If using the default X beep, the duration (milliseconds).
884 For compatibility, elements of `sound-alist' may also be of the form:
886 ( SOUND-NAME . <SOUND> )
887 ( SOUND-NAME <VOLUME> <SOUND> )
889 You should probably add things to this list by calling the function
892 Note that you can only play audio data if running on the console
893 screen of a machine with audio hardware which emacs understands, which
894 at this time means a Sun SparcStation, SGI, or HP9000s700.
896 Also note that the pitch, duration, and volume options are available
897 everywhere, but most X servers ignore the `pitch' option.
899 The variable `bell-volume' should be an integer from 0 to 100, with
900 100 being loudest, which controls how loud the sounds emacs makes
901 should be. Elements of the `sound-alist' may override this value.
902 This variable applies to the standard X bell sound as well as sound
905 If the symbol `t' is in place of a sound-string, Emacs uses the
906 default X beep. This allows you to define beep-types of different
907 volumes even when not running on the console.
909 You can add things to this list by calling the function
910 `load-sound-file', which reads in an audio-file and adds its data to
911 the sound-alist. You can specify the sound with the SOUND-NAME argument
912 and the file into which the sounds are loaded with the FILENAME
913 argument. The optional VOLUME argument sets the volume.
915 `load-sound-file (FILENAME SOUND-NAME &optional VOLUME)'
917 To load and install some sound files as beep-types, use the function
918 `load-default-sounds' (note that this only works if you are on display
919 0 of a machine with audio hardware).
921 The following beep-types are used by Emacs itself. Other Lisp
922 packages may use other beep types, but these are the ones that the C
923 kernel of Emacs uses.
926 An auto-save does not succeed
929 The Emacs command loop catches an error
932 You type a key that is undefined
935 You use an undefined mouse-click combination
938 Completion was not possible
941 You type something other than the required `y' or `n'
944 You type something other than `yes' or `no'
947 File: xemacs.info, Node: Faces, Next: Frame Components, Prev: Audible Bell, Up: Customization
952 XEmacs has objects called extents and faces. An "extent" is a
953 region of text and a "face" is a collection of textual attributes, such
954 as fonts and colors. Every extent is displayed in some face;
955 therefore, changing the properties of a face immediately updates the
956 display of all associated extents. Faces can be frame-local: you can
957 have a region of text that displays with completely different
958 attributes when its buffer is viewed from a different X window.
960 The display attributes of faces may be specified either in Lisp or
961 through the X resource manager.
966 You can change the face of an extent with the functions in this
967 section. All the functions prompt for a FACE as an argument; use
968 completion for a list of possible values.
971 Swap the foreground and background colors of the given FACE.
974 Make the font of the given FACE bold. When called from a program,
975 returns `nil' if this is not possible.
977 `M-x make-face-bold-italic'
978 Make the font of the given FACE bold italic. When called from a
979 program, returns `nil' if not possible.
981 `M-x make-face-italic'
982 Make the font of the given FACE italic. When called from a
983 program, returns `nil' if not possible.
985 `M-x make-face-unbold'
986 Make the font of the given FACE non-bold. When called from a
987 program, returns `nil' if not possible.
989 `M-x make-face-unitalic'
990 Make the font of the given FACE non-italic. When called from a
991 program, returns `nil' if not possible.
993 `M-x make-face-larger'
994 Make the font of the given FACE a little larger. When called from
995 a program, returns `nil' if not possible.
997 `M-x make-face-smaller'
998 Make the font of the given FACE a little smaller. When called
999 from a program, returns `nil' if not possible.
1001 `M-x set-face-background'
1002 Change the background color of the given FACE.
1004 `M-x set-face-background-pixmap'
1005 Change the background pixmap of the given FACE.
1008 Change the font of the given FACE.
1010 `M-x set-face-foreground'
1011 Change the foreground color of the given FACE.
1013 `M-x set-face-underline-p'
1014 Change whether the given FACE is underlined.
1016 You can exchange the foreground and background color of the selected
1017 FACE with the function `invert-face'. If the face does not specify both
1018 foreground and background, then its foreground and background are set
1019 to the background and foreground of the default face. When calling
1020 this from a program, you can supply the optional argument FRAME to
1021 specify which frame is affected; otherwise, all frames are affected.
1023 You can set the background color of the specified FACE with the
1024 function `set-face-background'. The argument `color' should be a
1025 string, the name of a color. When called from a program, if the
1026 optional FRAME argument is provided, the face is changed only in that
1027 frame; otherwise, it is changed in all frames.
1029 You can set the background pixmap of the specified FACE with the
1030 function `set-face-background-pixmap'. The pixmap argument NAME should
1031 be a string, the name of a file of pixmap data. The directories listed
1032 in the `x-bitmap-file-path' variable are searched. The bitmap may also
1033 be a list of the form `(WIDTH HEIGHT DATA)', where WIDTH and HEIGHT are
1034 the size in pixels, and DATA is a string containing the raw bits of the
1035 bitmap. If the optional FRAME argument is provided, the face is
1036 changed only in that frame; otherwise, it is changed in all frames.
1038 The variable `x-bitmap-file-path' takes as a value a list of the
1039 directories in which X bitmap files may be found. If the value is
1040 `nil', the list is initialized from the `*bitmapFilePath' resource.
1042 If the environment variable XBMLANGPATH is set, then it is consulted
1043 before the `x-bitmap-file-path' variable.
1045 You can set the font of the specified FACE with the function
1046 `set-face-font'. The FONT argument should be a string, the name of a
1047 font. When called from a program, if the optional FRAME argument is
1048 provided, the face is changed only in that frame; otherwise, it is
1049 changed in all frames.
1051 You can set the foreground color of the specified FACE with the
1052 function `set-face-foreground'. The argument COLOR should be a string,
1053 the name of a color. If the optional FRAME argument is provided, the
1054 face is changed only in that frame; otherwise, it is changed in all
1057 You can set underline the specified FACE with the function
1058 `set-face-underline-p'. The argument UNDERLINE-P can be used to make
1059 underlining an attribute of the face or not. If the optional FRAME
1060 argument is provided, the face is changed only in that frame;
1061 otherwise, it is changed in all frames.
1064 File: xemacs.info, Node: Frame Components, Next: X Resources, Prev: Faces, Up: Customization
1069 You can control the presence and position of most frame components,
1070 such as the menubar, toolbars, and gutters.
1072 This section is not written yet. Try the Lisp Reference Manual:
1073 *Note Menubar: (lispref)Menubar, *Note Toolbar Intro: (lispref)Toolbar
1074 Intro, and *Note Gutter Intro: (lispref)Gutter Intro.
1077 File: xemacs.info, Node: X Resources, Prev: Frame Components, Up: Customization
1082 Historically, XEmacs has used the X resource application class
1083 `Emacs' for its resources. Unfortunately, GNU Emacs uses the same
1084 application class, and resources are not compatible between the two
1085 Emacsen. This sharing of the application class often leads to trouble
1086 if you want to run both variants.
1088 Starting with XEmacs 21, XEmacs uses the class `XEmacs' if it finds
1089 any XEmacs resources in the resource database when the X connection is
1090 initialized. Otherwise, it will use the class `Emacs' for backwards
1091 compatibility. The variable X-EMACS-APPLICATION-CLASS may be consulted
1092 to determine the application class being used.
1094 The examples in this section assume the application class is `Emacs'.
1096 The Emacs resources are generally set per-frame. Each Emacs frame
1097 can have its own name or the same name as another, depending on the
1098 name passed to the `make-frame' function.
1100 You can specify resources for all frames with the syntax:
1102 Emacs*parameter: value
1106 Emacs*EmacsFrame.parameter:value
1108 You can specify resources for a particular frame with the syntax:
1110 Emacs*FRAME-NAME.parameter: value
1114 * Geometry Resources:: Controlling the size and position of frames.
1115 * Iconic Resources:: Controlling whether frames come up iconic.
1116 * Resource List:: List of resources settable on a frame or device.
1117 * Face Resources:: Controlling faces using resources.
1118 * Widgets:: The widget hierarchy for XEmacs.
1119 * Menubar Resources:: Specifying resources for the menubar.
1122 File: xemacs.info, Node: Geometry Resources, Next: Iconic Resources, Up: X Resources
1127 To make the default size of all Emacs frames be 80 columns by 55
1130 Emacs*EmacsFrame.geometry: 80x55
1132 To set the geometry of a particular frame named `fred', do this:
1134 Emacs*fred.geometry: 80x55
1136 Important! Do not use the following syntax:
1138 Emacs*geometry: 80x55
1140 You should never use `*geometry' with any X application. It does not
1141 say "make the geometry of Emacs be 80 columns by 55 lines." It really
1142 says, "make Emacs and all subwindows thereof be 80x55 in whatever units
1143 they care to measure in." In particular, that is both telling the
1144 Emacs text pane to be 80x55 in characters, and telling the menubar pane
1145 to be 80x55 pixels, which is surely not what you want.
1147 As a special case, this geometry specification also works (and sets
1148 the default size of all Emacs frames to 80 columns by 55 lines):
1150 Emacs.geometry: 80x55
1152 since that is the syntax used with most other applications (since most
1153 other applications have only one top-level window, unlike Emacs). In
1154 general, however, the top-level shell (the unmapped ApplicationShell
1155 widget named `Emacs' that is the parent of the shell widgets that
1156 actually manage the individual frames) does not have any interesting
1157 resources on it, and you should set the resources on the frames instead.
1159 The `-geometry' command-line argument sets only the geometry of the
1160 initial frame created by Emacs.
1162 A more complete explanation of geometry-handling is
1164 * The `-geometry' command-line option sets the `Emacs.geometry'
1165 resource, that is, the geometry of the ApplicationShell.
1167 * For the first frame created, the size of the frame is taken from
1168 the ApplicationShell if it is specified, otherwise from the
1169 geometry of the frame.
1171 * For subsequent frames, the order is reversed: First the frame, and
1172 then the ApplicationShell.
1174 * For the first frame created, the position of the frame is taken
1175 from the ApplicationShell (`Emacs.geometry') if it is specified,
1176 otherwise from the geometry of the frame.
1178 * For subsequent frames, the position is taken only from the frame,
1179 and never from the ApplicationShell.
1181 This is rather complicated, but it does seem to provide the most
1182 intuitive behavior with respect to the default sizes and positions of
1183 frames created in various ways.
1186 File: xemacs.info, Node: Iconic Resources, Next: Resource List, Prev: Geometry Resources, Up: X Resources
1191 Analogous to `-geometry', the `-iconic' command-line option sets the
1192 iconic flag of the ApplicationShell (`Emacs.iconic') and always applies
1193 to the first frame created regardless of its name. However, it is
1194 possible to set the iconic flag on particular frames (by name) by using
1195 the `Emacs*FRAME-NAME.iconic' resource.