Sync with r21-2-27.
[chise/xemacs-chise.git] / info / xemacs.info-12
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
2 xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
25
26    Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
31
32 \1f
33 File: xemacs.info,  Node: Fortran Columns,  Next: Fortran Abbrev,  Prev: Fortran Comments,  Up: Fortran
34
35 Columns
36 -------
37
38 `C-c C-r'
39      Displays a "column ruler" momentarily above the current line
40      (`fortran-column-ruler').
41
42 `C-c C-w'
43      Splits the current window horizontally so that it is 72 columns
44      wide.  This may help you avoid going over that limit
45      (`fortran-window-create').
46
47    The command `C-c C-r' (`fortran-column-ruler') shows a column ruler
48 above the current line.  The comment ruler consists of two lines of
49 text that show you the locations of columns with special significance
50 in Fortran programs.  Square brackets show the limits of the columns for
51 line numbers, and curly brackets show the limits of the columns for the
52 statement body.  Column numbers appear above them.
53
54    Note that the column numbers count from zero, as always in XEmacs.
55 As a result, the numbers may not be those you are familiar with; but the
56 actual positions in the line are standard Fortran.
57
58    The text used to display the column ruler is the value of the
59 variable `fortran-comment-ruler'.  By changing this variable, you can
60 change the display.
61
62    For even more help, use `C-c C-w' (`fortran-window-create'), a
63 command which splits the current window horizontally, resulting in a
64 window 72 columns wide.  When you edit in this window, you can
65 immediately see when a line gets too wide to be correct Fortran.
66
67 \1f
68 File: xemacs.info,  Node: Fortran Abbrev,  Prev: Fortran Columns,  Up: Fortran
69
70 Fortran Keyword Abbrevs
71 -----------------------
72
73    Fortran mode provides many built-in abbrevs for common keywords and
74 declarations.  These are the same sort of abbrevs that you can define
75 yourself.  To use them, you must turn on Abbrev mode.  *note Abbrevs::.
76
77    The built-in abbrevs are unusual in one way: they all start with a
78 semicolon.  You cannot normally use semicolon in an abbrev, but Fortran
79 mode makes this possible by changing the syntax of semicolon to "word
80 constituent".
81
82    For example, one built-in Fortran abbrev is `;c' for `continue'.  If
83 you insert `;c' and then insert a punctuation character such as a space
84 or a newline, the `;c' changes automatically to `continue', provided
85 Abbrev mode is enabled.
86
87    Type `;?' or `;C-h' to display a list of all built-in Fortran
88 abbrevs and what they stand for.
89
90 \1f
91 File: xemacs.info,  Node: Asm Mode,  Prev: Fortran,  Up: Programs
92
93 Asm Mode
94 ========
95
96    Asm mode is a major mode for editing files of assembler code.  It
97 defines these commands:
98
99 `<TAB>'
100      `tab-to-tab-stop'.
101
102 `<LFD>'
103      Insert a newline and then indent using `tab-to-tab-stop'.
104
105 `:'
106      Insert a colon and then remove the indentation from before the
107      label preceding colon.  Then do `tab-to-tab-stop'.
108
109 `;'
110      Insert or align a comment.
111
112    The variable `asm-comment-char' specifies which character starts
113 comments in assembler syntax.
114
115 \1f
116 File: xemacs.info,  Node: Running,  Next: Packages,  Prev: Programs,  Up: Top
117
118 Compiling and Testing Programs
119 ******************************
120
121    The previous chapter discusses the Emacs commands that are useful for
122 making changes in programs.  This chapter deals with commands that
123 assist in the larger process of developing and maintaining programs.
124
125 * Menu:
126
127 * Compilation::        Compiling programs in languages other than Lisp
128                         (C, Pascal, etc.)
129 * Modes: Lisp Modes.   Various modes for editing Lisp programs, with
130                        different facilities for running the Lisp programs.
131 * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
132 * Eval: Lisp Eval.     Executing a single Lisp expression in Emacs.
133 * Debug: Lisp Debug.   Debugging Lisp programs running in Emacs.
134 * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
135 * External Lisp::      Communicating through Emacs with a separate Lisp.
136
137 \1f
138 File: xemacs.info,  Node: Compilation,  Next: Lisp Modes,  Prev: Running,  Up: Running
139
140 Running "make", or Compilers Generally
141 ======================================
142
143    Emacs can run compilers for non-interactive languages like C and
144 Fortran as inferior processes, feeding the error log into an Emacs
145 buffer.  It can also parse the error messages and visit the files in
146 which errors are found, moving point to the line where the error
147 occurred.
148
149 `M-x compile'
150      Run a compiler asynchronously under Emacs, with error messages to
151      `*compilation*' buffer.
152
153 `M-x grep'
154      Run `grep' asynchronously under Emacs, with matching lines listed
155      in the buffer named `*compilation*'.
156
157 `M-x kill-compilation'
158      Kill the process made by the `M-x compile' command.
159
160 `M-x kill-grep'
161      Kill the running compilation or `grep' subprocess.
162
163 `C-x `'
164      Visit the next compiler error message or `grep' match.
165
166    To run `make' or another compiler, type `M-x compile'.  This command
167 reads a shell command line using the minibuffer, then executes the
168 specified command line in an inferior shell with output going to the
169 buffer named `*compilation*'.  By default, the current buffer's default
170 directory is used as the working directory for the execution of the
171 command; therefore, the makefile comes from this directory.
172
173    When the shell command line is read, the minibuffer appears
174 containing a default command line (the command you used the last time
175 you typed `M-x compile').  If you type just <RET>, the same command
176 line is used again.  The first `M-x compile' provides `make -k' as the
177 default.  The default is taken from the variable `compile-command'; if
178 the appropriate compilation command for a file is something other than
179 `make -k', it can be useful to have the file specify a local value for
180 `compile-command' (*note File Variables::).
181
182    When you start a compilation, the buffer `*compilation*' is
183 displayed in another window but not selected.  Its mode line displays
184 the word `run' or `exit' in the parentheses to tell you whether
185 compilation is finished.  You do not have to keep this buffer visible;
186 compilation continues in any case.
187
188    To kill the compilation process, type `M-x-kill-compilation'.  The
189 mode line of the `*compilation*' buffer changes to say `signal' instead
190 of `run'.  Starting a new compilation also kills any running
191 compilation, as only one can occur at any time.  Starting a new
192 compilation prompts for confirmation before actually killing a
193 compilation that is running.
194
195    To parse the compiler error messages, type `C-x `' (`next-error').
196 The character following `C-x' is the grave accent, not the single
197 quote.  The command displays the buffer `*compilation*' in one window
198 and the buffer in which the next error occurred in another window.
199 Point in that buffer is moved to the line where the error was found.
200 The corresponding error message is scrolled to the top of the window in
201 which `*compilation*' is displayed.
202
203    The first time you use `C-x `' after the start of a compilation, it
204 parses all the error messages, visits all the files that have error
205 messages, and creates markers pointing at the lines the error messages
206 refer to.  It then moves to the first error message location.
207 Subsequent uses of `C-x `' advance down the data set up by the first
208 use.  When the preparsed error messages are exhausted, the next `C-x `'
209 checks for any more error messages that have come in; this is useful if
210 you start editing compiler errors while compilation is still going on.
211 If no additional error messages have come in, `C-x `' reports an error.
212
213    `C-u C-x `' discards the preparsed error message data and parses the
214 `*compilation*' buffer again, then displays the first error.  This way,
215 you can process the same set of errors again.
216
217    Instead of running a compiler, you can run `grep' and see the lines
218 on which matches were found.  To do this, type `M-x grep' with an
219 argument line that contains the same arguments you would give to
220 `grep': a `grep'-style regexp (usually in single quotes to quote the
221 shell's special characters) followed by filenames, which may use
222 wildcard characters.  The output from `grep' goes in the
223 `*compilation*' buffer.  You can use `C-x `' to find the lines that
224 match as if they were compilation errors.
225
226    Note: a shell is used to run the compile command, but the shell is
227 not run in interactive mode.  In particular, this means that the shell
228 starts up with no prompt.  If you find your usual shell prompt making an
229 unsightly appearance in the `*compilation*' buffer, it means you have
230 made a mistake in your shell's initialization file (`.cshrc' or `.shrc'
231 or ...) by setting the prompt unconditionally.  The shell
232 initialization file should set the prompt only if there already is a
233 prompt.  Here's how to do it in `csh':
234
235      if ($?prompt) set prompt = ...
236
237 \1f
238 File: xemacs.info,  Node: Lisp Modes,  Next: Lisp Libraries,  Prev: Compilation,  Up: Running
239
240 Major Modes for Lisp
241 ====================
242
243    Emacs has four different major modes for Lisp.  They are the same in
244 terms of editing commands, but differ in the commands for executing Lisp
245 expressions.
246
247 Emacs-Lisp mode
248      The mode for editing source files of programs to run in Emacs Lisp.
249      This mode defines `C-M-x' to evaluate the current defun.  *Note
250      Lisp Libraries::.
251
252 Lisp Interaction mode
253      The mode for an interactive session with Emacs Lisp.  It defines
254      <LFD> to evaluate the sexp before point and insert its value in the
255      buffer.  *Note Lisp Interaction::.
256
257 Lisp mode
258      The mode for editing source files of programs that run in other
259      dialects of Lisp than Emacs Lisp.  This mode defines `C-M-x' to
260      send the current defun to an inferior Lisp process.  *Note
261      External Lisp::.
262
263 Inferior Lisp mode
264      The mode for an interactive session with an inferior Lisp process.
265      This mode combines the special features of Lisp mode and Shell mode
266      (*note Shell Mode::).
267
268 Scheme mode
269      Like Lisp mode but for Scheme programs.
270
271 Inferior Scheme mode
272      The mode for an interactive session with an inferior Scheme
273      process.
274
275 \1f
276 File: xemacs.info,  Node: Lisp Libraries,  Next: Lisp Eval,  Prev: Lisp Modes,  Up: Running
277
278 Libraries of Lisp Code for Emacs
279 ================================
280
281    Lisp code for Emacs editing commands is stored in files whose names
282 conventionally end in `.el'.  This ending tells Emacs to edit them in
283 Emacs-Lisp mode (*note Lisp Modes::).
284
285 * Menu:
286
287 * Loading::             Loading libraries of Lisp code into Emacs for use.
288 * Compiling Libraries:: Compiling a library makes it load and run faster.
289 * Mocklisp::            Converting Mocklisp to Lisp so XEmacs can run it.
290
291 \1f
292 File: xemacs.info,  Node: Loading,  Next: Compiling Libraries,  Prev: Lisp Libraries,  Up: Lisp Libraries
293
294 Loading Libraries
295 -----------------
296
297 `M-x load-file FILE'
298      Load the file FILE of Lisp code.
299
300 `M-x load-library LIBRARY'
301      Load the library named LIBRARY.
302
303 `M-x locate-library LIBRARY &optional NOSUFFIX'
304      Show the full path name of Emacs library LIBRARY.
305
306    To execute a file of Emacs Lisp, use `M-x load-file'.  This command
307 reads the file name you provide in the minibuffer, then executes the
308 contents of that file as Lisp code.  It is not necessary to visit the
309 file first; in fact, this command reads the file as found on disk, not
310 the text in an Emacs buffer.
311
312    Once a file of Lisp code is installed in the Emacs Lisp library
313 directories, users can load it using `M-x load-library'.  Programs can
314 load it by calling `load-library', or with `load', a more primitive
315 function that is similar but accepts some additional arguments.
316
317    `M-x load-library' differs from `M-x load-file' in that it searches
318 a sequence of directories and tries three file names in each directory.
319 The three names are: first, the specified name with `.elc' appended;
320 second, the name with `.el' appended; third, the specified name alone.
321 A `.elc' file would be the result of compiling the Lisp file into byte
322 code;  if possible, it is loaded in preference to the Lisp file itself
323 because the compiled file loads and runs faster.
324
325    Because the argument to `load-library' is usually not in itself a
326 valid file name, file name completion is not available.  In fact, when
327 using this command, you usually do not know exactly what file name will
328 be used.
329
330    The sequence of directories searched by `M-x load-library' is
331 specified by the variable `load-path', a list of strings that are
332 directory names.  The elements of this list may not begin with "`~'",
333 so you must call `expand-file-name' on them before adding them to the
334 list.  The default value of the list contains the directory where the
335 Lisp code for Emacs itself is stored.  If you have libraries of your
336 own, put them in a single directory and add that directory to
337 `load-path'.  `nil' in this list stands for the current default
338 directory, but it is probably not a good idea to put `nil' in the list.
339 If you start wishing that `nil' were in the list, you should probably
340 use `M-x load-file' for this case.
341
342    The variable is initialized by the EMACSLOADPATH environment
343 variable. If no value is specified, the variable takes the default value
344 specified in the file `paths.h' when Emacs was built. If a path isn't
345 specified in `paths.h', a default value is obtained from the file
346 system, near the directory in which the Emacs executable resides.
347
348    Like `M-x load-library', `M-x locate-library' searches the
349 directories in `load-path' to find the file that `M-x load-library'
350 would load.  If the optional second argument NOSUFFIX is non-`nil', the
351 suffixes `.elc' or `.el' are not added to the specified name LIBRARY
352 (like calling `load' instead of `load-library').
353
354    You often do not have to give any command to load a library, because
355 the commands defined in the library are set up to "autoload" that
356 library.  Running any of those commands causes `load' to be called to
357 load the library; this replaces the autoload definitions with the real
358 ones from the library.
359
360    If autoloading a file does not finish, either because of an error or
361 because of a `C-g' quit, all function definitions made by the file are
362 undone automatically.  So are any calls to `provide'.  As a
363 consequence, the entire file is loaded a second time if you use one of
364 the autoloadable commands again.  This prevents problems when the
365 command is no longer autoloading but is working incorrectly because the
366 file was only partially loaded.  Function definitions are undone only
367 for autoloading; explicit calls to `load' do not undo anything if
368 loading is not completed.
369
370    The variable `after-load-alist' takes an alist of expressions to be
371 evaluated when particular files are loaded.  Each element has the form
372 `(FILENAME forms...)'.  When `load' is run and the filename argument is
373 FILENAME, the forms in the corresponding element are executed at the
374 end of loading.
375
376    FILENAME must match exactly.  Normally FILENAME is the name of a
377 library, with no directory specified, since that is how load is
378 normally called.  An error in `forms' does not undo the load, but it
379 does prevent execution of the rest of the `forms'.
380
381 \1f
382 File: xemacs.info,  Node: Compiling Libraries,  Next: Mocklisp,  Prev: Loading,  Up: Lisp Libraries
383
384 Compiling Libraries
385 -------------------
386
387    Emacs Lisp code can be compiled into byte-code which loads faster,
388 takes up less space when loaded, and executes faster.
389
390 `M-x batch-byte-compile'
391      Run byte-compile-file on the files remaining on the command line.
392
393 `M-x byte-compile-buffer &optional BUFFER'
394      Byte-compile and evaluate contents of BUFFER (default is current
395      buffer).
396
397 `M-x byte-compile-file'
398      Compile a file of Lisp code named FILENAME into a file of byte
399      code.
400
401 `M-x byte-compile-and-load-file FILENAME'
402      Compile a file of Lisp code named FILENAME into a file of byte
403      code and load it.
404
405 `M-x byte-recompile-directory DIRECTORY'
406      Recompile every `.el' file in DIRECTORY that needs recompilation.
407
408 `M-x disassemble'
409      Print disassembled code for OBJECT on (optional) STREAM.
410
411 `M-x make-obsolete FUNCTION NEW'
412      Make the byte-compiler warn that FUNCTION is obsolete and NEW
413      should be used instead.
414
415    `byte-compile-file' creates a byte-code compiled file from an
416 Emacs-Lisp source file.  The default argument for this function is the
417 file visited in the current buffer.  The function reads the specified
418 file, compiles it into byte code, and writes an output file whose name
419 is made by appending `c' to the input file name.  Thus, the file
420 `rmail.el' would be compiled into `rmail.elc'. To compile a file of
421 Lisp code named FILENAME into a file of byte code and then load it, use
422 `byte-compile-and-load-file'. To compile and evaluate Lisp code in a
423 given buffer, use `byte-compile-buffer'.
424
425    To recompile all changed Lisp files in a directory, use `M-x
426 byte-recompile-directory'.  Specify just the directory name as an
427 argument.  Each `.el' file that has been byte-compiled before is
428 byte-compiled again if it has changed since the previous compilation.
429 A numeric argument to this command tells it to offer to compile each
430 `.el' file that has not been compiled yet.  You must answer `y' or `n'
431 to each offer.
432
433    You can use the function `batch-byte-compile' to invoke Emacs
434 non-interactively from the shell to do byte compilation.  When you use
435 this function, the files to be compiled are specified with command-line
436 arguments.  Use a shell command of the form:
437
438      emacs -batch -f batch-byte-compile FILES...
439
440    Directory names may also be given as arguments; in that case,
441 `byte-recompile-directory' is invoked on each such directory.
442 `batch-byte-compile' uses all remaining command-line arguments as file
443 or directory names, then kills the Emacs process.
444
445    `M-x disassemble' explains the result of byte compilation.  Its
446 argument is a function name.  It displays the byte-compiled code in a
447 help window in symbolic form, one instruction per line.  If the
448 instruction refers to a variable or constant, that is shown, too.
449
450 \1f
451 File: xemacs.info,  Node: Mocklisp,  Prev: Compiling Libraries,  Up: Lisp Libraries
452
453 Converting Mocklisp to Lisp
454 ---------------------------
455
456    XEmacs can run Mocklisp files by converting them to Emacs Lisp first.
457 To convert a Mocklisp file, visit it and then type `M-x
458 convert-mocklisp-buffer'.  Then save the resulting buffer of Lisp file
459 in a file whose name ends in `.el' and use the new file as a Lisp
460 library.
461
462    You cannot currently byte-compile converted Mocklisp code.  The
463 reason is that converted Mocklisp code uses some special Lisp features
464 to deal with Mocklisp's incompatible ideas of how arguments are
465 evaluated and which values signify "true" or "false".
466
467 \1f
468 File: xemacs.info,  Node: Lisp Eval,  Next: Lisp Debug,  Prev: Lisp Libraries,  Up: Running
469
470 Evaluating Emacs-Lisp Expressions
471 =================================
472
473    Lisp programs intended to be run in Emacs should be edited in
474 Emacs-Lisp mode; this will happen automatically for file names ending in
475 `.el'.  By contrast, Lisp mode itself should be used for editing Lisp
476 programs intended for other Lisp systems.  Emacs-Lisp mode can be
477 selected with the command `M-x emacs-lisp-mode'.
478
479    For testing of Lisp programs to run in Emacs, it is useful to be able
480 to evaluate part of the program as it is found in the Emacs buffer.  For
481 example, if you change the text of a Lisp function definition and then
482 evaluate the definition, Emacs installs the change for future calls to
483 the function.  Evaluation of Lisp expressions is also useful in any
484 kind of editing task for invoking non-interactive functions (functions
485 that are not commands).
486
487 `M-<ESC>'
488      Read a Lisp expression in the minibuffer, evaluate it, and print
489      the value in the minibuffer (`eval-expression').
490
491 `C-x C-e'
492      Evaluate the Lisp expression before point, and print the value in
493      the minibuffer (`eval-last-sexp').
494
495 `C-M-x'
496      Evaluate the defun containing point or after point, and print the
497      value in the minibuffer (`eval-defun').
498
499 `M-x eval-region'
500      Evaluate all the Lisp expressions in the region.
501
502 `M-x eval-current-buffer'
503      Evaluate all the Lisp expressions in the buffer.
504
505    `M-<ESC>' (`eval-expression') is the most basic command for
506 evaluating a Lisp expression interactively.  It reads the expression
507 using the minibuffer, so you can execute any expression on a buffer
508 regardless of what the buffer contains.  When evaluation is complete,
509 the current buffer is once again the buffer that was current when
510 `M-<ESC>' was typed.
511
512    `M-<ESC>' can easily confuse users, especially on keyboards with
513 autorepeat, where it can result from holding down the <ESC> key for too
514 long.  Therefore, `eval-expression' is normally a disabled command.
515 Attempting to use this command asks for confirmation and gives you the
516 option of enabling it; once you enable the command, you are no longer
517 required to confirm.  *Note Disabling::.
518
519    In Emacs-Lisp mode, the key `C-M-x' is bound to the function
520 `eval-defun', which parses the defun containing point or following point
521 as a Lisp expression and evaluates it.  The value is printed in the echo
522 area.  This command is convenient for installing in the Lisp environment
523 changes that you have just made in the text of a function definition.
524
525    The command `C-x C-e' (`eval-last-sexp') performs a similar job but
526 is available in all major modes, not just Emacs-Lisp mode.  It finds
527 the sexp before point, reads it as a Lisp expression, evaluates it, and
528 prints the value in the echo area.  It is sometimes useful to type in an
529 expression and then, with point still after it, type `C-x C-e'.
530
531    If `C-M-x' or `C-x C-e' are given a numeric argument, they print the
532 value by inserting it into the current buffer at point, rather than in
533 the echo area.  The argument value does not matter.
534
535    The most general command for evaluating Lisp expressions from a
536 buffer is `eval-region'.  `M-x eval-region' parses the text of the
537 region as one or more Lisp expressions, evaluating them one by one.
538 `M-x eval-current-buffer' is similar, but it evaluates the entire
539 buffer.  This is a reasonable way to install the contents of a file of
540 Lisp code that you are just ready to test.  After finding and fixing a
541 bug, use `C-M-x' on each function that you change, to keep the Lisp
542 world in step with the source file.
543
544 \1f
545 File: xemacs.info,  Node: Lisp Debug,  Next: Lisp Interaction,  Prev: Lisp Eval,  Up: Running
546
547 The Emacs-Lisp Debugger
548 =======================
549
550    XEmacs contains a debugger for Lisp programs executing inside it.
551 This debugger is normally not used; many commands frequently get Lisp
552 errors when invoked in inappropriate contexts (such as `C-f' at the end
553 of the buffer) and it would be unpleasant to enter a special debugging
554 mode in this case.  When you want to make Lisp errors invoke the
555 debugger, you must set the variable `debug-on-error' to non-`nil'.
556 Quitting with `C-g' is not considered an error, and `debug-on-error'
557 has no effect on the handling of `C-g'.  However, if you set
558 `debug-on-quit' to be non-`nil', `C-g' will invoke the debugger.  This
559 can be useful for debugging an infinite loop; type `C-g' once the loop
560 has had time to reach its steady state.  `debug-on-quit' has no effect
561 on errors.
562
563    You can make Emacs enter the debugger when a specified function is
564 called or at a particular place in Lisp code.  Use `M-x debug-on-entry'
565 with argument FUN-NAME to have Emacs enter the debugger as soon as
566 FUN-NAME is called. Use `M-x cancel-debug-on-entry' to make the
567 function stop entering the debugger when called.  (Redefining the
568 function also does this.)  To enter the debugger from some other place
569 in Lisp code, you must insert the expression `(debug)' there and
570 install the changed code with `C-M-x'.  *Note Lisp Eval::.
571
572    When the debugger is entered, it displays the previously selected
573 buffer in one window and a buffer named `*Backtrace*' in another
574 window.  The backtrace buffer contains one line for each level of Lisp
575 function execution currently going on.  At the beginning of the buffer
576 is a message describing the reason that the debugger was invoked, for
577 example, an error message if it was invoked due to an error.
578
579    The backtrace buffer is read-only and is in Backtrace mode, a special
580 major mode in which letters are defined as debugger commands.  The
581 usual Emacs editing commands are available; you can switch windows to
582 examine the buffer that was being edited at the time of the error, and
583 you can switch buffers, visit files, and perform any other editing
584 operations.  However, the debugger is a recursive editing level (*note
585 Recursive Edit::); it is a good idea to return to the backtrace buffer
586 and explictly exit the debugger when you don't want to use it any more.
587 Exiting the debugger kills the backtrace buffer.
588
589    The contents of the backtrace buffer show you the functions that are
590 executing and the arguments that were given to them.  It also allows you
591 to specify a stack frame by moving point to the line describing that
592 frame.  The frame whose line point is on is considered the "current
593 frame".  Some of the debugger commands operate on the current frame.
594 Debugger commands are mainly used for stepping through code one
595 expression at a time.  Here is a list of them:
596
597 `c'
598      Exit the debugger and continue execution.  In most cases,
599      execution of the program continues as if the debugger had never
600      been entered (aside from the effect of any variables or data
601      structures you may have changed while inside the debugger).  This
602      includes entry to the debugger due to function entry or exit,
603      explicit invocation, and quitting or certain errors.  Most errors
604      cannot be continued; trying to continue an error usually causes
605      the same error to occur again.
606
607 `d'
608      Continue execution, but enter the debugger the next time a Lisp
609      function is called.  This allows you to step through the
610      subexpressions of an expression, and see what the subexpressions
611      do and what values they compute.
612
613      When you enter the debugger this way, Emacs flags the stack frame
614      for the function call from which you entered.  The same function
615      is then called when you exit the frame.  To cancel this flag, use
616      `u'.
617
618 `b'
619      Set up to enter the debugger when the current frame is exited.
620      Frames that invoke the debugger on exit are flagged with stars.
621
622 `u'
623      Don't enter the debugger when the current frame is exited.  This
624      cancels a `b' command on a frame.
625
626 `e'
627      Read a Lisp expression in the minibuffer, evaluate it, and print
628      the value in the echo area.  This is equivalent to the command
629      `M-<ESC>', except that `e' is not normally disabled like `M-<ESC>'.
630
631 `q'
632      Terminate the program being debugged; return to top-level Emacs
633      command execution.
634
635      If the debugger was entered due to a `C-g' but you really want to
636      quit, not to debug, use the `q' command.
637
638 `r'
639      Return a value from the debugger.  The value is computed by
640      reading an expression with the minibuffer and evaluating it.
641
642      The value returned by the debugger makes a difference when the
643      debugger was invoked due to exit from a Lisp call frame (as
644      requested with `b'); then the value specified in the `r' command
645      is used as the value of that frame.
646
647      The debugger's return value also matters with many errors.  For
648      example, `wrong-type-argument' errors will use the debugger's
649      return value instead of the invalid argument; `no-catch' errors
650      will use the debugger value as a throw tag instead of the tag that
651      was not found.  If an error was signaled by calling the Lisp
652      function `signal', the debugger's return value is returned as the
653      value of `signal'.
654
655 \1f
656 File: xemacs.info,  Node: Lisp Interaction,  Next: External Lisp,  Prev: Lisp Debug,  Up: Running
657
658 Lisp Interaction Buffers
659 ========================
660
661    The buffer `*scratch*', which is selected when Emacs starts up, is
662 provided for evaluating Lisp expressions interactively inside Emacs.
663 Both the expressions you evaluate and their output goes in the buffer.
664
665    The `*scratch*' buffer's major mode is Lisp Interaction mode, which
666 is the same as Emacs-Lisp mode except for one command, <LFD>.  In
667 Emacs-Lisp mode, <LFD> is an indentation command.  In Lisp Interaction
668 mode, <LFD> is bound to `eval-print-last-sexp'.  This function reads
669 the Lisp expression before point, evaluates it, and inserts the value
670 in printed representation before point.
671
672    The way to use the `*scratch*' buffer is to insert Lisp expressions
673 at the end, ending each one with <LFD> so that it will be evaluated.
674 The result is a complete typescript of the expressions you have
675 evaluated and their values.
676
677    The rationale for this feature is that Emacs must have a buffer when
678 it starts up, but that buffer is not useful for editing files since a
679 new buffer is made for every file that you visit.  The Lisp interpreter
680 typescript is the most useful thing I can think of for the initial
681 buffer to do.  `M-x lisp-interaction-mode' will put any buffer in Lisp
682 Interaction mode.
683
684 \1f
685 File: xemacs.info,  Node: External Lisp,  Prev: Lisp Interaction,  Up: Running
686
687 Running an External Lisp
688 ========================
689
690    Emacs has facilities for running programs in other Lisp systems.
691 You can run a Lisp process as an inferior of Emacs, and pass
692 expressions to it to be evaluated.  You can also pass changed function
693 definitions directly from the Emacs buffers in which you edit the Lisp
694 programs to the inferior Lisp process.
695
696    To run an inferior Lisp process, type `M-x run-lisp'.  This runs the
697 program named `lisp', the same program you would run by typing `lisp'
698 as a shell command, with both input and output going through an Emacs
699 buffer named `*lisp*'.  In other words, any "terminal output" from Lisp
700 will go into the buffer, advancing point, and any "terminal input" for
701 Lisp comes from text in the buffer.  To give input to Lisp, go to the
702 end of the buffer and type the input, terminated by <RET>.  The
703 `*lisp*' buffer is in Inferior Lisp mode, which has all the special
704 characteristics of Lisp mode and Shell mode (*note Shell Mode::).
705
706    Use Lisp mode to run the source files of programs in external Lisps.
707 You can select this mode with `M-x lisp-mode'.  It is used automatically
708 for files whose names end in `.l' or `.lisp', as most Lisp systems
709 usually expect.
710
711    When you edit a function in a Lisp program you are running, the
712 easiest way to send the changed definition to the inferior Lisp process
713 is the key `C-M-x'.  In Lisp mode, this key runs the function
714 `lisp-send-defun', which finds the defun around or following point and
715 sends it as input to the Lisp process.  (Emacs can send input to any
716 inferior process regardless of what buffer is current.)
717
718    Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
719 to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
720 programs to be run in Emacs): in both modes it has the effect of
721 installing the function definition that point is in, but the way of
722 doing so is different according to where the relevant Lisp environment
723 is found.  *Note Lisp Modes::.
724
725 \1f
726 File: xemacs.info,  Node: Packages,  Next: Abbrevs,  Prev: Running,  Up: Top
727
728 Packages
729 ========
730
731    The XEmacs 21 distribution comes only with a very basic set of
732 built-in modes and packages.  Most of the packages that were part of
733 the distribution of earlier versions of XEmacs are now available
734 separately.  The installer as well as the user can choose which
735 packages to install; the actual installation process is easy.  This
736 gives an installer the ability to tailor an XEmacs installation for
737 local needs with safe removal of unnecessary code.
738
739 * Menu:
740
741 * Package Terminology:: Understanding different kinds of packages.
742 * Using Packages::      How to install and use packages.
743 * Building Packages::   Building packages from sources.
744
745 \1f
746 File: xemacs.info,  Node: Package Terminology,  Next: Using Packages,  Up: Packages
747
748 Package Flavors
749 ---------------
750
751    There are two main flavors of packages.
752
753    * Regular Packages A regular package is one in which multiple files
754      are involved and one may not in general safely remove any of them.
755
756    * Single-File Packages A single-file package is an aggregate
757      collection of thematically related but otherwise independent lisp
758      files.  These files are bundled together for download convenience
759      and individual files may be deleted at will without any loss of
760      functionality.
761
762 Package Distributions
763 ---------------------
764
765    XEmacs Lisp packages are distributed in two ways, depending on the
766 intended use.  Binary Packages are for installers and end-users and may
767 be installed directly into an XEmacs package directory.  Source Packages
768 are for developers and include all files necessary for rebuilding
769 bytecompiled lisp and creating tarballs for distribution.
770
771 Binary Packages
772 ---------------
773
774    Binary packages may be installed directly into an XEmacs package
775 hierarchy.
776
777 Source Packages
778 ---------------
779
780    Source packages contain all of the Package author's (where
781 appropriate in regular packages) source code plus all of the files
782 necessary to build distribution tarballs (Unix Tar format files,
783 gzipped for space savings).
784
785 \1f
786 File: xemacs.info,  Node: Using Packages,  Next: Building Packages,  Prev: Package Terminology,  Up: Packages
787
788 Getting Started
789 ---------------
790
791    When you first download XEmacs 21, you will usually first grab the
792 "core distribution", a file called `xemacs-21.0.tar.gz'. (Replace the
793 21.0 by the current version number.)  The core distribution contains
794 the sources of XEmacs and a minimal set of Emacs Lisp files, which are
795 in the subdirectory named `lisp'.  This subdirectory used to contain
796 all Emacs Lisp files distributed with XEmacs.  Now, to conserve disk
797 space, most non-essential packages were made optional.
798
799 Choosing the Packages You Need
800 ------------------------------
801
802    The available packages can currently be found in the same ftp
803 directory where you grabbed the core distribution from, and are located
804 in the subdirectory `packages/binary-packages'.  Package file names
805 follow the naming convention `<package-name>-<version>-pkg.tar.gz'.
806
807    If you have EFS *Note (EFS)::, packages can be installed over the
808 network.  Alternatively, if you have copies of the packages locally,
809 you can install packages from a local disk or CDROM.
810
811    The file `etc/PACKAGES' in the core distribution contains a list of
812 the packages available at the time of the XEmacs release.  Packages are
813 also listed on the `Options' menu under:
814
815         Options->Customize->Emacs->Packages
816
817    However, don't select any of these menu picks unless you actually
818 want to install the given package (and have properly configured your
819 system to do so).
820
821    You can also get a list of available packages, and whether or not
822 they are installed, using the visual package browser and installer.
823 You can access it via the menus:
824
825         Options->Manage Packages->List & Install
826
827    Or, you can get to it via the keyboard:
828
829      M-x pui-list-packages
830
831    Hint to system administrators of multi-user systems: it might be a
832 good idea to install all packages and not interfere with the wishes of
833 your users.
834
835    If you can't find which package provides the feature you require, try
836 using the `package-get-package-provider' function. Eg., if you know
837 that you need `thingatpt', type:
838
839      M-x package-get-package-provider RET thingatpt
840
841    which will return something like (fsf-compat "1.06"). You can the use
842 one of the methods above for installing the package you want.
843
844 XEmacs and Installing Packages
845 ------------------------------
846
847    Normally, packages are installed over the network, using EFS *Note
848 (EFS)::.  However, you may not have network access, or you may already
849 have some or all of the packages on a local disk, such as a CDROM.  If
850 you want to install from a local disk, you must first tell XEmacs where
851 to find the package binaries.  This is done by adding a line like the
852 following to your `.emacs' file:
853
854      (setq package-get-remote (cons (list nil "/my/path/to/package/binaries")
855                                     package-get-remote))
856
857    Here, you'd change `/my/path/to/package/binaries' to be the path to
858 your local package binaries.  Next, restart XEmacs, and you're ready to
859 go (advanced users can just re-evaluate the sexp).
860
861    If you are installing from a temporary, one-time directory, you can
862 also add these directory names to `package-get-remote' using:
863
864         M-x pui-add-install-directory
865
866    Note, however, that any directories added using this function are not
867 saved; this information will be lost when you quit XEmacs.
868
869    If you're going to install over the network, you only have to insure
870 that EFS *Note (EFS):: works, and that it can get outside a firewall, if
871 you happen to be behind one.  You shouldn't have to do anything else;
872 XEmacs already knows where to go. However you can add your own mirrors
873 to this list. See `package-get-remote'.
874
875    The easiest way to install a package is to use the visual package
876 browser and installer, using the menu pick:
877
878         Options->Manage Packages->List & Install
879    or
880         Options->Manage Packages->Using Custom->Select-> ...
881
882    You can also access it using the keyboard:
883
884      M-x pui-list-packages
885
886    The visual package browser will then display a list of all packages.
887 Help information will be displayed at the very bottom of the buffer; you
888 may have to scroll down to see it.  You can also press `?' to get the
889 same help.  From this buffer, you can tell the package status by the
890 character in the first column:
891
892 `-'
893      The package has not been installed.
894
895 `*'
896      The package has been installed, but a newer version is available.
897      The current version is out-of-date.
898
899 `+'
900      The package has been marked for installation/update.
901
902    If there is no character in the first column, the package has been
903 installed and is up-to-date.
904
905    From here, you can select or unselect packages for installation using
906 the <RET> key, the `Mouse-2' button or selecting "Select" from the
907 (Popup) Menu.  Once you've finished selecting the packages, you can
908 press the `x' key (or use the menu) to actually install the packages.
909 Note that you will have to restart XEmacs for XEmacs to recognize any
910 new packages.
911
912    Key summary:
913
914 `?'
915      Display simple help.
916
917 `<RET>'
918 `<Mouse-2>'
919      Toggle between selecting and unselecting a package for
920      installation.
921
922 `x'
923      Install selected packages.
924
925 `<SPC>'
926      View, in the minibuffer, additional information about the package,
927      such as the package date (not the build date) and the package
928      author.  Moving the mouse over a package name will also do the
929      same thing.
930
931 `v'
932      Toggle between verbose and non-verbose package display.
933
934 `g'
935      Refresh the package display.
936
937 `q'
938      Kill the package buffer.
939
940    Moving the mouse over a package will also cause additional
941 information about the package to be displayed in the minibuffer.
942
943 Other package installation interfaces
944 -------------------------------------
945
946    For an alternative package interface, you can select packages from
947 the customize menus, under:
948
949         Options->Customize->Emacs->Packages-> ...
950    or
951         Options->Manage Packages->Using Custom->Select-> ...
952
953    Set their state to on, and then do:
954
955         Options->Manage Packages->Using Custom->Update Packages
956
957    This will automatically retrieve the packages you have selected from
958 the XEmacs ftp site or your local disk, and install them into XEmacs.
959 Additionally it will update any packages you already have installed to
960 the newest version.  Note that if a package is newly installed you will
961 have to restart XEmacs for the change to take effect.
962
963    You can also install packages using a semi-manual interface:
964
965      M-x package-get-all <return>
966
967    Enter the name of the package (e.g., `prog-modes'), and XEmacs will
968 search for the latest version (as listed in the lisp file
969 `lisp/package-get-base.el'), and install it and any packages that it
970 depends upon.
971
972 Manual Binary Package Installation
973 ----------------------------------
974
975    Pre-compiled, binary packages can be installed in either a system
976 package directory (this is determined when XEmacs is compiled), or in
977 one of the following subdirectories of your `$HOME' directory:
978
979      ~/.xemacs/mule-packages
980      ~/.xemacs/xemacs-packages
981
982    Packages in the former directory will only be found by a Mule-enabled
983 XEmacs.
984
985    XEmacs does not have to be running to install binary packages,
986 although XEmacs will not know about any newly-installed packages until
987 you restart XEmacs.  Note, however, that installing a newer version of a
988 package while XEmacs is running could cause strange errors in XEmacs;
989 it's best to exit XEmacs before upgrading an existing package.
990
991    To install binary packages manually:
992
993   1. Download the package(s) that you want to install.  Each binary
994      package will typically be a gzip'd tarball.
995
996   2. Decide where to install the packages: in the system package
997      directory, or in `~/.xemacs/mule-packages' or
998      `~/.xemacs/xemacs-packages', respectively.  If you want to install
999      the packages in the system package directory, make sure you can
1000      write into that directory.  If you want to install in your `$HOME'
1001      directory, create the directory, `~/.xemacs/mule-packages' or
1002      `~/.xemacs/xemacs-packages', respectively.
1003
1004   3. Next, `cd' to the directory under which you want to install the
1005      package(s).
1006
1007   4. From this directory, uncompress and extract each of the gzip'd
1008      tarballs that you downloaded in step 1.  Unix and Cygnus cygwin
1009      users will typically do this using the commands:
1010
1011                 gunzip < package.tar.gz | tar xvf -
1012
1013      Above, replace `package.tar.gz' with the filename of the package
1014      that you downloaded in step 1.
1015
1016      Of course, if you use GNU `tar', you could also use:
1017
1018                 tar xvzf package.tar.gz
1019
1020   5. That's it.  Quit and restart XEmacs to get it to recognize any new
1021      or changed packages.
1022
1023
1024 \1f
1025 File: xemacs.info,  Node: Building Packages,  Prev: Using Packages,  Up: Packages
1026
1027    Source packages are available from the `packages/source-packages'
1028 subdirectory of your favorite XEmacs distribution site.  Alternatively,
1029 they are available via CVS from `cvs.xemacs.org'.  Look at
1030 `http://cvs.xemacs.org' for instructions.
1031
1032 Prerequisites for Building Source Packages
1033 ------------------------------------------
1034
1035    You must have GNU `cp', GNU `install' (or a BSD compatible `install'
1036 program) GNU `make' (3.75 or later preferred), `makeinfo' (1.68 from
1037 `texinfo-3.11' or later required), GNU `tar' and XEmacs 21.0.  The
1038 source packages will untar into a correct directory structure.  At the
1039 top level you must have `XEmacs.rules' and `package-compile.el'.  These
1040 files are available from the XEmacs FTP site from the same place you
1041 obtained your source package distributions.
1042
1043 What You Can Do With Source Packages
1044 ------------------------------------
1045
1046    NB:  A global build operation doesn't exist yet as of 13 January
1047 1998.
1048
1049    Source packages are most useful for creating XEmacs package tarballs
1050 for installation into your own XEmacs installations or for distributing
1051 to others.
1052
1053    Supported operations from `make' are:
1054
1055 `clean'
1056      Remove all built files except `auto-autoloads.el' and
1057      `custom-load.el'.
1058
1059 `distclean'
1060      Remove XEmacs backups as well as the files deleted by `make clean'.
1061
1062 `all'
1063      Bytecompile all files, build and bytecompile byproduct files like
1064      `auto-autoloads.el' and `custom-load.el'.  Create info version of
1065      TeXinfo documentation if present.
1066
1067 `srckit'
1068      Usually aliased to `make srckit-std'.  This does a `make
1069      distclean' and creates a package source tarball in the staging
1070      directory.  This is generally only of use for package maintainers.
1071
1072 `binkit'
1073      May be aliased to `binkit-sourceonly', `binkit-sourceinfo',
1074      `binkit-sourcedata', or `binkit-sourcedatainfo'. `sourceonly'
1075      indicates there is nothing to install in a data directory or info
1076      directory.  `sourceinfo' indicates that source and info files are
1077      to be installed.  `sourcedata' indicates that source and etc
1078      (data) files are to be installed.  `sourcedatainfo' indicates
1079      source, etc (data), and info files are to be installed.  A few
1080      packages have needs beyond the basic templates so this is not yet
1081      complete.
1082
1083 `dist'
1084      Runs the rules `srckit' followed by `binkit'.  This is primarily
1085      of use by XEmacs maintainers producing files for distribution.
1086
1087 \1f
1088 File: xemacs.info,  Node: Abbrevs,  Next: Picture,  Prev: Packages,  Up: Top
1089
1090 Abbrevs
1091 *******
1092
1093    An "abbrev" is a word which "expands" into some different text.
1094 Abbrevs are defined by the user to expand in specific ways.  For
1095 example, you might define `foo' as an abbrev expanding to `find outer
1096 otter'.  With this abbrev defined, you would be able to get `find outer
1097 otter ' into the buffer by typing `f o o <SPC>'.
1098
1099    Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
1100 Disabling Abbrev mode does not cause abbrev definitions to be discarded,
1101 but they do not expand until Abbrev mode is enabled again.  The command
1102 `M-x abbrev-mode' toggles Abbrev mode; with a numeric argument, it
1103 turns Abbrev mode on if the argument is positive, off otherwise.  *Note
1104 Minor Modes::.  `abbrev-mode' is also a variable; Abbrev mode is on
1105 when the variable is non-`nil'.  The variable `abbrev-mode'
1106 automatically becomes local to the current buffer when it is set.
1107
1108    Abbrev definitions can be "mode-specific"--active only in one major
1109 mode.  Abbrevs can also have "global" definitions that are active in
1110 all major modes.  The same abbrev can have a global definition and
1111 various mode-specific definitions for different major modes.  A
1112 mode-specific definition for the current major mode overrides a global
1113 definition.
1114
1115    You can define Abbrevs interactively during an editing session.  You
1116 can also save lists of abbrev definitions in files and reload them in
1117 later sessions.  Some users keep extensive lists of abbrevs that they
1118 load in every session.
1119
1120    A second kind of abbreviation facility is called the "dynamic
1121 expansion".  Dynamic abbrev expansion happens only when you give an
1122 explicit command and the result of the expansion depends only on the
1123 current contents of the buffer.  *Note Dynamic Abbrevs::.
1124
1125 * Menu:
1126
1127 * Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
1128 * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
1129 * Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
1130 * Saving Abbrevs::    Saving the entire list of abbrevs for another session.
1131 * Dynamic Abbrevs::   Abbreviations for words already in the buffer.
1132
1133 \1f
1134 File: xemacs.info,  Node: Defining Abbrevs,  Next: Expanding Abbrevs,  Prev: Abbrevs,  Up: Abbrevs
1135
1136 Defining Abbrevs
1137 ================
1138
1139 `C-x a g'
1140      Define an abbrev to expand into some text before point
1141      (`add-global-abbrev').
1142
1143 `C-x a l'
1144      Similar, but define an abbrev available only in the current major
1145      mode (`add-mode-abbrev').
1146
1147 `C-x a i g'
1148      Define a word in the buffer as an abbrev
1149      (`inverse-add-global-abbrev').
1150
1151 `C-x a i l'
1152      Define a word in the buffer as a mode-specific abbrev
1153      (`inverse-add-mode-abbrev').
1154
1155 `M-x kill-all-abbrevs'
1156      After this command, no abbrev definitions remain in effect.
1157
1158    The usual way to define an abbrev is to enter the text you want the
1159 abbrev to expand to, position point after it, and type `C-x a g'
1160 (`add-global-abbrev').  This reads the abbrev itself using the
1161 minibuffer, and then defines it as an abbrev for one or more words
1162 before point.  Use a numeric argument to say how many words before point
1163 should be taken as the expansion.  For example, to define the abbrev
1164 `foo' as in the example above, insert the text `find outer otter', then
1165 type
1166 `C-u 3 C-x a g f o o <RET>'.
1167
1168    An argument of zero to `C-x a g' means to use the contents of the
1169 region as the expansion of the abbrev being defined.
1170
1171    The command `C-x a l' (`add-mode-abbrev') is similar, but defines a
1172 mode-specific abbrev.  Mode-specific abbrevs are active only in a
1173 particular major mode.  `C-x a l' defines an abbrev for the major mode
1174 in effect at the time `C-x a l' is typed.  The arguments work the same
1175 way they do for `C-x a g'.
1176
1177    If the text of an abbrev you want is already in the buffer instead of
1178 the expansion, use command `C-x a i g' (`inverse-add-global-abbrev')
1179 instead of `C-x a g', or use `C-x a i l' (`inverse-add-mode-abbrev')
1180 instead of `C-x a l'.  These commands are called "inverse" because they
1181 invert the meaning of the argument found in the buffer and the argument
1182 read using the minibuffer.
1183
1184    To change the definition of an abbrev, just add the new definition.
1185 You will be asked to confirm if the abbrev has a prior definition.  To
1186 remove an abbrev definition, give a negative argument to `C-x a g' or
1187 `C-x a l'.  You must choose the command to specify whether to kill a
1188 global definition or a mode-specific definition for the current mode,
1189 since those two definitions are independent for one abbrev.
1190
1191    `M-x kill-all-abbrevs' removes all existing abbrev definitions.
1192