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