Resorted; add missing Morohashi's Daikanwa characters; add missing
[chise/xemacs-chise.git] / info / xemacs.info-11
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: Lisp Indent,  Next: C Indent,  Prev: Multi-line Indent,  Up: Grinding
34
35 Customizing Lisp Indentation
36 ----------------------------
37
38    The indentation pattern for a Lisp expression can depend on the
39 function called by the expression.  For each Lisp function, you can
40 choose among several predefined patterns of indentation, or define an
41 arbitrary one with a Lisp program.
42
43    The standard pattern of indentation is as follows: the second line
44 of the expression is indented under the first argument, if that is on
45 the same line as the beginning of the expression; otherwise, the second
46 line is indented underneath the function name.  Each following line is
47 indented under the previous line whose nesting depth is the same.
48
49    If the variable `lisp-indent-offset' is non-`nil', it overrides the
50 usual indentation pattern for the second line of an expression, so that
51 such lines are always indented `lisp-indent-offset' more columns than
52 the containing list.
53
54    Certain functions override the standard pattern.  Functions whose
55 names start with `def' always indent the second line by
56 `lisp-body-indention' extra columns beyond the open-parenthesis
57 starting the expression.
58
59    Individual functions can override the standard pattern in various
60 ways, according to the `lisp-indent-function' property of the function
61 name.  (Note: `lisp-indent-function' was formerly called
62 `lisp-indent-hook').  There are four possibilities for this property:
63
64 `nil'
65      This is the same as no property; the standard indentation pattern
66      is used.
67
68 `defun'
69      The pattern used for function names that start with `def' is used
70      for this function also.
71
72 a number, NUMBER
73      The first NUMBER arguments of the function are "distinguished"
74      arguments; the rest are considered the "body" of the expression.
75      A line in the expression is indented according to whether the
76      first argument on it is distinguished or not.  If the argument is
77      part of the body, the line is indented `lisp-body-indent' more
78      columns than the open-parenthesis starting the containing
79      expression.  If the argument is distinguished and is either the
80      first or second argument, it is indented twice that many extra
81      columns.  If the argument is distinguished and not the first or
82      second argument, the standard pattern is followed for that line.
83
84 a symbol, SYMBOL
85      SYMBOL should be a function name; that function is called to
86      calculate the indentation of a line within this expression.  The
87      function receives two arguments:
88     STATE
89           The value returned by `parse-partial-sexp' (a Lisp primitive
90           for indentation and nesting computation) when it parses up to
91           the beginning of this line.
92
93     POS
94           The position at which the line being indented begins.
95
96      It should return either a number, which is the number of columns of
97      indentation for that line, or a list whose first element is such a
98      number.  The difference between returning a number and returning a
99      list is that a number says that all following lines at the same
100      nesting level should be indented just like this one; a list says
101      that following lines might call for different indentations.  This
102      makes a difference when the indentation is computed by `C-M-q'; if
103      the value is a number, `C-M-q' need not recalculate indentation
104      for the following lines until the end of the list.
105
106 \1f
107 File: xemacs.info,  Node: C Indent,  Prev: Lisp Indent,  Up: Grinding
108
109 Customizing C Indentation
110 -------------------------
111
112    Two variables control which commands perform C indentation and when.
113
114    If `c-auto-newline' is non-`nil', newlines are inserted both before
115 and after braces that you insert and after colons and semicolons.
116 Correct C indentation is done on all the lines that are made this way.
117
118    If `c-tab-always-indent' is non-`nil', the <TAB> command in C mode
119 does indentation only if point is at the left margin or within the
120 line's indentation.  If there is non-whitespace to the left of point,
121 <TAB> just inserts a tab character in the buffer.  Normally, this
122 variable is `nil', and <TAB> always reindents the current line.
123
124    C does not have anything analogous to particular function names for
125 which special forms of indentation are desirable.  However, it has a
126 different need for customization facilities: many different styles of C
127 indentation are in common use.
128
129    There are six variables you can set to control the style that Emacs C
130 mode will use.
131
132 `c-indent-level'
133      Indentation of C statements within surrounding block.  The
134      surrounding block's indentation is the indentation of the line on
135      which the open-brace appears.
136
137 `c-continued-statement-offset'
138      Extra indentation given to a substatement, such as the then-clause
139      of an `if' or body of a `while'.
140
141 `c-brace-offset'
142      Extra indentation for lines that start with an open brace.
143
144 `c-brace-imaginary-offset'
145      An open brace following other text is treated as if it were this
146      far to the right of the start of its line.
147
148 `c-argdecl-indent'
149      Indentation level of declarations of C function arguments.
150
151 `c-label-offset'
152      Extra indentation for a line that is a label, case, or default.
153
154    The variable `c-indent-level' controls the indentation for C
155 statements with respect to the surrounding block.  In the example:
156
157          {
158            foo ();
159
160 the difference in indentation between the lines is `c-indent-level'.
161 Its standard value is 2.
162
163    If the open-brace beginning the compound statement is not at the
164 beginning of its line, the `c-indent-level' is added to the indentation
165 of the line, not the column of the open-brace.  For example,
166
167      if (losing) {
168        do_this ();
169
170 One popular indentation style is that which results from setting
171 `c-indent-level' to 8 and putting open-braces at the end of a line in
172 this way.  Another popular style prefers to put the open-brace on a
173 separate line.
174
175    In fact, the value of the variable `c-brace-imaginary-offset' is
176 also added to the indentation of such a statement.  Normally this
177 variable is zero.  Think of this variable as the imaginary position of
178 the open brace, relative to the first non-blank character on the line.
179 By setting the variable to 4 and `c-indent-level' to 0, you can get
180 this style:
181
182      if (x == y) {
183          do_it ();
184          }
185
186    When `c-indent-level' is zero, the statements inside most braces
187 line up exactly under the open brace.  An exception are braces in column
188 zero, like those surrounding a function's body.  The statements inside
189 those braces are not placed at column zero.  Instead, `c-brace-offset'
190 and `c-continued-statement-offset' (see below) are added to produce a
191 typical offset between brace levels, and the statements are indented
192 that far.
193
194    `c-continued-statement-offset' controls the extra indentation for a
195 line that starts within a statement (but not within parentheses or
196 brackets).  These lines are usually statements inside other statements,
197 like the then-clauses of `if' statements and the bodies of `while'
198 statements.  The `c-continued-statement-offset' parameter determines
199 the difference in indentation between the two lines in:
200
201      if (x == y)
202        do_it ();
203
204 The default value for `c-continued-statement-offset' is 2.  Some
205 popular indentation styles correspond to a value of zero for
206 `c-continued-statement-offset'.
207
208    `c-brace-offset' is the extra indentation given to a line that
209 starts with an open-brace.  Its standard value is zero; compare:
210
211      if (x == y)
212        {
213
214 with:
215
216      if (x == y)
217        do_it ();
218
219 If you set `c-brace-offset' to 4, the first example becomes:
220
221      if (x == y)
222            {
223
224    `c-argdecl-indent' controls the indentation of declarations of the
225 arguments of a C function.  It is absolute: argument declarations
226 receive exactly `c-argdecl-indent' spaces.  The standard value is 5 and
227 results in code like this:
228
229      char *
230      index (string, char)
231           char *string;
232           int char;
233
234    `c-label-offset' is the extra indentation given to a line that
235 contains a label, a case statement, or a `default:' statement.  Its
236 standard value is -2 and results in code like this:
237
238      switch (c)
239        {
240        case 'x':
241
242 If `c-label-offset' were zero, the same code would be indented as:
243
244      switch (c)
245        {
246          case 'x':
247
248 This example assumes that the other variables above also have their
249 default values.
250
251    Using the indentation style produced by the default settings of the
252 variables just discussed and putting open braces on separate lines
253 produces clear and readable files.  For an example, look at any of the C
254 source files of XEmacs.
255
256 \1f
257 File: xemacs.info,  Node: Matching,  Next: Comments,  Prev: Grinding,  Up: Programs
258
259 Automatic Display of Matching Parentheses
260 =========================================
261
262    The Emacs parenthesis-matching feature shows you automatically how
263 parentheses match in the text.  Whenever a self-inserting character that
264 is a closing delimiter is typed, the cursor moves momentarily to the
265 location of the matching opening delimiter, provided that is visible on
266 the screen.  If it is not on the screen, some text starting with that
267 opening delimiter is displayed in the echo area.  Either way, you see
268 the grouping you are closing off.
269
270    In Lisp, automatic matching applies only to parentheses.  In C, it
271 also applies to braces and brackets.  Emacs knows which characters to
272 regard as matching delimiters based on the syntax table set by the major
273 mode.  *Note Syntax::.
274
275    If the opening delimiter and closing delimiter are mismatched--as in
276 `[x)'--the echo area displays a warning message.  The correct matches
277 are specified in the syntax table.
278
279    Two variables control parenthesis matching displays.
280 `blink-matching-paren' turns the feature on or off. The default is `t'
281 (match display is on); `nil' turns it off.
282 `blink-matching-paren-distance' specifies how many characters back
283 Emacs searches to find a matching opening delimiter.  If the match is
284 not found in the specified region, scanning stops, and nothing is
285 displayed.  This prevents wasting lots of time scanning when there is no
286 match.  The default is 4000.
287
288 \1f
289 File: xemacs.info,  Node: Comments,  Next: Balanced Editing,  Prev: Matching,  Up: Programs
290
291 Manipulating Comments
292 =====================
293
294    The comment commands insert, kill and align comments.
295
296 `M-;'
297      Insert or align comment (`indent-for-comment').
298
299 `C-x ;'
300      Set comment column (`set-comment-column').
301
302 `C-u - C-x ;'
303      Kill comment on current line (`kill-comment').
304
305 `M-<LFD>'
306      Like <RET> followed by inserting and aligning a comment
307      (`indent-new-comment-line').
308
309    The command that creates a comment is `Meta-;'
310 (`indent-for-comment').  If there is no comment already on the line, a
311 new comment is created and aligned at a specific column called the
312 "comment column".  Emacs creates the comment by inserting the string at
313 the value of `comment-start'; see below.  Point is left after that
314 string.  If the text of the line extends past the comment column,
315 indentation is done to a suitable boundary (usually, at least one space
316 is inserted).  If the major mode has specified a string to terminate
317 comments, that string is inserted after point, to keep the syntax valid.
318
319    You can also use `Meta-;' to align an existing comment.  If a line
320 already contains the string that starts comments, `M-;' just moves
321 point after it and re-indents it to the conventional place.  Exception:
322 comments starting in column 0 are not moved.
323
324    Some major modes have special rules for indenting certain kinds of
325 comments in certain contexts.  For example, in Lisp code, comments which
326 start with two semicolons are indented as if they were lines of code,
327 instead of at the comment column.  Comments which start with three
328 semicolons are supposed to start at the left margin.  Emacs understands
329 these conventions by indenting a double-semicolon comment using <TAB>
330 and by not changing the indentation of a triple-semicolon comment at
331 all.
332
333      ;; This function is just an example.
334      ;;; Here either two or three semicolons are appropriate.
335      (defun foo (x)
336      ;;; And now, the first part of the function:
337        ;; The following line adds one.
338        (1+ x))           ; This line adds one.
339
340    In C code, a comment preceded on its line by nothing but whitespace
341 is indented like a line of code.
342
343    Even when an existing comment is properly aligned, `M-;' is still
344 useful for moving directly to the start of the comment.
345
346    `C-u - C-x ;' (`kill-comment') kills the comment on the current
347 line, if there is one.  The indentation before the start of the comment
348 is killed as well.  If there does not appear to be a comment in the
349 line, nothing happens.  To reinsert the comment on another line, move
350 to the end of that line, type first `C-y', and then `M-;' to realign
351 the comment.  Note that `C-u - C-x ;' is not a distinct key; it is `C-x
352 ;' (`set-comment-column') with a negative argument.  That command is
353 programmed to call `kill-comment' when called with a negative argument.
354 However, `kill-comment' is a valid command which you could bind
355 directly to a key if you wanted to.
356
357 Multiple Lines of Comments
358 --------------------------
359
360    If you are typing a comment and want to continue it on another line,
361 use the command `Meta-<LFD>' (`indent-new-comment-line'), which
362 terminates the comment you are typing, creates a new blank line
363 afterward, and begins a new comment indented under the old one.  If
364 Auto Fill mode is on and you go past the fill column while typing, the
365 comment is continued in just this fashion.  If point is not at the end
366 of the line when you type `M-<LFD>', the text on the rest of the line
367 becomes part of the new comment line.
368
369 Options Controlling Comments
370 ----------------------------
371
372    The comment column is stored in the variable `comment-column'.  You
373 can explicitly set it to a number.  Alternatively, the command `C-x ;'
374 (`set-comment-column') sets the comment column to the column point is
375 at.  `C-u C-x ;' sets the comment column to match the last comment
376 before point in the buffer, and then calls `Meta-;' to align the
377 current line's comment under the previous one.  Note that `C-u - C-x ;'
378 runs the function `kill-comment' as described above.
379
380    `comment-column' is a per-buffer variable; altering the variable
381 affects only the current buffer.  You can also change the default value.
382 *Note Locals::.  Many major modes initialize this variable for the
383 current buffer.
384
385    The comment commands recognize comments based on the regular
386 expression that is the value of the variable `comment-start-skip'.
387 This regexp should not match the null string.  It may match more than
388 the comment starting delimiter in the strictest sense of the word; for
389 example, in C mode the value of the variable is `"/\\*+ *"', which
390 matches extra stars and spaces after the `/*' itself.  (Note that `\\'
391 is needed in Lisp syntax to include a `\' in the string, which is needed
392 to deny the first star its special meaning in regexp syntax.  *Note
393 Regexps::.)
394
395    When a comment command makes a new comment, it inserts the value of
396 `comment-start' to begin it.  The value of `comment-end' is inserted
397 after point and will follow the text you will insert into the comment.
398 In C mode, `comment-start' has the value `"/* "' and `comment-end' has
399 the value `" */"'.
400
401    `comment-multi-line' controls how `M-<LFD>'
402 (`indent-new-comment-line') behaves when used inside a comment.  If
403 `comment-multi-line' is `nil', as it normally is, then `M-<LFD>'
404 terminates the comment on the starting line and starts a new comment on
405 the new following line.  If `comment-multi-line' is not `nil', then
406 `M-<LFD>' sets up the new following line as part of the same comment
407 that was found on the starting line.  This is done by not inserting a
408 terminator on the old line and not inserting a starter on the new line.
409 In languages where multi-line comments are legal, the value you choose
410 for this variable is a matter of taste.
411
412    The variable `comment-indent-hook' should contain a function that is
413 called to compute the indentation for a newly inserted comment or for
414 aligning an existing comment.  Major modes set this variable
415 differently.  The function is called with no arguments, but with point
416 at the beginning of the comment, or at the end of a line if a new
417 comment is to be inserted.  The function should return the column in
418 which the comment ought to start.  For example, in Lisp mode, the
419 indent hook function bases its decision on the number of semicolons
420 that begin an existing comment and on the code in the preceding lines.
421
422 \1f
423 File: xemacs.info,  Node: Balanced Editing,  Next: Lisp Completion,  Prev: Comments,  Up: Programs
424
425 Editing Without Unbalanced Parentheses
426 ======================================
427
428 `M-('
429      Put parentheses around next sexp(s) (`insert-parentheses').
430
431 `M-)'
432      Move past next close parenthesis and re-indent
433      (`move-over-close-and-reindent').
434
435    The commands `M-(' (`insert-parentheses') and `M-)'
436 (`move-over-close-and-reindent') are designed to facilitate a style of
437 editing which keeps parentheses balanced at all times.  `M-(' inserts a
438 pair of parentheses, either together as in `()', or, if given an
439 argument, around the next several sexps, and leaves point after the open
440 parenthesis.  Instead of typing `( F O O )', you can type `M-( F O O',
441 which has the same effect except for leaving the cursor before the
442 close parenthesis.  You can then type `M-)', which moves past the close
443 parenthesis, deletes any indentation preceding it (in this example
444 there is none), and indents with <LFD> after it.
445
446 \1f
447 File: xemacs.info,  Node: Lisp Completion,  Next: Documentation,  Prev: Balanced Editing,  Up: Programs
448
449 Completion for Lisp Symbols
450 ===========================
451
452    Completion usually happens in the minibuffer.  An exception is
453 completion for Lisp symbol names, which is available in all buffers.
454
455    The command `M-<TAB>' (`lisp-complete-symbol') takes the partial
456 Lisp symbol before point to be an abbreviation, and compares it against
457 all non-trivial Lisp symbols currently known to Emacs.  Any additional
458 characters that they all have in common are inserted at point.
459 Non-trivial symbols are those that have function definitions, values, or
460 properties.
461
462    If there is an open-parenthesis immediately before the beginning of
463 the partial symbol, only symbols with function definitions are
464 considered as completions.
465
466    If the partial name in the buffer has more than one possible
467 completion and they have no additional characters in common, a list of
468 all possible completions is displayed in another window.
469
470 \1f
471 File: xemacs.info,  Node: Documentation,  Next: Change Log,  Prev: Lisp Completion,  Up: Programs
472
473 Documentation Commands
474 ======================
475
476    As you edit Lisp code to be run in Emacs, you can use the commands
477 `C-h f' (`describe-function') and `C-h v' (`describe-variable') to
478 print documentation of functions and variables you want to call.  These
479 commands use the minibuffer to read the name of a function or variable
480 to document, and display the documentation in a window.
481
482    For extra convenience, these commands provide default arguments
483 based on the code in the neighborhood of point.  `C-h f' sets the
484 default to the function called in the innermost list containing point.
485 `C-h v' uses the symbol name around or adjacent to point as its default.
486
487    The `M-x manual-entry' command gives you access to documentation on
488 Unix commands, system calls, and libraries.  The command reads a topic
489 as an argument, and displays the Unix manual page for that topic.
490 `manual-entry' always searches all 8 sections of the manual and
491 concatenates all the entries it finds.  For example, the topic
492 `termcap' finds the description of the termcap library from section 3,
493 followed by the description of the termcap data base from section 5.
494
495 \1f
496 File: xemacs.info,  Node: Change Log,  Next: Tags,  Prev: Documentation,  Up: Programs
497
498 Change Logs
499 ===========
500
501    The Emacs command `M-x add-change-log-entry' helps you keep a record
502 of when and why you have changed a program.  It assumes that you have a
503 file in which you write a chronological sequence of entries describing
504 individual changes.  The default is to store the change entries in a
505 file called `ChangeLog' in the same directory as the file you are
506 editing.  The same `ChangeLog' file therefore records changes for all
507 the files in a directory.
508
509    A change log entry starts with a header line that contains your name
510 and the current date.  Except for these header lines, every line in the
511 change log starts with a tab.  One entry can describe several changes;
512 each change starts with a line starting with a tab and a star.  `M-x
513 add-change-log-entry' visits the change log file and creates a new entry
514 unless the most recent entry is for today's date and your name.  In
515 either case, it adds a new line to start the description of another
516 change just after the header line of the entry.  When `M-x
517 add-change-log-entry' is finished, all is prepared for you to edit in
518 the description of what you changed and how.  You must then save the
519 change log file yourself.
520
521    The change log file is always visited in Indented Text mode, which
522 means that <LFD> and auto-filling indent each new line like the previous
523 line.  This is convenient for entering the contents of an entry, which
524 must be indented.  *Note Text Mode::.
525
526    Here is an example of the formatting conventions used in the change
527 log for Emacs:
528
529      Wed Jun 26 19:29:32 1985  Richard M. Stallman  (rms at mit-prep)
530      
531              * xdisp.c (try_window_id):
532              If C-k is done at end of next-to-last line,
533              this fn updates window_end_vpos and cannot leave
534              window_end_pos nonnegative (it is zero, in fact).
535              If display is preempted before lines are output,
536              this is inconsistent.  Fix by setting
537              blank_end_of_window to nonzero.
538      
539      Tue Jun 25 05:25:33 1985  Richard M. Stallman  (rms at mit-prep)
540      
541              * cmds.c (Fnewline):
542              Call the auto fill hook if appropriate.
543      
544              * xdisp.c (try_window_id):
545              If point is found by compute_motion after xp, record that
546              permanently.  If display_text_line sets point position wrong
547              (case where line is killed, point is at eob and that line is
548              not displayed), set it again in final compute_motion.
549
550 \1f
551 File: xemacs.info,  Node: Tags,  Next: Fortran,  Prev: Change Log,  Up: Programs
552
553 Tags Tables
554 ===========
555
556    A "tags table" is a description of how a multi-file program is
557 broken up into files.  It lists the names of the component files and the
558 names and positions of the functions (or other named subunits) in each
559 file.  Grouping the related files makes it possible to search or replace
560 through all the files with one command.  Recording the function names
561 and positions makes possible the `M-.' command which finds the
562 definition of a function by looking up which of the files it is in.
563
564    Tags tables are stored in files called "tags table files".  The
565 conventional name for a tags table file is `TAGS'.
566
567    Each entry in the tags table records the name of one tag, the name
568 of the file that the tag is defined in (implicitly), and the position
569 in that file of the tag's definition.
570
571    Just what names from the described files are recorded in the tags
572 table depends on the programming language of the described file.  They
573 normally include all functions and subroutines, and may also include
574 global variables, data types, and anything else convenient.  Each name
575 recorded is called a "tag".
576
577 * Menu:
578
579 * Tag Syntax::          Tag syntax for various types of code and text files.
580 * Create Tags Table::   Creating a tags table with `etags'.
581 * Etags Regexps::       Create arbitrary tags using regular expressions.
582 * Select Tags Table::   How to visit a tags table.
583 * Find Tag::            Commands to find the definition of a specific tag.
584 * Tags Search::         Using a tags table for searching and replacing.
585 * List Tags::           Listing and finding tags defined in a file.
586
587 \1f
588 File: xemacs.info,  Node: Tag Syntax,  Next: Create Tags Table,  Prev: Tags,  Up: Tags
589
590 Source File Tag Syntax
591 ----------------------
592
593    Here is how tag syntax is defined for the most popular languages:
594
595    * In C code, any C function or typedef is a tag, and so are
596      definitions of `struct', `union' and `enum'.  You can tag function
597      declarations and external variables in addition to function
598      definitions by giving the `--declarations' option to `etags'.
599      `#define' macro definitions and `enum' constants are also tags,
600      unless you specify `--no-defines' when making the tags table.
601      Similarly, global variables are tags, unless you specify
602      `--no-globals'.  Use of `--no-globals' and `--no-defines' can make
603      the tags table file much smaller.
604
605    * In C++ code, in addition to all the tag constructs of C code,
606      member functions are also recognized, and optionally member
607      variables if you use the `--members' option.  Tags for variables
608      and functions in classes are named `CLASS::VARIABLE' and
609      `CLASS::FUNCTION'.  `operator' functions tags are named, for
610      example `operator+'.
611
612    * In Java code, tags include all the constructs recognized in C++,
613      plus the `interface', `extends' and `implements' constructs.  Tags
614      for variables and functions in classes are named `CLASS.VARIABLE'
615      and `CLASS.FUNCTION'.
616
617    * In LaTeX text, the argument of any of the commands `\chapter',
618      `\section', `\subsection', `\subsubsection', `\eqno', `\label',
619      `\ref', `\cite', `\bibitem', `\part', `\appendix', `\entry', or
620      `\index', is a tag.
621
622      Other commands can make tags as well, if you specify them in the
623      environment variable `TEXTAGS' before invoking `etags'.  The value
624      of this environment variable should be a colon-separated list of
625      command names.  For example,
626
627           TEXTAGS="def:newcommand:newenvironment"
628           export TEXTAGS
629
630      specifies (using Bourne shell syntax) that the commands `\def',
631      `\newcommand' and `\newenvironment' also define tags.
632
633    * In Lisp code, any function defined with `defun', any variable
634      defined with `defvar' or `defconst', and in general the first
635      argument of any expression that starts with `(def' in column zero,
636      is a tag.
637
638    * In Scheme code, tags include anything defined with `def' or with a
639      construct whose name starts with `def'.  They also include
640      variables set with `set!' at top level in the file.
641
642    Several other languages are also supported:
643
644    * In Ada code, functions, procedures, packages, tasks, and types are
645      tags.  Use the `--packages-only' option to create tags for packages
646      only.
647
648    * In assembler code, labels appearing at the beginning of a line,
649      followed by a colon, are tags.
650
651    * In Bison or Yacc input files, each rule defines as a tag the
652      nonterminal it constructs.  The portions of the file that contain
653      C code are parsed as C code.
654
655    * In Cobol code, tags are paragraph names; that is, any word
656      starting in column 8 and followed by a period.
657
658    * In Erlang code, the tags are the functions, records, and macros
659      defined in the file.
660
661    * In Fortran code, functions, subroutines and blockdata are tags.
662
663    * In Objective C code, tags include Objective C definitions for
664      classes, class categories, methods, and protocols.
665
666    * In Pascal code, the tags are the functions and procedures defined
667      in the file.
668
669    * In Perl code, the tags are the procedures defined by the `sub',
670      `my' and `local' keywords.  Use `--globals' if you want to tag
671      global variables.
672
673    * In Postscript code, the tags are the functions.
674
675    * In Prolog code, a tag name appears at the left margin.
676
677    * In Python code, `def' or `class' at the beginning of a line
678      generate a tag.
679
680    You can also generate tags based on regexp matching (*note Etags
681 Regexps::) to handle other formats and languages.
682
683 \1f
684 File: xemacs.info,  Node: Create Tags Table,  Next: Etags Regexps,  Prev: Tag Syntax,  Up: Tags
685
686 Creating Tags Tables
687 --------------------
688
689    The `etags' program is used to create a tags table file.  It knows
690 the syntax of several languages, as described in *Note Tag Syntax::.
691 Here is how to run `etags':
692
693      etags INPUTFILES...
694
695 The `etags' program reads the specified files, and writes a tags table
696 named `TAGS' in the current working directory.  You can intermix
697 compressed and plain text source file names.  `etags' knows about the
698 most common compression formats, and does the right thing.  So you can
699 compress all your source files and have `etags' look for compressed
700 versions of its file name arguments, if it does not find uncompressed
701 versions.  Under MS-DOS, `etags' also looks for file names like
702 `mycode.cgz' if it is given `mycode.c' on the command line and
703 `mycode.c' does not exist.
704
705    `etags' recognizes the language used in an input file based on its
706 file name and contents.  You can specify the language with the
707 `--language=NAME' option, described below.
708
709    If the tags table data become outdated due to changes in the files
710 described in the table, the way to update the tags table is the same
711 way it was made in the first place.  It is not necessary to do this
712 often.
713
714    If the tags table fails to record a tag, or records it for the wrong
715 file, then Emacs cannot possibly find its definition.  However, if the
716 position recorded in the tags table becomes a little bit wrong (due to
717 some editing in the file that the tag definition is in), the only
718 consequence is a slight delay in finding the tag.  Even if the stored
719 position is very wrong, Emacs will still find the tag, but it must
720 search the entire file for it.
721
722    So you should update a tags table when you define new tags that you
723 want to have listed, or when you move tag definitions from one file to
724 another, or when changes become substantial.  Normally there is no need
725 to update the tags table after each edit, or even every day.
726
727    One tags table can effectively include another.  Specify the included
728 tags file name with the `--include=FILE' option when creating the file
729 that is to include it.  The latter file then acts as if it contained
730 all the files specified in the included file, as well as the files it
731 directly contains.
732
733    If you specify the source files with relative file names when you run
734 `etags', the tags file will contain file names relative to the
735 directory where the tags file was initially written.  This way, you can
736 move an entire directory tree containing both the tags file and the
737 source files, and the tags file will still refer correctly to the source
738 files.
739
740    If you specify absolute file names as arguments to `etags', then the
741 tags file will contain absolute file names.  This way, the tags file
742 will still refer to the same files even if you move it, as long as the
743 source files remain in the same place.  Absolute file names start with
744 `/', or with `DEVICE:/' on MS-DOS and MS-Windows.
745
746    When you want to make a tags table from a great number of files, you
747 may have problems listing them on the command line, because some systems
748 have a limit on its length.  The simplest way to circumvent this limit
749 is to tell `etags' to read the file names from its standard input, by
750 typing a dash in place of the file names, like this:
751
752      find . -name "*.[chCH]" -print | etags -
753
754    Use the option `--language=NAME' to specify the language explicitly.
755 You can intermix these options with file names; each one applies to
756 the file names that follow it.  Specify `--language=auto' to tell
757 `etags' to resume guessing the language from the file names and file
758 contents.  Specify `--language=none' to turn off language-specific
759 processing entirely; then `etags' recognizes tags by regexp matching
760 alone (*note Etags Regexps::).
761
762    `etags --help' prints the list of the languages `etags' knows, and
763 the file name rules for guessing the language. It also prints a list of
764 all the available `etags' options, together with a short explanation.
765
766 \1f
767 File: xemacs.info,  Node: Etags Regexps,  Next: Select Tags Table,  Prev: Create Tags Table,  Up: Tags
768
769 Etags Regexps
770 -------------
771
772    The `--regex' option provides a general way of recognizing tags
773 based on regexp matching.  You can freely intermix it with file names.
774 Each `--regex' option adds to the preceding ones, and applies only to
775 the following files.  The syntax is:
776
777      --regex=/TAGREGEXP[/NAMEREGEXP]/
778
779 where TAGREGEXP is used to match the lines to tag.  It is always
780 anchored, that is, it behaves as if preceded by `^'.  If you want to
781 account for indentation, just match any initial number of blanks by
782 beginning your regular expression with `[ \t]*'.  In the regular
783 expressions, `\' quotes the next character, and `\t' stands for the tab
784 character.  Note that `etags' does not handle the other C escape
785 sequences for special characters.
786
787    The syntax of regular expressions in `etags' is the same as in
788 Emacs, augmented with the "interval operator", which works as in `grep'
789 and `ed'.  The syntax of an interval operator is `\{M,N\}', and its
790 meaning is to match the preceding expression at least M times and up to
791 N times.
792
793    You should not match more characters with TAGREGEXP than that needed
794 to recognize what you want to tag.  If the match is such that more
795 characters than needed are unavoidably matched by TAGREGEXP (as will
796 usually be the case), you should add a NAMEREGEXP, to pick out just the
797 tag.  This will enable Emacs to find tags more accurately and to do
798 completion on tag names more reliably.  You can find some examples
799 below.
800
801    The option `--ignore-case-regex' (or `-c') is like `--regex', except
802 that the regular expression provided will be matched without regard to
803 case, which is appropriate for various programming languages.
804
805    The `-R' option deletes all the regexps defined with `--regex'
806 options.  It applies to the file names following it, as you can see
807 from the following example:
808
809      etags --regex=/REG1/ voo.doo --regex=/REG2/ \
810          bar.ber -R --lang=lisp los.er
811
812 Here `etags' chooses the parsing language for `voo.doo' and `bar.ber'
813 according to their contents.  `etags' also uses REG1 to recognize
814 additional tags in `voo.doo', and both REG1 and REG2 to recognize
815 additional tags in `bar.ber'.  `etags' uses the Lisp tags rules, and no
816 regexp matching, to recognize tags in `los.er'.
817
818    A regular expression can be bound to a given language, by prepending
819 it with `{lang}'.  When you do this, `etags' will use the regular
820 expression only for files of that language.  `etags --help' prints the
821 list of languages recognised by `etags'.  The following example tags
822 the `DEFVAR' macros in the Emacs source files.  `etags' applies this
823 regular expression to C files only:
824
825      --regex='{c}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/'
826
827 This feature is particularly useful when storing a list of regular
828 expressions in a file.  The following option syntax instructs `etags'
829 to read two files of regular expressions.  The regular expressions
830 contained in the second file are matched without regard to case.
831
832      --regex=@first-file --ignore-case-regex=@second-file
833
834 A regex file contains one regular expressions per line.  Empty lines,
835 and lines beginning with space or tab are ignored.  When the first
836 character in a line is `@', `etags' assumes that the rest of the line
837 is the name of a file of regular expressions.  This means that such
838 files can be nested.  All the other lines are taken to be regular
839 expressions.  For example, one can create a file called `emacs.tags'
840 with the following contents (the first line in the file is a comment):
841
842              -- This is for GNU Emacs source files
843      {c}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/
844
845 and then use it like this:
846
847      etags --regex=@emacs.tags *.[ch] */*.[ch]
848
849    Here are some more examples.  The regexps are quoted to protect them
850 from shell interpretation.
851
852    * Tag Octave files:
853
854           etags --language=none \
855                 --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' \
856                 --regex='/###key \(.*\)/\1/' \
857                 --regex='/[ \t]*global[ \t].*/' \
858                 *.m
859
860      Note that tags are not generated for scripts so that you have to
861      add a line by yourself of the form `###key <script-name>' if you
862      want to jump to it.
863
864    * Tag Tcl files:
865
866           etags --language=none --regex='/proc[ \t]+\([^ \t]+\)/\1/' *.tcl
867
868    * Tag VHDL files:
869
870           --language=none \
871           --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \
872           --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\
873           \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/'
874
875 \1f
876 File: xemacs.info,  Node: Select Tags Table,  Next: Find Tag,  Prev: Etags Regexps,  Up: Tags
877
878 Selecting a Tags Table
879 ----------------------
880
881    At any time Emacs has one "selected" tags table, and all the commands
882 for working with tags tables use the selected one.  To select a tags
883 table, use the variable `tag-table-alist'.
884
885    The value of `tag-table-alist' is a list that determines which
886 `TAGS' files should be active for a given buffer.  This is not really
887 an association list, in that all elements are checked.  The car of each
888 element of this list is a pattern against which the buffers file name
889 is compared; if it matches, then the cdr of the list should be the name
890 of the tags table to use.  If more than one element of this list
891 matches the buffers file name, all of the associated tags tables are
892 used.  Earlier ones are searched first.
893
894    If the car of elements of this list are strings, they are treated as
895 regular-expressions against which the file is compared (like the
896 `auto-mode-alist').  If they are not strings, they are evaluated.  If
897 they evaluate to non-`nil', the current buffer is considered to match.
898
899    If the cdr of the elements of this list are strings, they are
900 assumed to name a tags file.  If they name a directory, the string
901 `tags' is appended to them to get the file name.  If they are not
902 strings, they are evaluated and must return an appropriate string.
903
904    For example:
905
906        (setq tag-table-alist
907              '(("/usr/src/public/perl/" . "/usr/src/public/perl/perl-3.0/")
908                ("\\.el$" . "/usr/local/emacs/src/")
909                ("/jbw/gnu/" . "/usr15/degree/stud/jbw/gnu/")
910                ("" . "/usr/local/emacs/src/")
911                ))
912
913    The example defines the tags table alist in the following way:
914
915    * Anything in the directory `/usr/src/public/perl/' should use the
916      `TAGS' file `/usr/src/public/perl/perl-3.0/TAGS'.
917
918    * Files ending in `.el' should use the `TAGS' file
919      `/usr/local/emacs/src/TAGS'.
920
921    * Anything in or below the directory `/jbw/gnu/' should use the
922      `TAGS' file `/usr15/degree/stud/jbw/gnu/TAGS'.
923
924    If you had a file called `/usr/jbw/foo.el', it would use both `TAGS'
925 files,
926 `/usr/local/emacs/src/TAGS' and `/usr15/degree/stud/jbw/gnu/TAGS' (in
927 that order), because it matches both patterns.
928
929    If the buffer-local variable `buffer-tag-table' is set, it names a
930 tags table that is searched before all others when `find-tag' is
931 executed from this buffer.
932
933    If there is a file called `TAGS' in the same directory as the file
934 in question, then that tags file will always be used as well (after the
935 `buffer-tag-table' but before the tables specified by this list).
936
937    If the variable `tags-file-name' is set, the `TAGS' file it names
938 will apply to all buffers (for backwards compatibility.)  It is searched
939 first.
940
941    If the value of the variable `tags-always-build-completion-table' is
942 `t', the tags file will always be added to the completion table without
943 asking first, regardless of the size of the tags file.
944
945    The function `M-x visit-tags-table', is largely made obsolete by the
946 variable `tag-table-alist', tells tags commands to use the tags table
947 file FILE first.  The FILE should be the name of a file created with
948 the `etags' program.  A directory name is also acceptable; it means the
949 file `TAGS' in that directory.  The function only stores the file name
950 you provide in the variable `tags-file-name'.  Emacs does not actually
951 read in the tags table contents until you try to use them.  You can set
952 the variable explicitly instead of using `visit-tags-table'.  The value
953 of the variable `tags-file-name' is the name of the tags table used by
954 all buffers.  This is for backward compatibility, and is largely
955 supplanted by the variable `tag-table-alist'.
956
957 \1f
958 File: xemacs.info,  Node: Find Tag,  Next: Tags Search,  Prev: Select Tags Table,  Up: Tags
959
960 Finding a Tag
961 -------------
962
963    The most important thing that a tags table enables you to do is to
964 find the definition of a specific tag.
965
966 `M-. TAG &OPTIONAL OTHER-WINDOW'
967      Find first definition of TAG (`find-tag').
968
969 `C-u M-.'
970      Find next alternate definition of last tag specified.
971
972 `C-x 4 . TAG'
973      Find first definition of TAG, but display it in another window
974      (`find-tag-other-window').
975
976    `M-.' (`find-tag') is the command to find the definition of a
977 specified tag.  It searches through the tags table for that tag, as a
978 string, then uses the tags table information to determine the file in
979 which the definition is used and the approximate character position of
980 the definition in the file.  Then `find-tag' visits the file, moves
981 point to the approximate character position, and starts searching
982 ever-increasing distances away for the text that should appear at the
983 beginning of the definition.
984
985    If an empty argument is given (by typing <RET>), the sexp in the
986 buffer before or around point is used as the name of the tag to find.
987 *Note Lists::, for information on sexps.
988
989    The argument to `find-tag' need not be the whole tag name; it can be
990 a substring of a tag name.  However, there can be many tag names
991 containing the substring you specify.  Since `find-tag' works by
992 searching the text of the tags table, it finds the first tag in the
993 table that the specified substring appears in.  To find other tags that
994 match the substring, give `find-tag' a numeric argument, as in `C-u
995 M-.'.  This does not read a tag name, but continues searching the tag
996 table's text for another tag containing the same substring last used.
997 If your keyboard has a real <META> key, `M-0 M-.' is an easier
998 alternative to `C-u M-.'.
999
1000    If the optional second argument OTHER-WINDOW is non-`nil', it uses
1001 another window to display the tag.  Multiple active tags tables and
1002 completion are supported.
1003
1004    Variables of note include the following:
1005
1006 `tag-table-alist'
1007      Controls which tables apply to which buffers.
1008
1009 `tags-file-name'
1010      Stores a default tags table.
1011
1012 `tags-build-completion-table'
1013      Controls completion behavior.
1014
1015 `buffer-tag-table'
1016      Specifies a buffer-local table.
1017
1018 `make-tags-files-invisible'
1019      Sets whether tags tables should be very hidden.
1020
1021 `tag-mark-stack-max'
1022      Specifies how many tags-based hops to remember.
1023
1024    Like most commands that can switch buffers, `find-tag' has another
1025 similar command that displays the new buffer in another window.  `C-x 4
1026 .' invokes the function `find-tag-other-window'.  (This key sequence
1027 ends with a period.)
1028
1029    Emacs comes with a tags table file `TAGS' (in the directory
1030 containing Lisp libraries) that includes all the Lisp libraries and all
1031 the C sources of Emacs.  By specifying this file with `visit-tags-table'
1032 and then using `M-.' you can quickly look at the source of any Emacs
1033 function.
1034
1035 \1f
1036 File: xemacs.info,  Node: Tags Search,  Next: List Tags,  Prev: Find Tag,  Up: Tags
1037
1038 Searching and Replacing with Tags Tables
1039 ----------------------------------------
1040
1041    The commands in this section visit and search all the files listed
1042 in the selected tags table, one by one.  For these commands, the tags
1043 table serves only to specify a sequence of files to search.  A related
1044 command is `M-x grep' (*note Compilation::).
1045
1046 `M-x tags-search <RET> REGEXP <RET>'
1047      Search for REGEXP through the files in the selected tags table.
1048
1049 `M-x tags-query-replace <RET> REGEXP <RET> REPLACEMENT <RET>'
1050      Perform a `query-replace-regexp' on each file in the selected tags
1051      table.
1052
1053 `M-,'
1054      Restart one of the commands above, from the current location of
1055      point (`tags-loop-continue').
1056
1057    `M-x tags-search' reads a regexp using the minibuffer, then searches
1058 for matches in all the files in the selected tags table, one file at a
1059 time.  It displays the name of the file being searched so you can
1060 follow its progress.  As soon as it finds an occurrence, `tags-search'
1061 returns.
1062
1063    Having found one match, you probably want to find all the rest.  To
1064 find one more match, type `M-,' (`tags-loop-continue') to resume the
1065 `tags-search'.  This searches the rest of the current buffer, followed
1066 by the remaining files of the tags table.
1067
1068    `M-x tags-query-replace' performs a single `query-replace-regexp'
1069 through all the files in the tags table.  It reads a regexp to search
1070 for and a string to replace with, just like ordinary `M-x
1071 query-replace-regexp'.  It searches much like `M-x tags-search', but
1072 repeatedly, processing matches according to your input.  *Note
1073 Replace::, for more information on query replace.
1074
1075    It is possible to get through all the files in the tags table with a
1076 single invocation of `M-x tags-query-replace'.  But often it is useful
1077 to exit temporarily, which you can do with any input event that has no
1078 special query replace meaning.  You can resume the query replace
1079 subsequently by typing `M-,'; this command resumes the last tags search
1080 or replace command that you did.
1081
1082    The commands in this section carry out much broader searches than the
1083 `find-tag' family.  The `find-tag' commands search only for definitions
1084 of tags that match your substring or regexp.  The commands
1085 `tags-search' and `tags-query-replace' find every occurrence of the
1086 regexp, as ordinary search commands and replace commands do in the
1087 current buffer.
1088
1089    These commands create buffers only temporarily for the files that
1090 they have to search (those which are not already visited in Emacs
1091 buffers).  Buffers in which no match is found are quickly killed; the
1092 others continue to exist.
1093
1094    It may have struck you that `tags-search' is a lot like `grep'.  You
1095 can also run `grep' itself as an inferior of Emacs and have Emacs show
1096 you the matching lines one by one.  This works much like running a
1097 compilation; finding the source locations of the `grep' matches works
1098 like finding the compilation errors.  *Note Compilation::.
1099
1100    If you wish to process all the files in a selected tags table, but
1101 `M-x tags-search' and `M-x tags-query-replace' are not giving you the
1102 desired result, you can use `M-x next-file'.
1103
1104 `C-u M-x next-file'
1105      With a numeric argument, regardless of its value, visit the first
1106      file in the tags table and prepare to advance sequentially by
1107      files.
1108
1109 `M-x next-file'
1110      Visit the next file in the selected tags table.
1111
1112 \1f
1113 File: xemacs.info,  Node: List Tags,  Prev: Tags Search,  Up: Tags
1114
1115 Tags Table Inquiries
1116 --------------------
1117
1118 `M-x list-tags'
1119      Display a list of the tags defined in a specific program file.
1120
1121 `M-x tags-apropos'
1122      Display a list of all tags matching a specified regexp.
1123
1124    `M-x list-tags' reads the name of one of the files described by the
1125 selected tags table, and displays a list of all the tags defined in that
1126 file.  The "file name" argument is really just a string to compare
1127 against the names recorded in the tags table; it is read as a string
1128 rather than a file name.  Therefore, completion and defaulting are not
1129 available, and you must enter the string the same way it appears in the
1130 tag table.  Do not include a directory as part of the file name unless
1131 the file name recorded in the tags table contains that directory.
1132
1133    `M-x tags-apropos' is like `apropos' for tags.  It reads a regexp,
1134 then finds all the tags in the selected tags table whose entries match
1135 that regexp, and displays the tag names found.
1136
1137 \1f
1138 File: xemacs.info,  Node: Fortran,  Next: Asm Mode,  Prev: Tags,  Up: Programs
1139
1140 Fortran Mode
1141 ============
1142
1143    Fortran mode provides special motion commands for Fortran statements
1144 and subprograms, and indentation commands that understand Fortran
1145 conventions of nesting, line numbers, and continuation statements.
1146
1147    Special commands for comments are provided because Fortran comments
1148 are unlike those of other languages.
1149
1150    Built-in abbrevs optionally save typing when you insert Fortran
1151 keywords.
1152
1153    Use `M-x fortran-mode' to switch to this major mode.  Doing so calls
1154 the value of `fortran-mode-hook' as a function of no arguments if that
1155 variable has a non-`nil' value.
1156
1157 * Menu:
1158
1159 * Motion: Fortran Motion.     Moving point by statements or subprograms.
1160 * Indent: Fortran Indent.     Indentation commands for Fortran.
1161 * Comments: Fortran Comments. Inserting and aligning comments.
1162 * Columns: Fortran Columns.   Measuring columns for valid Fortran.
1163 * Abbrev: Fortran Abbrev.     Built-in abbrevs for Fortran keywords.
1164
1165    Fortran mode was contributed by Michael Prange.
1166
1167 \1f
1168 File: xemacs.info,  Node: Fortran Motion,  Next: Fortran Indent,  Prev: Fortran,  Up: Fortran
1169
1170 Motion Commands
1171 ---------------
1172
1173    Fortran mode provides special commands to move by subprograms
1174 (functions and subroutines) and by statements.  There is also a command
1175 to put the region around one subprogram, which is convenient for
1176 killing it or moving it.
1177
1178 `C-M-a'
1179      Move to beginning of subprogram
1180      (`beginning-of-fortran-subprogram').
1181
1182 `C-M-e'
1183      Move to end of subprogram (`end-of-fortran-subprogram').
1184
1185 `C-M-h'
1186      Put point at beginning of subprogram and mark at end
1187      (`mark-fortran-subprogram').
1188
1189 `C-c C-n'
1190      Move to beginning of current or next statement (`fortran-next-
1191      statement').
1192
1193 `C-c C-p'
1194      Move to beginning of current or previous statement (`fortran-
1195      previous-statement').
1196