annotate man/xemacs/custom.texi @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children ec9a17fef872
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @node Customization, Quitting, Emulation, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @chapter Customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @cindex customization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This chapter talks about various topics relevant to adapting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 behavior of Emacs in minor ways.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 All kinds of customization affect only the particular Emacs job that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 do them in. They are completely lost when you kill the Emacs job, and have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 no effect on other Emacs jobs you may run at the same time or later. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 only way an Emacs job can affect anything outside of it is by writing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 file; in particular, the only way to make a customization `permanent' is to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 put something in your @file{.emacs} file or other appropriate file to do the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 customization in each session. @xref{Init File}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 * Minor Modes:: Each minor mode is one feature you can turn on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 independently of any others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 * Variables:: Many Emacs commands examine Emacs variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 to decide what to do; by setting variables,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 you can control their functioning.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 to be replayed with a single command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 * Key Bindings:: The keymaps say what command each key runs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 By changing them, you can "redefine keys".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Syntax:: The syntax table controls how words and expressions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 are parsed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Init File:: How to write common customizations in the @file{.emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Audible Bell:: Changing how Emacs sounds the bell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * Faces:: Changing the fonts and colors of a region of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 * X Resources:: X resources controlling various aspects of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 behavior of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @node Minor Modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 @section Minor Modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 @cindex minor modes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 @cindex mode line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 Minor modes are options which you can use or not. For example, Auto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Fill mode is a minor mode in which @key{SPC} breaks lines between words
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 as you type. All the minor modes are independent of each other and of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 the selected major mode. Most minor modes inform you in the mode line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 when they are on; for example, @samp{Fill} in the mode line means that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 Auto Fill mode is on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 Append @code{-mode} to the name of a minor mode to get the name of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 command function that turns the mode on or off. Thus, the command to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 enable or disable Auto Fill mode is called @kbd{M-x auto-fill-mode}. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 commands are usually invoked with @kbd{M-x}, but you can bind keys to them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 if you wish. With no argument, the function turns the mode on if it was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 off and off if it was on. This is known as @dfn{toggling}. A positive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 argument always turns the mode on, and an explicit zero argument or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 negative argument always turns it off.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 @cindex Auto Fill mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @findex auto-fill-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Auto Fill mode allows you to enter filled text without breaking lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 explicitly. Emacs inserts newlines as necessary to prevent lines from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 becoming too long. @xref{Filling}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 @cindex Overwrite mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @findex overwrite-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 Overwrite mode causes ordinary printing characters to replace existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 text instead of moving it to the right. For example, if point is in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 front of the @samp{B} in @samp{FOOBAR}, and you type a @kbd{G} in Overwrite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 mode, it changes to @samp{FOOGAR}, instead of @samp{FOOGBAR}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 @cindex Abbrev mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @findex abbrev-mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 Abbrev mode allows you to define abbreviations that automatically expand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 as you type them. For example, @samp{amd} might expand to @samp{abbrev
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 mode}. @xref{Abbrevs}, for full information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 @node Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @section Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 @cindex variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 @cindex option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 A @dfn{variable} is a Lisp symbol which has a value. Variable names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 can contain any characters, but by convention they are words separated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 by hyphens. A variable can also have a documentation string, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 describes what kind of value it should have and how the value will be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 Lisp allows any variable to have any kind of value, but most variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 that Emacs uses require a value of a certain type. Often the value has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 to be a string or a number. Sometimes we say that a certain feature is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 turned on if a variable is ``non-@code{nil},'' meaning that if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 variable's value is @code{nil}, the feature is off, but the feature is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 on for @i{any} other value. The conventional value to turn on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 feature---since you have to pick one particular value when you set the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 variable---is @code{t}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 Emacs uses many Lisp variables for internal recordkeeping, as any Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 program must, but the most interesting variables for you are the ones that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 exist for the sake of customization. Emacs does not (usually) change the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 values of these variables; instead, you set the values, and thereby alter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 and control the behavior of certain Emacs commands. These variables are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 called @dfn{options}. Most options are documented in this manual and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 appear in the Variable Index (@pxref{Variable Index}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 One example of a variable which is an option is @code{fill-column}, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 specifies the position of the right margin (as a number of characters from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 the left margin) to be used by the fill commands (@pxref{Filling}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 * Examining:: Examining or setting one variable's value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 * Edit Options:: Examining or editing list of all variables' values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 * Locals:: Per-buffer values of variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 * File Variables:: How files can specify variable values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 @node Examining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 @subsection Examining and Setting Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 @cindex setting variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 @item C-h v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 @itemx M-x describe-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 Print the value and documentation of a variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @findex set-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 @item M-x set-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 Change the value of a variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @kindex C-h v
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @findex describe-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 To examine the value of a single variable, use @kbd{C-h v}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (@code{describe-variable}), which reads a variable name using the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 minibuffer, with completion. It prints both the value and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 documentation of the variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 C-h v fill-column @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 prints something like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 fill-column's value is 75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 Documentation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 *Column beyond which automatic line-wrapping should happen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 Automatically becomes local when set in any fashion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 @cindex option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 The star at the beginning of the documentation indicates that this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 is an option. @kbd{C-h v} is not restricted to options; it allows any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 variable name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 @findex set-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 If you know which option you want to set, you can use @kbd{M-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 set-variable} to set it. This prompts for the variable name in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 minibuffer (with completion), and then prompts for a Lisp expression for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 new value using the minibuffer a second time. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 M-x set-variable @key{RET} fill-column @key{RET} 75 @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 sets @code{fill-column} to 75, as if you had executed the Lisp expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @code{(setq fill-column 75)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 Setting variables in this way, like all means of customizing Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 except where explicitly stated, affects only the current Emacs session.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 @node Edit Options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 @subsection Editing Variable Values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 @item M-x list-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 Display a buffer listing names, values, and documentation of all options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 @item M-x edit-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Change option values by editing a list of options.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 @findex list-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 @kbd{M-x list-options} displays a list of all Emacs option variables in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 an Emacs buffer named @samp{*List Options*}. Each option is shown with its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 documentation and its current value. Here is what a portion of it might
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 look like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; exec-path:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 *List of directories to search programs to run in subprocesses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 Each element is a string (directory name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 or nil (try the default directory).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; fill-column:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 *Column beyond which automatic line-wrapping should happen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 Automatically becomes local when set in any fashion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @findex edit-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 @kbd{M-x edit-options} goes one step further and immediately selects the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @samp{*List Options*} buffer; this buffer uses the major mode Options mode,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 which provides commands that allow you to point at an option and change its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 value:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 @item s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 Set the variable point is in or near to a new value read using the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 @item x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 Toggle the variable point is in or near: if the value was @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 it becomes @code{t}; otherwise it becomes @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 Set the variable point is in or near to @code{t}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @item 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 Set the variable point is in or near to @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @item n
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 @itemx p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 Move to the next or previous variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 @node Locals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 @subsection Local Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 @item M-x make-local-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 Make a variable have a local value in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 @item M-x kill-local-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 Make a variable use its global value in the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 @item M-x make-variable-buffer-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Mark a variable so that setting it will make it local to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 buffer that is current at that time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 @cindex local variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 You can make any variable @dfn{local} to a specific Emacs buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 This means that the variable's value in that buffer is independent of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 its value in other buffers. A few variables are always local in every
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 buffer. All other Emacs variables have a @dfn{global} value which is in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 effect in all buffers that have not made the variable local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 Major modes always make the variables they set local to the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 This is why changing major modes in one buffer has no effect on other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @findex make-local-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @kbd{M-x make-local-variable} reads the name of a variable and makes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 local to the current buffer. Further changes in this buffer will not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 affect others, and changes in the global value will not affect this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @findex make-variable-buffer-local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 @cindex per-buffer variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 @kbd{M-x make-variable-buffer-local} reads the name of a variable and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 changes the future behavior of the variable so that it automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 becomes local when it is set. More precisely, once you have marked a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 variable in this way, the usual ways of setting the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 variable will automatically invoke @code{make-local-variable} first. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 call such variables @dfn{per-buffer} variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 Some important variables have been marked per-buffer already. They
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 include @code{abbrev-mode}, @code{auto-fill-function},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 @code{case-fold-search}, @code{comment-column}, @code{ctl-arrow},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 @code{fill-column}, @code{fill-prefix}, @code{indent-tabs-mode},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 @code{left-margin}, @*@code{mode-line-format}, @code{overwrite-mode},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 @code{selective-display-ellipses}, @*@code{selective-display},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 @code{tab-width}, and @code{truncate-lines}. Some other variables are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 always local in every buffer, but they are used for internal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 purposes.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 Note: the variable @code{auto-fill-function} was formerly named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 @code{auto-fill-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @findex kill-local-variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 If you want a variable to cease to be local to the current buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 call @kbd{M-x kill-local-variable} and provide the name of a variable to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 the prompt. The global value of the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 is again in effect in this buffer. Setting the major mode kills all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 the local variables of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 @findex setq-default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 To set the global value of a variable, regardless of whether the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 variable has a local value in the current buffer, you can use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 Lisp function @code{setq-default}. It works like @code{setq}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 If there is a local value in the current buffer, the local value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 not affected by @code{setq-default}; thus, the new global value may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 not be visible until you switch to another buffer, as in the case of:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 (setq-default fill-column 75)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 @code{setq-default} is the only way to set the global value of a variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 that has been marked with @code{make-variable-buffer-local}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 @findex default-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 Programs can look at a variable's default value with @code{default-value}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 This function takes a symbol as an argument and returns its default value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 The argument is evaluated; usually you must quote it explicitly, as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 the case of:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (default-value 'fill-column)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 @node File Variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 @subsection Local Variables in Files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @cindex local variables in files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 A file can contain a @dfn{local variables list}, which specifies the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 values to use for certain Emacs variables when that file is edited.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 Visiting the file checks for a local variables list and makes each variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 in the list local to the buffer in which the file is visited, with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 value specified in the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 A local variables list goes near the end of the file, in the last page.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (It is often best to put it on a page by itself.) The local variables list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 starts with a line containing the string @samp{Local Variables:}, and ends
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 with a line containing the string @samp{End:}. In between come the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 variable names and values, one set per line, as @samp{@var{variable}:@:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @var{value}}. The @var{value}s are not evaluated; they are used literally.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 The line which starts the local variables list does not have to say
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 just @samp{Local Variables:}. If there is other text before @samp{Local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 Variables:}, that text is called the @dfn{prefix}, and if there is other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 text after, that is called the @dfn{suffix}. If a prefix or suffix are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 present, each entry in the local variables list should have the prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 before it and the suffix after it. This includes the @samp{End:} line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 The prefix and suffix are included to disguise the local variables list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 as a comment so the compiler or text formatter will ignore it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 If you do not need to disguise the local variables list as a comment in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 this way, there is no need to include a prefix or a suffix.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 Two ``variable'' names are special in a local variables list: a value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 for the variable @code{mode} sets the major mode, and a value for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 variable @code{eval} is simply evaluated as an expression and the value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 is ignored. These are not real variables; setting them in any other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 context does not have the same effect. If @code{mode} is used in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 local variables list, it should be the first entry in the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 Here is an example of a local variables list:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;;; Local Variables: ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;;; mode:lisp ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 ;;; comment-column:0 ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 ;;; comment-start: ";;; " ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;;; comment-end:"***" ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;;; End: ***
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 Note that the prefix is @samp{;;; } and the suffix is @samp{ ***}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 Note also that comments in the file begin with and end with the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 strings. Presumably the file contains code in a language which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 enough like Lisp for Lisp mode to be useful but in which comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 start and end differently. The prefix and suffix are used in the local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 variables list to make the list look like several lines of comments when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 the compiler or interpreter for that language reads the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 The start of the local variables list must be no more than 3000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 characters from the end of the file, and must be in the last page if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 file is divided into pages. Otherwise, Emacs will not notice it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 there. The purpose is twofold: a stray @samp{Local Variables:}@: not in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 the last page does not confuse Emacs, and Emacs never needs to search a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 long file that contains no page markers and has no local variables list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 You may be tempted to turn on Auto Fill mode with a local variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 list. That is inappropriate. Whether you use Auto Fill mode or not is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 a matter of personal taste, not a matter of the contents of particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 files. If you want to use Auto Fill, set up major mode hooks with your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 @file{.emacs} file to turn it on (when appropriate) for you alone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (@pxref{Init File}). Don't try to use a local variable list that would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 impose your taste on everyone working with the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 XEmacs allows you to specify local variables in the first line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 of a file, in addition to specifying them in the @code{Local Variables}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 section at the end of a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
383 If the first line of a file contains two occurrences of @code{`-*-'},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
384 XEmacs uses the information between them to determine what the major
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
385 mode and variable settings should be. For example, these are all legal:
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;;; -*- mode: emacs-lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;;; -*- mode: postscript; version-control: never -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;;; -*- tags-file-name: "/foo/bar/TAGS" -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 For historical reasons, the syntax @code{`-*- modename -*-'} is allowed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 as well; for example, you can use:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 ;;; -*- emacs-lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 @vindex enable-local-variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 The variable @code{enable-local-variables} controls the use of local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 variables lists in files you visit. The value can be @code{t},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @code{nil}, or something else. A value of @code{t} means local variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 lists are obeyed; @code{nil} means they are ignored; anything else means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 query.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 The command @code{M-x normal-mode} always obeys local variables lists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 and ignores this variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 @node Keyboard Macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @section Keyboard Macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 @cindex keyboard macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 A @dfn{keyboard macro} is a command defined by the user to abbreviate a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 sequence of keys. For example, if you discover that you are about to type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @kbd{C-n C-d} forty times, you can speed your work by defining a keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 macro to invoke @kbd{C-n C-d} and calling it with a repeat count of forty.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 @c widecommands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 @item C-x (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 Start defining a keyboard macro (@code{start-kbd-macro}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 @item C-x )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 End the definition of a keyboard macro (@code{end-kbd-macro}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 @item C-x e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 Execute the most recent keyboard macro (@code{call-last-kbd-macro}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 @item C-u C-x (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 Re-execute last keyboard macro, then add more keys to its definition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 @item C-x q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 When this point is reached during macro execution, ask for confirmation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (@code{kbd-macro-query}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 @item M-x name-last-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 Give a command name (for the duration of the session) to the most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 recently defined keyboard macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 @item M-x insert-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 Insert in the buffer a keyboard macro's definition, as Lisp code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 Keyboard macros differ from other Emacs commands in that they are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 written in the Emacs command language rather than in Lisp. This makes it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 easier for the novice to write them and makes them more convenient as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 temporary hacks. However, the Emacs command language is not powerful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 enough as a programming language to be useful for writing anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 general or complex. For such things, Lisp must be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 You define a keyboard macro by executing the commands which are its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 definition. Put differently, as you are defining a keyboard macro, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 definition is being executed for the first time. This way, you see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 what the effects of your commands are, and don't have to figure
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 them out in your head. When you are finished, the keyboard macro is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 defined and also has been executed once. You can then execute the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 set of commands again by invoking the macro.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 * Basic Kbd Macro:: Defining and running keyboard macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 * Save Kbd Macro:: Giving keyboard macros names; saving them in files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 * Kbd Macro Query:: Keyboard macros that do different things each use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 @node Basic Kbd Macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 @subsection Basic Use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 @kindex C-x (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 @kindex C-x )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 @kindex C-x e
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 @findex start-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 @findex end-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 @findex call-last-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 To start defining a keyboard macro, type @kbd{C-x (}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (@code{start-kbd-macro}). From then on, anything you type continues to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 executed, but also becomes part of the definition of the macro. @samp{Def}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 appears in the mode line to remind you of what is going on. When you are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 finished, the @kbd{C-x )} command (@code{end-kbd-macro}) terminates the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 definition, without becoming part of it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 C-x ( M-f foo C-x )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 defines a macro to move forward a word and then insert @samp{foo}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 You can give @kbd{C-x )} a repeat count as an argument, in which case it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 repeats the macro that many times right after defining it, but defining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 the macro counts as the first repetition (since it is executed as you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 define it). If you give @kbd{C-x )} an argument of 4, it executes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 macro immediately 3 additional times. An argument of zero to @kbd{C-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 e} or @kbd{C-x )} means repeat the macro indefinitely (until it gets an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 error or you type @kbd{C-g}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 Once you have defined a macro, you can invoke it again with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 @kbd{C-x e} command (@code{call-last-kbd-macro}). You can give the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 command a repeat count numeric argument to execute the macro many times.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 To repeat an operation at regularly spaced places in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 text, define a macro and include as part of the macro the commands to move
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 to the next place you want to use it. For example, if you want to change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 each line, you should position point at the start of a line, and define a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 macro to change that line and leave point at the start of the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 Repeating the macro will then operate on successive lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 After you have terminated the definition of a keyboard macro, you can add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 to the end of its definition by typing @kbd{C-u C-x (}. This is equivalent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 to plain @kbd{C-x (} followed by retyping the whole definition so far. As
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 a consequence it re-executes the macro as previously defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @node Save Kbd Macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 @subsection Naming and Saving Keyboard Macros
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 @findex name-last-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 To save a keyboard macro for longer than until you define the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 next one, you must give it a name using @kbd{M-x name-last-kbd-macro}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 This reads a name as an argument using the minibuffer and defines that name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 to execute the macro. The macro name is a Lisp symbol, and defining it in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 this way makes it a valid command name for calling with @kbd{M-x} or for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 binding a key to with @code{global-set-key} (@pxref{Keymaps}). If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 specify a name that has a prior definition other than another keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 macro, Emacs prints an error message and nothing is changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 @findex insert-kbd-macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 Once a macro has a command name, you can save its definition in a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 You can then use it in another editing session. First visit the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 you want to save the definition in. Then use the command:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 M-x insert-kbd-macro @key{RET} @var{macroname} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 This inserts some Lisp code that, when executed later, will define the same
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 macro with the same definition it has now. You need not understand Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 code to do this, because @code{insert-kbd-macro} writes the Lisp code for you.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 Then save the file. You can load the file with @code{load-file}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (@pxref{Lisp Libraries}). If the file you save in is your initialization file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 @file{~/.emacs} (@pxref{Init File}), then the macro will be defined each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 time you run Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 If you give @code{insert-kbd-macro} a prefix argument, it creates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 additional Lisp code to record the keys (if any) that you have bound to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 keyboard macro, so that the macro is reassigned the same keys when you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 load the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @node Kbd Macro Query
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @subsection Executing Macros With Variations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 @kindex C-x q
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 @findex kbd-macro-query
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 You can use @kbd{C-x q} (@code{kbd-macro-query}), to get an effect similar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 to that of @code{query-replace}. The macro asks you each time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 whether to make a change. When you are defining the macro, type @kbd{C-x
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 q} at the point where you want the query to occur. During macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 definition, the @kbd{C-x q} does nothing, but when you invoke the macro,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 @kbd{C-x q} reads a character from the terminal to decide whether to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 continue.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 The special answers to a @kbd{C-x q} query are @key{SPC}, @key{DEL},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 @kbd{C-d}, @kbd{C-l}, and @kbd{C-r}. Any other character terminates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 execution of the keyboard macro and is then read as a command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 @key{SPC} means to continue. @key{DEL} means to skip the remainder of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 this repetition of the macro, starting again from the beginning in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 next repetition. @kbd{C-d} means to skip the remainder of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 repetition and cancel further repetition. @kbd{C-l} redraws the frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 and asks you again for a character to specify what to do. @kbd{C-r} enters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 a recursive editing level, in which you can perform editing that is not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 part of the macro. When you exit the recursive edit using @kbd{C-M-c},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 you are asked again how to continue with the keyboard macro. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 type a @key{SPC} at this time, the rest of the macro definition is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 executed. It is up to you to leave point and the text in a state such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 that the rest of the macro will do what you want.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 @kbd{C-u C-x q}, which is @kbd{C-x q} with a numeric argument, performs a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 different function. It enters a recursive edit reading input from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 keyboard, both when you type it during the definition of the macro and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 when it is executed from the macro. During definition, the editing you do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 inside the recursive edit does not become part of the macro. During macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 execution, the recursive edit gives you a chance to do some particularized
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 editing. @xref{Recursive Edit}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 @node Key Bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 @section Customizing Key Bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 This section deals with the @dfn{keymaps} that define the bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 between keys and functions, and shows how you can customize these bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 @cindex command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @cindex function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 @cindex command name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 A command is a Lisp function whose definition provides for interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 use. Like every Lisp function, a command has a function name, which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 a Lisp symbol whose name usually consists of lower case letters and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 hyphens.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 * Keymaps:: Definition of the keymap data structure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 Names of Emacs's standard keymaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 * Rebinding:: How to redefine one key's meaning conveniently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 * Disabling:: Disabling a command means confirmation is required
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 before it can be executed. This is done to protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 beginners from surprises.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 @node Keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 @subsection Keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 @cindex keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 @cindex global keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 @vindex global-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 The bindings between characters and command functions are recorded in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 data structures called @dfn{keymaps}. Emacs has many of these. One, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 @dfn{global} keymap, defines the meanings of the single-character keys that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 are defined regardless of major mode. It is the value of the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 @code{global-map}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 @cindex local keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 @vindex c-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 @vindex lisp-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 Each major mode has another keymap, its @dfn{local keymap}, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 contains overriding definitions for the single-character keys that are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 redefined in that mode. Each buffer records which local keymap is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 installed for it at any time, and the current buffer's local keymap is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 the only one that directly affects command execution. The local keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 for Lisp mode, C mode, and many other major modes always exist even when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 not in use. They are the values of the variables @code{lisp-mode-map},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 @code{c-mode-map}, and so on. For less frequently used major modes, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 local keymap is sometimes constructed only when the mode is used for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 first time in a session, to save space.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 @cindex minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @vindex minibuffer-local-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 @vindex minibuffer-local-ns-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 @vindex minibuffer-local-completion-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 @vindex minibuffer-local-must-match-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 @vindex repeat-complex-command-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 @vindex isearch-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 There are local keymaps for the minibuffer, too; they contain various
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 completion and exit commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 @code{minibuffer-local-map} is used for ordinary input (no completion).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 @code{minibuffer-local-ns-map} is similar, except that @key{SPC} exits
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 just like @key{RET}. This is used mainly for Mocklisp compatibility.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 @code{minibuffer-local-completion-map} is for permissive completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 @code{minibuffer-local-must-match-map} is for strict completion and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 for cautious completion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 @code{repeat-complex-command-map} is for use in @kbd{C-x @key{ESC}}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 @code{isearch-mode-map} contains the bindings of the special keys which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 are bound in the pseudo-mode entered with @kbd{C-s} and @kbd{C-r}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 @vindex ctl-x-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 @vindex help-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 @vindex esc-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 Finally, each prefix key has a keymap which defines the key sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 that start with it. For example, @code{ctl-x-map} is the keymap used for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 characters following a @kbd{C-x}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 @code{ctl-x-map} is the variable name for the map used for characters that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 follow @kbd{C-x}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 @code{help-map} is used for characters that follow @kbd{C-h}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 @code{esc-map} is for characters that follow @key{ESC}. All Meta
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 characters are actually defined by this map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 @code{ctl-x-4-map} is for characters that follow @kbd{C-x 4}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677 @code{mode-specific-map} is for characters that follow @kbd{C-c}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 The definition of a prefix key is the keymap to use for looking up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 the following character. Sometimes the definition is actually a Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 symbol whose function definition is the following character keymap. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 effect is the same, but it provides a command name for the prefix key that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 you can use as a description of what the prefix key is for. Thus the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 binding of @kbd{C-x} is the symbol @code{Ctl-X-Prefix}, whose function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 definition is the keymap for @kbd{C-x} commands, the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 @code{ctl-x-map}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 Prefix key definitions can appear in either the global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 map or a local map. The definitions of @kbd{C-c}, @kbd{C-x}, @kbd{C-h},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 and @key{ESC} as prefix keys appear in the global map, so these prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 keys are always available. Major modes can locally redefine a key as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 prefix by putting a prefix key definition for it in the local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 map.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 A mode can also put a prefix definition of a global prefix character such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 as @kbd{C-x} into its local map. This is how major modes override the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 definitions of certain keys that start with @kbd{C-x}. This case is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 special, because the local definition does not entirely replace the global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 one. When both the global and local definitions of a key are other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 keymaps, the next character is looked up in both keymaps, with the local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 definition overriding the global one. The character after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 @kbd{C-x} is looked up in both the major mode's own keymap for redefined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 @kbd{C-x} commands and in @code{ctl-x-map}. If the major mode's own keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 for @kbd{C-x} commands contains @code{nil}, the definition from the global
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 keymap for @kbd{C-x} commands is used.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 @node Rebinding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 @subsection Changing Key Bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 @cindex key rebinding, this session
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 @cindex rebinding keys, this session
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 You can redefine an Emacs key by changing its entry in a keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 You can change the global keymap, in which case the change is effective in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 all major modes except those that have their own overriding local
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 definitions for the same key. Or you can change the current buffer's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 local map, which affects all buffers using the same major mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 * Interactive Rebinding:: Changing Key Bindings Interactively
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 * Programmatic Rebinding:: Changing Key Bindings Programmatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 * Key Bindings Using Strings::Using Strings for Changing Key Bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 @node Interactive Rebinding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 @subsubsection Changing Key Bindings Interactively
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 @findex global-set-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 @findex local-set-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 @findex local-unset-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 @item M-x global-set-key @key{RET} @var{key} @var{cmd} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 Defines @var{key} globally to run @var{cmd}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 @item M-x local-set-key @key{RET} @var{keys} @var{cmd} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 Defines @var{key} locally (in the major mode now in effect) to run
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 @var{cmd}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737 @item M-x local-unset-key @key{RET} @var{keys} @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 Removes the local binding of @var{key}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 @var{cmd} is a symbol naming an interactively-callable function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 When called interactively, @var{key} is the next complete key sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 that you type. When called as a function, @var{key} is a string, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 vector of events, or a vector of key-description lists as described in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 the @code{define-key} function description. The binding goes in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 the current buffer's local map, which is shared with other buffers in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 the same major mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 The following example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 M-x global-set-key @key{RET} C-f next-line @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 redefines @kbd{C-f} to move down a line. The fact that @var{cmd} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 read second makes it serve as a kind of confirmation for @var{key}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 These functions offer no way to specify a particular prefix keymap as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 the one to redefine in, but that is not necessary, as you can include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 prefixes in @var{key}. @var{key} is read by reading characters one by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 one until they amount to a complete key (that is, not a prefix key).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 Thus, if you type @kbd{C-f} for @var{key}, Emacs enters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 the minibuffer immediately to read @var{cmd}. But if you type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 @kbd{C-x}, another character is read; if that character is @kbd{4},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 another character is read, and so on. For example,@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 M-x global-set-key @key{RET} C-x 4 $ spell-other-window @key{RET}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 redefines @kbd{C-x 4 $} to run the (fictitious) command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 @code{spell-other-window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 @findex define-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 @findex substitute-key-definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 The most general way to modify a keymap is the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 @code{define-key}, used in Lisp code (such as your @file{.emacs} file).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 @code{define-key} takes three arguments: the keymap, the key to modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 in it, and the new definition. @xref{Init File}, for an example.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 @code{substitute-key-definition} is used similarly; it takes three
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784 arguments, an old definition, a new definition, and a keymap, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 redefines in that keymap all keys that were previously defined with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 old definition to have the new definition instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 @node Programmatic Rebinding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 @subsubsection Changing Key Bindings Programmatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 You can use the functions @code{global-set-key} and @code{define-key}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 to rebind keys under program control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 @findex define-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 @findex global-set-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 @item @code{(global-set-key @var{keys} @var{cmd})}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 Defines @var{keys} globally to run @var{cmd}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 @item @code{(define-key @var{keymap} @var{keys} @var{def})}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 Defines @var{keys} to run @var{def} in the keymap @var{keymap}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 @var{keymap} is a keymap object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 @var{keys} is the sequence of keystrokes to bind.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 @var{def} is anything that can be a key's definition:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 @code{nil}, meaning key is undefined in this keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 A command, that is, a Lisp function suitable for interactive calling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 A string or key sequence vector, which is treated as a keyboard macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 A keymap to define a prefix key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 A symbol so that when the key is looked up, the symbol stands for its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 function definition, which should at that time be one of the above,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 or another symbol whose function definition is used, and so on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 A cons, @code{(string . defn)}, meaning that @var{defn} is the definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 (@var{defn} should be a valid definition in its own right)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 A cons, @code{(keymap . char)}, meaning use the definition of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 @var{char} in map @var{keymap}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 For backward compatibility, XEmacs allows you to specify key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 sequences as strings. However, the preferred method is to use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833 representations of key sequences as vectors of keystrokes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 @xref{Keystrokes}, for more information about the rules for constructing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 key sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 Emacs allows you to abbreviate representations for key sequences in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 most places where there is no ambiguity.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 Here are some rules for abbreviation:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 The keysym by itself is equivalent to a list of just that keysym, i.e.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 @code{f1} is equivalent to @code{(f1)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 A keystroke by itself is equivalent to a vector containing just that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 keystroke, i.e., @code{(control a)} is equivalent to @code{[(control a)]}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 You can use ASCII codes for keysyms that have them. i.e.,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 @code{65} is equivalent to @code{A}. (This is not so much an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 abbreviation as an alternate representation.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 Here are some examples of programmatically binding keys:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 ;;; Bind @code{my-command} to @key{f1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 (global-set-key 'f1 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 ;;; Bind @code{my-command} to @kbd{Shift-f1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 (global-set-key '(shift f1) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 ;;; Bind @code{my-command} to @kbd{C-c Shift-f1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 (global-set-key '[(control c) (shift f1)] 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 ;;; Bind @code{my-command} to the middle mouse button.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 (global-set-key 'button2 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 ;;; Bind @code{my-command} to @kbd{@key{META} @key{CTL} @key{Right Mouse Button}}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 ;;; in the keymap that is in force when you are running @code{dired}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 (define-key dired-mode-map '(meta control button3) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 @comment ;; note that these next four lines are not synonymous:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 @comment ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 @comment (global-set-key '(meta control delete) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 @comment (global-set-key '(meta control backspace) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 @comment (global-set-key '(meta control h) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 @comment (global-set-key '(meta control H) 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 @comment
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 @comment ;; note that this binds two key sequences: ``control-j'' and ``linefeed''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 @comment ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 @comment (global-set-key "\^J" 'my-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 @node Key Bindings Using Strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 @subsubsection Using Strings for Changing Key Bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 For backward compatibility, you can still use strings to represent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 key sequences. Thus you can use comands like the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 ;;; Bind @code{end-of-line} to @kbd{C-f}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 (global-set-key "\C-f" 'end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 Note, however, that in some cases you may be binding more than one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 key sequence by using a single command. This situation can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 arise because in ASCII, @kbd{C-i} and @key{TAB} have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 the same representation. Therefore, when Emacs sees:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 (global-set-key "\C-i" 'end-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 it is unclear whether the user intended to bind @kbd{C-i} or @key{TAB}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 The solution XEmacs adopts is to bind both of these key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909 sequences.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 @cindex redefining keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 After binding a command to two key sequences with a form like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 (define-key global-map "\^X\^I" 'command-1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 it is possible to redefine only one of those sequences like so:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 (define-key global-map [(control x) (control i)] 'command-2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 (define-key global-map [(control x) tab] 'command-3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 This applies only when running under a window system. If you are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 talking to Emacs through an ASCII-only channel, you do not get any of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 these features.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 Here is a table of pairs of key sequences that behave in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 similar fashion:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 control h backspace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 control l clear
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 control i tab
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 control m return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 control j linefeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 control [ escape
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 control @@ control space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 @node Disabling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 @subsection Disabling Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 @cindex disabled command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 Disabling a command marks it as requiring confirmation before it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 can be executed. The purpose of disabling a command is to prevent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 beginning users from executing it by accident and being confused.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 The direct mechanism for disabling a command is to have a non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 @code{disabled} property on the Lisp symbol for the command. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 properties are normally set by the user's @file{.emacs} file with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 Lisp expressions such as:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 (put 'delete-region 'disabled t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 If the value of the @code{disabled} property is a string, that string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 is included in the message printed when the command is used:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 (put 'delete-region 'disabled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 "Text deleted this way cannot be yanked back!\n")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 @findex disable-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 @findex enable-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 You can disable a command either by editing the @file{.emacs} file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 directly or with the command @kbd{M-x disable-command}, which edits the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 @file{.emacs} file for you. @xref{Init File}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 When you attempt to invoke a disabled command interactively in Emacs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 a window is displayed containing the command's name, its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 documentation, and some instructions on what to do next; then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 Emacs asks for input saying whether to execute the command as requested,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 enable it and execute, or cancel it. If you decide to enable the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 command, you are asked whether to do this permanently or just for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 current session. Enabling permanently works by automatically editing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 your @file{.emacs} file. You can use @kbd{M-x enable-command} at any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 time to enable any command permanently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 Whether a command is disabled is independent of what key is used to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 invoke it; it also applies if the command is invoked using @kbd{M-x}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 Disabling a command has no effect on calling it as a function from Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 @node Syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 @section The Syntax Table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 @cindex syntax table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 All the Emacs commands which parse words or balance parentheses are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 controlled by the @dfn{syntax table}. The syntax table specifies which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 characters are opening delimiters, which are parts of words, which are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995 string quotes, and so on. Actually, each major mode has its own syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 table (though sometimes related major modes use the same one) which it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 installs in each buffer that uses that major mode. The syntax table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 installed in the current buffer is the one that all commands use, so we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 call it ``the'' syntax table. A syntax table is a Lisp object, a vector of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 length 256 whose elements are numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 * Entry: Syntax Entry. What the syntax table records for each character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 * Change: Syntax Change. How to change the information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 @node Syntax Entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 @subsection Information About Each Character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 The syntax table entry for a character is a number that encodes six
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 pieces of information:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 The syntactic class of the character, represented as a small integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017 The matching delimiter, for delimiter characters only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 (the matching delimiter of @samp{(} is @samp{)}, and vice versa)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 A flag saying whether the character is the first character of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 two-character comment starting sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 A flag saying whether the character is the second character of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 two-character comment starting sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 A flag saying whether the character is the first character of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 two-character comment ending sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 A flag saying whether the character is the second character of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 two-character comment ending sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 The syntactic classes are stored internally as small integers, but are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 usually described to or by the user with characters. For example, @samp{(}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 is used to specify the syntactic class of opening delimiters. Here is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 table of syntactic classes, with the characters that specify them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 @item @w{ }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 The class of whitespace characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 @item w
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042 The class of word-constituent characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 @item _
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 The class of characters that are part of symbol names but not words.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 This class is represented by @samp{_} because the character @samp{_}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 has this class in both C and Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 @item .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 The class of punctuation characters that do not fit into any other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 special class.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 @item (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 The class of opening delimiters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 @item )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 The class of closing delimiters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 @item '
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 The class of expression-adhering characters. These characters are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 part of a symbol if found within or adjacent to one, and are part
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 of a following expression if immediately preceding one, but are like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 whitespace if surrounded by whitespace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 @item "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 The class of string-quote characters. They match each other in pairs,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 and the characters within the pair all lose their syntactic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 significance except for the @samp{\} and @samp{/} classes of escape
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 characters, which can be used to include a string-quote inside the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 @item $
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 The class of self-matching delimiters. This is intended for @TeX{}'s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 @samp{$}, which is used both to enter and leave math mode. Thus,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 a pair of matching @samp{$} characters surround each piece of math mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 @TeX{} input. A pair of adjacent @samp{$} characters act like a single
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 one for purposes of matching.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 @item /
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 The class of escape characters that always just deny the following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 character its special syntactic significance. The character after one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 of these escapes is always treated as alphabetic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 @item \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 The class of C-style escape characters. In practice, these are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 treated just like @samp{/}-class characters, because the extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 possibilities for C escapes (such as being followed by digits) have no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 effect on where the containing expression ends.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 @item <
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 The class of comment-starting characters. Only single-character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 comment starters (such as @samp{;} in Lisp mode) are represented this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 @item >
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086 The class of comment-ending characters. Newline has this syntax in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 Lisp mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 @vindex parse-sexp-ignore-comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091 The characters flagged as part of two-character comment delimiters can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 have other syntactic functions most of the time. For example, @samp{/} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 @samp{*} in C code, when found separately, have nothing to do with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 comments. The comment-delimiter significance overrides when the pair of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 characters occur together in the proper order. Only the list and sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 commands use the syntax table to find comments; the commands specifically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 for comments have other variables that tell them where to find comments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 Moreover, the list and sexp commands notice comments only if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 @code{parse-sexp-ignore-comments} is non-@code{nil}. This variable is set
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 to @code{nil} in modes where comment-terminator sequences are liable to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 appear where there is no comment, for example, in Lisp mode where the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 comment terminator is a newline but not every newline ends a comment.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 @node Syntax Change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 @subsection Altering Syntax Information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 It is possible to alter a character's syntax table entry by storing a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 number in the appropriate element of the syntax table, but it would be hard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 to determine what number to use. Emacs therefore provides a command that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 allows you to specify the syntactic properties of a character in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 convenient way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 @findex modify-syntax-entry
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 @kbd{M-x modify-syntax-entry} is the command to change a character's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 syntax. It can be used interactively and is also used by major
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 modes to initialize their own syntax tables. Its first argument is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 character to change. The second argument is a string that specifies the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 new syntax. When called from Lisp code, there is a third, optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 argument, which specifies the syntax table in which to make the change. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 not supplied, or if this command is called interactively, the third
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 argument defaults to the current buffer's syntax table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 @enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 The first character in the string specifies the syntactic class. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 is one of the characters in the previous table (@pxref{Syntax Entry}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 The second character is the matching delimiter. For a character that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 is not an opening or closing delimiter, this should be a space, and may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 be omitted if no following characters are needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 The remaining characters are flags. The flag characters allowed are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 Flag this character as the first of a two-character comment starting sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 @item 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 Flag this character as the second of a two-character comment starting sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 @item 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 Flag this character as the first of a two-character comment ending sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 @item 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 Flag this character as the second of a two-character comment ending sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 @end enumerate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 @kindex C-h s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149 @findex describe-syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 Use @kbd{C-h s} (@code{describe-syntax}) to display a description of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 the contents of the current syntax table. The description of each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 character includes both the string you have to pass to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 @code{modify-syntax-entry} to set up that character's current syntax,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 and some English to explain that string if necessary.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 @node Init File
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 @section The Init File, .emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 @cindex init file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 @cindex Emacs initialization file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 @cindex key rebinding, permanent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 @cindex rebinding keys, permanently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 When you start Emacs, it normally loads the file @file{.emacs} in your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 home directory. This file, if it exists, should contain Lisp code. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 is called your initialization file or @dfn{init file}. Use the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 line switches @samp{-q} and @samp{-u} to tell Emacs whether to load an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 init file (@pxref{Entering Emacs}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 @vindex init-file-user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170 When the @file{.emacs} file is read, the variable @code{init-file-user}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 says which user's init file it is. The value may be the null string or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 string containing a user's name. If the value is a null string, it means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 that the init file was taken from the user that originally logged in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 In all cases, @code{(concat "~" init-file-user "/")} evaluates to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 directory name of the directory where the @file{.emacs} file was looked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 for.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 At some sites there is a @dfn{default init file}, which is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 library named @file{default.el}, found via the standard search path for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 libraries. The Emacs distribution contains no such library; your site
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 may create one for local customizations. If this library exists, it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 loaded whenever you start Emacs. But your init file, if any, is loaded
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 first; if it sets @code{inhibit-default-init} non-@code{nil}, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 @file{default} is not loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 If you have a large amount of code in your @file{.emacs} file, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 should move it into another file named @file{@var{something}.el},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 byte-compile it (@pxref{Lisp Libraries}), and load that file from your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 @file{.emacs} file using @code{load}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 * Init Syntax:: Syntax of constants in Emacs Lisp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 * Init Examples:: How to do some things with an init file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 * Terminal Init:: Each terminal type can have an init file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 @node Init Syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 @subsection Init File Syntax
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 The @file{.emacs} file contains one or more Lisp function call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 expressions. Each consists of a function name followed by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 arguments, all surrounded by parentheses. For example, @code{(setq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 fill-column 60)} represents a call to the function @code{setq} which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 used to set the variable @code{fill-column} (@pxref{Filling}) to 60.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 The second argument to @code{setq} is an expression for the new value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 of the variable. This can be a constant, a variable, or a function call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 expression. In @file{.emacs}, constants are used most of the time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 They can be:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 @item Numbers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 Integers are written in decimal, with an optional initial minus sign.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 If a sequence of digits is followed by a period and another sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 of digits, it is interpreted as a floating point number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 @item Strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 Lisp string syntax is the same as C string syntax with a few extra
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 features. Use a double-quote character to begin and end a string constant.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 Newlines and special characters may be present literally in strings. They
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 can also be represented as backslash sequences: @samp{\n} for newline,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 @samp{\b} for backspace, @samp{\r} for return, @samp{\t} for tab,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 @samp{\f} for formfeed (control-l), @samp{\e} for escape, @samp{\\} for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227 backslash, @samp{\"} for a double-quote, or @samp{\@var{ooo}} for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 character whose octal code is @var{ooo}. Backslash and double-quote are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 the only characters for which backslash sequences are mandatory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 You can use @samp{\C-} as a prefix for a control character, as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 @samp{\C-s} for ASCII Control-S, and @samp{\M-} as a prefix for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 a Meta character, as in @samp{\M-a} for Meta-A or @samp{\M-\C-a} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 Control-Meta-A.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 @item Characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 Lisp character constant syntax consists of a @samp{?} followed by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 either a character or an escape sequence starting with @samp{\}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 Examples: @code{?x}, @code{?\n}, @code{?\"}, @code{?\)}. Note that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 strings and characters are not interchangeable in Lisp; some contexts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 require one and some contexts require the other.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 @item True
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 @code{t} stands for `true'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 @item False
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 @code{nil} stands for `false'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 @item Other Lisp objects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 Write a single-quote (') followed by the Lisp object you want.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 @node Init Examples
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 @subsection Init File Examples
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256 Here are some examples of doing certain commonly desired things with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 Lisp expressions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 Make @key{TAB} in C mode just insert a tab if point is in the middle of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 (setq c-tab-always-indent nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 Here we have a variable whose value is normally @code{t} for `true'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 and the alternative is @code{nil} for `false'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 Make searches case sensitive by default (in all buffers that do not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 override this).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 (setq-default case-fold-search nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 This sets the default value, which is effective in all buffers that do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 not have local values for the variable. Setting @code{case-fold-search}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 with @code{setq} affects only the current buffer's local value, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 is probably not what you want to do in an init file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 Make Text mode the default mode for new buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 (setq default-major-mode 'text-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 Note that @code{text-mode} is used because it is the command for entering
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 the mode we want. A single-quote is written before it to make a symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 constant; otherwise, @code{text-mode} would be treated as a variable name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 Turn on Auto Fill mode automatically in Text mode and related modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 (setq text-mode-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 '(lambda () (auto-fill-mode 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 Here we have a variable whose value should be a Lisp function. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 function we supply is a list starting with @code{lambda}, and a single
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 quote is written in front of it to make it (for the purpose of this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306 @code{setq}) a list constant rather than an expression. Lisp functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 are not explained here; for mode hooks it is enough to know that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 @code{(auto-fill-mode 1)} is an expression that will be executed when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 Text mode is entered. You could replace it with any other expression
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310 that you like, or with several expressions in a row.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 (setq text-mode-hook 'turn-on-auto-fill)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 This is another way to accomplish the same result.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 @code{turn-on-auto-fill} is a symbol whose function definition is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 @code{(lambda () (auto-fill-mode 1))}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 Load the installed Lisp library named @file{foo} (actually a file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 @file{foo.elc} or @file{foo.el} in a standard Emacs directory).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 (load "foo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 When the argument to @code{load} is a relative pathname, not starting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 with @samp{/} or @samp{~}, @code{load} searches the directories in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 @code{load-path} (@pxref{Loading}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 Load the compiled Lisp file @file{foo.elc} from your home directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 (load "~/foo.elc")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 Here an absolute file name is used, so no searching is done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 Rebind the key @kbd{C-x l} to run the function @code{make-symbolic-link}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 (global-set-key "\C-xl" 'make-symbolic-link)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 (define-key global-map "\C-xl" 'make-symbolic-link)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 Note once again the single-quote used to refer to the symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 @code{make-symbolic-link} instead of its value as a variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 Do the same thing for C mode only.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 (define-key c-mode-map "\C-xl" 'make-symbolic-link)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 Bind the function key @key{F1} to a command in C mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 Note that the names of function keys must be lower case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 (define-key c-mode-map 'f1 'make-symbolic-link)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 Bind the shifted version of @key{F1} to a command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 (define-key c-mode-map '(shift f1) 'make-symbolic-link)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380 Redefine all keys which now run @code{next-line} in Fundamental mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 to run @code{forward-line} instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 (substitute-key-definition 'next-line 'forward-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 global-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 Make @kbd{C-x C-v} undefined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (global-unset-key "\C-x\C-v")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 One reason to undefine a key is so that you can make it a prefix.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 Simply defining @kbd{C-x C-v @var{anything}} would make @kbd{C-x C-v}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 a prefix, but @kbd{C-x C-v} must be freed of any non-prefix definition
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 first.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 Make @samp{$} have the syntax of punctuation in Text mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 Note the use of a character constant for @samp{$}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 (modify-syntax-entry ?\$ "." text-mode-syntax-table)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 Enable the use of the command @code{eval-expression} without confirmation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 (put 'eval-expression 'disabled nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 @node Terminal Init
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 @subsection Terminal-Specific Initialization
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 Each terminal type can have a Lisp library to be loaded into Emacs when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 it is run on that type of terminal. For a terminal type named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 @var{termtype}, the library is called @file{term/@var{termtype}} and it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 found by searching the directories @code{load-path} as usual and trying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 suffixes @samp{.elc} and @samp{.el}. Normally it appears in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 subdirectory @file{term} of the directory where most Emacs libraries are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 kept.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 The usual purpose of the terminal-specific library is to define the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 escape sequences used by the terminal's function keys using the library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 @file{keypad.el}. See the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 @file{term/vt100.el} for an example of how this is done.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 When the terminal type contains a hyphen, only the part of the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 before the first hyphen is significant in choosing the library name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 Thus, terminal types @samp{aaa-48} and @samp{aaa-30-rv} both use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 the library @file{term/aaa}. The code in the library can use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 @code{(getenv "TERM")} to find the full terminal type name.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 @vindex term-file-prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 The library's name is constructed by concatenating the value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 variable @code{term-file-prefix} and the terminal type. Your @file{.emacs}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 file can prevent the loading of the terminal-specific library by setting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 @code{term-file-prefix} to @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 @vindex term-setup-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 The value of the variable @code{term-setup-hook}, if not @code{nil}, is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 called as a function of no arguments at the end of Emacs initialization,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 after both your @file{.emacs} file and any terminal-specific library have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 been read. You can set the value in the @file{.emacs} file to override
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 part of any of the terminal-specific libraries and to define
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 initializations for terminals that do not have a library.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 @node Audible Bell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 @section Changing the Bell Sound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 @cindex audible bell, changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 @cindex bell, changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 @vindex sound-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 @findex load-default-sounds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 @findex play-sound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 You can now change how the audible bell sounds using the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 @code{sound-alist}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 @code{sound-alist}'s value is an list associating symbols with, among
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 other things, strings of audio-data. When @code{ding} is called with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 one of the symbols, the associated sound data is played instead of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 standard beep. This only works if you are logged in on the console of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 machine with audio hardware. To listen to a sound of the provided type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 call the function @code{play-sound} with the argument @var{sound}. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 can also set the volume of the sound with the optional argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 @var{volume}.@refill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 @cindex ding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473 Each element of @code{sound-alist} is a list describing a sound.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 The first element of the list is the name of the sound being defined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 Subsequent elements of the list are alternating keyword/value pairs:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 @item sound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 A string of raw sound data, or the name of another sound to play.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 The symbol @code{t} here means use the default X beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 @item volume
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 An integer from 0-100, defaulting to @code{bell-volume}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 @item pitch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 If using the default X beep, the pitch (Hz) to generate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 @item duration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 If using the default X beep, the duration (milliseconds).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 For compatibility, elements of `sound-alist' may also be of the form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 ( @var{sound-name} . @var{<sound>} )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 ( @var{sound-name} @var{<volume>} @var{<sound>} )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 You should probably add things to this list by calling the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 @code{load-sound-file}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 Note that you can only play audio data if running on the console screen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 of a machine with audio hardware which emacs understands, which at this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 time means a Sun SparcStation, SGI, or HP9000s700.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 Also note that the pitch, duration, and volume options are available
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 everywhere, but most X servers ignore the `pitch' option.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 @vindex bell-volume
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510 The variable @code{bell-volume} should be an integer from 0 to 100,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 with 100 being loudest, which controls how loud the sounds emacs makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 should be. Elements of the @code{sound-alist} may override this value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 This variable applies to the standard X bell sound as well as sound files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 If the symbol @code{t} is in place of a sound-string, Emacs uses the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 default X beep. This allows you to define beep-types of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 different volumes even when not running on the console.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 @findex load-sound-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 You can add things to this list by calling the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 @code{load-sound-file}, which reads in an audio-file and adds its data to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 the sound-alist. You can specify the sound with the @var{sound-name}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 argument and the file into which the sounds are loaded with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 @var{filename} argument. The optional @var{volume} argument sets the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 volume.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 @code{load-sound-file (@var{filename sound-name} &optional @var{volume})}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 To load and install some sound files as beep-types, use the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 @code{load-default-sounds} (note that this only works if you are on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531 display 0 of a machine with audio hardware).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 The following beep-types are used by Emacs itself. Other Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 packages may use other beep types, but these are the ones that the C
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 kernel of Emacs uses.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 @item auto-save-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 An auto-save does not succeed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 @item command-error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 The Emacs command loop catches an error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 @item undefined-key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 You type a key that is undefined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 @item undefined-click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 You use an undefined mouse-click combination
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 @item no-completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 Completion was not possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 @item y-or-n-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 You type something other than the required @code{y} or @code{n}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 @item yes-or-no-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 You type something other than @code{yes} or @code{no}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 @comment node-name, next, previous, up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 @node Faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 @section Faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 XEmacs has objects called extents and faces. An @dfn{extent}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 is a region of text and a @dfn{face} is a collection of textual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566 attributes, such as fonts and colors. Every extent is displayed in some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 face; therefore, changing the properties of a face immediately updates the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 display of all associated extents. Faces can be frame-local: you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 have a region of text that displays with completely different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 attributes when its buffer is viewed from a different X window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 The display attributes of faces may be specified either in Lisp or through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 the X resource manager.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575 @subsection Customizing Faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 You can change the face of an extent with the functions in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 this section. All the functions prompt for a @var{face} as an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 argument; use completion for a list of possible values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 @table @kbd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 @item M-x invert-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 Swap the foreground and background colors of the given @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 @item M-x make-face-bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 Make the font of the given @var{face} bold. When called from a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 program, returns @code{nil} if this is not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 @item M-x make-face-bold-italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 Make the font of the given @var{face} bold italic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 @item M-x make-face-italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 Make the font of the given @var{face} italic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 @item M-x make-face-unbold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 Make the font of the given @var{face} non-bold.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 @item M-x make-face-unitalic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 Make the font of the given @var{face} non-italic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 @item M-x make-face-larger
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 Make the font of the given @var{face} a little larger.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602 @item M-x make-face-smaller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 Make the font of the given @var{face} a little smaller.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 When called from a program, returns @code{nil} if not possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 @item M-x set-face-background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 Change the background color of the given @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 @item M-x set-face-background-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 Change the background pixmap of the given @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 @item M-x set-face-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 Change the font of the given @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 @item M-x set-face-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 Change the foreground color of the given @var{face}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 @item M-x set-face-underline-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 Change whether the given @var{face} is underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 @findex make-face-bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 @findex make-face-bold-italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 @findex make-face-italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 @findex make-face-unbold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 @findex make-face-unitalic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 @findex make-face-larger
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 @findex make-face-smaller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 @findex invert-face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 You can exchange the foreground and background color of the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 @var{face} with the function @code{invert-face}. If the face does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 specify both foreground and background, then its foreground and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 background are set to the background and foreground of the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 When calling this from a program, you can supply the optional argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 @var{frame} to specify which frame is affected; otherwise, all frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 are affected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 @findex set-face-background
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 You can set the background color of the specified @var{face} with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 function @code{set-face-background}. The argument @code{color} should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 be a string, the name of a color. When called from a program, if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 optional @var{frame} argument is provided, the face is changed only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 in that frame; otherwise, it is changed in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 @findex set-face-background-pixmap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 You can set the background pixmap of the specified @var{face} with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 function @code{set-face-background-pixmap}. The pixmap argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 @var{name} should be a string, the name of a file of pixmap data. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 directories listed in the @code{x-bitmap-file-path} variable are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 searched. The bitmap may also be a list of the form @code{(@var{width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 height data})}, where @var{width} and @var{height} are the size in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 pixels, and @var{data} is a string containing the raw bits of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 bitmap. If the optional @var{frame} argument is provided, the face is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 changed only in that frame; otherwise, it is changed in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 The variable @code{x-bitmap-file-path} takes as a value a list of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 directories in which X bitmap files may be found. If the value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 @code{nil}, the list is initialized from the @code{*bitmapFilePath}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 resource.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 If the environment variable @b{XBMLANGPATH} is set, then it is consulted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 before the @code{x-bitmap-file-path} variable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 @findex set-face-font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 You can set the font of the specified @var{face} with the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 @code{set-face-font}. The @var{font} argument should be a string, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 name of a font. When called from a program, if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 optional @var{frame} argument is provided, the face is changed only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 in that frame; otherwise, it is changed in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 @findex set-face-foreground
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668 You can set the foreground color of the specified @var{face} with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 function @code{set-face-foreground}. The argument @var{color} should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 a string, the name of a color. If the optional @var{frame} argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 provided, the face is changed only in that frame; otherwise, it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 changed in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 @findex set-face-underline-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 You can set underline the specified @var{face} with the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 @code{set-face-underline-p}. The argument @var{underline-p} can be used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 to make underlining an attribute of the face or not. If the optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 @var{frame} argument is provided, the face is changed only in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 frame; otherwise, it is changed in all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 @node X Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 @section X Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 @cindex X resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 @findex x-create-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 The Emacs resources are generally set per-frame. Each Emacs frame can have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 its own name or the same name as another, depending on the name passed to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 @code{make-frame} function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 You can specify resources for all frames with the syntax:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 Emacs*parameter: value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 Emacs*EmacsFrame.parameter:value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704 You can specify resources for a particular frame with the syntax:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 Emacs*FRAME-NAME.parameter: value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 * Geometry Resources:: Controlling the size and position of frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 * Iconic Resources:: Controlling whether frames come up iconic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 * Resource List:: List of resources settable on a frame or device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 * Face Resources:: Controlling faces using resources.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 * Widgets:: The widget hierarchy for XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 * Menubar Resources:: Specifying resources for the menubar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 @node Geometry Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 @subsection Geometry Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 To make the default size of all Emacs frames be 80 columns by 55 lines,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 do this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 Emacs*EmacsFrame.geometry: 80x55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 To set the geometry of a particular frame named @samp{fred}, do this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 Emacs*fred.geometry: 80x55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 Important! Do not use the following syntax:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 Emacs*geometry: 80x55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 You should never use @code{*geometry} with any X application. It does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 not say "make the geometry of Emacs be 80 columns by 55 lines." It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 really says, "make Emacs and all subwindows thereof be 80x55 in whatever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 units they care to measure in." In particular, that is both telling the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 Emacs text pane to be 80x55 in characters, and telling the menubar pane
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 to be 80x55 pixels, which is surely not what you want.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 As a special case, this geometry specification also works (and sets the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 default size of all Emacs frames to 80 columns by 55 lines):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 Emacs.geometry: 80x55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 since that is the syntax used with most other applications (since most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 other applications have only one top-level window, unlike Emacs). In
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 general, however, the top-level shell (the unmapped ApplicationShell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 widget named @samp{Emacs} that is the parent of the shell widgets that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 actually manage the individual frames) does not have any interesting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 resources on it, and you should set the resources on the frames instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 The @code{-geometry} command-line argument sets only the geometry of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 initial frame created by Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 A more complete explanation of geometry-handling is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 The @code{-geometry} command-line option sets the @code{Emacs.geometry}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 resource, that is, the geometry of the ApplicationShell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 For the first frame created, the size of the frame is taken from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 ApplicationShell if it is specified, otherwise from the geometry of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 For subsequent frames, the order is reversed: First the frame, and then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 the ApplicationShell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 For the first frame created, the position of the frame is taken from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 ApplicationShell (@code{Emacs.geometry}) if it is specified, otherwise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 from the geometry of the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 For subsequent frames, the position is taken only from the frame, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 never from the ApplicationShell.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 This is rather complicated, but it does seem to provide the most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 intuitive behavior with respect to the default sizes and positions of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 frames created in various ways.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 @node Iconic Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 @subsection Iconic Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 Analogous to @code{-geometry}, the @code{-iconic} command-line option
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 sets the iconic flag of the ApplicationShell (@code{Emacs.iconic}) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 always applies to the first frame created regardless of its name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 However, it is possible to set the iconic flag on particular frames (by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 name) by using the @code{Emacs*FRAME-NAME.iconic} resource.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 @node Resource List
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 @subsection Resource List
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 Emacs frames accept the following resources:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815 @item @code{geometry} (class @code{Geometry}): string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 Initial geometry for the frame. @xref{Geometry Resources} for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 complete discussion of how this works.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 @item @code{iconic} (class @code{Iconic}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 Whether this frame should appear in the iconified state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 @item @code{internalBorderWidth} (class @code{InternalBorderWidth}): int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823 How many blank pixels to leave between the text and the edge of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 @item @code{interline} (class @code{Interline}): int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827 How many pixels to leave between each line (may not be implemented).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 @item @code{menubar} (class @code{Menubar}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 Whether newly-created frames should initially have a menubar. Set to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 true by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833 @item @code{initiallyUnmapped} (class @code{InitiallyUnmapped}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 Whether XEmacs should leave the initial frame unmapped when it starts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 up. This is useful if you are starting XEmacs as a server (e.g. in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 conjunction with gnuserv or the external client widget). You can also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 control this with the @code{-unmapped} command-line option.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 @item @code{barCursor} (class @code{BarColor}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 Whether the cursor should be displayed as a bar, or the traditional box.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 @item @code{cursorColor} (class @code{CursorColor}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843 The color of the text cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 @item @code{scrollBarWidth} (class @code{ScrollBarWidth}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 How wide the vertical scrollbars should be, in pixels; 0 means no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 vertical scrollbars. You can also use a resource specification of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 form @code{*scrollbar.width}, or the usual toolkit scrollbar resources:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 @code{*XmScrollBar.width} (Motif), @code{*XlwScrollBar.width} (Lucid),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850 or @code{*Scrollbar.thickness} (Athena). We don't recommend that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 use the toolkit resources, though, because they're dependent on how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852 exactly your particular build of XEmacs was configured.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 @item @code{scrollBarHeight} (class @code{ScrollBarHeight}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855 How high the horizontal scrollbars should be, in pixels; 0 means no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 horizontal scrollbars. You can also use a resource specification of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 form @code{*scrollbar.height}, or the usual toolkit scrollbar resources:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 @code{*XmScrollBar.height} (Motif), @code{*XlwScrollBar.height} (Lucid),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859 or @code{*Scrollbar.thickness} (Athena). We don't recommend that you use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 the toolkit resources, though, because they're dependent on how exactly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861 your particular build of XEmacs was configured.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 @item @code{scrollBarPlacement} (class @code{ScrollBarPlacement}): string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864 Where the horizontal and vertical scrollbars should be positioned. This
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1865 should be one of the four strings @samp{BOTTOM_LEFT},
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1866 @samp{BOTTOM_RIGHT}, @samp{TOP_LEFT}, and @samp{TOP_RIGHT}. Default is
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1867 @samp{BOTTOM_RIGHT} for the Motif and Lucid scrollbars and
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1868 @samp{BOTTOM_LEFT} for the Athena scrollbars.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 @item @code{topToolBarHeight} (class @code{TopToolBarHeight}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 @itemx @code{bottomToolBarHeight} (class @code{BottomToolBarHeight}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 @itemx @code{leftToolBarWidth} (class @code{LeftToolBarWidth}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 @itemx @code{rightToolBarWidth} (class @code{RightToolBarWidth}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874 Height and width of the four possible toolbars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 @item @code{topToolBarShadowColor} (class @code{TopToolBarShadowColor}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 @itemx @code{bottomToolBarShadowColor} (class @code{BottomToolBarShadowColor}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 Color of the top and bottom shadows for the toolbars. NOTE: These resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 do @emph{not} have anything to do with the top and bottom toolbars (i.e. the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880 toolbars at the top and bottom of the frame)! Rather, they affect the top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 and bottom shadows around the edges of all four kinds of toolbars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 @item @code{topToolBarShadowPixmap} (class @code{TopToolBarShadowPixmap}): pixmap-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884 @itemx @code{bottomToolBarShadowPixmap} (class @code{BottomToolBarShadowPixmap}): pixmap-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 Pixmap of the top and bottom shadows for the toolbars. If set, these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 resources override the corresponding color resources. NOTE: These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887 resources do @emph{not} have anything to do with the top and bottom
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 toolbars (i.e. the toolbars at the top and bottom of the frame)!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 Rather, they affect the top and bottom shadows around the edges of all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 four kinds of toolbars.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 @item @code{toolBarShadowThickness} (class @code{ToolBarShadowThickness}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893 Thickness of the shadows around the toolbars, in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895 @item @code{visualBell} (class @code{VisualBell}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 Whether XEmacs should flash the screen rather than making an audible beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 @item @code{bellVolume} (class @code{BellVolume}): integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 Volume of the audible beep.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 @item @code{useBackingStore} (class @code{UseBackingStore}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 Whether XEmacs should set the backing-store attribute of the X windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903 it creates. This increases the memory usage of the X server but decreases
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 the amount of X traffic necessary to update the screen, and is useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 when the connection to the X server goes over a low-bandwidth line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 such as a modem connection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 Emacs devices accept the following resources:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 @item @code{textPointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 The cursor to use when the mouse is over text. This resource is used to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 initialize the variable @code{x-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 @item @code{selectionPointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917 The cursor to use when the mouse is over a selectable text region (an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 extent with the @samp{highlight} property; for example, an Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 cross-reference). This resource is used to initialize the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 @code{x-selection-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 @item @code{spacePointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 The cursor to use when the mouse is over a blank space in a buffer (that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 is, after the end of a line or after the end-of-file). This resource is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 used to initialize the variable @code{x-nontext-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927 @item @code{modeLinePointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 The cursor to use when the mouse is over a modeline. This resource is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929 used to initialize the variable @code{x-mode-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 @item @code{gcPointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 The cursor to display when a garbage-collection is in progress. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 resource is used to initialize the variable @code{x-gc-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 @item @code{scrollbarPointer} (class @code{Cursor}): cursor-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 The cursor to use when the mouse is over the scrollbar. This resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 is used to initialize the variable @code{x-scrollbar-pointer-shape}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 @item @code{pointerColor} (class @code{Foreground}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 @itemx @code{pointerBackground} (class @code{Background}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 The foreground and background colors of the mouse cursor. These
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 resources are used to initialize the variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943 @code{x-pointer-foreground-color} and @code{x-pointer-background-color}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 @node Face Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 @subsection Face Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949 The attributes of faces are also per-frame. They can be specified as:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 Emacs.FACE_NAME.parameter: value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959 Emacs*FRAME_NAME.FACE_NAME.parameter: value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963 Faces accept the following resources:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 @item @code{attributeFont} (class @code{AttributeFont}): font-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967 The font of this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 @item @code{attributeForeground} (class @code{AttributeForeground}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 @itemx @code{attributeBackground} (class @code{AttributeBackground}): color-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 The foreground and background colors of this face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973 @item @code{attributeBackgroundPixmap} (class @code{AttributeBackgroundPixmap}): file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 The name of an @sc{XBM} file (or @sc{XPM} file, if your version of Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 supports @sc{XPM}), to use as a background stipple.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 @item @code{attributeUnderline} (class @code{AttributeUnderline}): boolean
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 Whether text in this face should be underlined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 All text is displayed in some face, defaulting to the face named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 @code{default}. To set the font of normal text, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983 @code{Emacs*default.attributeFont}. To set it in the frame named
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 @code{fred}, use @code{Emacs*fred.default.attributeFont}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 These are the names of the predefined faces:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 @item default
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 Everything inherits from this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 @item bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 If this is not specified in the resource database, Emacs tries to find a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994 bold version of the font of the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 @item italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997 If this is not specified in the resource database, Emacs tries to find
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 an italic version of the font of the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000 @item bold-italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 If this is not specified in the resource database, Emacs tries to find a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 bold-italic version of the font of the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 @item modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005 This is the face that the modeline is displayed in. If not specified in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 the resource database, it is determined from the default face by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 reversing the foreground and background colors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009 @item highlight
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 This is the face that highlighted extents (for example, Info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 cross-references and possible completions, when the mouse passes over
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 them) are displayed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014 @item left-margin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 @itemx right-margin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 These are the faces that the left and right annotation margins are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 displayed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019 @item zmacs-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 This is the face that mouse selections are displayed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 @item isearch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023 This is the face that the matched text being searched for is displayed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 @item info-node
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027 This is the face of info menu items. If unspecified, it is copied from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 @code{bold-italic}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 @item info-xref
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 This is the face of info cross-references. If unspecified, it is copied
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032 from @code{bold}. (Note that, when the mouse passes over a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 cross-reference, the cross-reference's face is determined from a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 combination of the @code{info-xref} and @code{highlight} faces.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 Other packages might define their own faces; to see a list of all faces,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 use any of the interactive face-manipulation commands such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 @code{set-face-font} and type @samp{?} when you are prompted for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 name of a face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042 If the @code{bold}, @code{italic}, and @code{bold-italic} faces are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 specified in the resource database, then XEmacs attempts to derive them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 from the font of the default face. It can only succeed at this if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 have specified the default font using the XLFD (X Logical Font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046 Description) format, which looks like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 If you use any of the other, less strict font name formats, some of which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054 look like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 lucidasanstypewriter-12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 fixed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 9x13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 then XEmacs won't be able to guess the names of the bold and italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 versions. All X fonts can be referred to via XLFD-style names, so you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 should use those forms. See the man pages for @samp{X(1)},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 @samp{xlsfonts(1)}, and @samp{xfontsel(1)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 @node Widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 @subsection Widgets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 There are several structural widgets between the terminal EmacsFrame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071 widget and the top level ApplicationShell; the exact names and types of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 these widgets change from release to release (for example, they changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073 between 19.8 and 19.9, 19.9 and 19.10, and 19.10 and 19.12) and are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 subject to further change in the future, so you should avoid mentioning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 them in your resource database. The above-mentioned syntaxes should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 forward- compatible. As of 19.13, the exact widget hierarchy is as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 INVOCATION-NAME "shell" "container" FRAME-NAME
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 x-emacs-application-class "EmacsShell" "EmacsManager" "EmacsFrame"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084 where INVOCATION-NAME is the terminal component of the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 XEmacs executable (usually @samp{xemacs}), and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 @samp{x-emacs-application-class} is generally @samp{Emacs}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088 @node Menubar Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 @subsection Menubar Resources
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 As the menubar is implemented as a widget which is not a part of XEacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 proper, it does not use the fac" mechanism for specifying fonts and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 colors: It uses whatever resources are appropriate to the type of widget
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 which is used to implement it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 If Emacs was compiled to use only the Motif-lookalike menu widgets, then one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 way to specify the font of the menubar would be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 Emacs*menubar*font: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103 If the Motif library is being used, then one would have to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 Emacs*menubar*fontList: *-courier-medium-r-*-*-*-120-*-*-*-*-*-*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 because the Motif library uses the @code{fontList} resource name instead
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 of @code{font}, which has subtly different semantics.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 The same is true of the scrollbars: They accept whichever resources are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 appropriate for the toolkit in use.