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