home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 8 / CDASC08.ISO / VRAC / E17INFO.ZIP / EMACS-10 < prev    next >
Encoding:
GNU Info File  |  1993-07-18  |  48.8 KB  |  1,229 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Comments,  Next: Balanced Editing,  Prev: Matching,  Up: Programs
  6.  
  7. Manipulating Comments
  8. =====================
  9.  
  10.    The comment commands insert, kill and align comments.
  11.  
  12. `M-;'
  13.      Insert or align comment (`indent-for-comment').
  14.  
  15. `C-x ;'
  16.      Set comment column (`set-comment-column').
  17.  
  18. `C-u - C-x ;'
  19.      Kill comment on current line (`kill-comment').
  20.  
  21. `M-LFD'
  22.      Like RET followed by inserting and aligning a comment
  23.      (`indent-new-comment-line').
  24.  
  25. `M-x comment-region'
  26.      Add or remove comment delimiters on all the lines in the region.
  27.  
  28.    The command that creates a comment is `M-;' (`indent-for-comment').
  29. If there is no comment already on the line, a new comment is created,
  30. aligned at a specific column called the "comment column".  The comment
  31. is created by inserting the string Emacs thinks comments should start
  32. with (the value of `comment-start'; see below).  Point is left after
  33. that string.  If the text of the line extends past the comment column,
  34. then the indentation is done to a suitable boundary (usually, at least
  35. one space is inserted).  If the major mode has specified a string to
  36. terminate comments, that is inserted after point, to keep the syntax
  37. valid.
  38.  
  39.    `M-;' can also be used to align an existing comment.  If a line
  40. already contains the string that starts comments, then `M-;' just moves
  41. point after it and re-indents it to the conventional place.  Exception:
  42. comments starting in column 0 are not moved.
  43.  
  44.    Some major modes have special rules for indenting certain kinds of
  45. comments in certain contexts.  For example, in Lisp code, comments which
  46. start with two semicolons are indented as if they were lines of code,
  47. instead of at the comment column.  Comments which start with three
  48. semicolons are supposed to start at the left margin.  Emacs understands
  49. these conventions by indenting a double-semicolon comment using TAB,
  50. and by not changing the indentation of a triple-semicolon comment at
  51. all.
  52.  
  53.      ;; This function is just an example
  54.      ;;; Here either two or three semicolons are appropriate.
  55.      (defun foo (x)
  56.      ;;; And now, the first part of the function:
  57.        ;; The following line adds one.
  58.        (1+ x))           ; This line adds one.
  59.  
  60.    In C code, a comment preceded on its line by nothing but whitespace
  61. is indented like a line of code.
  62.  
  63.    Even when an existing comment is properly aligned, `M-;' is still
  64. useful for moving directly to the start of the comment.
  65.  
  66.    `C-u - C-x ;' (`kill-comment') kills the comment on the current line,
  67. if there is one.  The indentation before the start of the comment is
  68. killed as well.  If there does not appear to be a comment in the line,
  69. nothing is done.  To reinsert the comment on another line, move to the
  70. end of that line, do `C-y', and then do `M-;' to realign it.  Note that
  71. `C-u - C-x ;' is not a distinct key; it is `C-x ;'
  72. (`set-comment-column') with a negative argument.  That command is
  73. programmed so that when it receives a negative argument it calls
  74. `kill-comment'.  However, `kill-comment' is a valid command which you
  75. could bind directly to a key if you wanted to.
  76.  
  77.    The `M-x comment-region' command adds comment delimiters to the
  78. lines that start in the region, thus commenting them out.  With a
  79. negative argument, it does the opposite--it deletes comment delimiters
  80. from the lines in the region.
  81.  
  82.    With a positive argument, `comment-region' adds comment delimiters
  83. and duplicates the last character of the comment start sequence as many
  84. times as the argument specifies.  Thus, in Lisp mode, `C-u 2 M-x
  85. comment-region' adds `;;' to each line.
  86.  
  87.    Duplicating the comment delimiter is a way of calling attention to
  88. the comment.  It can also affect how the comment is indented.  In Lisp,
  89. for proper indentation, you should use an argument of two, if between
  90. defuns, and three, if within a defun.
  91.  
  92. Multiple Lines of Comments
  93. --------------------------
  94.  
  95.    If you are typing a comment and find that you wish to continue it on
  96. another line, you can use the command `M-LFD'
  97. (`indent-new-comment-line'), which terminates the comment you are
  98. typing, creates a new blank line afterward, and begins a new comment
  99. indented under the old one.  When Auto Fill mode is on, going past the
  100. fill column while typing a comment causes the comment to be continued in
  101. just this fashion.  If point is not at the end of the line when `M-LFD'
  102. is typed, the text on the rest of the line becomes part of the new
  103. comment line.
  104.  
  105. Options Controlling Comments
  106. ----------------------------
  107.  
  108.    The comment column is stored in the variable `comment-column'.  You
  109. can set it to a number explicitly.  Alternatively, the command `C-x ;'
  110. (`set-comment-column') sets the comment column to the column point is
  111. at.  `C-u C-x ;' sets the comment column to match the last comment
  112. before point in the buffer, and then does a `M-;' to align the current
  113. line's comment under the previous one.  Note that `C-u - C-x ;' runs
  114. the function `kill-comment' as described above.
  115.  
  116.    The variable `comment-column' is per-buffer: setting the variable in
  117. the normal fashion affects only the current buffer, but there is a
  118. default value which you can change with `setq-default'.  *Note
  119. Locals::.  Many major modes initialize this variable for the current
  120. buffer.
  121.  
  122.    The comment commands recognize comments based on the regular
  123. expression that is the value of the variable `comment-start-skip'.
  124. This regexp should not match the null string.  It may match more than
  125. the comment starting delimiter in the strictest sense of the word; for
  126. example, in C mode the value of the variable is `"/\\*+ *"', which
  127. matches extra stars and spaces after the `/*' itself.  (Note that `\\'
  128. is needed in Lisp syntax to include a `\' in the string, which is needed
  129. to deny the first star its special meaning in regexp syntax.  *Note
  130. Regexps::.)
  131.  
  132.    When a comment command makes a new comment, it inserts the value of
  133. `comment-start' to begin it.  The value of `comment-end' is inserted
  134. after point, so that it will follow the text that you will insert into
  135. the comment.  In C mode, `comment-start' has the value `"/* "' and
  136. `comment-end' has the value `" */"'.
  137.  
  138.    The variable `comment-multi-line' controls how `M-LFD'
  139. (`indent-new-comment-line') behaves when used inside a comment.  If
  140. `comment-multi-line' is `nil', as it normally is, then the comment on
  141. the starting line is terminated and a new comment is started on the new
  142. following line.  If `comment-multi-line' is not `nil', then the new
  143. following line is set up as part of the same comment that was found on
  144. the starting line.  This is done by not inserting a terminator on the
  145. old line, and not inserting a starter on the new line.  In languages
  146. where multi-line comments work, the choice of value for this variable
  147. is a matter of taste.
  148.  
  149.    The variable `comment-indent-function' should contain a function
  150. that will be called to compute the indentation for a newly inserted
  151. comment or for aligning an existing comment.  It is set differently by
  152. various major modes.  The function is called with no arguments, but with
  153. point at the beginning of the comment, or at the end of a line if a new
  154. comment is to be inserted.  It should return the column in which the
  155. comment ought to start.  For example, in Lisp mode, the indent hook
  156. function bases its decision on how many semicolons begin an existing
  157. comment, and on the code in the preceding lines.
  158.  
  159. 
  160. File: emacs,  Node: Balanced Editing,  Next: Symbol Completion,  Prev: Comments,  Up: Programs
  161.  
  162. Editing Without Unbalanced Parentheses
  163. ======================================
  164.  
  165. `M-('
  166.      Put parentheses around next sexp(s) (`insert-parentheses').
  167.  
  168. `M-)'
  169.      Move past next close parenthesis and re-indent
  170.      (`move-over-close-and-reindent').
  171.  
  172.    The commands `M-(' (`insert-parentheses') and `M-)'
  173. (`move-over-close-and-reindent') are designed to facilitate a style of
  174. editing which keeps parentheses balanced at all times.  `M-(' inserts a
  175. pair of parentheses, either together as in `()', or, if given an
  176. argument, around the next several sexps, and leaves point after the open
  177. parenthesis.  Instead of typing `( F O O )', you can type `M-( F O O',
  178. which has the same effect except for leaving the cursor before the
  179. close parenthesis.  Then you can type `M-)', which moves past the close
  180. parenthesis, deleting any indentation preceding it (in this example
  181. there is none), and indenting with LFD after it.
  182.  
  183. 
  184. File: emacs,  Node: Symbol Completion,  Next: Documentation,  Prev: Balanced Editing,  Up: Programs
  185.  
  186. Completion for Symbol Names
  187. ===========================
  188.  
  189.    Usually completion happens in the minibuffer.  But one kind of
  190. completion is available in all buffers: completion for symbol names.
  191.  
  192.    The character `M-TAB' runs a command to complete the partial symbol
  193. before point against the set of meaningful symbol names.  Any
  194. additional characters determined by the partial name are inserted at
  195. point.
  196.  
  197.    If the partial name in the buffer has more than one possible
  198. completion and they have no additional characters in common, a list of
  199. all possible completions is displayed in another window.
  200.  
  201.    There are two ways of determining the set of legitimate symbol names
  202. to complete against.  In most major modes, this uses a tag table (*note
  203. Tags::.); the legitimate symbol names are the tag names listed in the
  204. tag table file.  The command which implements this is `complete-tag'.
  205.  
  206.    In Emacs-Lisp mode, the name space for completion normally consists
  207. of nontrivial symbols present in Emacs--those that have function
  208. definitions, values or properties.  However, if there is an
  209. open-parenthesis immediately before the beginning of the partial symbol,
  210. only symbols with function definitions are considered as completions.
  211. The command which implements this is `lisp-complete-symbol'.
  212.  
  213. 
  214. File: emacs,  Node: Documentation,  Next: Change Log,  Prev: Symbol Completion,  Up: Programs
  215.  
  216. Documentation Commands
  217. ======================
  218.  
  219.    As you edit Lisp code to be run in Emacs, the commands `C-h f'
  220. (`describe-function') and `C-h v' (`describe-variable') can be used to
  221. print documentation of functions and variables that you want to call.
  222. These commands use the minibuffer to read the name of a function or
  223. variable to document, and display the documentation in a window.
  224.  
  225.    For extra convenience, these commands provide default arguments
  226. based on the code in the neighborhood of point.  `C-h f' sets the
  227. default to the function called in the innermost list containing point.
  228. `C-h v' uses the symbol name around or adjacent to point as its default.
  229.  
  230.    Documentation on Unix commands, system calls and libraries can be
  231. obtained with the `M-x manual-entry' command.  This reads a topic as an
  232. argument, and displays the text on that topic from the Unix manual.
  233. `manual-entry' starts a background process that formats the manual
  234. page, by running the `man' program.  The result goes in a buffer named
  235. `*man TOPIC*'.  These buffers have a special major mode that
  236. facilitates scrolling and examining other manual pages.
  237.  
  238.    Eventually the GNU project hopes to replace most man pages with
  239. better-organized manuals that you can browse with Info.  *Note Misc
  240. Help::.  Since this process is only partially completed, it is still
  241. useful to read manual pages.
  242.  
  243. 
  244. File: emacs,  Node: Change Log,  Next: Tags,  Prev: Documentation,  Up: Programs
  245.  
  246. Change Logs
  247. ===========
  248.  
  249.    The Emacs command `C-x 4 a' adds a new entry to the change log file
  250. for the file you are editing (`add-change-log-entry-other-window').
  251.  
  252.    A change log file contains a chronological record of when and why you
  253. have changed a program, consisting of a sequence of entries describing
  254. individual changes.  Normally it is kept in a file called `ChangeLog'
  255. in the same directory as the file you are editing, or one of its parent
  256. directories.  A single `ChangeLog' file can record changes for all the
  257. files in its directory and all its subdirectories.
  258.  
  259.    A change log entry starts with a header line that contains your name
  260. and the current date.  Aside from these header lines, every line in the
  261. change log starts with a space or a tab.  The bulk of the entry consists
  262. of "items", each of which starts with a line starting with whitespace
  263. and a star.  Here are two entries, each with two items:
  264.  
  265.      Wed May  5 14:11:45 1993  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
  266.      
  267.          * man.el: Rename functions and variables `man-*' to `Man-*'.
  268.          (manual-entry): Make prompt string clearer.
  269.      
  270.          * simple.el (blink-matching-paren-distance): Change default to 12,000.
  271.      
  272.      Tue May  4 12:42:19 1993  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
  273.      
  274.          * vc.el (minor-mode-map-alist): Don't use it if it's void.
  275.          (vc-cancel-version): Doc fix.
  276.  
  277.    One entry can describe several changes; each change should have its
  278. own item.  Normally there should be a blank line between items.  When
  279. items are related (parts of the same change, in different places), group
  280. them by leaving no blank line between them.  The second entry above
  281. contains two items grouped in this way.
  282.  
  283.    `C-x 4 a' visits the change log file and creates a new entry unless
  284. the most recent entry is for today's date and your name.  It also
  285. creates a new item for the current file.  For many languages, it can
  286. even guess the name of the function or other object that was changed.
  287.  
  288.    The change log file is visited in Change Log mode.  Each bunch of
  289. grouped item counts as one paragraph, and each entry is considered a
  290. page.  This facilitates editing the entries.  LFD and auto-fill indent
  291. each new line like the previous line; this is convenient for entering
  292. the contents of an entry.
  293.  
  294. 
  295. File: emacs,  Node: Tags,  Next: Emerge,  Prev: Change Log,  Up: Programs
  296.  
  297. Tag Tables
  298. ==========
  299.  
  300.    A "tag table" is a description of how a multi-file program is broken
  301. up into files.  It lists the names of the component files and the names
  302. and positions of the functions (or other named subunits) in each file.
  303. Grouping the related files makes it possible to search or replace
  304. through all the files with one command.  Recording the function names
  305. and positions makes possible the `M-.'  command which you can use to
  306. find the definition of a function without having to know which of the
  307. files it is in.
  308.  
  309.    Tag tables are stored in files called "tag table files".  The
  310. conventional name for a tag table file is `TAGS'.
  311.  
  312.    Each entry in the tag table records the name of one tag, the name of
  313. the file that the tag is defined in (implicitly), and the position in
  314. that file of the tag's definition.
  315.  
  316.    Just what names from the described files are recorded in the tag
  317. table depends on the programming language of the described file.  They
  318. normally include all functions and subroutines, and may also include
  319. global variables, data types, and anything else convenient.  Each name
  320. recorded is called a "tag".
  321.  
  322. * Menu:
  323.  
  324. * Tag Syntax::          Tag syntax for various types of code and text
  325.                           files.
  326. * Create Tag Table::    Creating a tag table with `etags'.
  327. * Select Tag Table::    How to visit a tag table.
  328. * Find Tag::            Commands to find the definition of a specific
  329.                           tag.
  330. * Tags Search::         Using a tag table for searching and replacing.
  331. * Tags Stepping::       Visiting files in a tag table, one by one.
  332. * List Tags::           Listing and finding tags defined in a file.
  333.  
  334. 
  335. File: emacs,  Node: Tag Syntax,  Next: Create Tag Table,  Up: Tags
  336.  
  337. Source File Tag Syntax
  338. ----------------------
  339.  
  340.    In Lisp code, any function defined with `defun', any variable
  341. defined with `defvar' or `defconst', and in general the first argument
  342. of any expression that starts with `(def' in column zero, is a tag.
  343.  
  344.    In Scheme code, tags include anything defined with `def' or with a
  345. construct whose name starts with `def'.  They also include variables
  346. set with `set!' at top level in the file.
  347.  
  348.    In C code, any C function is a tag, and so is any typedef if `-t' is
  349. specified when the tag table is constructed.
  350.  
  351.    In Yacc or Bison input files, each rule defines as a tag the
  352. nonterminal it constructs.  The portions of the file that contain C code
  353. are parsed as C code.
  354.  
  355.    In Fortran code, functions and subroutines are tags.
  356.  
  357.    In Prolog code, a tag name appears at the left margin.
  358.  
  359.    In assembler code, labels appearing at the beginning of a line,
  360. followed by a colon, are tags.
  361.  
  362.    In LaTeX text, the argument of any of the commands `\chapter',
  363. `\section', `\subsection', `\subsubsection', `\eqno', `\label', `\ref',
  364. `\cite', `\bibitem' and `\typeout' is a tag.
  365.  
  366. 
  367. File: emacs,  Node: Create Tag Table,  Next: Select Tag Table,  Prev: Tag Syntax,  Up: Tags
  368.  
  369. Creating Tag Tables
  370. -------------------
  371.  
  372.    The `etags' program is used to create a tag table file.  It knows
  373. the syntax of several languages, as described in *Note Tag Syntax::.
  374. Here is how to run `etags':
  375.  
  376.      etags INPUTFILES...
  377.  
  378. The `etags' program reads the specified files, and writes a tag table
  379. named `TAGS' in the current working directory.  `etags' recognizes the
  380. language used in an input file based on its file name and contents;
  381. there are no switches for specifying the language.  The `-t' switch
  382. tells `etags' to record typedefs in C code as tags.
  383.  
  384.    If the tag table data become outdated due to changes in the files
  385. described in the table, the way to update the tag table is the same way
  386. it was made in the first place.  It is not necessary to do this often.
  387.  
  388.    If the tag table fails to record a tag, or records it for the wrong
  389. file, then Emacs cannot possibly find its definition.  However, if the
  390. position recorded in the tag table becomes a little bit wrong (due to
  391. some editing in the file that the tag definition is in), the only
  392. consequence is a slight delay in finding the tag.  Even if the stored
  393. position is very wrong, Emacs will still find the tag, but it must
  394. search the entire file for it.
  395.  
  396.    So you should update a tag table when you define new tags that you
  397. want to have listed, or when you move tag definitions from one file to
  398. another, or when changes become substantial.  Normally there is no need
  399. to update the tag table after each edit, or even every day.
  400.  
  401. 
  402. File: emacs,  Node: Select Tag Table,  Next: Find Tag,  Prev: Create Tag Table,  Up: Tags
  403.  
  404. Selecting a Tag Table
  405. ---------------------
  406.  
  407.    Emacs has at any time one "selected" tag table, and all the commands
  408. for working with tag tables use the selected one.  To select a tag
  409. table, type `M-x visit-tags-table', which reads the tag table file name
  410. as an argument.  The name `TAGS' in the default directory is used as the
  411. default file name.
  412.  
  413.    All this command does is store the file name in the variable
  414. `tags-file-name'.  Emacs does not actually read in the tag table
  415. contents until you try to use them.  Setting this variable yourself is
  416. just as good as using `visit-tags-table'.  The variable's initial value
  417. is `nil'; that value tells all the commands for working with tag tables
  418. that they must ask for a tag table file name to use.
  419.  
  420.    Using `visit-tags-table' to load a new tag table does not discard
  421. the other tables previously loaded.  The other tags commands use all
  422. the tag tables that are loaded; the first one they use is the one that
  423. mentions the current visited file.
  424.  
  425.    You can specify a precise list of tag tables by setting the variable
  426. `tags-table-list' to a list of strings, like this:
  427.  
  428.      (setq tags-table-list
  429.            '("~/emacs" "/usr/local/lib/emacs/src"))
  430.  
  431. This tells the tags commands to look at the `TAGS' files in your
  432. `~/emacs' directory and in the `/usr/local/lib/emacs/src' directory.
  433. The order depends on which file you are in and which tags table
  434. mentions that file, as explained above.
  435.  
  436. 
  437. File: emacs,  Node: Find Tag,  Next: Tags Search,  Prev: Select Tag Table,  Up: Tags
  438.  
  439. Finding a Tag
  440. -------------
  441.  
  442.    The most important thing that a tag table enables you to do is to
  443. find the definition of a specific tag.
  444.  
  445. `M-. TAG RET'
  446.      Find first definition of TAG (`find-tag').
  447.  
  448. `C-u M-.'
  449.      Find next alternate definition of last tag specified.
  450.  
  451. `C-u - M-.'
  452.      Go back to previous tag found.
  453.  
  454. `M-x find-tag-regexp RET PATTERN RET'
  455.      Find a tag whose name matches PATTERN.
  456.  
  457. `C-u M-x find-tag-regexp'
  458.      Find the next tag whose name matches the last pattern used.
  459.  
  460. `C-x 4 . TAG RET'
  461.      Find first definition of TAG, but display it in another window
  462.      (`find-tag-other-window').
  463.  
  464. `C-x 5 . TAG RET'
  465.      Find first definition of TAG, and create a new frame to select the
  466.      buffer (`find-tag-other-frame').
  467.  
  468.    `M-.' (`find-tag') is the command to find the definition of a
  469. specified tag.  It searches through the tag table for that tag, as a
  470. string, and then uses the tag table info to determine the file that the
  471. definition is in and the approximate character position in the file of
  472. the definition.  Then `find-tag' visits that file, moves point to the
  473. approximate character position, and searches ever-increasing distances
  474. away to find the tag definition.
  475.  
  476.    If an empty argument is given (just type RET), the sexp in the
  477. buffer before or around point is used as the TAG argument.  *Note
  478. Lists::, for info on sexps.
  479.  
  480.    You don't need to give `M-.' the full name of the tag; a part will
  481. do.  This is because `M-.' finds tags in the table which contain TAG as
  482. a substring.  However, it prefers an exact match to a substring match.
  483.  
  484.    To find other tags that match the same substring, give `find-tag' a
  485. numeric argument, as in `C-u M-.'; this does not read a tag name, but
  486. continues searching the tag table's text for another tag containing the
  487. same substring last used.  If you have a real META key, `M-0 M-.' is an
  488. easier alternative to `C-u M-.'.
  489.  
  490.    Like most commands that can switch buffers, `find-tag' has a variant
  491. that displays the new buffer in another window, and one that makes a
  492. new frame for it.  The former is `C-x 4 .', which invokes the command
  493. `find-tag-other-window'.  The latter is `C-x 5 .', which invokes
  494. `find-tag-other-frame'.
  495.  
  496.    To move back to places you've found tags recently, use `C-u - M-.';
  497. more generally, `M-.' with a negative numeric argument.  This command
  498. can take you to another buffer.  `C-x 4 .' with a negative argument
  499. finds the previous tag location in another window.
  500.  
  501.    The new command `M-x find-tag-regexp' visits the tags that match a
  502. specified regular expression.  It is just like `M-.' except that it
  503. does regexp matching instead of substring matching.
  504.  
  505.    Emacs comes with a tag table file `src/TAGS' that includes all the
  506. Lisp libraries and all the C sources of Emacs.  By specifying this file
  507. with `visit-tags-table' and then using `M-.' you can quickly find the
  508. source for any Emacs function.
  509.  
  510. 
  511. File: emacs,  Node: Tags Search,  Next: Tags Stepping,  Prev: Find Tag,  Up: Tags
  512.  
  513. Searching and Replacing with Tag Tables
  514. ---------------------------------------
  515.  
  516.    The commands in this section visit and search all the files listed
  517. in the selected tag table, one by one.  For these commands, the tag
  518. table serves only to specify a sequence of files to search.  A related
  519. command is `M-x grep' (*note Compilation::.).
  520.  
  521. `M-x tags-search'
  522.      Search for the specified regexp through the files in the selected
  523.      tag table.
  524.  
  525. `M-x tags-query-replace'
  526.      Perform a `query-replace' on each file in the selected tag table.
  527.  
  528. `M-,'
  529.      Restart one of the commands above, from the current location of
  530.      point (`tags-loop-continue').
  531.  
  532.    `M-x tags-search' reads a regexp using the minibuffer, then searches
  533. for matches in all the files in the selected tag table, one file at a
  534. time.  It displays the name of the file being searched so you can
  535. follow its progress.  As soon as it finds an occurrence, `tags-search'
  536. returns.
  537.  
  538.    Having found one match, you probably want to find all the rest.  To
  539. find one more match, type `M-,' (`tags-loop-continue') to resume the
  540. `tags-search'.  This searches the rest of the current buffer, followed
  541. by the remaining files of the tag table.
  542.  
  543.    `M-x tags-query-replace' performs a single `query-replace' through
  544. all the files in the tag table.  It reads a regexp to search for and a
  545. string to replace with, just like ordinary `M-x query-replace-regexp'.
  546. It searches much like `M-x tags-search' but repeatedly, processing
  547. matches according to your input.  *Note Replace::, for more information
  548. on query replace.
  549.  
  550.    It is possible to get through all the files in the tag table with a
  551. single invocation of `M-x tags-query-replace'.  But since any
  552. unrecognized character causes the command to exit, you may need to
  553. continue where you left off.  `M-,' can be used for this.  It resumes
  554. the last tags search or replace command that you did.
  555.  
  556.    The commands in this section carry out much broader searches than the
  557. `find-tags' family.  The `find-tags' commands search only for
  558. definitions of tags that match your substring or regexp.  The commands
  559. `tags-search' and `tags-query-replace' find every occurrence of the
  560. regexp, as ordinary search commands and replace commands do in the
  561. current buffer.
  562.  
  563.    These commands create buffers only temporarily for the files that
  564. they have to search (those which are not already visited in Emacs
  565. buffers).  Buffers in which no match is found are quickly killed; the
  566. others continue to exist.
  567.  
  568.    It may have struck you that `tags-search' is a lot like `grep'.  You
  569. can also run `grep' itself as an inferior of Emacs and have Emacs show
  570. you the matching lines one by one.  This works mostly the same as
  571. running a compilation and having Emacs show you where the errors were.
  572. *Note Compilation::.
  573.  
  574. 
  575. File: emacs,  Node: Tags Stepping,  Next: List Tags,  Prev: Tags Search,  Up: Tags
  576.  
  577. Stepping Through a Tag Table
  578. ----------------------------
  579.  
  580.    If you wish to process all the files in the selected tag table, but
  581. not in the specific ways that `M-x tags-search' and `M-x
  582. tags-query-replace' do, you can use `M-x next-file' to visit the files
  583. one by one.
  584.  
  585. `C-u M-x next-file'
  586.      Visit the first file in the tag table, and prepare to advance
  587.      sequentially by files.
  588.  
  589. `M-x next-file'
  590.      Visit the next file in the selected tag table.
  591.  
  592. 
  593. File: emacs,  Node: List Tags,  Prev: Tags Stepping,  Up: Tags
  594.  
  595. Tag Table Inquiries
  596. -------------------
  597.  
  598. `M-x list-tags'
  599.      Display a list of the tags defined in a specific program file.
  600.  
  601. `M-x tags-apropos'
  602.      Display a list of all tags matching a specified regexp.
  603.  
  604.    `M-x list-tags' reads the name of one of the files described by the
  605. selected tag table, and displays a list of all the tags defined in that
  606. file.  The "file name" argument is really just a string to compare
  607. against the names recorded in the tag table; it is read as a string
  608. rather than as a file name.  Therefore, completion and defaulting are
  609. not available, and you must enter the string the same way it appears in
  610. the tag table.  Do not include a directory as part of the file name
  611. unless the file name recorded in the tag table includes a directory.
  612.  
  613.    `M-x tags-apropos' is like `apropos' for tags.  It reads a regexp,
  614. then finds all the tags in the selected tag table whose entries match
  615. that regexp, and displays the tag names found.
  616.  
  617.    You can also perform completion in the buffer on the name space of
  618. tag names in the current tag tables.  *Note Symbol Completion::.
  619.  
  620. 
  621. File: emacs,  Node: Emerge,  Next: C Mode,  Prev: Tags,  Up: Programs
  622.  
  623. Merging Files with Emerge
  624. =========================
  625.  
  626.    It's not unusual for programmers to get their signals crossed and
  627. modify the same program in two different directions.  To recover from
  628. this confusion, you need to merge the two versions.  Emerge makes this
  629. easier.  See also *Note Comparing Files::.
  630.  
  631. * Menu:
  632.  
  633. * Overview of Emerge::        How to start Emerge.  Basic concepts.
  634. * Submodes of Emerge::      Fast mode vs. Edit mode.
  635.                   Skip Prefers mode and Auto Advance mode.
  636. * State of Difference::        You do the merge by specifying state A or B
  637.                   for each difference.
  638. * Merge Commands::        Commands for selecting a difference,
  639.                   changing states of differences, etc.
  640. * Exiting Emerge::        What to do when you've finished the merge.
  641. * Combining in Emerge::        How to keep both alternatives for a difference.
  642. * Fine Points of Emerge::   Misc.
  643.  
  644. 
  645. File: emacs,  Node: Overview of Emerge,  Next: Submodes of Emerge,  Up: Emerge
  646.  
  647. Overview of Emerge
  648. ------------------
  649.  
  650.    To start Emerge, run one of these four commands:
  651.  
  652. `M-x emerge-files'
  653.      Merge two specified files.
  654.  
  655. `M-x emerge-files-with-ancestor'
  656.      Merge two specified files, with reference to a common ancestor.
  657.  
  658. `M-x emerge-buffers'
  659.      Merge two buffers.
  660.  
  661. `M-x emerge-buffers-with-ancestor'
  662.      Merge two buffers with reference to a common ancestor in a third
  663.      buffer.
  664.  
  665.    The Emerge commands compare two files or buffers, and display the
  666. comparison in three buffers: one for each input text (the "A buffer"
  667. and the "B buffer"), and one (the "merge buffer") where merging takes
  668. place.  The merge buffer shows the full merged text, not just the
  669. differences.  Wherever the two input texts differ, you can choose which
  670. one of them to include in the merge buffer.
  671.  
  672.    The Emerge commands that take input from existing buffers use only
  673. the accessible portions of those buffers, if they are narrowed (*note
  674. Narrowing::.).
  675.  
  676.    If a common ancestor version is available, from which the two texts
  677. to be merged were both derived, Emerge can use it to guess which
  678. alternative is right.  Wherever one current version agrees with the
  679. ancestor, Emerge presumes that the other current version is a deliberate
  680. change which should be kept in the merged version.  Use the
  681. `with-ancestor' commands if you want to specify a common ancestor text.
  682. These commands read three file or buffer names--variant A, variant B,
  683. and the common ancestor.
  684.  
  685.    After the comparison is done and the buffers are prepared, the
  686. interactive merging starts.  You control the merging by typing special
  687. commands in the merge buffer.  The merge buffer shows you a full merged
  688. text, not just differences.  For each run of differences between the
  689. input texts, you can choose which one of them to keep, or edit them both
  690. together.
  691.  
  692.    The merge buffer uses a special major mode, Emerge mode, with
  693. commands for making these choices.  But you can also edit the buffer
  694. with ordinary Emacs commands.
  695.  
  696.    At any given time, the attention of Emerge is focused on one
  697. particular difference, called the "selected" difference.  This
  698. difference is marked off in the three buffers like this:
  699.  
  700.      vvvvvvvvvvvvvvvvvvvv
  701.      TEXT THAT DIFFERS
  702.      ^^^^^^^^^^^^^^^^^^^^
  703.  
  704. Emerge numbers all the differences sequentially and the mode line
  705. always shows the number of the selected difference.
  706.  
  707.    Normally, the merge buffer starts out with the A version of the text.
  708. But when the A version of a part of the buffer agrees with the common
  709. ancestor, then the B version is preferred for that part.
  710.  
  711.    Emerge leaves the merged text in the merge buffer when you exit.  At
  712. that point, you can save it in a file with `C-x C-w'.  If you give a
  713. prefix argument to `emerge-files' or `emerge-files-with-ancestor', it
  714. reads the name of the output file using the minibuffer.  (This is the
  715. last file name those commands read.) Then exiting from Emerge saves the
  716. merged text in the output file.
  717.  
  718.    If you abort Emerge with `C-]', the output is not saved.
  719.  
  720. 
  721. File: emacs,  Node: Submodes of Emerge,  Next: State of Difference,  Prev: Overview of Emerge,  Up: Emerge
  722.  
  723. Submodes of Emerge
  724. ------------------
  725.  
  726.    You can choose between two modes for giving merge commands: Fast mode
  727. and Edit mode.  In Fast mode, basic Emerge commands are single
  728. characters, but ordinary Emacs commands are disabled.  This is
  729. convenient if you use only Emerge commands.
  730.  
  731.    In Edit mode, all Emerge commands start with the prefix key `C-c
  732. C-c', and the normal Emacs commands are also available.  This allows
  733. editing the merge buffer, but slows down Emerge operations.
  734.  
  735.    Use `e' to switch to Edit mode, and `C-c C-c f' to switch to Fast
  736. mode.  The mode line indicates Edit and Fast modes with `E' and `F'.
  737.  
  738.    Emerge has two additional submodes that affect how particular merge
  739. commands work: Auto Advance mode and Skip Prefers mode.
  740.  
  741.    If Auto Advance mode is in effect, the `a' and `b' commands advance
  742. to the next difference.  This lets you go through the merge faster as
  743. long as you simply choose one of the alternatives from the input.  The
  744. mode line indicates Auto Advance mode with `A'.
  745.  
  746.    If Skip Prefers mode is in effect, the `n' and `p' commands skip
  747. over differences in states prefer-A and prefer-B.  Thus you see only
  748. differences for which neither version is presumed "correct".  The mode
  749. line indicates Skip Prefers mode with `S'.
  750.  
  751.    Use the command `s a' (`emerge-auto-advance-mode') to set or clear
  752. Auto Advance mode.  Use `s s' (`emerge-skip-prefers-mode') to set or
  753. clear Skip Prefers mode.  These commands turn on the mode with a
  754. positive argument, turns it off with a negative or zero argument, and
  755. toggle the mode with no argument.
  756.  
  757. 
  758. File: emacs,  Node: State of Difference,  Next: Merge Commands,  Prev: Submodes of Emerge,  Up: Emerge
  759.  
  760. State of a Difference
  761. ---------------------
  762.  
  763.    In the merge buffer, a difference is marked with lines of `v' and
  764. `^' characters.  Each difference has one of these seven states:
  765.  
  766. A
  767.      The difference is showing the A version.  The `a' command always
  768.      produces this state; the mode line indicates it with `A'.
  769.  
  770. B
  771.      The difference is showing the B version.  The `b' command always
  772.      produces this state; the mode line indicates it with `B'.
  773.  
  774. default-A
  775. default-B
  776.      The difference is showing the A or the B state by default, because
  777.      you haven't made a choice.  All differences start in the default-A
  778.      state (and thus the merge buffer is a copy of the A buffer),
  779.      except those for which one alternative is "preferred" (see below).
  780.  
  781.      When you select a difference, its state changes from default-A or
  782.      default-B to plain A or B.  Thus, the selected difference never has
  783.      state default-A or default-B, and these states are never displayed
  784.      in the mode line.
  785.  
  786.      The command `d a' chooses default-A as the default state, and `d
  787.      b' chooses default-B.  This chosen default applies to all
  788.      differences which you haven't selected and for which no
  789.      alternative is preferred.  If you are moving through the merge
  790.      sequentially, the differences you haven't selected are those
  791.      following the selected one.  Thus, while moving sequentially, you
  792.      can effectively make the A version the default for some sections
  793.      of the merge buffer and the B version the default for others by
  794.      using `d a' and `d b' at the end of each section.
  795.  
  796. prefer-A
  797. prefer-B
  798.      The difference is showing the A or B state because it is
  799.      "preferred".  This means that you haven't made an explicit choice,
  800.      but one alternative seems likely to be right because the other
  801.      alternative agrees with the common ancestor.  Thus, where the A
  802.      buffer agrees with the common ancestor, the B version is
  803.      preferred, because chances are it is the one that was actually
  804.      changed.
  805.  
  806.      These two states are displayed in the mode line as `A*' and `B*'.
  807.  
  808. combined
  809.      The difference is showing a combination of the A and B states, as a
  810.      result of the `x c' or `x C' commands.
  811.  
  812.      Once a difference is in this state, the `a' and `b' commands don't
  813.      do anything to it unless you give them a prefix argument.
  814.  
  815.      The mode line displays this state as `comb'.
  816.  
  817. 
  818. File: emacs,  Node: Merge Commands,  Next: Exiting Emerge,  Prev: State of Difference,  Up: Emerge
  819.  
  820. Merge Commands
  821. --------------
  822.  
  823.    Here are the Merge commands for Fast mode; in Edit mode, precede them
  824. with `C-c C-c':
  825.  
  826. `p'
  827.      Select the previous difference.
  828.  
  829. `n'
  830.      Select the next difference.
  831.  
  832. `a'
  833.      Choose the A version of this difference.
  834.  
  835. `b'
  836.      Choose the B version of this difference.
  837.  
  838. `j'
  839.      Select a particular difference; specify the sequence number of that
  840.      difference as a prefix argument.
  841.  
  842. `.'
  843.      Select the difference containing point.  You can use this command
  844.      in the merge buffer or in the A or B buffer.
  845.  
  846. `q'
  847.      Quit--finish the merge.
  848.  
  849. `C-]'
  850.      Abort--exit merging and do not save the output.
  851.  
  852. `f'
  853.      Go into Fast mode.  (In Edit mode, this is actually `C-c C-c f'.)
  854.  
  855. `e'
  856.      Go into Edit mode.
  857.  
  858. `l'
  859.      Recenter (like `C-l') all three windows.
  860.  
  861. `-'
  862.      Specify part of a prefix numeric argument.
  863.  
  864. `DIGIT'
  865.      Also specify part of a prefix numeric argument.
  866.  
  867. `d a'
  868.      Choose the A version as the default from here down in the merge
  869.      buffer.
  870.  
  871. `d b'
  872.      Choose the B version as the default from here down in the merge
  873.      buffer.
  874.  
  875. `c a'
  876.      Copy the A version of this difference into the kill ring.
  877.  
  878. `c b'
  879.      Copy the B version of this difference into the kill ring.
  880.  
  881. `i a'
  882.      Insert the A version of this difference at the point.
  883.  
  884. `i b'
  885.      Insert the B version of this difference at the point.
  886.  
  887. `m'
  888.      Put the point and mark around the difference region.
  889.  
  890. `^'
  891.      Scroll all three windows down (like `M-v').
  892.  
  893. `v'
  894.      Scroll all three windows up (like `C-v').
  895.  
  896. `<'
  897.      Scroll all three windows left (like `C-x <').
  898.  
  899. `>'
  900.      Scroll all three windows right (like `C-x >').
  901.  
  902. `|'
  903.      Reset horizontal scroll on all three windows.
  904.  
  905. `x 1'
  906.      Shrink the merge window to one line.  (Use `C-u l' to restore it
  907.      to full size.)
  908.  
  909. `x c'
  910.      Combine the two versions of this difference.
  911.  
  912. `x f'
  913.      Show the files/buffers Emerge is operating on in Help window.
  914.      (Use `C-u l' to restore windows.)
  915.  
  916. `x j'
  917.      Join this difference with the following one.  (`C-u x j' joins
  918.      this difference with the previous one.)
  919.  
  920. `x s'
  921.      Split this difference into two differences.  Before you use this
  922.      command, position point in each of the three buffers to the place
  923.      where you want to split the difference.
  924.  
  925. `x t'
  926.      Trim identical lines off top and bottom of the difference.  Such
  927.      lines occur when the A and B versions are identical but differ
  928.      from the ancestor version.
  929.  
  930. 
  931. File: emacs,  Node: Exiting Emerge,  Next: Combining in Emerge,  Prev: Merge Commands,  Up: Emerge
  932.  
  933. Exiting Emerge
  934. --------------
  935.  
  936.    The `q' command (`emerge-quit') finishes the merge, storing the
  937. results into the output file if you specified one.  It restores the A
  938. and B buffers to their proper contents, or kills them if they were
  939. created by Emerge and you haven't changed them.  It also disables the
  940. Emerge commands in the merge buffer, since executing them later could
  941. damage the contents of the various buffers.
  942.  
  943.    `C-]' aborts the merge.  This means exiting without writing the
  944. output file.  If you didn't specify an output file, then there is no
  945. real difference between aborting and finishing the merge.
  946.  
  947.    If Emerge was called from another Lisp program, then its return value
  948. is `t' for successful completion, or `nil' if you abort.
  949.  
  950. 
  951. File: emacs,  Node: Combining in Emerge,  Next: Fine Points of Emerge,  Prev: Exiting Emerge,  Up: Emerge
  952.  
  953. Combining the Two Versions
  954. --------------------------
  955.  
  956.    Sometimes you want to keep *both* alternatives for a particular
  957. locus.  To do this, use `x c', which edits the merge buffer like this:
  958.  
  959.      #ifdef NEW
  960.      VERSION FROM A FILE
  961.      #else /* NEW */
  962.      VERSION FROM B FILE
  963.      #endif /* NEW */
  964.  
  965. While this example shows C preprocessor conditionals delimiting the two
  966. alternative versions, you can specify the strings you want by setting
  967. the variable `emerge-combine-versions-template' to a string of your
  968. choice.  In the string, `%a' says where to put version A, and `%b' says
  969. where to put version B.  The default setting, which produces the
  970. results shown above, looks like this:
  971.  
  972.      "#ifdef NEW\n%a#else /* NEW */\n%b#endif /* NEW */\n"
  973.  
  974. 
  975. File: emacs,  Node: Fine Points of Emerge,  Prev: Combining in Emerge,  Up: Emerge
  976.  
  977. Fine Points of Emerge
  978. ---------------------
  979.  
  980.    During the merge, you mustn't try to edit the A and B buffers
  981. yourself.  Emerge modifies them temporarily, but ultimately puts them
  982. back the way they were.
  983.  
  984.    You can have any number of merges going at once--just don't use any
  985. one buffer as input to more than one merge at once, since the temporary
  986. changes made in these buffers would get in each other's way.
  987.  
  988.    Starting Emerge can take a long time because it needs to compare the
  989. files fully.  Emacs can't do anything else until `diff' finishes.
  990. Perhaps in the future someone will change Emerge to do the comparison in
  991. the background when the input files are large--then you could keep on
  992. doing other things with Emacs until Emerge gets ready to accept
  993. commands.
  994.  
  995.    After setting up the merge, Emerge runs the hook
  996. `emerge-startup-hook' (*note Hooks::.).
  997.  
  998. 
  999. File: emacs,  Node: C Mode,  Next: Fortran,  Prev: Emerge,  Up: Programs
  1000.  
  1001. C Mode
  1002. ======
  1003.  
  1004.    In addition to the facilities of typical programming language major
  1005. modes (*note Program Modes::.), C mode has various special facilities.
  1006.  
  1007. `M-a'
  1008. `M-e'
  1009.      In C mode, `M-a' and `M-e' now move by complete C statements
  1010.      (`c-beginning-of-statement' and `c-end-of-statement').  These
  1011.      commands do ordinary, textual sentence motion when in or next to a
  1012.      comment.
  1013.  
  1014. `M-q'
  1015.      `M-q' in C mode runs `c-fill-paragraph', which is designed for
  1016.      filling C comments.  (We assume you don't want to fill the actual
  1017.      C code in a C program.)
  1018.  
  1019. `C-c C-u'
  1020.      Move back to the containing preprocessor conditional, setting the
  1021.      mark at the starting point (`c-up-conditional').
  1022.  
  1023.      A prefix argument acts as a repeat count.  With a negative
  1024.      argument, this command moves forward to the end of the containing
  1025.      preprocessor conditional.  When going backwards, `#elif' acts like
  1026.      `#else' followed by `#if'.  When going forwards, `#elif' is
  1027.      ignored.
  1028.  
  1029. `C-c C-n'
  1030.      Move forward across the next preprocessor conditional, setting the
  1031.      mark at the starting point (`c-forward-conditional').
  1032.  
  1033. `C-c C-p'
  1034.      Move backward across the previous preprocessor conditional,
  1035.      setting the at the starting point (`c-backward-conditional').
  1036.  
  1037. `M-x c-macro-expand'
  1038.      When you are debugging C code that uses macros, sometimes it is
  1039.      hard to figure out precisely how the macros expand.  The command
  1040.      `M-x c-macro-expand' runs the C preprocessor and shows you what
  1041.      expansion results from the region.  The portion of the buffer
  1042.      before the region is also included in preprocessing, for the sake
  1043.      of macros defined there, but the output from this part isn't shown.
  1044.  
  1045. `M-x c-backslash-region'
  1046.      Insert or align `\' characters at the ends of the lines of the
  1047.      region, except for the last such line.  This is useful after
  1048.      writing or editing a C macro definition.
  1049.  
  1050.      If a line already ends in `\', this command adjusts the amount of
  1051.      whitespace before it.  Otherwise, it inserts a new `\'.
  1052.  
  1053.    C++ mode is like C mode, except that it understands C++ comment
  1054. syntax and certain other differences between C and C++.  It also has a
  1055. command `M-x fill-c++-comment', which fills a paragraph made of C++
  1056. comment lines.
  1057.  
  1058.    The command `comment-region' is useful in C++ mode for commenting
  1059. out several consecutive lines, or removing the commenting out of such
  1060. lines.  (You don't need this command with C comment syntax because you
  1061. don't need to put comment delimiters on each line.)  *Note Comments::.
  1062.  
  1063. 
  1064. File: emacs,  Node: Fortran,  Next: Asm Mode,  Prev: C Mode,  Up: Programs
  1065.  
  1066. Fortran Mode
  1067. ============
  1068.  
  1069.    Fortran mode provides special motion commands for Fortran statements
  1070. and subprograms, and indentation commands that understand Fortran
  1071. conventions of nesting, line numbers and continuation statements.
  1072. Fortran mode has it's own Auto Fill mode that breaks long lines into
  1073. proper Fortran continuation lines.
  1074.  
  1075.    Special commands for comments are provided because Fortran comments
  1076. are unlike those of other languages.
  1077.  
  1078.    Built-in abbrevs optionally save typing when you insert Fortran
  1079. keywords.
  1080.  
  1081.    Use `M-x fortran-mode' to switch to this major mode.  This command
  1082. runs the hook `fortran-mode-hook' (*note Hooks::.).
  1083.  
  1084. * Menu:
  1085.  
  1086. * Motion: Fortran Motion.      Moving point by statements or subprograms.
  1087. * Indent: Fortran Indent.      Indentation commands for Fortran.
  1088. * Comments: Fortran Comments.  Inserting and aligning comments.
  1089. * Autofill: Fortran Autofill.  Auto fill minor mode for Fortran.
  1090. * Columns: Fortran Columns.    Measuring columns for valid Fortran.
  1091. * Abbrev: Fortran Abbrev.      Built-in abbrevs for Fortran keywords.
  1092.  
  1093.    Fortran mode was contributed by Michael Prange.  It has been updated
  1094. by Stephen A. Wood who has collated the contributions and suggestions
  1095. of many users.
  1096.  
  1097. 
  1098. File: emacs,  Node: Fortran Motion,  Next: Fortran Indent,  Up: Fortran
  1099.  
  1100. Motion Commands
  1101. ---------------
  1102.  
  1103.    Fortran mode provides special commands to move by subprograms
  1104. (functions and subroutines) and by statements.  There is also a command
  1105. to put the region around one subprogram, convenient for killing it or
  1106. moving it.
  1107.  
  1108. `C-M-a'
  1109.      Move to beginning of subprogram
  1110.      (`beginning-of-fortran-subprogram').
  1111.  
  1112. `C-M-e'
  1113.      Move to end of subprogram (`end-of-fortran-subprogram').
  1114.  
  1115. `C-M-h'
  1116.      Put point at beginning of subprogram and mark at end
  1117.      (`mark-fortran-subprogram').
  1118.  
  1119. `C-c C-n'
  1120.      Move to beginning of current or next statement
  1121.      (`fortran-next-statement').
  1122.  
  1123. `C-c C-p'
  1124.      Move to beginning of current or previous statement
  1125.      (`fortran-previous-statement').
  1126.  
  1127. 
  1128. File: emacs,  Node: Fortran Indent,  Next: Fortran Comments,  Prev: Fortran Motion,  Up: Fortran
  1129.  
  1130. Fortran Indentation
  1131. -------------------
  1132.  
  1133.    Special commands and features are needed for indenting Fortran code
  1134. in order to make sure various syntactic entities (line numbers, comment
  1135. line indicators and continuation line flags) appear in the columns that
  1136. are required for standard Fortran.
  1137.  
  1138. * Menu:
  1139.  
  1140. * Commands: ForIndent Commands.  Commands for indenting Fortran.
  1141. * Contline: ForIndent Cont.      How continuation lines indent.
  1142. * Numbers:  ForIndent Num.       How line numbers auto-indent.
  1143. * Conv:     ForIndent Conv.      Conventions you must obey to avoid trouble.
  1144. * Vars:     ForIndent Vars.      Variables controlling Fortran indent style.
  1145.  
  1146. 
  1147. File: emacs,  Node: ForIndent Commands,  Next: ForIndent Cont,  Up: Fortran Indent
  1148.  
  1149. Fortran Indentation Commands
  1150. ............................
  1151.  
  1152. `TAB'
  1153.      Indent the current line (`fortran-indent-line').
  1154.  
  1155. `LFD'
  1156.      Indent the current and start a new indented line
  1157.      (`fortran-indent-new-line').
  1158.  
  1159. `M-LFD'
  1160.      Break the current line and set up a continuation line.
  1161.  
  1162. `C-M-q'
  1163.      Indent all the lines of the subprogram point is in
  1164.      (`fortran-indent-subprogram').
  1165.  
  1166.    Fortran mode redefines TAB to reindent the current line for Fortran
  1167. (`fortran-indent-line').  This command indents Line numbers and
  1168. continuation markers to their required columns, and independently
  1169. indents the body of the statement based on its nesting in the program.
  1170.  
  1171.    The key `LFD' runs the command `fortran-indent-new-line', which
  1172. reindents the current line then makes and indents a new line.  This
  1173. command is useful to reindent the closing statement of `do' loops and
  1174. other blocks before starting a new line.
  1175.  
  1176.    The key `C-M-q' runs `fortran-indent-subprogram', a command to
  1177. reindent all the lines of the Fortran subprogram (function or
  1178. subroutine) containing point.
  1179.  
  1180.    The key `M-LFD' runs `fortran-split-line', which splits a line in
  1181. the appropriate fashion for Fortran.  In a non-comment line, the second
  1182. half becomes a continuation line and is indented accordingly.  In a
  1183. comment line, both halves become separate comment lines.
  1184.  
  1185. 
  1186. File: emacs,  Node: ForIndent Cont,  Next: ForIndent Num,  Prev: ForIndent Commands,  Up: Fortran Indent
  1187.  
  1188. Continuation Lines
  1189. ..................
  1190.  
  1191.    Most modern Fortran compilers allow two ways of writing continuation
  1192. lines.  If the first non-space character on a line is in column 5, then
  1193. that line is a continuation of the previous line.  We call this "fixed
  1194. format".  (In GNU Emacs we always count columns from 0.)  A line that
  1195. starts with a tab character followed by any digit except `0' is also a
  1196. continuation line.  We call this style of continuation "tab format".
  1197.  
  1198.    Fortran mode can make either style of continuation line, but you
  1199. must specify which one you prefer.  The value of the variable
  1200. `indent-tabs-mode' controls the choice: `nil' for fixed format, and
  1201. non-`nil' for tab format.  You can tell which style is presently in
  1202. effect by the presence or absence of the string `Tab' in the mode line.
  1203.  
  1204.    If the text on a line starts with the conventional Fortran
  1205. continuation marker `$', or if it begins with any non-whitespace
  1206. character in column 5, Fortran mode treats it as a continuation line.
  1207. When you indent a continuation line with TAB, it converts the line to
  1208. the current continuation style.  When you split a Fortran statement
  1209. with `M-LFD', the continuation marker on the newline is created
  1210. according to the continuation style.
  1211.  
  1212.    The setting of continuation style affects several other aspects of
  1213. editing in Fortran mode.  In fixed format mode, the minimum column
  1214. number for the body of a statement is 6.  Lines inside of Fortran
  1215. blocks that are indented to larger column numbers always use only the
  1216. space character for whitespace.  In tab format mode, the minimum column
  1217. number for the statement body is 8, and the whitespace before column 8
  1218. must always consist of one tab character.
  1219.  
  1220.    When you enter Fortran mode for an existing file, it tries to deduce
  1221. the proper continuation style automatically from the file contents.
  1222. The first line that begins with either a tab character or six spaces
  1223. determines the choice.  The variable `fortran-analyze-depth' specifies
  1224. how many lines to consider (at the beginning of the file); if none of
  1225. those lines indicates a style, then the variable
  1226. `fortran-tab-mode-default' specifies the style.  If it is `nil', that
  1227. specifies fixed format, and non-`nil' specifies tab format.
  1228.  
  1229.