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