Sync with r21-2-35.
[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 Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
34
35 Fortran Indentation
36 -------------------
37
38    Special commands and features are available for indenting Fortran
39 code.  They make sure various syntactic entities (line numbers, comment
40 line indicators, and continuation line flags) appear in the columns
41 that are required for standard Fortran.
42
43 * Menu:
44
45 * Commands: ForIndent Commands. Commands for indenting Fortran.
46 * Numbers:  ForIndent Num.      How line numbers auto-indent.
47 * Conv:     ForIndent Conv.     Conventions you must obey to avoid trouble.
48 * Vars:     ForIndent Vars.     Variables controlling Fortran indent style.
49
50 \1f
51 File: xemacs.info,  Node: ForIndent Commands,  Next: ForIndent Num,  Prev: Fortran Indent,  Up: Fortran Indent
52
53 Fortran Indentation Commands
54 ............................
55
56 `<TAB>'
57      Indent the current line (`fortran-indent-line').
58
59 `M-<LFD>'
60      Break the current line and set up a continuation line.
61
62 `C-M-q'
63      Indent all the lines of the subprogram point is in
64      (`fortran-indent-subprogram').
65
66    <TAB> is redefined by Fortran mode to reindent the current line for
67 Fortran (`fortran-indent-line').  Line numbers and continuation markers
68 are indented to their required columns, and the body of the statement
69 is independently indented, based on its nesting in the program.
70
71    The key `C-M-q' is redefined as `fortran-indent-subprogram', a
72 command that reindents all the lines of the Fortran subprogram
73 (function or subroutine) containing point.
74
75    The key `M-<LFD>' is redefined as `fortran-split-line', a command to
76 split a line in the appropriate fashion for Fortran.  In a non-comment
77 line, the second half becomes a continuation line and is indented
78 accordingly.  In a comment line, both halves become separate comment
79 lines.
80
81 \1f
82 File: xemacs.info,  Node: ForIndent Num,  Next: ForIndent Conv,  Prev: ForIndent Commands,  Up: Fortran Indent
83
84 Line Numbers and Continuation
85 .............................
86
87    If a number is the first non-whitespace in the line, it is assumed
88 to be a line number and is moved to columns 0 through 4.  (Columns are
89 always counted from 0 in XEmacs.)  If the text on the line starts with
90 the conventional Fortran continuation marker `$', it is moved to column
91 5.  If the text begins with any non whitespace character in column 5,
92 it is assumed to be an unconventional continuation marker and remains
93 in column 5.
94
95    Line numbers of four digits or less are normally indented one space.
96 This amount is controlled by the variable `fortran-line-number-indent',
97 which is the maximum indentation a line number can have.  Line numbers
98 are indented to right-justify them to end in column 4 unless that would
99 require more than the maximum indentation.  The default value of the
100 variable is 1.
101
102    Simply inserting a line number is enough to indent it according to
103 these rules.  As each digit is inserted, the indentation is recomputed.
104 To turn off this feature, set the variable
105 `fortran-electric-line-number' to `nil'.  Then inserting line numbers
106 is like inserting anything else.
107
108 \1f
109 File: xemacs.info,  Node: ForIndent Conv,  Next: ForIndent Vars,  Prev: ForIndent Num,  Up: Fortran Indent
110
111 Syntactic Conventions
112 .....................
113
114    Fortran mode assumes that you follow certain conventions that
115 simplify the task of understanding a Fortran program well enough to
116 indent it properly:
117
118    * Two nested `do' loops never share a `continue' statement.
119
120    * The same character appears in column 5 of all continuation lines.
121      It is the value of the variable `fortran-continuation-char'.  By
122      default, this character is `$'.
123
124 If you fail to follow these conventions, the indentation commands may
125 indent some lines unaesthetically.  However, a correct Fortran program
126 will retain its meaning when reindented even if the conventions are not
127 followed.
128
129 \1f
130 File: xemacs.info,  Node: ForIndent Vars,  Prev: ForIndent Conv,  Up: Fortran Indent
131
132 Variables for Fortran Indentation
133 .................................
134
135    Several additional variables control how Fortran indentation works.
136
137 `fortran-do-indent'
138      Extra indentation within each level of `do' statement (the default
139      is 3).
140
141 `fortran-if-indent'
142      Extra indentation within each level of `if' statement (the default
143      is 3).
144
145 `fortran-continuation-indent'
146      Extra indentation for bodies of continuation lines (the default is
147      5).
148
149 `fortran-check-all-num-for-matching-do'
150      If this is `nil', indentation assumes that each `do' statement
151      ends on a `continue' statement.  Therefore, when computing
152      indentation for a statement other than `continue', it can save
153      time by not checking for a `do' statement ending there.  If this
154      is non-`nil', indenting any numbered statement must check for a
155      `do' that ends there.  The default is `nil'.
156
157 `fortran-minimum-statement-indent'
158      Minimum indentation for Fortran statements.  For standard Fortran,
159      this is 6.  Statement bodies are always indented at least this
160      much.
161
162 \1f
163 File: xemacs.info,  Node: Fortran Comments,  Next: Fortran Columns,  Prev: Fortran Indent,  Up: Fortran
164
165 Comments
166 --------
167
168    The usual Emacs comment commands assume that a comment can follow a
169 line of code.  In Fortran, the standard comment syntax requires an
170 entire line to be just a comment.  Therefore, Fortran mode replaces the
171 standard Emacs comment commands and defines some new variables.
172
173    Fortran mode can also handle a non-standard comment syntax where
174 comments start with `!' and can follow other text.  Because only some
175 Fortran compilers accept this syntax, Fortran mode will not insert such
176 comments unless you have specified to do so in advance by setting the
177 variable `comment-start' to `"!"' (*note Variables::).
178
179 `M-;'
180      Align comment or insert new comment (`fortran-comment-indent').
181
182 `C-x ;'
183      Applies to nonstandard `!' comments only.
184
185 `C-c ;'
186      Turn all lines of the region into comments, or (with arg) turn
187      them back into real code (`fortran-comment-region').
188
189    `M-;' in Fortran mode is redefined as the command
190 `fortran-comment-indent'.  Like the usual `M-;' command, it recognizes
191 an existing comment and aligns its text appropriately.  If there is no
192 existing comment, a comment is inserted and aligned.
193
194    Inserting and aligning comments is not the same in Fortran mode as in
195 other modes.  When a new comment must be inserted, a full-line comment
196 is inserted if the current line is blank.  On a non-blank line, a
197 non-standard `!' comment is inserted if you previously specified you
198 wanted to use them.  Otherwise a full-line comment is inserted on a new
199 line before the current line.
200
201    Non-standard `!' comments are aligned like comments in other
202 languages, but full-line comments are aligned differently.  In a
203 standard full-line comment, the comment delimiter itself must always
204 appear in column zero.  What can be aligned is the text within the
205 comment.  You can choose from three styles of alignment by setting the
206 variable `fortran-comment-indent-style' to one of these values:
207
208 `fixed'
209      The text is aligned at a fixed column, which is the value of
210      `fortran-comment-line-column'.  This is the default.
211
212 `relative'
213      The text is aligned as if it were a line of code, but with an
214      additional `fortran-comment-line-column' columns of indentation.
215
216 `nil'
217      Text in full-line columns is not moved automatically.
218
219    You can also specify the character to be used to indent within
220 full-line comments by setting the variable `fortran-comment-indent-char'
221 to the character you want to use.
222
223    Fortran mode introduces two variables `comment-line-start' and
224 `comment-line-start-skip', which do for full-line comments what
225 `comment-start' and `comment-start-skip' do for ordinary text-following
226 comments.  Normally these are set properly by Fortran mode, so you do
227 not need to change them.
228
229    The normal Emacs comment command `C-x ;' has not been redefined.  It
230 can therefore be used if you use `!' comments, but is useless in
231 Fortran mode otherwise.
232
233    The command `C-c ;' (`fortran-comment-region') turns all the lines
234 of the region into comments by inserting the string `C$$$' at the front
235 of each one.  With a numeric arg, the region is turned back into live
236 code by deleting `C$$$' from the front of each line.  You can control
237 the string used for the comments by setting the variable
238 `fortran-comment-region'.  Note that here we have an example of a
239 command and a variable with the same name; the two uses of the name
240 never conflict because in Lisp and in Emacs it is always clear from the
241 context which one is referred to.
242
243 \1f
244 File: xemacs.info,  Node: Fortran Columns,  Next: Fortran Abbrev,  Prev: Fortran Comments,  Up: Fortran
245
246 Columns
247 -------
248
249 `C-c C-r'
250      Displays a "column ruler" momentarily above the current line
251      (`fortran-column-ruler').
252
253 `C-c C-w'
254      Splits the current window horizontally so that it is 72 columns
255      wide.  This may help you avoid going over that limit
256      (`fortran-window-create').
257
258    The command `C-c C-r' (`fortran-column-ruler') shows a column ruler
259 above the current line.  The comment ruler consists of two lines of
260 text that show you the locations of columns with special significance
261 in Fortran programs.  Square brackets show the limits of the columns for
262 line numbers, and curly brackets show the limits of the columns for the
263 statement body.  Column numbers appear above them.
264
265    Note that the column numbers count from zero, as always in XEmacs.
266 As a result, the numbers may not be those you are familiar with; but the
267 actual positions in the line are standard Fortran.
268
269    The text used to display the column ruler is the value of the
270 variable `fortran-comment-ruler'.  By changing this variable, you can
271 change the display.
272
273    For even more help, use `C-c C-w' (`fortran-window-create'), a
274 command which splits the current window horizontally, resulting in a
275 window 72 columns wide.  When you edit in this window, you can
276 immediately see when a line gets too wide to be correct Fortran.
277
278 \1f
279 File: xemacs.info,  Node: Fortran Abbrev,  Prev: Fortran Columns,  Up: Fortran
280
281 Fortran Keyword Abbrevs
282 -----------------------
283
284    Fortran mode provides many built-in abbrevs for common keywords and
285 declarations.  These are the same sort of abbrevs that you can define
286 yourself.  To use them, you must turn on Abbrev mode.  *note Abbrevs::.
287
288    The built-in abbrevs are unusual in one way: they all start with a
289 semicolon.  You cannot normally use semicolon in an abbrev, but Fortran
290 mode makes this possible by changing the syntax of semicolon to "word
291 constituent".
292
293    For example, one built-in Fortran abbrev is `;c' for `continue'.  If
294 you insert `;c' and then insert a punctuation character such as a space
295 or a newline, the `;c' changes automatically to `continue', provided
296 Abbrev mode is enabled.
297
298    Type `;?' or `;C-h' to display a list of all built-in Fortran
299 abbrevs and what they stand for.
300
301 \1f
302 File: xemacs.info,  Node: Asm Mode,  Prev: Fortran,  Up: Programs
303
304 Asm Mode
305 ========
306
307    Asm mode is a major mode for editing files of assembler code.  It
308 defines these commands:
309
310 `<TAB>'
311      `tab-to-tab-stop'.
312
313 `<LFD>'
314      Insert a newline and then indent using `tab-to-tab-stop'.
315
316 `:'
317      Insert a colon and then remove the indentation from before the
318      label preceding colon.  Then do `tab-to-tab-stop'.
319
320 `;'
321      Insert or align a comment.
322
323    The variable `asm-comment-char' specifies which character starts
324 comments in assembler syntax.
325
326 \1f
327 File: xemacs.info,  Node: Running,  Next: Packages,  Prev: Programs,  Up: Top
328
329 Compiling and Testing Programs
330 ******************************
331
332    The previous chapter discusses the Emacs commands that are useful for
333 making changes in programs.  This chapter deals with commands that
334 assist in the larger process of developing and maintaining programs.
335
336 * Menu:
337
338 * Compilation::        Compiling programs in languages other than Lisp
339                         (C, Pascal, etc.)
340 * Modes: Lisp Modes.   Various modes for editing Lisp programs, with
341                        different facilities for running the Lisp programs.
342 * Libraries: Lisp Libraries.      Creating Lisp programs to run in Emacs.
343 * Eval: Lisp Eval.     Executing a single Lisp expression in Emacs.
344 * Debug: Lisp Debug.   Debugging Lisp programs running in Emacs.
345 * Interaction: Lisp Interaction.  Executing Lisp in an Emacs buffer.
346 * External Lisp::      Communicating through Emacs with a separate Lisp.
347
348 \1f
349 File: xemacs.info,  Node: Compilation,  Next: Lisp Modes,  Prev: Running,  Up: Running
350
351 Running "make", or Compilers Generally
352 ======================================
353
354    Emacs can run compilers for non-interactive languages like C and
355 Fortran as inferior processes, feeding the error log into an Emacs
356 buffer.  It can also parse the error messages and visit the files in
357 which errors are found, moving point to the line where the error
358 occurred.
359
360 `M-x compile'
361      Run a compiler asynchronously under Emacs, with error messages to
362      `*compilation*' buffer.
363
364 `M-x grep'
365      Run `grep' asynchronously under Emacs, with matching lines listed
366      in the buffer named `*compilation*'.
367
368 `M-x kill-compilation'
369      Kill the process made by the `M-x compile' command.
370
371 `M-x kill-grep'
372      Kill the running compilation or `grep' subprocess.
373
374 `C-x `'
375      Visit the next compiler error message or `grep' match.
376
377    To run `make' or another compiler, type `M-x compile'.  This command
378 reads a shell command line using the minibuffer, then executes the
379 specified command line in an inferior shell with output going to the
380 buffer named `*compilation*'.  By default, the current buffer's default
381 directory is used as the working directory for the execution of the
382 command; therefore, the makefile comes from this directory.
383
384    When the shell command line is read, the minibuffer appears
385 containing a default command line (the command you used the last time
386 you typed `M-x compile').  If you type just <RET>, the same command
387 line is used again.  The first `M-x compile' provides `make -k' as the
388 default.  The default is taken from the variable `compile-command'; if
389 the appropriate compilation command for a file is something other than
390 `make -k', it can be useful to have the file specify a local value for
391 `compile-command' (*note File Variables::).
392
393    When you start a compilation, the buffer `*compilation*' is
394 displayed in another window but not selected.  Its mode line displays
395 the word `run' or `exit' in the parentheses to tell you whether
396 compilation is finished.  You do not have to keep this buffer visible;
397 compilation continues in any case.
398
399    To kill the compilation process, type `M-x-kill-compilation'.  The
400 mode line of the `*compilation*' buffer changes to say `signal' instead
401 of `run'.  Starting a new compilation also kills any running
402 compilation, as only one can occur at any time.  Starting a new
403 compilation prompts for confirmation before actually killing a
404 compilation that is running.
405
406    To parse the compiler error messages, type `C-x `' (`next-error').
407 The character following `C-x' is the grave accent, not the single
408 quote.  The command displays the buffer `*compilation*' in one window
409 and the buffer in which the next error occurred in another window.
410 Point in that buffer is moved to the line where the error was found.
411 The corresponding error message is scrolled to the top of the window in
412 which `*compilation*' is displayed.
413
414    The first time you use `C-x `' after the start of a compilation, it
415 parses all the error messages, visits all the files that have error
416 messages, and creates markers pointing at the lines the error messages
417 refer to.  It then moves to the first error message location.
418 Subsequent uses of `C-x `' advance down the data set up by the first
419 use.  When the preparsed error messages are exhausted, the next `C-x `'
420 checks for any more error messages that have come in; this is useful if
421 you start editing compiler errors while compilation is still going on.
422 If no additional error messages have come in, `C-x `' reports an error.
423
424    `C-u C-x `' discards the preparsed error message data and parses the
425 `*compilation*' buffer again, then displays the first error.  This way,
426 you can process the same set of errors again.
427
428    Instead of running a compiler, you can run `grep' and see the lines
429 on which matches were found.  To do this, type `M-x grep' with an
430 argument line that contains the same arguments you would give to
431 `grep': a `grep'-style regexp (usually in single quotes to quote the
432 shell's special characters) followed by filenames, which may use
433 wildcard characters.  The output from `grep' goes in the
434 `*compilation*' buffer.  You can use `C-x `' to find the lines that
435 match as if they were compilation errors.
436
437    Note: a shell is used to run the compile command, but the shell is
438 not run in interactive mode.  In particular, this means that the shell
439 starts up with no prompt.  If you find your usual shell prompt making an
440 unsightly appearance in the `*compilation*' buffer, it means you have
441 made a mistake in your shell's initialization file (`.cshrc' or `.shrc'
442 or ...) by setting the prompt unconditionally.  The shell
443 initialization file should set the prompt only if there already is a
444 prompt.  Here's how to do it in `csh':
445
446      if ($?prompt) set prompt = ...
447
448 \1f
449 File: xemacs.info,  Node: Lisp Modes,  Next: Lisp Libraries,  Prev: Compilation,  Up: Running
450
451 Major Modes for Lisp
452 ====================
453
454    Emacs has four different major modes for Lisp.  They are the same in
455 terms of editing commands, but differ in the commands for executing Lisp
456 expressions.
457
458 Emacs-Lisp mode
459      The mode for editing source files of programs to run in Emacs Lisp.
460      This mode defines `C-M-x' to evaluate the current defun.  *Note
461      Lisp Libraries::.
462
463 Lisp Interaction mode
464      The mode for an interactive session with Emacs Lisp.  It defines
465      <LFD> to evaluate the sexp before point and insert its value in the
466      buffer.  *Note Lisp Interaction::.
467
468 Lisp mode
469      The mode for editing source files of programs that run in other
470      dialects of Lisp than Emacs Lisp.  This mode defines `C-M-x' to
471      send the current defun to an inferior Lisp process.  *Note
472      External Lisp::.
473
474 Inferior Lisp mode
475      The mode for an interactive session with an inferior Lisp process.
476      This mode combines the special features of Lisp mode and Shell mode
477      (*note Shell Mode::).
478
479 Scheme mode
480      Like Lisp mode but for Scheme programs.
481
482 Inferior Scheme mode
483      The mode for an interactive session with an inferior Scheme
484      process.
485
486 \1f
487 File: xemacs.info,  Node: Lisp Libraries,  Next: Lisp Eval,  Prev: Lisp Modes,  Up: Running
488
489 Libraries of Lisp Code for Emacs
490 ================================
491
492    Lisp code for Emacs editing commands is stored in files whose names
493 conventionally end in `.el'.  This ending tells Emacs to edit them in
494 Emacs-Lisp mode (*note Lisp Modes::).
495
496 * Menu:
497
498 * Loading::             Loading libraries of Lisp code into Emacs for use.
499 * Compiling Libraries:: Compiling a library makes it load and run faster.
500 * Mocklisp::            Converting Mocklisp to Lisp so XEmacs can run it.
501
502 \1f
503 File: xemacs.info,  Node: Loading,  Next: Compiling Libraries,  Prev: Lisp Libraries,  Up: Lisp Libraries
504
505 Loading Libraries
506 -----------------
507
508 `M-x load-file FILE'
509      Load the file FILE of Lisp code.
510
511 `M-x load-library LIBRARY'
512      Load the library named LIBRARY.
513
514 `M-x locate-library LIBRARY &optional NOSUFFIX'
515      Show the full path name of Emacs library LIBRARY.
516
517    To execute a file of Emacs Lisp, use `M-x load-file'.  This command
518 reads the file name you provide in the minibuffer, then executes the
519 contents of that file as Lisp code.  It is not necessary to visit the
520 file first; in fact, this command reads the file as found on disk, not
521 the text in an Emacs buffer.
522
523    Once a file of Lisp code is installed in the Emacs Lisp library
524 directories, users can load it using `M-x load-library'.  Programs can
525 load it by calling `load-library', or with `load', a more primitive
526 function that is similar but accepts some additional arguments.
527
528    `M-x load-library' differs from `M-x load-file' in that it searches
529 a sequence of directories and tries three file names in each directory.
530 The three names are: first, the specified name with `.elc' appended;
531 second, the name with `.el' appended; third, the specified name alone.
532 A `.elc' file would be the result of compiling the Lisp file into byte
533 code;  if possible, it is loaded in preference to the Lisp file itself
534 because the compiled file loads and runs faster.
535
536    Because the argument to `load-library' is usually not in itself a
537 valid file name, file name completion is not available.  In fact, when
538 using this command, you usually do not know exactly what file name will
539 be used.
540
541    The sequence of directories searched by `M-x load-library' is
542 specified by the variable `load-path', a list of strings that are
543 directory names.  The elements of this list may not begin with "`~'",
544 so you must call `expand-file-name' on them before adding them to the
545 list.  The default value of the list contains the directory where the
546 Lisp code for Emacs itself is stored.  If you have libraries of your
547 own, put them in a single directory and add that directory to
548 `load-path'.  `nil' in this list stands for the current default
549 directory, but it is probably not a good idea to put `nil' in the list.
550 If you start wishing that `nil' were in the list, you should probably
551 use `M-x load-file' for this case.
552
553    The variable is initialized by the EMACSLOADPATH environment
554 variable. If no value is specified, the variable takes the default value
555 specified in the file `paths.h' when Emacs was built. If a path isn't
556 specified in `paths.h', a default value is obtained from the file
557 system, near the directory in which the Emacs executable resides.
558
559    Like `M-x load-library', `M-x locate-library' searches the
560 directories in `load-path' to find the file that `M-x load-library'
561 would load.  If the optional second argument NOSUFFIX is non-`nil', the
562 suffixes `.elc' or `.el' are not added to the specified name LIBRARY
563 (like calling `load' instead of `load-library').
564
565    You often do not have to give any command to load a library, because
566 the commands defined in the library are set up to "autoload" that
567 library.  Running any of those commands causes `load' to be called to
568 load the library; this replaces the autoload definitions with the real
569 ones from the library.
570
571    If autoloading a file does not finish, either because of an error or
572 because of a `C-g' quit, all function definitions made by the file are
573 undone automatically.  So are any calls to `provide'.  As a
574 consequence, the entire file is loaded a second time if you use one of
575 the autoloadable commands again.  This prevents problems when the
576 command is no longer autoloading but is working incorrectly because the
577 file was only partially loaded.  Function definitions are undone only
578 for autoloading; explicit calls to `load' do not undo anything if
579 loading is not completed.
580
581    The variable `after-load-alist' takes an alist of expressions to be
582 evaluated when particular files are loaded.  Each element has the form
583 `(FILENAME forms...)'.  When `load' is run and the filename argument is
584 FILENAME, the forms in the corresponding element are executed at the
585 end of loading.
586
587    FILENAME must match exactly.  Normally FILENAME is the name of a
588 library, with no directory specified, since that is how load is
589 normally called.  An error in `forms' does not undo the load, but it
590 does prevent execution of the rest of the `forms'.
591
592 \1f
593 File: xemacs.info,  Node: Compiling Libraries,  Next: Mocklisp,  Prev: Loading,  Up: Lisp Libraries
594
595 Compiling Libraries
596 -------------------
597
598    Emacs Lisp code can be compiled into byte-code which loads faster,
599 takes up less space when loaded, and executes faster.
600
601 `M-x batch-byte-compile'
602      Run byte-compile-file on the files remaining on the command line.
603
604 `M-x byte-compile-buffer &optional BUFFER'
605      Byte-compile and evaluate contents of BUFFER (default is current
606      buffer).
607
608 `M-x byte-compile-file'
609      Compile a file of Lisp code named FILENAME into a file of byte
610      code.
611
612 `M-x byte-compile-and-load-file FILENAME'
613      Compile a file of Lisp code named FILENAME into a file of byte
614      code and load it.
615
616 `M-x byte-recompile-directory DIRECTORY'
617      Recompile every `.el' file in DIRECTORY that needs recompilation.
618
619 `M-x disassemble'
620      Print disassembled code for OBJECT on (optional) STREAM.
621
622 `M-x make-obsolete FUNCTION NEW'
623      Make the byte-compiler warn that FUNCTION is obsolete and NEW
624      should be used instead.
625
626    `byte-compile-file' creates a byte-code compiled file from an
627 Emacs-Lisp source file.  The default argument for this function is the
628 file visited in the current buffer.  The function reads the specified
629 file, compiles it into byte code, and writes an output file whose name
630 is made by appending `c' to the input file name.  Thus, the file
631 `rmail.el' would be compiled into `rmail.elc'. To compile a file of
632 Lisp code named FILENAME into a file of byte code and then load it, use
633 `byte-compile-and-load-file'. To compile and evaluate Lisp code in a
634 given buffer, use `byte-compile-buffer'.
635
636    To recompile all changed Lisp files in a directory, use `M-x
637 byte-recompile-directory'.  Specify just the directory name as an
638 argument.  Each `.el' file that has been byte-compiled before is
639 byte-compiled again if it has changed since the previous compilation.
640 A numeric argument to this command tells it to offer to compile each
641 `.el' file that has not been compiled yet.  You must answer `y' or `n'
642 to each offer.
643
644    You can use the function `batch-byte-compile' to invoke Emacs
645 non-interactively from the shell to do byte compilation.  When you use
646 this function, the files to be compiled are specified with command-line
647 arguments.  Use a shell command of the form:
648
649      emacs -batch -f batch-byte-compile FILES...
650
651    Directory names may also be given as arguments; in that case,
652 `byte-recompile-directory' is invoked on each such directory.
653 `batch-byte-compile' uses all remaining command-line arguments as file
654 or directory names, then kills the Emacs process.
655
656    `M-x disassemble' explains the result of byte compilation.  Its
657 argument is a function name.  It displays the byte-compiled code in a
658 help window in symbolic form, one instruction per line.  If the
659 instruction refers to a variable or constant, that is shown, too.
660
661 \1f
662 File: xemacs.info,  Node: Mocklisp,  Prev: Compiling Libraries,  Up: Lisp Libraries
663
664 Converting Mocklisp to Lisp
665 ---------------------------
666
667    XEmacs can run Mocklisp files by converting them to Emacs Lisp first.
668 To convert a Mocklisp file, visit it and then type `M-x
669 convert-mocklisp-buffer'.  Then save the resulting buffer of Lisp file
670 in a file whose name ends in `.el' and use the new file as a Lisp
671 library.
672
673    You cannot currently byte-compile converted Mocklisp code.  The
674 reason is that converted Mocklisp code uses some special Lisp features
675 to deal with Mocklisp's incompatible ideas of how arguments are
676 evaluated and which values signify "true" or "false".
677
678 \1f
679 File: xemacs.info,  Node: Lisp Eval,  Next: Lisp Debug,  Prev: Lisp Libraries,  Up: Running
680
681 Evaluating Emacs-Lisp Expressions
682 =================================
683
684    Lisp programs intended to be run in Emacs should be edited in
685 Emacs-Lisp mode; this will happen automatically for file names ending in
686 `.el'.  By contrast, Lisp mode itself should be used for editing Lisp
687 programs intended for other Lisp systems.  Emacs-Lisp mode can be
688 selected with the command `M-x emacs-lisp-mode'.
689
690    For testing of Lisp programs to run in Emacs, it is useful to be able
691 to evaluate part of the program as it is found in the Emacs buffer.  For
692 example, if you change the text of a Lisp function definition and then
693 evaluate the definition, Emacs installs the change for future calls to
694 the function.  Evaluation of Lisp expressions is also useful in any
695 kind of editing task for invoking non-interactive functions (functions
696 that are not commands).
697
698 `M-<ESC>'
699      Read a Lisp expression in the minibuffer, evaluate it, and print
700      the value in the minibuffer (`eval-expression').
701
702 `C-x C-e'
703      Evaluate the Lisp expression before point, and print the value in
704      the minibuffer (`eval-last-sexp').
705
706 `C-M-x'
707      Evaluate the defun containing point or after point, and print the
708      value in the minibuffer (`eval-defun').
709
710 `M-x eval-region'
711      Evaluate all the Lisp expressions in the region.
712
713 `M-x eval-current-buffer'
714      Evaluate all the Lisp expressions in the buffer.
715
716    `M-<ESC>' (`eval-expression') is the most basic command for
717 evaluating a Lisp expression interactively.  It reads the expression
718 using the minibuffer, so you can execute any expression on a buffer
719 regardless of what the buffer contains.  When evaluation is complete,
720 the current buffer is once again the buffer that was current when
721 `M-<ESC>' was typed.
722
723    `M-<ESC>' can easily confuse users, especially on keyboards with
724 autorepeat, where it can result from holding down the <ESC> key for too
725 long.  Therefore, `eval-expression' is normally a disabled command.
726 Attempting to use this command asks for confirmation and gives you the
727 option of enabling it; once you enable the command, you are no longer
728 required to confirm.  *Note Disabling::.
729
730    In Emacs-Lisp mode, the key `C-M-x' is bound to the function
731 `eval-defun', which parses the defun containing point or following point
732 as a Lisp expression and evaluates it.  The value is printed in the echo
733 area.  This command is convenient for installing in the Lisp environment
734 changes that you have just made in the text of a function definition.
735
736    The command `C-x C-e' (`eval-last-sexp') performs a similar job but
737 is available in all major modes, not just Emacs-Lisp mode.  It finds
738 the sexp before point, reads it as a Lisp expression, evaluates it, and
739 prints the value in the echo area.  It is sometimes useful to type in an
740 expression and then, with point still after it, type `C-x C-e'.
741
742    If `C-M-x' or `C-x C-e' are given a numeric argument, they print the
743 value by inserting it into the current buffer at point, rather than in
744 the echo area.  The argument value does not matter.
745
746    The most general command for evaluating Lisp expressions from a
747 buffer is `eval-region'.  `M-x eval-region' parses the text of the
748 region as one or more Lisp expressions, evaluating them one by one.
749 `M-x eval-current-buffer' is similar, but it evaluates the entire
750 buffer.  This is a reasonable way to install the contents of a file of
751 Lisp code that you are just ready to test.  After finding and fixing a
752 bug, use `C-M-x' on each function that you change, to keep the Lisp
753 world in step with the source file.
754
755 \1f
756 File: xemacs.info,  Node: Lisp Debug,  Next: Lisp Interaction,  Prev: Lisp Eval,  Up: Running
757
758 The Emacs-Lisp Debugger
759 =======================
760
761    XEmacs contains a debugger for Lisp programs executing inside it.
762 This debugger is normally not used; many commands frequently get Lisp
763 errors when invoked in inappropriate contexts (such as `C-f' at the end
764 of the buffer) and it would be unpleasant to enter a special debugging
765 mode in this case.  When you want to make Lisp errors invoke the
766 debugger, you must set the variable `debug-on-error' to non-`nil'.
767 Quitting with `C-g' is not considered an error, and `debug-on-error'
768 has no effect on the handling of `C-g'.  However, if you set
769 `debug-on-quit' to be non-`nil', `C-g' will invoke the debugger.  This
770 can be useful for debugging an infinite loop; type `C-g' once the loop
771 has had time to reach its steady state.  `debug-on-quit' has no effect
772 on errors.
773
774    You can make Emacs enter the debugger when a specified function is
775 called or at a particular place in Lisp code.  Use `M-x debug-on-entry'
776 with argument FUN-NAME to have Emacs enter the debugger as soon as
777 FUN-NAME is called. Use `M-x cancel-debug-on-entry' to make the
778 function stop entering the debugger when called.  (Redefining the
779 function also does this.)  To enter the debugger from some other place
780 in Lisp code, you must insert the expression `(debug)' there and
781 install the changed code with `C-M-x'.  *Note Lisp Eval::.
782
783    When the debugger is entered, it displays the previously selected
784 buffer in one window and a buffer named `*Backtrace*' in another
785 window.  The backtrace buffer contains one line for each level of Lisp
786 function execution currently going on.  At the beginning of the buffer
787 is a message describing the reason that the debugger was invoked, for
788 example, an error message if it was invoked due to an error.
789
790    The backtrace buffer is read-only and is in Backtrace mode, a special
791 major mode in which letters are defined as debugger commands.  The
792 usual Emacs editing commands are available; you can switch windows to
793 examine the buffer that was being edited at the time of the error, and
794 you can switch buffers, visit files, and perform any other editing
795 operations.  However, the debugger is a recursive editing level (*note
796 Recursive Edit::); it is a good idea to return to the backtrace buffer
797 and explicitly exit the debugger when you don't want to use it any
798 more.  Exiting the debugger kills the backtrace buffer.
799
800    The contents of the backtrace buffer show you the functions that are
801 executing and the arguments that were given to them.  It also allows you
802 to specify a stack frame by moving point to the line describing that
803 frame.  The frame whose line point is on is considered the "current
804 frame".  Some of the debugger commands operate on the current frame.
805 Debugger commands are mainly used for stepping through code one
806 expression at a time.  Here is a list of them:
807
808 `c'
809      Exit the debugger and continue execution.  In most cases,
810      execution of the program continues as if the debugger had never
811      been entered (aside from the effect of any variables or data
812      structures you may have changed while inside the debugger).  This
813      includes entry to the debugger due to function entry or exit,
814      explicit invocation, and quitting or certain errors.  Most errors
815      cannot be continued; trying to continue an error usually causes
816      the same error to occur again.
817
818 `d'
819      Continue execution, but enter the debugger the next time a Lisp
820      function is called.  This allows you to step through the
821      subexpressions of an expression, and see what the subexpressions
822      do and what values they compute.
823
824      When you enter the debugger this way, Emacs flags the stack frame
825      for the function call from which you entered.  The same function
826      is then called when you exit the frame.  To cancel this flag, use
827      `u'.
828
829 `b'
830      Set up to enter the debugger when the current frame is exited.
831      Frames that invoke the debugger on exit are flagged with stars.
832
833 `u'
834      Don't enter the debugger when the current frame is exited.  This
835      cancels a `b' command on a frame.
836
837 `e'
838      Read a Lisp expression in the minibuffer, evaluate it, and print
839      the value in the echo area.  This is equivalent to the command
840      `M-<ESC>', except that `e' is not normally disabled like `M-<ESC>'.
841
842 `q'
843      Terminate the program being debugged; return to top-level Emacs
844      command execution.
845
846      If the debugger was entered due to a `C-g' but you really want to
847      quit, not to debug, use the `q' command.
848
849 `r'
850      Return a value from the debugger.  The value is computed by
851      reading an expression with the minibuffer and evaluating it.
852
853      The value returned by the debugger makes a difference when the
854      debugger was invoked due to exit from a Lisp call frame (as
855      requested with `b'); then the value specified in the `r' command
856      is used as the value of that frame.
857
858      The debugger's return value also matters with many errors.  For
859      example, `wrong-type-argument' errors will use the debugger's
860      return value instead of the invalid argument; `no-catch' errors
861      will use the debugger value as a throw tag instead of the tag that
862      was not found.  If an error was signaled by calling the Lisp
863      function `signal', the debugger's return value is returned as the
864      value of `signal'.
865
866 \1f
867 File: xemacs.info,  Node: Lisp Interaction,  Next: External Lisp,  Prev: Lisp Debug,  Up: Running
868
869 Lisp Interaction Buffers
870 ========================
871
872    The buffer `*scratch*', which is selected when Emacs starts up, is
873 provided for evaluating Lisp expressions interactively inside Emacs.
874 Both the expressions you evaluate and their output goes in the buffer.
875
876    The `*scratch*' buffer's major mode is Lisp Interaction mode, which
877 is the same as Emacs-Lisp mode except for one command, <LFD>.  In
878 Emacs-Lisp mode, <LFD> is an indentation command.  In Lisp Interaction
879 mode, <LFD> is bound to `eval-print-last-sexp'.  This function reads
880 the Lisp expression before point, evaluates it, and inserts the value
881 in printed representation before point.
882
883    The way to use the `*scratch*' buffer is to insert Lisp expressions
884 at the end, ending each one with <LFD> so that it will be evaluated.
885 The result is a complete typescript of the expressions you have
886 evaluated and their values.
887
888    The rationale for this feature is that Emacs must have a buffer when
889 it starts up, but that buffer is not useful for editing files since a
890 new buffer is made for every file that you visit.  The Lisp interpreter
891 typescript is the most useful thing I can think of for the initial
892 buffer to do.  `M-x lisp-interaction-mode' will put any buffer in Lisp
893 Interaction mode.
894
895 \1f
896 File: xemacs.info,  Node: External Lisp,  Prev: Lisp Interaction,  Up: Running
897
898 Running an External Lisp
899 ========================
900
901    Emacs has facilities for running programs in other Lisp systems.
902 You can run a Lisp process as an inferior of Emacs, and pass
903 expressions to it to be evaluated.  You can also pass changed function
904 definitions directly from the Emacs buffers in which you edit the Lisp
905 programs to the inferior Lisp process.
906
907    To run an inferior Lisp process, type `M-x run-lisp'.  This runs the
908 program named `lisp', the same program you would run by typing `lisp'
909 as a shell command, with both input and output going through an Emacs
910 buffer named `*lisp*'.  In other words, any "terminal output" from Lisp
911 will go into the buffer, advancing point, and any "terminal input" for
912 Lisp comes from text in the buffer.  To give input to Lisp, go to the
913 end of the buffer and type the input, terminated by <RET>.  The
914 `*lisp*' buffer is in Inferior Lisp mode, which has all the special
915 characteristics of Lisp mode and Shell mode (*note Shell Mode::).
916
917    Use Lisp mode to run the source files of programs in external Lisps.
918 You can select this mode with `M-x lisp-mode'.  It is used automatically
919 for files whose names end in `.l' or `.lisp', as most Lisp systems
920 usually expect.
921
922    When you edit a function in a Lisp program you are running, the
923 easiest way to send the changed definition to the inferior Lisp process
924 is the key `C-M-x'.  In Lisp mode, this key runs the function
925 `lisp-send-defun', which finds the defun around or following point and
926 sends it as input to the Lisp process.  (Emacs can send input to any
927 inferior process regardless of what buffer is current.)
928
929    Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
930 to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
931 programs to be run in Emacs): in both modes it has the effect of
932 installing the function definition that point is in, but the way of
933 doing so is different according to where the relevant Lisp environment
934 is found.  *Note Lisp Modes::.
935
936 \1f
937 File: xemacs.info,  Node: Packages,  Next: Abbrevs,  Prev: Running,  Up: Top
938
939 Packages
940 ========
941
942    The XEmacs 21 distribution comes only with a very basic set of
943 built-in modes and packages.  Most of the packages that were part of
944 the distribution of earlier versions of XEmacs are now available
945 separately.  The installer as well as the user can choose which
946 packages to install; the actual installation process is easy.  This
947 gives an installer the ability to tailor an XEmacs installation for
948 local needs with safe removal of unnecessary code.
949
950 * Menu:
951
952 * Package Terminology:: Understanding different kinds of packages.
953 * Using Packages::      How to install and use packages.
954 * Building Packages::   Building packages from sources.
955
956 \1f
957 File: xemacs.info,  Node: Package Terminology,  Next: Using Packages,  Up: Packages
958
959 Package Flavors
960 ---------------
961
962    There are two main flavors of packages.
963
964    * Regular Packages A regular package is one in which multiple files
965      are involved and one may not in general safely remove any of them.
966
967    * Single-File Packages A single-file package is an aggregate
968      collection of thematically related but otherwise independent lisp
969      files.  These files are bundled together for download convenience
970      and individual files may be deleted at will without any loss of
971      functionality.
972
973 Package Distributions
974 ---------------------
975
976    XEmacs Lisp packages are distributed in two ways, depending on the
977 intended use.  Binary Packages are for installers and end-users and may
978 be installed directly into an XEmacs package directory.  Source Packages
979 are for developers and include all files necessary for rebuilding
980 bytecompiled lisp and creating tarballs for distribution.
981
982 Binary Packages
983 ---------------
984
985    Binary packages may be installed directly into an XEmacs package
986 hierarchy.
987
988 Source Packages
989 ---------------
990
991    Source packages contain all of the Package author's (where
992 appropriate in regular packages) source code plus all of the files
993 necessary to build distribution tarballs (Unix Tar format files,
994 gzipped for space savings).
995