diff options
| author | Chong Yidong | 2006-03-16 03:19:56 +0000 |
|---|---|---|
| committer | Chong Yidong | 2006-03-16 03:19:56 +0000 |
| commit | e0fc8fa2dd2e0a42c55027addc5c78090b5deac7 (patch) | |
| tree | 788c12dd7408e6c94354959932fc147ae43d7b42 /man/programs.texi | |
| parent | dc5c3489f44f5bd0a17ee3deef9363387f5b4de5 (diff) | |
| download | emacs-e0fc8fa2dd2e0a42c55027addc5c78090b5deac7.tar.gz emacs-e0fc8fa2dd2e0a42c55027addc5c78090b5deac7.zip | |
* emacs-xtra.texi (Emerge, Picture Mode. Fortran): New chapters,
moved here from Emacs manual.
* programs.texi (Fortran): Section moved to emacs-xtra.
(Program Modes): Xref to Fortran in emacs-xtra.
* maintaining.texi (Emerge): Moved to emacs-xtra.
* files.texi (Comparing Files): Xref to Emerge in emacs-xtra.
* picture.texi: File deleted.
* text.texi (Text): Xref to Picture Mode in emacs-xtra.
* abbrevs.texi (Abbrevs):
* sending.texi (Sending Mail): Picture node removed.
* emacs.texi (Top): Update node listings.
Diffstat (limited to 'man/programs.texi')
| -rw-r--r-- | man/programs.texi | 519 |
1 files changed, 2 insertions, 517 deletions
diff --git a/man/programs.texi b/man/programs.texi index 643e6445fb0..9ec4f7ff2d3 100644 --- a/man/programs.texi +++ b/man/programs.texi | |||
| @@ -41,7 +41,6 @@ Highlight program syntax (@pxref{Font Lock}). | |||
| 41 | * Misc for Programs:: Other Emacs features useful for editing programs. | 41 | * Misc for Programs:: Other Emacs features useful for editing programs. |
| 42 | * C Modes:: Special commands of C, C++, Objective-C, | 42 | * C Modes:: Special commands of C, C++, Objective-C, |
| 43 | Java, and Pike modes. | 43 | Java, and Pike modes. |
| 44 | * Fortran:: Fortran mode and its special features. | ||
| 45 | * Asm Mode:: Asm mode and its special features. | 44 | * Asm Mode:: Asm mode and its special features. |
| 46 | @end menu | 45 | @end menu |
| 47 | 46 | ||
| @@ -109,7 +108,8 @@ tab character before point, in these modes. | |||
| 109 | Separate manuals are available for the modes for Ada (@pxref{Top, , Ada | 108 | Separate manuals are available for the modes for Ada (@pxref{Top, , Ada |
| 110 | Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK | 109 | Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK |
| 111 | (@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes | 110 | (@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes |
| 112 | (@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}). | 111 | (@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}). For Fortran |
| 112 | mode, @inforef{Fortran,, emacs-xtra}. | ||
| 113 | 113 | ||
| 114 | @cindex mode hook | 114 | @cindex mode hook |
| 115 | @vindex c-mode-hook | 115 | @vindex c-mode-hook |
| @@ -1715,521 +1715,6 @@ to a C/C++ source file, or vice versa. The variable | |||
| 1715 | names. | 1715 | names. |
| 1716 | @end table | 1716 | @end table |
| 1717 | 1717 | ||
| 1718 | @node Fortran | ||
| 1719 | @section Fortran Mode | ||
| 1720 | @cindex Fortran mode | ||
| 1721 | @cindex mode, Fortran | ||
| 1722 | |||
| 1723 | Fortran mode provides special motion commands for Fortran statements | ||
| 1724 | and subprograms, and indentation commands that understand Fortran | ||
| 1725 | conventions of nesting, line numbers and continuation statements. | ||
| 1726 | Fortran mode has support for Auto Fill mode that breaks long lines into | ||
| 1727 | proper Fortran continuation lines. | ||
| 1728 | |||
| 1729 | Special commands for comments are provided because Fortran comments | ||
| 1730 | are unlike those of other languages. Built-in abbrevs optionally save | ||
| 1731 | typing when you insert Fortran keywords. | ||
| 1732 | |||
| 1733 | Use @kbd{M-x fortran-mode} to switch to this major mode. This command | ||
| 1734 | runs the hook @code{fortran-mode-hook} (@pxref{Hooks}). | ||
| 1735 | |||
| 1736 | @cindex Fortran77 and Fortran90 | ||
| 1737 | @findex f90-mode | ||
| 1738 | @findex fortran-mode | ||
| 1739 | Fortran mode is meant for editing Fortran77 ``fixed format'' (and also | ||
| 1740 | ``tab format'') source code. For editing the modern Fortran90 or | ||
| 1741 | Fortran95 ``free format'' source code, use F90 mode (@code{f90-mode}). | ||
| 1742 | Emacs normally uses Fortran mode for files with extension @samp{.f}, | ||
| 1743 | @samp{.F} or @samp{.for}, and F90 mode for the extension @samp{.f90} and | ||
| 1744 | @samp{.f95}. GNU Fortran supports both kinds of format. | ||
| 1745 | |||
| 1746 | @menu | ||
| 1747 | * Motion: Fortran Motion. Moving point by statements or subprograms. | ||
| 1748 | * Indent: Fortran Indent. Indentation commands for Fortran. | ||
| 1749 | * Comments: Fortran Comments. Inserting and aligning comments. | ||
| 1750 | * Autofill: Fortran Autofill. Auto fill support for Fortran. | ||
| 1751 | * Columns: Fortran Columns. Measuring columns for valid Fortran. | ||
| 1752 | * Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords. | ||
| 1753 | @end menu | ||
| 1754 | |||
| 1755 | @node Fortran Motion | ||
| 1756 | @subsection Motion Commands | ||
| 1757 | |||
| 1758 | In addition to the normal commands for moving by and operating on | ||
| 1759 | ``defuns'' (Fortran subprograms---functions and subroutines, as well as | ||
| 1760 | modules for F90 mode), Fortran mode provides special commands to move by | ||
| 1761 | statements and other program units. | ||
| 1762 | |||
| 1763 | @table @kbd | ||
| 1764 | @kindex C-c C-n @r{(Fortran mode)} | ||
| 1765 | @findex fortran-next-statement | ||
| 1766 | @findex f90-next-statement | ||
| 1767 | @item C-c C-n | ||
| 1768 | Move to the beginning of the next statement | ||
| 1769 | (@code{fortran-next-statement}/@code{f90-next-statement}). | ||
| 1770 | |||
| 1771 | @kindex C-c C-p @r{(Fortran mode)} | ||
| 1772 | @findex fortran-previous-statement | ||
| 1773 | @findex f90-previous-statement | ||
| 1774 | @item C-c C-p | ||
| 1775 | Move to the beginning of the previous statement | ||
| 1776 | (@code{fortran-previous-statement}/@code{f90-previous-statement}). | ||
| 1777 | If there is no previous statement (i.e. if called from the first | ||
| 1778 | statement in the buffer), move to the start of the buffer. | ||
| 1779 | |||
| 1780 | @kindex C-c C-e @r{(F90 mode)} | ||
| 1781 | @findex f90-next-block | ||
| 1782 | @item C-c C-e | ||
| 1783 | Move point forward to the start of the next code block | ||
| 1784 | (@code{f90-next-block}). A code block is a subroutine, | ||
| 1785 | @code{if}--@code{endif} statement, and so forth. This command exists | ||
| 1786 | for F90 mode only, not Fortran mode. With a numeric argument, this | ||
| 1787 | moves forward that many blocks. | ||
| 1788 | |||
| 1789 | @kindex C-c C-a @r{(F90 mode)} | ||
| 1790 | @findex f90-previous-block | ||
| 1791 | @item C-c C-a | ||
| 1792 | Move point backward to the previous code block | ||
| 1793 | (@code{f90-previous-block}). This is like @code{f90-next-block}, but | ||
| 1794 | moves backwards. | ||
| 1795 | |||
| 1796 | @kindex C-M-n @r{(Fortran mode)} | ||
| 1797 | @findex fortran-end-of-block | ||
| 1798 | @findex f90-end-of-block | ||
| 1799 | @item C-M-n | ||
| 1800 | Move to the end of the current code block | ||
| 1801 | (@code{fortran-end-of-block}/@code{f90-end-of-block}). With a numeric | ||
| 1802 | agument, move forward that number of blocks. The mark is set before | ||
| 1803 | moving point. The F90 mode version of this command checks for | ||
| 1804 | consistency of block types and labels (if present), but it does not | ||
| 1805 | check the outermost block since that may be incomplete. | ||
| 1806 | |||
| 1807 | @kindex C-M-p @r{(Fortran mode)} | ||
| 1808 | @findex fortran-beginning-of-block | ||
| 1809 | @findex f90-beginning-of-block | ||
| 1810 | @item C-M-p | ||
| 1811 | Move to the start of the current code block | ||
| 1812 | (@code{fortran-beginning-of-block}/@code{f90-beginning-of-block}). This | ||
| 1813 | is like @code{fortran-end-of-block}, but moves backwards. | ||
| 1814 | @end table | ||
| 1815 | |||
| 1816 | @node Fortran Indent | ||
| 1817 | @subsection Fortran Indentation | ||
| 1818 | |||
| 1819 | Special commands and features are needed for indenting Fortran code in | ||
| 1820 | order to make sure various syntactic entities (line numbers, comment line | ||
| 1821 | indicators and continuation line flags) appear in the columns that are | ||
| 1822 | required for standard, fixed (or tab) format Fortran. | ||
| 1823 | |||
| 1824 | @menu | ||
| 1825 | * Commands: ForIndent Commands. Commands for indenting and filling Fortran. | ||
| 1826 | * Contline: ForIndent Cont. How continuation lines indent. | ||
| 1827 | * Numbers: ForIndent Num. How line numbers auto-indent. | ||
| 1828 | * Conv: ForIndent Conv. Conventions you must obey to avoid trouble. | ||
| 1829 | * Vars: ForIndent Vars. Variables controlling Fortran indent style. | ||
| 1830 | @end menu | ||
| 1831 | |||
| 1832 | @node ForIndent Commands | ||
| 1833 | @subsubsection Fortran Indentation and Filling Commands | ||
| 1834 | |||
| 1835 | @table @kbd | ||
| 1836 | @item C-M-j | ||
| 1837 | Break the current line at point and set up a continuation line | ||
| 1838 | (@code{fortran-split-line}). | ||
| 1839 | @item M-^ | ||
| 1840 | Join this line to the previous line (@code{fortran-join-line}). | ||
| 1841 | @item C-M-q | ||
| 1842 | Indent all the lines of the subprogram point is in | ||
| 1843 | (@code{fortran-indent-subprogram}). | ||
| 1844 | @item M-q | ||
| 1845 | Fill a comment block or statement. | ||
| 1846 | @end table | ||
| 1847 | |||
| 1848 | @kindex C-M-q @r{(Fortran mode)} | ||
| 1849 | @findex fortran-indent-subprogram | ||
| 1850 | The key @kbd{C-M-q} runs @code{fortran-indent-subprogram}, a command | ||
| 1851 | to reindent all the lines of the Fortran subprogram (function or | ||
| 1852 | subroutine) containing point. | ||
| 1853 | |||
| 1854 | @kindex C-M-j @r{(Fortran mode)} | ||
| 1855 | @findex fortran-split-line | ||
| 1856 | The key @kbd{C-M-j} runs @code{fortran-split-line}, which splits | ||
| 1857 | a line in the appropriate fashion for Fortran. In a non-comment line, | ||
| 1858 | the second half becomes a continuation line and is indented | ||
| 1859 | accordingly. In a comment line, both halves become separate comment | ||
| 1860 | lines. | ||
| 1861 | |||
| 1862 | @kindex M-^ @r{(Fortran mode)} | ||
| 1863 | @kindex C-c C-d @r{(Fortran mode)} | ||
| 1864 | @findex fortran-join-line | ||
| 1865 | @kbd{M-^} or @kbd{C-c C-d} runs the command @code{fortran-join-line}, | ||
| 1866 | which joins a continuation line back to the previous line, roughly as | ||
| 1867 | the inverse of @code{fortran-split-line}. The point must be on a | ||
| 1868 | continuation line when this command is invoked. | ||
| 1869 | |||
| 1870 | @kindex M-q @r{(Fortran mode)} | ||
| 1871 | @kbd{M-q} in Fortran mode fills the comment block or statement that | ||
| 1872 | point is in. This removes any excess statement continuations. | ||
| 1873 | |||
| 1874 | @node ForIndent Cont | ||
| 1875 | @subsubsection Continuation Lines | ||
| 1876 | @cindex Fortran continuation lines | ||
| 1877 | |||
| 1878 | @vindex fortran-continuation-string | ||
| 1879 | Most Fortran77 compilers allow two ways of writing continuation lines. | ||
| 1880 | If the first non-space character on a line is in column 5, then that | ||
| 1881 | line is a continuation of the previous line. We call this @dfn{fixed | ||
| 1882 | format}. (In GNU Emacs we always count columns from 0; but note that | ||
| 1883 | the Fortran standard counts from 1.) The variable | ||
| 1884 | @code{fortran-continuation-string} specifies what character to put in | ||
| 1885 | column 5. A line that starts with a tab character followed by any digit | ||
| 1886 | except @samp{0} is also a continuation line. We call this style of | ||
| 1887 | continuation @dfn{tab format}. (Fortran90 introduced ``free format'', | ||
| 1888 | with another style of continuation lines). | ||
| 1889 | |||
| 1890 | @vindex indent-tabs-mode @r{(Fortran mode)} | ||
| 1891 | @vindex fortran-analyze-depth | ||
| 1892 | @vindex fortran-tab-mode-default | ||
| 1893 | Fortran mode can use either style of continuation line. When you | ||
| 1894 | enter Fortran mode, it tries to deduce the proper continuation style | ||
| 1895 | automatically from the buffer contents. It does this by scanning up to | ||
| 1896 | @code{fortran-analyze-depth} (default 100) lines from the start of the | ||
| 1897 | buffer. The first line that begins with either a tab character or six | ||
| 1898 | spaces determines the choice. If the scan fails (for example, if the | ||
| 1899 | buffer is new and therefore empty), the value of | ||
| 1900 | @code{fortran-tab-mode-default} (@code{nil} for fixed format, and | ||
| 1901 | non-@code{nil} for tab format) is used. @samp{/t} in the mode line | ||
| 1902 | indicates tab format is selected. Fortran mode sets the value of | ||
| 1903 | @code{indent-tabs-mode} accordingly (@pxref{Just Spaces}). | ||
| 1904 | |||
| 1905 | If the text on a line starts with the Fortran continuation marker | ||
| 1906 | @samp{$}, or if it begins with any non-whitespace character in column | ||
| 1907 | 5, Fortran mode treats it as a continuation line. When you indent a | ||
| 1908 | continuation line with @key{TAB}, it converts the line to the current | ||
| 1909 | continuation style. When you split a Fortran statement with | ||
| 1910 | @kbd{C-M-j}, the continuation marker on the newline is created according | ||
| 1911 | to the continuation style. | ||
| 1912 | |||
| 1913 | The setting of continuation style affects several other aspects of | ||
| 1914 | editing in Fortran mode. In fixed format mode, the minimum column | ||
| 1915 | number for the body of a statement is 6. Lines inside of Fortran | ||
| 1916 | blocks that are indented to larger column numbers always use only the | ||
| 1917 | space character for whitespace. In tab format mode, the minimum | ||
| 1918 | column number for the statement body is 8, and the whitespace before | ||
| 1919 | column 8 must always consist of one tab character. | ||
| 1920 | |||
| 1921 | @node ForIndent Num | ||
| 1922 | @subsubsection Line Numbers | ||
| 1923 | |||
| 1924 | If a number is the first non-whitespace in the line, Fortran | ||
| 1925 | indentation assumes it is a line number and moves it to columns 0 | ||
| 1926 | through 4. (Columns always count from 0 in GNU Emacs.) | ||
| 1927 | |||
| 1928 | @vindex fortran-line-number-indent | ||
| 1929 | Line numbers of four digits or less are normally indented one space. | ||
| 1930 | The variable @code{fortran-line-number-indent} controls this; it | ||
| 1931 | specifies the maximum indentation a line number can have. The default | ||
| 1932 | value of the variable is 1. Fortran mode tries to prevent line number | ||
| 1933 | digits passing column 4, reducing the indentation below the specified | ||
| 1934 | maximum if necessary. If @code{fortran-line-number-indent} has the | ||
| 1935 | value 5, line numbers are right-justified to end in column 4. | ||
| 1936 | |||
| 1937 | @vindex fortran-electric-line-number | ||
| 1938 | Simply inserting a line number is enough to indent it according to | ||
| 1939 | these rules. As each digit is inserted, the indentation is recomputed. | ||
| 1940 | To turn off this feature, set the variable | ||
| 1941 | @code{fortran-electric-line-number} to @code{nil}. | ||
| 1942 | |||
| 1943 | |||
| 1944 | @node ForIndent Conv | ||
| 1945 | @subsubsection Syntactic Conventions | ||
| 1946 | |||
| 1947 | Fortran mode assumes that you follow certain conventions that simplify | ||
| 1948 | the task of understanding a Fortran program well enough to indent it | ||
| 1949 | properly: | ||
| 1950 | |||
| 1951 | @itemize @bullet | ||
| 1952 | @item | ||
| 1953 | Two nested @samp{do} loops never share a @samp{continue} statement. | ||
| 1954 | |||
| 1955 | @item | ||
| 1956 | Fortran keywords such as @samp{if}, @samp{else}, @samp{then}, @samp{do} | ||
| 1957 | and others are written without embedded whitespace or line breaks. | ||
| 1958 | |||
| 1959 | Fortran compilers generally ignore whitespace outside of string | ||
| 1960 | constants, but Fortran mode does not recognize these keywords if they | ||
| 1961 | are not contiguous. Constructs such as @samp{else if} or @samp{end do} | ||
| 1962 | are acceptable, but the second word should be on the same line as the | ||
| 1963 | first and not on a continuation line. | ||
| 1964 | @end itemize | ||
| 1965 | |||
| 1966 | @noindent | ||
| 1967 | If you fail to follow these conventions, the indentation commands may | ||
| 1968 | indent some lines unaesthetically. However, a correct Fortran program | ||
| 1969 | retains its meaning when reindented even if the conventions are not | ||
| 1970 | followed. | ||
| 1971 | |||
| 1972 | @node ForIndent Vars | ||
| 1973 | @subsubsection Variables for Fortran Indentation | ||
| 1974 | |||
| 1975 | @vindex fortran-do-indent | ||
| 1976 | @vindex fortran-if-indent | ||
| 1977 | @vindex fortran-structure-indent | ||
| 1978 | @vindex fortran-continuation-indent | ||
| 1979 | @vindex fortran-check-all-num@dots{} | ||
| 1980 | @vindex fortran-minimum-statement-indent@dots{} | ||
| 1981 | Several additional variables control how Fortran indentation works: | ||
| 1982 | |||
| 1983 | @table @code | ||
| 1984 | @item fortran-do-indent | ||
| 1985 | Extra indentation within each level of @samp{do} statement (default 3). | ||
| 1986 | |||
| 1987 | @item fortran-if-indent | ||
| 1988 | Extra indentation within each level of @samp{if}, @samp{select case}, or | ||
| 1989 | @samp{where} statements (default 3). | ||
| 1990 | |||
| 1991 | @item fortran-structure-indent | ||
| 1992 | Extra indentation within each level of @samp{structure}, @samp{union}, | ||
| 1993 | @samp{map}, or @samp{interface} statements (default 3). | ||
| 1994 | |||
| 1995 | @item fortran-continuation-indent | ||
| 1996 | Extra indentation for bodies of continuation lines (default 5). | ||
| 1997 | |||
| 1998 | @item fortran-check-all-num-for-matching-do | ||
| 1999 | In Fortran77, a numbered @samp{do} statement is ended by any statement | ||
| 2000 | with a matching line number. It is common (but not compulsory) to use a | ||
| 2001 | @samp{continue} statement for this purpose. If this variable has a | ||
| 2002 | non-@code{nil} value, indenting any numbered statement must check for a | ||
| 2003 | @samp{do} that ends there. If you always end @samp{do} statements with | ||
| 2004 | a @samp{continue} line (or if you use the more modern @samp{enddo}), | ||
| 2005 | then you can speed up indentation by setting this variable to | ||
| 2006 | @code{nil}. The default is @code{nil}. | ||
| 2007 | |||
| 2008 | @item fortran-blink-matching-if | ||
| 2009 | If this is @code{t}, indenting an @samp{endif} (or @samp{enddo} | ||
| 2010 | statement moves the cursor momentarily to the matching @samp{if} (or | ||
| 2011 | @samp{do}) statement to show where it is. The default is @code{nil}. | ||
| 2012 | |||
| 2013 | @item fortran-minimum-statement-indent-fixed | ||
| 2014 | Minimum indentation for Fortran statements when using fixed format | ||
| 2015 | continuation line style. Statement bodies are never indented less than | ||
| 2016 | this much. The default is 6. | ||
| 2017 | |||
| 2018 | @item fortran-minimum-statement-indent-tab | ||
| 2019 | Minimum indentation for Fortran statements for tab format continuation line | ||
| 2020 | style. Statement bodies are never indented less than this much. The | ||
| 2021 | default is 8. | ||
| 2022 | @end table | ||
| 2023 | |||
| 2024 | The variables controlling the indentation of comments are described in | ||
| 2025 | the following section. | ||
| 2026 | |||
| 2027 | @node Fortran Comments | ||
| 2028 | @subsection Fortran Comments | ||
| 2029 | |||
| 2030 | The usual Emacs comment commands assume that a comment can follow a | ||
| 2031 | line of code. In Fortran77, the standard comment syntax requires an | ||
| 2032 | entire line to be just a comment. Therefore, Fortran mode replaces the | ||
| 2033 | standard Emacs comment commands and defines some new variables. | ||
| 2034 | |||
| 2035 | @vindex fortran-comment-line-start | ||
| 2036 | Fortran mode can also handle the Fortran90 comment syntax where comments | ||
| 2037 | start with @samp{!} and can follow other text. Because only some Fortran77 | ||
| 2038 | compilers accept this syntax, Fortran mode will not insert such comments | ||
| 2039 | unless you have said in advance to do so. To do this, set the variable | ||
| 2040 | @code{fortran-comment-line-start} to @samp{"!"}. | ||
| 2041 | |||
| 2042 | @table @kbd | ||
| 2043 | @item M-; | ||
| 2044 | Align comment or insert new comment (@code{fortran-indent-comment}). | ||
| 2045 | |||
| 2046 | @item C-x ; | ||
| 2047 | Applies to nonstandard @samp{!} comments only. | ||
| 2048 | |||
| 2049 | @item C-c ; | ||
| 2050 | Turn all lines of the region into comments, or (with argument) turn them back | ||
| 2051 | into real code (@code{fortran-comment-region}). | ||
| 2052 | @end table | ||
| 2053 | |||
| 2054 | @findex fortran-indent-comment | ||
| 2055 | @kbd{M-;} in Fortran mode is redefined as the command | ||
| 2056 | @code{fortran-indent-comment}. Like the usual @kbd{M-;} command, this | ||
| 2057 | recognizes any kind of existing comment and aligns its text appropriately; | ||
| 2058 | if there is no existing comment, a comment is inserted and aligned. But | ||
| 2059 | inserting and aligning comments are not the same in Fortran mode as in | ||
| 2060 | other modes. | ||
| 2061 | |||
| 2062 | When a new comment must be inserted, if the current line is blank, a | ||
| 2063 | full-line comment is inserted. On a non-blank line, a nonstandard @samp{!} | ||
| 2064 | comment is inserted if you have said you want to use them. Otherwise a | ||
| 2065 | full-line comment is inserted on a new line before the current line. | ||
| 2066 | |||
| 2067 | Nonstandard @samp{!} comments are aligned like comments in other | ||
| 2068 | languages, but full-line comments are different. In a standard full-line | ||
| 2069 | comment, the comment delimiter itself must always appear in column zero. | ||
| 2070 | What can be aligned is the text within the comment. You can choose from | ||
| 2071 | three styles of alignment by setting the variable | ||
| 2072 | @code{fortran-comment-indent-style} to one of these values: | ||
| 2073 | |||
| 2074 | @vindex fortran-comment-indent-style | ||
| 2075 | @vindex fortran-comment-line-extra-indent | ||
| 2076 | @table @code | ||
| 2077 | @item fixed | ||
| 2078 | Align the text at a fixed column, which is the sum of | ||
| 2079 | @code{fortran-comment-line-extra-indent} and the minimum statement | ||
| 2080 | indentation. This is the default. | ||
| 2081 | |||
| 2082 | The minimum statement indentation is | ||
| 2083 | @code{fortran-minimum-statement-indent-fixed} for fixed format | ||
| 2084 | continuation line style and @code{fortran-minimum-statement-indent-tab} | ||
| 2085 | for tab format style. | ||
| 2086 | |||
| 2087 | @item relative | ||
| 2088 | Align the text as if it were a line of code, but with an additional | ||
| 2089 | @code{fortran-comment-line-extra-indent} columns of indentation. | ||
| 2090 | |||
| 2091 | @item nil | ||
| 2092 | Don't move text in full-line comments automatically. | ||
| 2093 | @end table | ||
| 2094 | |||
| 2095 | @vindex fortran-comment-indent-char | ||
| 2096 | In addition, you can specify the character to be used to indent within | ||
| 2097 | full-line comments by setting the variable | ||
| 2098 | @code{fortran-comment-indent-char} to the single-character string you want | ||
| 2099 | to use. | ||
| 2100 | |||
| 2101 | @vindex fortran-directive-re | ||
| 2102 | Compiler directive lines, or preprocessor lines, have much the same | ||
| 2103 | appearance as comment lines. It is important, though, that such lines | ||
| 2104 | never be indented at all, no matter what the value of | ||
| 2105 | @code{fortran-comment-indent-style}. The variable | ||
| 2106 | @code{fortran-directive-re} is a regular expression that specifies which | ||
| 2107 | lines are directives. Matching lines are never indented, and receive | ||
| 2108 | distinctive font-locking. | ||
| 2109 | |||
| 2110 | The normal Emacs comment command @kbd{C-x ;} has not been redefined. If | ||
| 2111 | you use @samp{!} comments, this command can be used with them. Otherwise | ||
| 2112 | it is useless in Fortran mode. | ||
| 2113 | |||
| 2114 | @kindex C-c ; @r{(Fortran mode)} | ||
| 2115 | @findex fortran-comment-region | ||
| 2116 | @vindex fortran-comment-region | ||
| 2117 | The command @kbd{C-c ;} (@code{fortran-comment-region}) turns all the | ||
| 2118 | lines of the region into comments by inserting the string @samp{C$$$} at | ||
| 2119 | the front of each one. With a numeric argument, it turns the region | ||
| 2120 | back into live code by deleting @samp{C$$$} from the front of each line | ||
| 2121 | in it. The string used for these comments can be controlled by setting | ||
| 2122 | the variable @code{fortran-comment-region}. Note that here we have an | ||
| 2123 | example of a command and a variable with the same name; these two uses | ||
| 2124 | of the name never conflict because in Lisp and in Emacs it is always | ||
| 2125 | clear from the context which one is meant. | ||
| 2126 | |||
| 2127 | @node Fortran Autofill | ||
| 2128 | @subsection Auto Fill in Fortran Mode | ||
| 2129 | |||
| 2130 | Fortran mode has specialized support for Auto Fill mode, which is a | ||
| 2131 | minor mode that automatically splits statements as you insert them when | ||
| 2132 | they become too wide. Splitting a statement involves making | ||
| 2133 | continuation lines using @code{fortran-continuation-string} | ||
| 2134 | (@pxref{ForIndent Cont}). This splitting happens when you type | ||
| 2135 | @key{SPC}, @key{RET}, or @key{TAB}, and also in the Fortran indentation | ||
| 2136 | commands. You activate Auto Fill in Fortran mode in the normal way | ||
| 2137 | (@pxref{Auto Fill}). | ||
| 2138 | |||
| 2139 | @vindex fortran-break-before-delimiters | ||
| 2140 | Auto Fill breaks lines at spaces or delimiters when the lines get | ||
| 2141 | longer than the desired width (the value of @code{fill-column}). The | ||
| 2142 | delimiters (besides whitespace) that Auto Fill can break at are | ||
| 2143 | @samp{+}, @samp{-}, @samp{/}, @samp{*}, @samp{=}, @samp{<}, @samp{>}, | ||
| 2144 | and @samp{,}. The line break comes after the delimiter if the | ||
| 2145 | variable @code{fortran-break-before-delimiters} is @code{nil}. | ||
| 2146 | Otherwise (and by default), the break comes before the delimiter. | ||
| 2147 | |||
| 2148 | To enable Auto Fill in all Fortran buffers, add | ||
| 2149 | @code{turn-on-auto-fill} to @code{fortran-mode-hook}. @xref{Hooks}. | ||
| 2150 | |||
| 2151 | @node Fortran Columns | ||
| 2152 | @subsection Checking Columns in Fortran | ||
| 2153 | |||
| 2154 | @table @kbd | ||
| 2155 | @item C-c C-r | ||
| 2156 | Display a ``column ruler'' momentarily above the current line | ||
| 2157 | (@code{fortran-column-ruler}). | ||
| 2158 | @item C-c C-w | ||
| 2159 | Split the current window horizontally temporarily so that it is 72 | ||
| 2160 | columns wide (@code{fortran-window-create-momentarily}). This may | ||
| 2161 | help you avoid making lines longer than the 72-character limit that | ||
| 2162 | some Fortran compilers impose. | ||
| 2163 | @item C-u C-c C-w | ||
| 2164 | Split the current window horizontally so that it is 72 columns wide | ||
| 2165 | (@code{fortran-window-create}). You can then continue editing. | ||
| 2166 | @item M-x fortran-strip-sequence-nos | ||
| 2167 | Delete all text in column 72 and beyond. | ||
| 2168 | @end table | ||
| 2169 | |||
| 2170 | @kindex C-c C-r @r{(Fortran mode)} | ||
| 2171 | @findex fortran-column-ruler | ||
| 2172 | The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column | ||
| 2173 | ruler momentarily above the current line. The comment ruler is two lines | ||
| 2174 | of text that show you the locations of columns with special significance in | ||
| 2175 | Fortran programs. Square brackets show the limits of the columns for line | ||
| 2176 | numbers, and curly brackets show the limits of the columns for the | ||
| 2177 | statement body. Column numbers appear above them. | ||
| 2178 | |||
| 2179 | Note that the column numbers count from zero, as always in GNU Emacs. | ||
| 2180 | As a result, the numbers may be one less than those you are familiar | ||
| 2181 | with; but the positions they indicate in the line are standard for | ||
| 2182 | Fortran. | ||
| 2183 | |||
| 2184 | @vindex fortran-column-ruler-fixed | ||
| 2185 | @vindex fortran-column-ruler-tabs | ||
| 2186 | The text used to display the column ruler depends on the value of the | ||
| 2187 | variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is | ||
| 2188 | @code{nil}, then the value of the variable | ||
| 2189 | @code{fortran-column-ruler-fixed} is used as the column ruler. | ||
| 2190 | Otherwise, the value of the variable @code{fortran-column-ruler-tab} is | ||
| 2191 | displayed. By changing these variables, you can change the column ruler | ||
| 2192 | display. | ||
| 2193 | |||
| 2194 | @kindex C-c C-w @r{(Fortran mode)} | ||
| 2195 | @findex fortran-window-create-momentarily | ||
| 2196 | @kbd{C-c C-w} (@code{fortran-window-create-momentarily}) temporarily | ||
| 2197 | splits the current window horizontally, making a window 72 columns | ||
| 2198 | wide, so you can see any lines that are too long. Type a space to | ||
| 2199 | restore the normal width. | ||
| 2200 | |||
| 2201 | @kindex C-u C-c C-w @r{(Fortran mode)} | ||
| 2202 | @findex fortran-window-create | ||
| 2203 | You can also split the window horizontally and continue editing with | ||
| 2204 | the split in place. To do this, use @kbd{C-u C-c C-w} (@code{M-x | ||
| 2205 | fortran-window-create}). By editing in this window you can | ||
| 2206 | immediately see when you make a line too wide to be correct Fortran. | ||
| 2207 | |||
| 2208 | @findex fortran-strip-sequence-nos | ||
| 2209 | The command @kbd{M-x fortran-strip-sequence-nos} deletes all text in | ||
| 2210 | column 72 and beyond, on all lines in the current buffer. This is the | ||
| 2211 | easiest way to get rid of old sequence numbers. | ||
| 2212 | |||
| 2213 | @node Fortran Abbrev | ||
| 2214 | @subsection Fortran Keyword Abbrevs | ||
| 2215 | |||
| 2216 | Fortran mode provides many built-in abbrevs for common keywords and | ||
| 2217 | declarations. These are the same sort of abbrev that you can define | ||
| 2218 | yourself. To use them, you must turn on Abbrev mode. @xref{Abbrevs}. | ||
| 2219 | |||
| 2220 | The built-in abbrevs are unusual in one way: they all start with a | ||
| 2221 | semicolon. You cannot normally use semicolon in an abbrev, but Fortran | ||
| 2222 | mode makes this possible by changing the syntax of semicolon to ``word | ||
| 2223 | constituent.'' | ||
| 2224 | |||
| 2225 | For example, one built-in Fortran abbrev is @samp{;c} for | ||
| 2226 | @samp{continue}. If you insert @samp{;c} and then insert a punctuation | ||
| 2227 | character such as a space or a newline, the @samp{;c} expands automatically | ||
| 2228 | to @samp{continue}, provided Abbrev mode is enabled.@refill | ||
| 2229 | |||
| 2230 | Type @samp{;?} or @samp{;C-h} to display a list of all the built-in | ||
| 2231 | Fortran abbrevs and what they stand for. | ||
| 2232 | |||
| 2233 | @node Asm Mode | 1718 | @node Asm Mode |
| 2234 | @section Asm Mode | 1719 | @section Asm Mode |
| 2235 | 1720 | ||