home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / beos / emacs / emacs-19.34-bin / emacs-19 / info / emacs-13 < prev    next >
Encoding:
GNU Info File  |  1997-09-17  |  48.2 KB  |  1,235 lines

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