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: Save Kbd Macro, Next: Kbd Macro Query, Prev: Basic Kbd Macro, Up: Keyboard Macros
35 Naming and Saving Keyboard Macros
36 ---------------------------------
38 To save a keyboard macro for longer than until you define the next
39 one, you must give it a name using `M-x name-last-kbd-macro'. This
40 reads a name as an argument using the minibuffer and defines that name
41 to execute the macro. The macro name is a Lisp symbol, and defining it
42 in this way makes it a valid command name for calling with `M-x' or for
43 binding a key to with `global-set-key' (*note Keymaps::). If you
44 specify a name that has a prior definition other than another keyboard
45 macro, Emacs prints an error message and nothing is changed.
47 Once a macro has a command name, you can save its definition in a
48 file. You can then use it in another editing session. First visit the
49 file you want to save the definition in. Then use the command:
51 M-x insert-kbd-macro <RET> MACRONAME <RET>
53 This inserts some Lisp code that, when executed later, will define the
54 same macro with the same definition it has now. You need not
55 understand Lisp code to do this, because `insert-kbd-macro' writes the
56 Lisp code for you. Then save the file. You can load the file with
57 `load-file' (*note Lisp Libraries::). If the file you save in is your
58 initialization file (*note Init File::), then the macro will be defined
59 each time you run Emacs.
61 If you give `insert-kbd-macro' a prefix argument, it creates
62 additional Lisp code to record the keys (if any) that you have bound to
63 the keyboard macro, so that the macro is reassigned the same keys when
67 File: xemacs.info, Node: Kbd Macro Query, Prev: Save Kbd Macro, Up: Keyboard Macros
69 Executing Macros With Variations
70 --------------------------------
72 You can use `C-x q' (`kbd-macro-query'), to get an effect similar to
73 that of `query-replace'. The macro asks you each time whether to make
74 a change. When you are defining the macro, type `C-x q' at the point
75 where you want the query to occur. During macro definition, the `C-x
76 q' does nothing, but when you invoke the macro, `C-x q' reads a
77 character from the terminal to decide whether to continue.
79 The special answers to a `C-x q' query are <SPC>, <DEL>, `C-d',
80 `C-l', and `C-r'. Any other character terminates execution of the
81 keyboard macro and is then read as a command. <SPC> means to continue.
82 <DEL> means to skip the remainder of this repetition of the macro,
83 starting again from the beginning in the next repetition. `C-d' means
84 to skip the remainder of this repetition and cancel further repetition.
85 `C-l' redraws the frame and asks you again for a character to specify
86 what to do. `C-r' enters a recursive editing level, in which you can
87 perform editing that is not part of the macro. When you exit the
88 recursive edit using `C-M-c', you are asked again how to continue with
89 the keyboard macro. If you type a <SPC> at this time, the rest of the
90 macro definition is executed. It is up to you to leave point and the
91 text in a state such that the rest of the macro will do what you want.
93 `C-u C-x q', which is `C-x q' with a numeric argument, performs a
94 different function. It enters a recursive edit reading input from the
95 keyboard, both when you type it during the definition of the macro and
96 when it is executed from the macro. During definition, the editing you
97 do inside the recursive edit does not become part of the macro. During
98 macro execution, the recursive edit gives you a chance to do some
99 particularized editing. *Note Recursive Edit::.
102 File: xemacs.info, Node: Key Bindings, Next: Syntax, Prev: Keyboard Macros, Up: Customization
104 Customizing Key Bindings
105 ========================
107 This section deals with the "keymaps" that define the bindings
108 between keys and functions, and shows how you can customize these
111 A command is a Lisp function whose definition provides for
112 interactive use. Like every Lisp function, a command has a function
113 name, which is a Lisp symbol whose name usually consists of lower case
118 * Keymaps:: Definition of the keymap data structure.
119 Names of Emacs's standard keymaps.
120 * Rebinding:: How to redefine one key's meaning conveniently.
121 * Disabling:: Disabling a command means confirmation is required
122 before it can be executed. This is done to protect
123 beginners from surprises.
126 File: xemacs.info, Node: Keymaps, Next: Rebinding, Up: Key Bindings
131 The bindings between characters and command functions are recorded in
132 data structures called "keymaps". Emacs has many of these. One, the
133 "global" keymap, defines the meanings of the single-character keys that
134 are defined regardless of major mode. It is the value of the variable
137 Each major mode has another keymap, its "local keymap", which
138 contains overriding definitions for the single-character keys that are
139 redefined in that mode. Each buffer records which local keymap is
140 installed for it at any time, and the current buffer's local keymap is
141 the only one that directly affects command execution. The local keymaps
142 for Lisp mode, C mode, and many other major modes always exist even when
143 not in use. They are the values of the variables `lisp-mode-map',
144 `c-mode-map', and so on. For less frequently used major modes, the
145 local keymap is sometimes constructed only when the mode is used for the
146 first time in a session, to save space.
148 There are local keymaps for the minibuffer, too; they contain various
149 completion and exit commands.
151 * `minibuffer-local-map' is used for ordinary input (no completion).
153 * `minibuffer-local-ns-map' is similar, except that <SPC> exits just
154 like <RET>. This is used mainly for Mocklisp compatibility.
156 * `minibuffer-local-completion-map' is for permissive completion.
158 * `minibuffer-local-must-match-map' is for strict completion and for
161 * `repeat-complex-command-map' is for use in `C-x <ESC>'.
163 * `isearch-mode-map' contains the bindings of the special keys which
164 are bound in the pseudo-mode entered with `C-s' and `C-r'.
166 Finally, each prefix key has a keymap which defines the key sequences
167 that start with it. For example, `ctl-x-map' is the keymap used for
168 characters following a `C-x'.
170 * `ctl-x-map' is the variable name for the map used for characters
173 * `help-map' is used for characters that follow `C-h'.
175 * `esc-map' is for characters that follow <ESC>. All Meta characters
176 are actually defined by this map.
178 * `ctl-x-4-map' is for characters that follow `C-x 4'.
180 * `mode-specific-map' is for characters that follow `C-c'.
182 The definition of a prefix key is the keymap to use for looking up
183 the following character. Sometimes the definition is actually a Lisp
184 symbol whose function definition is the following character keymap. The
185 effect is the same, but it provides a command name for the prefix key
186 that you can use as a description of what the prefix key is for. Thus
187 the binding of `C-x' is the symbol `Ctl-X-Prefix', whose function
188 definition is the keymap for `C-x' commands, the value of `ctl-x-map'.
190 Prefix key definitions can appear in either the global map or a
191 local map. The definitions of `C-c', `C-x', `C-h', and <ESC> as prefix
192 keys appear in the global map, so these prefix keys are always
193 available. Major modes can locally redefine a key as a prefix by
194 putting a prefix key definition for it in the local map.
196 A mode can also put a prefix definition of a global prefix character
197 such as `C-x' into its local map. This is how major modes override the
198 definitions of certain keys that start with `C-x'. This case is
199 special, because the local definition does not entirely replace the
200 global one. When both the global and local definitions of a key are
201 other keymaps, the next character is looked up in both keymaps, with
202 the local definition overriding the global one. The character after the
203 `C-x' is looked up in both the major mode's own keymap for redefined
204 `C-x' commands and in `ctl-x-map'. If the major mode's own keymap for
205 `C-x' commands contains `nil', the definition from the global keymap
206 for `C-x' commands is used.
209 File: xemacs.info, Node: Rebinding, Next: Disabling, Prev: Keymaps, Up: Key Bindings
211 Changing Key Bindings
212 ---------------------
214 You can redefine an Emacs key by changing its entry in a keymap.
215 You can change the global keymap, in which case the change is effective
216 in all major modes except those that have their own overriding local
217 definitions for the same key. Or you can change the current buffer's
218 local map, which affects all buffers using the same major mode.
222 * Interactive Rebinding:: Changing Key Bindings Interactively
223 * Programmatic Rebinding:: Changing Key Bindings Programmatically
224 * Key Bindings Using Strings:: Using Strings for Changing Key Bindings
227 File: xemacs.info, Node: Interactive Rebinding, Next: Programmatic Rebinding, Up: Rebinding
229 Changing Key Bindings Interactively
230 ...................................
232 `M-x global-set-key <RET> KEY CMD <RET>'
233 Defines KEY globally to run CMD.
235 `M-x local-set-key <RET> KEYS CMD <RET>'
236 Defines KEY locally (in the major mode now in effect) to run CMD.
238 `M-x local-unset-key <RET> KEYS <RET>'
239 Removes the local binding of KEY.
241 CMD is a symbol naming an interactively-callable function.
243 When called interactively, KEY is the next complete key sequence
244 that you type. When called as a function, KEY is a string, a vector of
245 events, or a vector of key-description lists as described in the
246 `define-key' function description. The binding goes in the current
247 buffer's local map, which is shared with other buffers in the same
250 The following example:
252 M-x global-set-key <RET> C-f next-line <RET>
254 redefines `C-f' to move down a line. The fact that CMD is read second
255 makes it serve as a kind of confirmation for KEY.
257 These functions offer no way to specify a particular prefix keymap as
258 the one to redefine in, but that is not necessary, as you can include
259 prefixes in KEY. KEY is read by reading characters one by one until
260 they amount to a complete key (that is, not a prefix key). Thus, if
261 you type `C-f' for KEY, Emacs enters the minibuffer immediately to read
262 CMD. But if you type `C-x', another character is read; if that
263 character is `4', another character is read, and so on. For example,
265 M-x global-set-key <RET> C-x 4 $ spell-other-window <RET>
267 redefines `C-x 4 $' to run the (fictitious) command
268 `spell-other-window'.
270 The most general way to modify a keymap is the function
271 `define-key', used in Lisp code (such as your init file). `define-key'
272 takes three arguments: the keymap, the key to modify in it, and the new
273 definition. *Note Init File::, for an example.
274 `substitute-key-definition' is used similarly; it takes three
275 arguments, an old definition, a new definition, and a keymap, and
276 redefines in that keymap all keys that were previously defined with the
277 old definition to have the new definition instead.
280 File: xemacs.info, Node: Programmatic Rebinding, Next: Key Bindings Using Strings, Prev: Interactive Rebinding, Up: Rebinding
282 Changing Key Bindings Programmatically
283 ......................................
285 You can use the functions `global-set-key' and `define-key' to
286 rebind keys under program control.
288 ``(global-set-key KEYS CMD)''
289 Defines KEYS globally to run CMD.
291 ``(define-key KEYMAP KEYS DEF)''
292 Defines KEYS to run DEF in the keymap KEYMAP.
294 KEYMAP is a keymap object.
296 KEYS is the sequence of keystrokes to bind.
298 DEF is anything that can be a key's definition:
300 * `nil', meaning key is undefined in this keymap
302 * A command, that is, a Lisp function suitable for interactive
305 * A string or key sequence vector, which is treated as a keyboard
308 * A keymap to define a prefix key
310 * A symbol so that when the key is looked up, the symbol stands for
311 its function definition, which should at that time be one of the
312 above, or another symbol whose function definition is used, and so
315 * A cons, `(string . defn)', meaning that DEFN is the definition
316 (DEFN should be a valid definition in its own right)
318 * A cons, `(keymap . char)', meaning use the definition of CHAR in
321 For backward compatibility, XEmacs allows you to specify key
322 sequences as strings. However, the preferred method is to use the
323 representations of key sequences as vectors of keystrokes. *Note
324 Keystrokes::, for more information about the rules for constructing key
327 Emacs allows you to abbreviate representations for key sequences in
328 most places where there is no ambiguity. Here are some rules for
331 * The keysym by itself is equivalent to a list of just that keysym,
332 i.e., `f1' is equivalent to `(f1)'.
334 * A keystroke by itself is equivalent to a vector containing just
335 that keystroke, i.e., `(control a)' is equivalent to `[(control
338 * You can use ASCII codes for keysyms that have them. i.e., `65' is
339 equivalent to `A'. (This is not so much an abbreviation as an
340 alternate representation.)
342 Here are some examples of programmatically binding keys:
345 ;;; Bind `my-command' to <f1>
346 (global-set-key 'f1 'my-command)
348 ;;; Bind `my-command' to Shift-f1
349 (global-set-key '(shift f1) 'my-command)
351 ;;; Bind `my-command' to C-c Shift-f1
352 (global-set-key '[(control c) (shift f1)] 'my-command)
354 ;;; Bind `my-command' to the middle mouse button.
355 (global-set-key 'button2 'my-command)
357 ;;; Bind `my-command' to <META> <CTL> <Right Mouse Button>
358 ;;; in the keymap that is in force when you are running `dired'.
359 (define-key dired-mode-map '(meta control button3) 'my-command)
362 File: xemacs.info, Node: Key Bindings Using Strings, Prev: Programmatic Rebinding, Up: Rebinding
364 Using Strings for Changing Key Bindings
365 .......................................
367 For backward compatibility, you can still use strings to represent
368 key sequences. Thus you can use commands like the following:
370 ;;; Bind `end-of-line' to C-f
371 (global-set-key "\C-f" 'end-of-line)
373 Note, however, that in some cases you may be binding more than one
374 key sequence by using a single command. This situation can arise
375 because in ASCII, `C-i' and <TAB> have the same representation.
376 Therefore, when Emacs sees:
378 (global-set-key "\C-i" 'end-of-line)
380 it is unclear whether the user intended to bind `C-i' or <TAB>. The
381 solution XEmacs adopts is to bind both of these key sequences.
383 After binding a command to two key sequences with a form like:
385 (define-key global-map "\^X\^I" 'command-1)
387 it is possible to redefine only one of those sequences like so:
389 (define-key global-map [(control x) (control i)] 'command-2)
390 (define-key global-map [(control x) tab] 'command-3)
392 This applies only when running under a window system. If you are
393 talking to Emacs through an ASCII-only channel, you do not get any of
396 Here is a table of pairs of key sequences that behave in a similar
405 control @ control space
408 File: xemacs.info, Node: Disabling, Prev: Rebinding, Up: Key Bindings
413 Disabling a command marks it as requiring confirmation before it can
414 be executed. The purpose of disabling a command is to prevent
415 beginning users from executing it by accident and being confused.
417 The direct mechanism for disabling a command is to have a non-`nil'
418 `disabled' property on the Lisp symbol for the command. These
419 properties are normally set by the user's init file with Lisp
422 (put 'delete-region 'disabled t)
426 If the value of the `disabled' property is a string, that string is
427 included in the message printed when the command is used:
429 (put 'delete-region 'disabled
430 "Text deleted this way cannot be yanked back!\n")
432 You can disable a command either by editing the init file directly
433 or with the command `M-x disable-command', which edits the init file
434 for you. *Note Init File::.
436 When you attempt to invoke a disabled command interactively in Emacs,
437 a window is displayed containing the command's name, its documentation,
438 and some instructions on what to do next; then Emacs asks for input
439 saying whether to execute the command as requested, enable it and
440 execute, or cancel it. If you decide to enable the command, you are
441 asked whether to do this permanently or just for the current session.
442 Enabling permanently works by automatically editing your init file.
443 You can use `M-x enable-command' at any time to enable any command
446 Whether a command is disabled is independent of what key is used to
447 invoke it; it also applies if the command is invoked using `M-x'.
448 Disabling a command has no effect on calling it as a function from Lisp
452 File: xemacs.info, Node: Syntax, Next: Init File, Prev: Key Bindings, Up: Customization
457 All the Emacs commands which parse words or balance parentheses are
458 controlled by the "syntax table". The syntax table specifies which
459 characters are opening delimiters, which are parts of words, which are
460 string quotes, and so on. Actually, each major mode has its own syntax
461 table (though sometimes related major modes use the same one) which it
462 installs in each buffer that uses that major mode. The syntax table
463 installed in the current buffer is the one that all commands use, so we
464 call it "the" syntax table. A syntax table is a Lisp object, a vector
465 of length 256 whose elements are numbers.
469 * Entry: Syntax Entry. What the syntax table records for each character.
470 * Change: Syntax Change. How to change the information.
473 File: xemacs.info, Node: Syntax Entry, Next: Syntax Change, Up: Syntax
475 Information About Each Character
476 --------------------------------
478 The syntax table entry for a character is a number that encodes six
479 pieces of information:
481 * The syntactic class of the character, represented as a small
484 * The matching delimiter, for delimiter characters only (the
485 matching delimiter of `(' is `)', and vice versa)
487 * A flag saying whether the character is the first character of a
488 two-character comment starting sequence
490 * A flag saying whether the character is the second character of a
491 two-character comment starting sequence
493 * A flag saying whether the character is the first character of a
494 two-character comment ending sequence
496 * A flag saying whether the character is the second character of a
497 two-character comment ending sequence
499 The syntactic classes are stored internally as small integers, but
500 are usually described to or by the user with characters. For example,
501 `(' is used to specify the syntactic class of opening delimiters. Here
502 is a table of syntactic classes, with the characters that specify them.
505 The class of whitespace characters.
508 The class of word-constituent characters.
511 The class of characters that are part of symbol names but not
512 words. This class is represented by `_' because the character `_'
513 has this class in both C and Lisp.
516 The class of punctuation characters that do not fit into any other
520 The class of opening delimiters.
523 The class of closing delimiters.
526 The class of expression-adhering characters. These characters are
527 part of a symbol if found within or adjacent to one, and are part
528 of a following expression if immediately preceding one, but are
529 like whitespace if surrounded by whitespace.
532 The class of string-quote characters. They match each other in
533 pairs, and the characters within the pair all lose their syntactic
534 significance except for the `\' and `/' classes of escape
535 characters, which can be used to include a string-quote inside the
539 The class of self-matching delimiters. This is intended for TeX's
540 `$', which is used both to enter and leave math mode. Thus, a
541 pair of matching `$' characters surround each piece of math mode
542 TeX input. A pair of adjacent `$' characters act like a single
543 one for purposes of matching.
546 The class of escape characters that always just deny the following
547 character its special syntactic significance. The character after
548 one of these escapes is always treated as alphabetic.
551 The class of C-style escape characters. In practice, these are
552 treated just like `/'-class characters, because the extra
553 possibilities for C escapes (such as being followed by digits)
554 have no effect on where the containing expression ends.
557 The class of comment-starting characters. Only single-character
558 comment starters (such as `;' in Lisp mode) are represented this
562 The class of comment-ending characters. Newline has this syntax in
565 The characters flagged as part of two-character comment delimiters
566 can have other syntactic functions most of the time. For example, `/'
567 and `*' in C code, when found separately, have nothing to do with
568 comments. The comment-delimiter significance overrides when the pair of
569 characters occur together in the proper order. Only the list and sexp
570 commands use the syntax table to find comments; the commands
571 specifically for comments have other variables that tell them where to
572 find comments. Moreover, the list and sexp commands notice comments
573 only if `parse-sexp-ignore-comments' is non-`nil'. This variable is set
574 to `nil' in modes where comment-terminator sequences are liable to
575 appear where there is no comment, for example, in Lisp mode where the
576 comment terminator is a newline but not every newline ends a comment.
579 File: xemacs.info, Node: Syntax Change, Prev: Syntax Entry, Up: Syntax
581 Altering Syntax Information
582 ---------------------------
584 It is possible to alter a character's syntax table entry by storing
585 a new number in the appropriate element of the syntax table, but it
586 would be hard to determine what number to use. Emacs therefore
587 provides a command that allows you to specify the syntactic properties
588 of a character in a convenient way.
590 `M-x modify-syntax-entry' is the command to change a character's
591 syntax. It can be used interactively and is also used by major modes
592 to initialize their own syntax tables. Its first argument is the
593 character to change. The second argument is a string that specifies the
594 new syntax. When called from Lisp code, there is a third, optional
595 argument, which specifies the syntax table in which to make the change.
596 If not supplied, or if this command is called interactively, the third
597 argument defaults to the current buffer's syntax table.
599 1. The first character in the string specifies the syntactic class.
600 It is one of the characters in the previous table (*note Syntax
603 2. The second character is the matching delimiter. For a character
604 that is not an opening or closing delimiter, this should be a
605 space, and may be omitted if no following characters are needed.
607 3. The remaining characters are flags. The flag characters allowed
611 Flag this character as the first of a two-character comment
615 Flag this character as the second of a two-character comment
619 Flag this character as the first of a two-character comment
623 Flag this character as the second of a two-character comment
626 Use `C-h s' (`describe-syntax') to display a description of the
627 contents of the current syntax table. The description of each
628 character includes both the string you have to pass to
629 `modify-syntax-entry' to set up that character's current syntax, and
630 some English to explain that string if necessary.
633 File: xemacs.info, Node: Init File, Next: Audible Bell, Prev: Syntax, Up: Customization
638 When you start Emacs, it normally loads either `.xemacs/init.el' or
639 the file `.emacs' (whichever comes first) in your home directory. This
640 file, if it exists, should contain Lisp code. It is called your
641 initialization file or "init file". Use the command line switch `-q'
642 to tell Emacs whether to load an init file (*note Entering Emacs::).
643 Use the command line switch `-user-init-file' (*note Command
644 Switches::) to tell Emacs to load a different file instead of
645 `~/.xemacs/init.el'/`~/.emacs'.
647 When the init file is read, the variable `user-init-file' says which
648 init file was loaded.
650 At some sites there is a "default init file", which is the library
651 named `default.el', found via the standard search path for libraries.
652 The Emacs distribution contains no such library; your site may create
653 one for local customizations. If this library exists, it is loaded
654 whenever you start Emacs. But your init file, if any, is loaded first;
655 if it sets `inhibit-default-init' non-`nil', then `default' is not
658 If you have a large amount of code in your init file, you should
659 byte-compile it to `~/.xemacs/init.elc' or `~/.emacs.elc'.
663 * Init Syntax:: Syntax of constants in Emacs Lisp.
664 * Init Examples:: How to do some things with an init file.
665 * Terminal Init:: Each terminal type can have an init file.
668 File: xemacs.info, Node: Init Syntax, Next: Init Examples, Up: Init File
673 The init file contains one or more Lisp function call expressions.
674 Each consists of a function name followed by arguments, all surrounded
675 by parentheses. For example, `(setq fill-column 60)' represents a call
676 to the function `setq' which is used to set the variable `fill-column'
677 (*note Filling::) to 60.
679 The second argument to `setq' is an expression for the new value of
680 the variable. This can be a constant, a variable, or a function call
681 expression. In the init file, constants are used most of the time.
685 Integers are written in decimal, with an optional initial minus
688 If a sequence of digits is followed by a period and another
689 sequence of digits, it is interpreted as a floating point number.
691 The number prefixes `#b', `#o', and `#x' are supported to
692 represent numbers in binary, octal, and hexadecimal notation (or
696 Lisp string syntax is the same as C string syntax with a few extra
697 features. Use a double-quote character to begin and end a string
700 Newlines and special characters may be present literally in
701 strings. They can also be represented as backslash sequences:
702 `\n' for newline, `\b' for backspace, `\r' for return, `\t' for
703 tab, `\f' for formfeed (control-l), `\e' for escape, `\\' for a
704 backslash, `\"' for a double-quote, or `\OOO' for the character
705 whose octal code is OOO. Backslash and double-quote are the only
706 characters for which backslash sequences are mandatory.
708 You can use `\C-' as a prefix for a control character, as in
709 `\C-s' for ASCII Control-S, and `\M-' as a prefix for a Meta
710 character, as in `\M-a' for Meta-A or `\M-\C-a' for Control-Meta-A.
713 Lisp character constant syntax consists of a `?' followed by
714 either a character or an escape sequence starting with `\'.
715 Examples: `?x', `?\n', `?\"', `?\)'. Note that strings and
716 characters are not interchangeable in Lisp; some contexts require
717 one and some contexts require the other.
720 `t' stands for `true'.
723 `nil' stands for `false'.
726 Write a single-quote (') followed by the Lisp object you want.
729 File: xemacs.info, Node: Init Examples, Next: Terminal Init, Prev: Init Syntax, Up: Init File
734 Here are some examples of doing certain commonly desired things with
737 * Make <TAB> in C mode just insert a tab if point is in the middle
740 (setq c-tab-always-indent nil)
742 Here we have a variable whose value is normally `t' for `true' and
743 the alternative is `nil' for `false'.
745 * Make searches case sensitive by default (in all buffers that do not
748 (setq-default case-fold-search nil)
750 This sets the default value, which is effective in all buffers
751 that do not have local values for the variable. Setting
752 `case-fold-search' with `setq' affects only the current buffer's
753 local value, which is probably not what you want to do in an init
756 * Make Text mode the default mode for new buffers.
758 (setq default-major-mode 'text-mode)
760 Note that `text-mode' is used because it is the command for
761 entering the mode we want. A single-quote is written before it to
762 make a symbol constant; otherwise, `text-mode' would be treated as
765 * Turn on Auto Fill mode automatically in Text mode and related
769 '(lambda () (auto-fill-mode 1)))
771 Here we have a variable whose value should be a Lisp function. The
772 function we supply is a list starting with `lambda', and a single
773 quote is written in front of it to make it (for the purpose of this
774 `setq') a list constant rather than an expression. Lisp functions
775 are not explained here; for mode hooks it is enough to know that
776 `(auto-fill-mode 1)' is an expression that will be executed when
777 Text mode is entered. You could replace it with any other
778 expression that you like, or with several expressions in a row.
780 (setq text-mode-hook 'turn-on-auto-fill)
782 This is another way to accomplish the same result.
783 `turn-on-auto-fill' is a symbol whose function definition is
784 `(lambda () (auto-fill-mode 1))'.
786 * Load the installed Lisp library named `foo' (actually a file
787 `foo.elc' or `foo.el' in a standard Emacs directory).
791 When the argument to `load' is a relative pathname, not starting
792 with `/' or `~', `load' searches the directories in `load-path'
795 * Load the compiled Lisp file `foo.elc' from your home directory.
799 Here an absolute file name is used, so no searching is done.
801 * Rebind the key `C-x l' to run the function `make-symbolic-link'.
803 (global-set-key "\C-xl" 'make-symbolic-link)
807 (define-key global-map "\C-xl" 'make-symbolic-link)
809 Note once again the single-quote used to refer to the symbol
810 `make-symbolic-link' instead of its value as a variable.
812 * Do the same thing for C mode only.
814 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
816 * Bind the function key <F1> to a command in C mode. Note that the
817 names of function keys must be lower case.
819 (define-key c-mode-map 'f1 'make-symbolic-link)
821 * Bind the shifted version of <F1> to a command.
823 (define-key c-mode-map '(shift f1) 'make-symbolic-link)
825 * Redefine all keys which now run `next-line' in Fundamental mode to
826 run `forward-line' instead.
828 (substitute-key-definition 'next-line 'forward-line
831 * Make `C-x C-v' undefined.
833 (global-unset-key "\C-x\C-v")
835 One reason to undefine a key is so that you can make it a prefix.
836 Simply defining `C-x C-v ANYTHING' would make `C-x C-v' a prefix,
837 but `C-x C-v' must be freed of any non-prefix definition first.
839 * Make `$' have the syntax of punctuation in Text mode. Note the
840 use of a character constant for `$'.
842 (modify-syntax-entry ?\$ "." text-mode-syntax-table)
844 * Enable the use of the command `eval-expression' without
847 (put 'eval-expression 'disabled nil)
850 File: xemacs.info, Node: Terminal Init, Prev: Init Examples, Up: Init File
852 Terminal-Specific Initialization
853 --------------------------------
855 Each terminal type can have a Lisp library to be loaded into Emacs
856 when it is run on that type of terminal. For a terminal type named
857 TERMTYPE, the library is called `term/TERMTYPE' and it is found by
858 searching the directories `load-path' as usual and trying the suffixes
859 `.elc' and `.el'. Normally it appears in the subdirectory `term' of
860 the directory where most Emacs libraries are kept.
862 The usual purpose of the terminal-specific library is to define the
863 escape sequences used by the terminal's function keys using the library
864 `keypad.el'. See the file `term/vt100.el' for an example of how this
867 When the terminal type contains a hyphen, only the part of the name
868 before the first hyphen is significant in choosing the library name.
869 Thus, terminal types `aaa-48' and `aaa-30-rv' both use the library
870 `term/aaa'. The code in the library can use `(getenv "TERM")' to find
871 the full terminal type name.
873 The library's name is constructed by concatenating the value of the
874 variable `term-file-prefix' and the terminal type. Your init file can
875 prevent the loading of the terminal-specific library by setting
876 `term-file-prefix' to `nil'. *Note Init File::.
878 The value of the variable `term-setup-hook', if not `nil', is called
879 as a function of no arguments at the end of Emacs initialization, after
880 both your init file and any terminal-specific library have been read.
881 *Note Init File::. You can set the value in the init file to override
882 part of any of the terminal-specific libraries and to define
883 initializations for terminals that do not have a library.
886 File: xemacs.info, Node: Audible Bell, Next: Faces, Prev: Init File, Up: Customization
888 Changing the Bell Sound
889 =======================
891 You can now change how the audible bell sounds using the variable
894 `sound-alist''s value is an list associating symbols with, among
895 other things, strings of audio-data. When `ding' is called with one of
896 the symbols, the associated sound data is played instead of the
897 standard beep. This only works if you are logged in on the console of a
898 machine with audio hardware. To listen to a sound of the provided type,
899 call the function `play-sound' with the argument SOUND. You can also
900 set the volume of the sound with the optional argument VOLUME.
902 Each element of `sound-alist' is a list describing a sound. The
903 first element of the list is the name of the sound being defined.
904 Subsequent elements of the list are alternating keyword/value pairs:
907 A string of raw sound data, or the name of another sound to play.
908 The symbol `t' here means use the default X beep.
911 An integer from 0-100, defaulting to `bell-volume'.
914 If using the default X beep, the pitch (Hz) to generate.
917 If using the default X beep, the duration (milliseconds).
919 For compatibility, elements of `sound-alist' may also be of the form:
921 ( SOUND-NAME . <SOUND> )
922 ( SOUND-NAME <VOLUME> <SOUND> )
924 You should probably add things to this list by calling the function
927 Note that you can only play audio data if running on the console
928 screen of a machine with audio hardware which emacs understands, which
929 at this time means a Sun SparcStation, SGI, or HP9000s700.
931 Also note that the pitch, duration, and volume options are available
932 everywhere, but most X servers ignore the `pitch' option.
934 The variable `bell-volume' should be an integer from 0 to 100, with
935 100 being loudest, which controls how loud the sounds emacs makes
936 should be. Elements of the `sound-alist' may override this value.
937 This variable applies to the standard X bell sound as well as sound
940 If the symbol `t' is in place of a sound-string, Emacs uses the
941 default X beep. This allows you to define beep-types of different
942 volumes even when not running on the console.
944 You can add things to this list by calling the function
945 `load-sound-file', which reads in an audio-file and adds its data to
946 the sound-alist. You can specify the sound with the SOUND-NAME argument
947 and the file into which the sounds are loaded with the FILENAME
948 argument. The optional VOLUME argument sets the volume.
950 `load-sound-file (FILENAME SOUND-NAME &optional VOLUME)'
952 To load and install some sound files as beep-types, use the function
953 `load-default-sounds' (note that this only works if you are on display
954 0 of a machine with audio hardware).
956 The following beep-types are used by Emacs itself. Other Lisp
957 packages may use other beep types, but these are the ones that the C
958 kernel of Emacs uses.
961 An auto-save does not succeed
964 The Emacs command loop catches an error
967 You type a key that is undefined
970 You use an undefined mouse-click combination
973 Completion was not possible
976 You type something other than the required `y' or `n'
979 You type something other than `yes' or `no'
982 File: xemacs.info, Node: Faces, Next: Frame Components, Prev: Audible Bell, Up: Customization
987 XEmacs has objects called extents and faces. An "extent" is a
988 region of text and a "face" is a collection of textual attributes, such
989 as fonts and colors. Every extent is displayed in some face;
990 therefore, changing the properties of a face immediately updates the
991 display of all associated extents. Faces can be frame-local: you can
992 have a region of text that displays with completely different
993 attributes when its buffer is viewed from a different X window.
995 The display attributes of faces may be specified either in Lisp or
996 through the X resource manager.
1001 You can change the face of an extent with the functions in this
1002 section. All the functions prompt for a FACE as an argument; use
1003 completion for a list of possible values.
1006 Swap the foreground and background colors of the given FACE.
1008 `M-x make-face-bold'
1009 Make the font of the given FACE bold. When called from a program,
1010 returns `nil' if this is not possible.
1012 `M-x make-face-bold-italic'
1013 Make the font of the given FACE bold italic. When called from a
1014 program, returns `nil' if not possible.
1016 `M-x make-face-italic'
1017 Make the font of the given FACE italic. When called from a
1018 program, returns `nil' if not possible.
1020 `M-x make-face-unbold'
1021 Make the font of the given FACE non-bold. When called from a
1022 program, returns `nil' if not possible.
1024 `M-x make-face-unitalic'
1025 Make the font of the given FACE non-italic. When called from a
1026 program, returns `nil' if not possible.
1028 `M-x make-face-larger'
1029 Make the font of the given FACE a little larger. When called from
1030 a program, returns `nil' if not possible.
1032 `M-x make-face-smaller'
1033 Make the font of the given FACE a little smaller. When called
1034 from a program, returns `nil' if not possible.
1036 `M-x set-face-background'
1037 Change the background color of the given FACE.
1039 `M-x set-face-background-pixmap'
1040 Change the background pixmap of the given FACE.
1043 Change the font of the given FACE.
1045 `M-x set-face-foreground'
1046 Change the foreground color of the given FACE.
1048 `M-x set-face-underline-p'
1049 Change whether the given FACE is underlined.
1051 You can exchange the foreground and background color of the selected
1052 FACE with the function `invert-face'. If the face does not specify both
1053 foreground and background, then its foreground and background are set
1054 to the background and foreground of the default face. When calling
1055 this from a program, you can supply the optional argument FRAME to
1056 specify which frame is affected; otherwise, all frames are affected.
1058 You can set the background color of the specified FACE with the
1059 function `set-face-background'. The argument `color' should be a
1060 string, the name of a color. When called from a program, if the
1061 optional FRAME argument is provided, the face is changed only in that
1062 frame; otherwise, it is changed in all frames.
1064 You can set the background pixmap of the specified FACE with the
1065 function `set-face-background-pixmap'. The pixmap argument NAME should
1066 be a string, the name of a file of pixmap data. The directories listed
1067 in the `x-bitmap-file-path' variable are searched. The bitmap may also
1068 be a list of the form `(WIDTH HEIGHT DATA)', where WIDTH and HEIGHT are
1069 the size in pixels, and DATA is a string containing the raw bits of the
1070 bitmap. If the optional FRAME argument is provided, the face is
1071 changed only in that frame; otherwise, it is changed in all frames.
1073 The variable `x-bitmap-file-path' takes as a value a list of the
1074 directories in which X bitmap files may be found. If the value is
1075 `nil', the list is initialized from the `*bitmapFilePath' resource.
1077 If the environment variable XBMLANGPATH is set, then it is consulted
1078 before the `x-bitmap-file-path' variable.
1080 You can set the font of the specified FACE with the function
1081 `set-face-font'. The FONT argument should be a string, the name of a
1082 font. When called from a program, if the optional FRAME argument is
1083 provided, the face is changed only in that frame; otherwise, it is
1084 changed in all frames.
1086 You can set the foreground color of the specified FACE with the
1087 function `set-face-foreground'. The argument COLOR should be a string,
1088 the name of a color. If the optional FRAME argument is provided, the
1089 face is changed only in that frame; otherwise, it is changed in all
1092 You can set underline the specified FACE with the function
1093 `set-face-underline-p'. The argument UNDERLINE-P can be used to make
1094 underlining an attribute of the face or not. If the optional FRAME
1095 argument is provided, the face is changed only in that frame;
1096 otherwise, it is changed in all frames.
1099 File: xemacs.info, Node: Frame Components, Next: X Resources, Prev: Faces, Up: Customization
1104 You can control the presence and position of most frame components,
1105 such as the menubar, toolbars, and gutters.
1107 This section is not written yet. Try the Lisp Reference Manual:
1108 *Note Menubar: (lispref)Menubar, *Note Toolbar Intro: (lispref)Toolbar
1109 Intro, and *Note Gutter Intro: (lispref)Gutter Intro.
1112 File: xemacs.info, Node: X Resources, Prev: Frame Components, Up: Customization
1117 Historically, XEmacs has used the X resource application class
1118 `Emacs' for its resources. Unfortunately, GNU Emacs uses the same
1119 application class, and resources are not compatible between the two
1120 Emacsen. This sharing of the application class often leads to trouble
1121 if you want to run both variants.
1123 Starting with XEmacs 21, XEmacs uses the class `XEmacs' if it finds
1124 any XEmacs resources in the resource database when the X connection is
1125 initialized. Otherwise, it will use the class `Emacs' for backwards
1126 compatibility. The variable X-EMACS-APPLICATION-CLASS may be consulted
1127 to determine the application class being used.
1129 The examples in this section assume the application class is `Emacs'.
1131 The Emacs resources are generally set per-frame. Each Emacs frame
1132 can have its own name or the same name as another, depending on the
1133 name passed to the `make-frame' function.
1135 You can specify resources for all frames with the syntax:
1137 Emacs*parameter: value
1141 Emacs*EmacsFrame.parameter:value
1143 You can specify resources for a particular frame with the syntax:
1145 Emacs*FRAME-NAME.parameter: value
1149 * Geometry Resources:: Controlling the size and position of frames.
1150 * Iconic Resources:: Controlling whether frames come up iconic.
1151 * Resource List:: List of resources settable on a frame or device.
1152 * Face Resources:: Controlling faces using resources.
1153 * Widgets:: The widget hierarchy for XEmacs.
1154 * Menubar Resources:: Specifying resources for the menubar.
1157 File: xemacs.info, Node: Geometry Resources, Next: Iconic Resources, Up: X Resources
1162 To make the default size of all Emacs frames be 80 columns by 55
1165 Emacs*EmacsFrame.geometry: 80x55
1167 To set the geometry of a particular frame named `fred', do this:
1169 Emacs*fred.geometry: 80x55
1171 Important! Do not use the following syntax:
1173 Emacs*geometry: 80x55
1175 You should never use `*geometry' with any X application. It does not
1176 say "make the geometry of Emacs be 80 columns by 55 lines." It really
1177 says, "make Emacs and all subwindows thereof be 80x55 in whatever units
1178 they care to measure in." In particular, that is both telling the
1179 Emacs text pane to be 80x55 in characters, and telling the menubar pane
1180 to be 80x55 pixels, which is surely not what you want.
1182 As a special case, this geometry specification also works (and sets
1183 the default size of all Emacs frames to 80 columns by 55 lines):
1185 Emacs.geometry: 80x55
1187 since that is the syntax used with most other applications (since most
1188 other applications have only one top-level window, unlike Emacs). In
1189 general, however, the top-level shell (the unmapped ApplicationShell
1190 widget named `Emacs' that is the parent of the shell widgets that
1191 actually manage the individual frames) does not have any interesting
1192 resources on it, and you should set the resources on the frames instead.
1194 The `-geometry' command-line argument sets only the geometry of the
1195 initial frame created by Emacs.
1197 A more complete explanation of geometry-handling is
1199 * The `-geometry' command-line option sets the `Emacs.geometry'
1200 resource, that is, the geometry of the ApplicationShell.
1202 * For the first frame created, the size of the frame is taken from
1203 the ApplicationShell if it is specified, otherwise from the
1204 geometry of the frame.
1206 * For subsequent frames, the order is reversed: First the frame, and
1207 then the ApplicationShell.
1209 * For the first frame created, the position of the frame is taken
1210 from the ApplicationShell (`Emacs.geometry') if it is specified,
1211 otherwise from the geometry of the frame.
1213 * For subsequent frames, the position is taken only from the frame,
1214 and never from the ApplicationShell.
1216 This is rather complicated, but it does seem to provide the most
1217 intuitive behavior with respect to the default sizes and positions of
1218 frames created in various ways.
1221 File: xemacs.info, Node: Iconic Resources, Next: Resource List, Prev: Geometry Resources, Up: X Resources
1226 Analogous to `-geometry', the `-iconic' command-line option sets the
1227 iconic flag of the ApplicationShell (`Emacs.iconic') and always applies
1228 to the first frame created regardless of its name. However, it is
1229 possible to set the iconic flag on particular frames (by name) by using
1230 the `Emacs*FRAME-NAME.iconic' resource.