Mercurial > emacs
comparison man/programs.texi @ 36183:d3f65290e6b2
Clean up comment-dwim vs indent-for-comment, etc.
Move comment-padding to the Options for Comments node.
Give details of hideshow commands.
Many cleanups for etags.
Rewrite Imenu node.
Put ff-find-related-file into Other C Commands node.
Clean up fortran comment ruler info.
Fortran Misc node deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 19 Feb 2001 03:45:02 +0000 |
parents | e6bffd5c5287 |
children | 62cf166239f3 |
comparison
equal
deleted
inserted
replaced
36182:add12d9a298a | 36183:d3f65290e6b2 |
---|---|
41 @cindex folding | 41 @cindex folding |
42 @findex outline-minor-mode | 42 @findex outline-minor-mode |
43 @cindex outlines | 43 @cindex outlines |
44 The selective display feature is useful for looking at the overall | 44 The selective display feature is useful for looking at the overall |
45 structure of a function (@pxref{Selective Display}). This feature | 45 structure of a function (@pxref{Selective Display}). This feature |
46 causes only the lines that are indented less than a specified amount to | 46 hides the lines that are indented more than a specified amount. |
47 appear on the screen. Programming modes often support Outline minor | 47 Programming modes often support Outline minor mode (@pxref{Outline |
48 mode (@pxref{Outline Mode}). The Foldout package provides | 48 Mode}). The Foldout package provides folding-editor features |
49 folding-editor features (@pxref{Foldout}). | 49 (@pxref{Foldout}). |
50 | 50 |
51 The `automatic typing' features may be useful when writing programs. | 51 The `automatic typing' features may be useful for writing programs. |
52 @xref{,Autotyping,, autotype, Autotyping}. | 52 @xref{,Autotyping,, autotype, Autotyping}. |
53 | 53 |
54 @menu | 54 @menu |
55 * Program Modes:: Major modes for editing programs. | 55 * Program Modes:: Major modes for editing programs. |
56 * Lists:: Expressions with balanced parentheses. | 56 * Lists:: Expressions with balanced parentheses. |
1130 specifies an explicit choice for Java mode, and the default @samp{gnu} | 1130 specifies an explicit choice for Java mode, and the default @samp{gnu} |
1131 style for the other C-like modes. | 1131 style for the other C-like modes. |
1132 | 1132 |
1133 The style @code{gnu} defines the formatting recommend by the GNU | 1133 The style @code{gnu} defines the formatting recommend by the GNU |
1134 Project; it is the default, so as to encourage the indentation we | 1134 Project; it is the default, so as to encourage the indentation we |
1135 recommend. If you make changes in variables such as | 1135 recommend. However, if you make changes in variables such as |
1136 @code{c-basic-offset} and @code{c-offsets-alist} in your @file{~/.emacs} | 1136 @code{c-basic-offset} and @code{c-offsets-alist} in your |
1137 file, they will however take precedence. | 1137 @file{~/.emacs} file, your changes override the what @code{gnu} style |
1138 says. | |
1138 | 1139 |
1139 @findex c-add-style | 1140 @findex c-add-style |
1140 To define a new C indentation style, call the function | 1141 To define a new C indentation style, call the function |
1141 @code{c-add-style}: | 1142 @code{c-add-style}: |
1142 | 1143 |
1190 wasting lots of time when there is no match. The default is 12,000. | 1191 wasting lots of time when there is no match. The default is 12,000. |
1191 | 1192 |
1192 @cindex Show Paren mode | 1193 @cindex Show Paren mode |
1193 @cindex highlighting matching parentheses | 1194 @cindex highlighting matching parentheses |
1194 @findex show-paren-mode | 1195 @findex show-paren-mode |
1195 You can also request a more powerful alternative kind of automatic | 1196 Show Paren mode provides a more powerful kind of automatic |
1196 parenthesis matching by enabling Show Paren mode. This mode turns off | 1197 parenthesis matching. Whenever point is after a close parenthesis, |
1197 the usual kind of matching parenthesis display and instead uses | 1198 the close parenthesis and its matching open parenthesis are both |
1198 highlighting to show what matches. Whenever point is after a close | 1199 highlighted; otherwise, if point is before an open parenthesis, the |
1199 parenthesis, the close parenthesis and its matching open parenthesis are | |
1200 both highlighted; otherwise, if point is before an open parenthesis, the | |
1201 matching close parenthesis is highlighted. (There is no need to | 1200 matching close parenthesis is highlighted. (There is no need to |
1202 highlight the open parenthesis after point because the cursor appears on | 1201 highlight the open parenthesis after point because the cursor appears |
1203 top of that character.) Use the command @kbd{M-x show-paren-mode} to | 1202 on top of that character.) Use the command @kbd{M-x show-paren-mode} |
1204 enable or disable this mode. | 1203 to enable or disable this mode. |
1205 | 1204 |
1206 By default, @code{show-paren-mode} uses colors to highlight the | 1205 By default, @code{show-paren-mode} uses colors to highlight the |
1207 parentheses. However, if your display doesn't support colors, you can | 1206 parentheses. However, if your display doesn't support colors, you can |
1208 customize the faces @code{show-paren-match-face} and | 1207 customize the faces @code{show-paren-match-face} and |
1209 @code{show-paren-mismatch-face} to use other attributes, such as bold or | 1208 @code{show-paren-mismatch-face} to use other attributes, such as bold or |
1222 * Options for Comments:: | 1221 * Options for Comments:: |
1223 @end menu | 1222 @end menu |
1224 | 1223 |
1225 @node Comment Commands | 1224 @node Comment Commands |
1226 @subsection Comment Commands | 1225 @subsection Comment Commands |
1227 | |
1228 @kindex M-; | |
1229 @cindex indentation for comments | 1226 @cindex indentation for comments |
1230 @findex indent-for-comment | 1227 |
1231 @findex comment-dwim | 1228 The comment commands in this table insert, kill and align comments. |
1232 | 1229 They are described in this section and following sections. |
1233 The comment commands insert, kill and align comments. | 1230 |
1234 | |
1235 @c WideCommands | |
1236 @table @kbd | 1231 @table @kbd |
1237 @item M-; | 1232 @item M-; |
1238 Call the comment command that is appropriate for the context | 1233 Insert or realign comment on current line; alternatively, comment or |
1239 (@code{comment-dwim}). | 1234 uncomment the region (@code{comment-dwim}). |
1240 @item M-x indent-for-comment | 1235 @item C-u M-; |
1241 Insert or align comment. | 1236 Kill comment on current line (@code{comment-kill}). |
1242 @item C-x ; | 1237 @item C-x ; |
1243 Set comment column (@code{set-comment-column}). | 1238 Set comment column (@code{set-comment-column}). |
1244 @item C-u - C-x ; | |
1245 Kill comment on current line (@code{comment-kill}). | |
1246 @item C-M-j | 1239 @item C-M-j |
1247 Like @key{RET} followed by inserting and aligning a comment | 1240 Like @key{RET} followed by inserting and aligning a comment |
1248 (@code{indent-new-comment-line}). | 1241 (@code{indent-new-comment-line}). |
1249 @item M-x comment-region | 1242 @item M-x comment-region |
1250 Add or remove comment delimiters on all the lines in the region. | 1243 Add or remove comment delimiters on all the lines in the region. |
1251 @end table | 1244 @end table |
1252 | 1245 |
1253 The command that creates a comment is @kbd{M-x indent-for-comment}. | 1246 @kindex M-; |
1254 If there is no comment already on the line, a new comment is created, | 1247 @findex comment-dwim |
1255 aligned at a specific column called the @dfn{comment column}. The comment | 1248 The command to create or align a comment is @kbd{M-;} |
1256 is created by inserting the string Emacs thinks comments should start with | 1249 (@code{comment-dwim}). The word ``dwim'' is an acronym for ``Do What |
1257 (the value of @code{comment-start}; see below). Point is left after that | 1250 I Mean''; it indicates that this command can be used for many |
1258 string. If the text of the line extends past the comment column, then the | 1251 different jobs relating to comments, depending on the situation where |
1259 indentation is done to a suitable boundary (usually, at least one space is | 1252 you use it. |
1260 inserted). If the major mode has specified a string to terminate comments, | 1253 |
1261 that is inserted after point, to keep the syntax valid. | 1254 If there is no comment already on the line, @kbd{M-;} inserts a new |
1262 | 1255 comment, aligned at a specific column called the @dfn{comment column}. |
1263 @kbd{M-x indent-for-comment} can also be used to align an existing | 1256 The new comment begins with the string Emacs thinks comments should |
1264 comment. If a line already contains the string that starts comments, | 1257 start with (the value of @code{comment-start}; see below). Point is |
1265 then @kbd{M-x indent-for-comment} just moves point after it and | 1258 after that string, so you can insert the text of the comment right |
1266 reindents it to the conventional place. Exception: comments starting in | 1259 away. If the major mode has specified a string to terminate comments, |
1267 column 0 are not moved. | 1260 @kbd{M-;} inserts that too, to keep the syntax valid. |
1268 | 1261 |
1269 @kbd{M-;} (@code{comment-dwim}) conveniently combines | 1262 If the text of the line extends past the comment column, then the |
1270 @code{indent-for-comment} with @code{comment-region} and | 1263 comment start string is indented to a suitable boundary (usually, at |
1271 @code{uncomment-region}, described below in @ref{Multi-Line Comments}, | 1264 least one space is inserted). |
1272 as appropriate for the current context. If the region is active and the | 1265 |
1273 Transient Mark mode is on (@pxref{Transient Mark}), @kbd{M-;} invokes | 1266 You can also use @kbd{M-;} to align an existing comment. If a line |
1274 @code{comment-region}, unless the region consists only of comments, in | 1267 already contains the comment-start string, @kbd{M-;} reindents it to |
1275 which case it invokes @code{uncomment-region}. Otherwise, if the | 1268 the conventional alignment and moves point after it. (Exception: |
1276 current line is empty, @kbd{M-;} inserts a comment and indents it. If | 1269 comments starting in column 0 are not moved.) Even when an existing |
1277 the current line is not empty, @kbd{M-;} invokes @code{comment-kill} if | 1270 comment is properly aligned, @kbd{M-;} is still useful for moving |
1278 a numeric argument was given, else it reindents the comment on the | 1271 directly to the start of the text inside the comment. |
1279 current line. (The @dfn{dwim} in @code{comment-dwim} is an acronym for | 1272 |
1280 ``Do What I Mean''.) | 1273 @findex comment-kill |
1274 @kindex C-u M-; | |
1275 @kbd{C-u M-;} kills any comment on the current line, along with the | |
1276 whitespace before it. To reinsert the comment on another line, move | |
1277 to the end of that line, do @kbd{C-y}, and then do @kbd{M-;} to | |
1278 realign it. | |
1279 | |
1280 Note that @kbd{C-u M-;} is not a distinct key; it is @kbd{M-;} | |
1281 (@code{comment-dwim}) with a prefix argument. That command is | |
1282 programmed so that when it receives a prefix argument it calls | |
1283 @code{comment-kill}. However, @code{comment-kill} is a valid command | |
1284 in its own right, and you can bind it directly to a key if you wish. | |
1285 | |
1286 @kbd{M-;} does two other jobs when used with an active region in | |
1287 Transient Mark mode (@pxref{Transient Mark}). Then it either adds or | |
1288 removes comment delimiters on each line of the region. (If every line | |
1289 is a comment, it removes comment delimiters from each; otherwise, it | |
1290 adds comment delimiters to each.) If you are not using Transient Mark | |
1291 mode, then you should use the commands @code{comment-region} and | |
1292 @code{uncomment-region} to do these jobs (@pref{Multi-Line Comments}). | |
1293 A prefix argument used in these circumstances specifies how many | |
1294 comment delimiters to add or how many to delete. | |
1281 | 1295 |
1282 Some major modes have special rules for indenting certain kinds of | 1296 Some major modes have special rules for indenting certain kinds of |
1283 comments in certain contexts. For example, in Lisp code, comments which | 1297 comments in certain contexts. For example, in Lisp code, comments which |
1284 start with two semicolons are indented as if they were lines of code, | 1298 start with two semicolons are indented as if they were lines of code, |
1285 instead of at the comment column. Comments which start with three | 1299 instead of at the comment column. Comments which start with three |
1296 (1+ x)) ; This line adds one. | 1310 (1+ x)) ; This line adds one. |
1297 @end example | 1311 @end example |
1298 | 1312 |
1299 In C code, a comment preceded on its line by nothing but whitespace | 1313 In C code, a comment preceded on its line by nothing but whitespace |
1300 is indented like a line of code. | 1314 is indented like a line of code. |
1301 | |
1302 Even when an existing comment is properly aligned, @kbd{M-;} is still | |
1303 useful for moving directly to the start of the comment. | |
1304 | |
1305 @kindex C-u - C-x ; | |
1306 @findex kill-comment | |
1307 @findex comment-kill | |
1308 @kbd{C-u - C-x ;} (@code{comment-kill}) kills the comment on the current line, | |
1309 if there is one. The indentation before the start of the comment is killed | |
1310 as well. If there does not appear to be a comment in the line, nothing is | |
1311 done. To reinsert the comment on another line, move to the end of that | |
1312 line, do @kbd{C-y}, and then do @kbd{M-;} to realign it. Note that | |
1313 @kbd{C-u - C-x ;} is not a distinct key; it is @kbd{C-x ;} (@code{set-comment-column}) | |
1314 with a negative argument. That command is programmed so that when it | |
1315 receives a negative argument it calls @code{comment-kill}. However, | |
1316 @code{comment-kill} is a valid command which you could bind directly to a | |
1317 key if you wanted to. (For compatibility with previous versions, | |
1318 @code{kill-comment} is provided as an alias to @code{comment-kill}.) | |
1319 | 1315 |
1320 @node Multi-Line Comments | 1316 @node Multi-Line Comments |
1321 @subsection Multiple Lines of Comments | 1317 @subsection Multiple Lines of Comments |
1322 | 1318 |
1323 @kindex C-M-j | 1319 @kindex C-M-j |
1346 the comment delimiter is a way of calling attention to the comment. It | 1342 the comment delimiter is a way of calling attention to the comment. It |
1347 can also affect how the comment is indented. In Lisp, for proper | 1343 can also affect how the comment is indented. In Lisp, for proper |
1348 indentation, you should use an argument of two, if between defuns, and | 1344 indentation, you should use an argument of two, if between defuns, and |
1349 three, if within a defun. | 1345 three, if within a defun. |
1350 | 1346 |
1351 @vindex comment-padding | |
1352 The variable @code{comment-padding} specifies how many spaces | |
1353 @code{comment-region} should insert on each line between the | |
1354 comment delimiter and the line's original text. The default is 1. | |
1355 | |
1356 @node Options for Comments | 1347 @node Options for Comments |
1357 @subsection Options Controlling Comments | 1348 @subsection Options Controlling Comments |
1358 | 1349 |
1359 @vindex comment-column | 1350 @vindex comment-column |
1360 @kindex C-x ; | 1351 @kindex C-x ; |
1362 The comment column is stored in the variable @code{comment-column}. You | 1353 The comment column is stored in the variable @code{comment-column}. You |
1363 can set it to a number explicitly. Alternatively, the command @kbd{C-x ;} | 1354 can set it to a number explicitly. Alternatively, the command @kbd{C-x ;} |
1364 (@code{set-comment-column}) sets the comment column to the column point is | 1355 (@code{set-comment-column}) sets the comment column to the column point is |
1365 at. @kbd{C-u C-x ;} sets the comment column to match the last comment | 1356 at. @kbd{C-u C-x ;} sets the comment column to match the last comment |
1366 before point in the buffer, and then does a @kbd{M-;} to align the | 1357 before point in the buffer, and then does a @kbd{M-;} to align the |
1367 current line's comment under the previous one. Note that @kbd{C-u - C-x ;} | 1358 current line's comment under the previous one. |
1368 runs the function @code{comment-kill} as described above. | |
1369 | 1359 |
1370 The variable @code{comment-column} is per-buffer: setting the variable | 1360 The variable @code{comment-column} is per-buffer: setting the variable |
1371 in the normal fashion affects only the current buffer, but there is a | 1361 in the normal fashion affects only the current buffer, but there is a |
1372 default value which you can change with @code{setq-default}. | 1362 default value which you can change with @code{setq-default}. |
1373 @xref{Locals}. Many major modes initialize this variable for the | 1363 @xref{Locals}. Many major modes initialize this variable for the |
1389 When a comment command makes a new comment, it inserts the value of | 1379 When a comment command makes a new comment, it inserts the value of |
1390 @code{comment-start} to begin it. The value of @code{comment-end} is | 1380 @code{comment-start} to begin it. The value of @code{comment-end} is |
1391 inserted after point, so that it will follow the text that you will insert | 1381 inserted after point, so that it will follow the text that you will insert |
1392 into the comment. In C mode, @code{comment-start} has the value | 1382 into the comment. In C mode, @code{comment-start} has the value |
1393 @w{@code{"/* "}} and @code{comment-end} has the value @w{@code{" */"}}. | 1383 @w{@code{"/* "}} and @code{comment-end} has the value @w{@code{" */"}}. |
1384 | |
1385 @vindex comment-padding | |
1386 The variable @code{comment-padding} specifies how many spaces | |
1387 @code{comment-region} should insert on each line between the | |
1388 comment delimiter and the line's original text. The default is 1. | |
1394 | 1389 |
1395 @vindex comment-multi-line | 1390 @vindex comment-multi-line |
1396 The variable @code{comment-multi-line} controls how @kbd{C-M-j} | 1391 The variable @code{comment-multi-line} controls how @kbd{C-M-j} |
1397 (@code{indent-new-comment-line}) behaves when used inside a comment. If | 1392 (@code{indent-new-comment-line}) behaves when used inside a comment. If |
1398 @code{comment-multi-line} is @code{nil}, as it normally is, then the | 1393 @code{comment-multi-line} is @code{nil}, as it normally is, then the |
1449 @code{parens-require-spaces} to @code{nil} value if you wish to inhibit | 1444 @code{parens-require-spaces} to @code{nil} value if you wish to inhibit |
1450 this. | 1445 this. |
1451 | 1446 |
1452 @findex check-parens | 1447 @findex check-parens |
1453 @cindex unbalanced parentheses and quotes | 1448 @cindex unbalanced parentheses and quotes |
1454 You can use @kbd{M-x check-parens} to find any unbalanced parentheses | 1449 You can use @kbd{M-x check-parens} to find any unbalanced |
1455 and unbalanced quotes in strings in a buffer. | 1450 parentheses and unbalanced string quotes in a buffer. |
1456 | 1451 |
1457 @node Symbol Completion | 1452 @node Symbol Completion |
1458 @section Completion for Symbol Names | 1453 @section Completion for Symbol Names |
1459 @cindex completion (symbol names) | 1454 @cindex completion (symbol names) |
1460 | 1455 |
1517 | 1512 |
1518 @node Hideshow | 1513 @node Hideshow |
1519 @section Hideshow minor mode | 1514 @section Hideshow minor mode |
1520 | 1515 |
1521 @findex hs-minor-mode | 1516 @findex hs-minor-mode |
1522 Hideshow minor mode provides selective display of blocks. Use @kbd{M-x | 1517 Hideshow minor mode provides selective display of portions of a |
1523 hs-minor-mode} to toggle the mode or add @code{hs-minor-mode} to the | 1518 file, known as @dfn{blocks}. You can use @kbd{M-x hs-minor-mode} to |
1524 hook for major modes with which you want to use it and which support it. | 1519 enable or disable this mode, or add @code{hs-minor-mode} to the mode |
1525 | 1520 hook for certain major modes in order to enable it automatically for |
1526 Blocks are defined dependent on the mode. In C mode or C++ mode, they | 1521 those modes. |
1527 are delimited by braces, while in Lisp-ish modes they are delimited by | 1522 |
1528 parens. Multi-line comments can also be hidden. | 1523 Just what constitutes a block depends on the major mode. In C mode |
1524 or C++ mode, they are delimited by braces, while in Lisp mode and | |
1525 similar modes they are delimited by parentheses. Multi-line comments | |
1526 also count as blocks. | |
1529 | 1527 |
1530 @findex hs-hide-all | 1528 @findex hs-hide-all |
1531 @findex hs-hide-block | 1529 @findex hs-hide-block |
1532 @findex hs-show-all | 1530 @findex hs-show-all |
1533 @findex hs-show-block | 1531 @findex hs-show-block |
1534 @findex hs-show-region | 1532 @findex hs-show-region |
1535 @findex hs-hide-level | 1533 @findex hs-hide-level |
1536 @findex hs-minor-mode | 1534 @findex hs-minor-mode |
1537 @kindex C-c h | 1535 @kindex C-c C-h |
1538 @kindex C-c s | 1536 @kindex C-c C-s |
1539 @kindex C-c H | 1537 @kindex C-c C-M-h |
1540 @kindex C-c S | 1538 @kindex C-c C-M-s |
1541 @kindex C-c R | 1539 @kindex C-c C-r |
1542 @kindex C-c L | 1540 @kindex C-c C-l |
1543 @kindex S-mouse-2 | 1541 @kindex S-Mouse-2 |
1544 The mode provides the commands @kbd{C-c h} (@kbd{M-x hs-hide-all}), | 1542 @table @kbd |
1545 @kbd{C-c s} (@kbd{M-x hs-hide-block}), @kbd{C-c H} (@kbd{M-x | 1543 @item C-c C-h |
1546 hs-show-all}), @kbd{C-c S} (@kbd{M-x hs-show-block}), @kbd{C-c R} | 1544 Hide the current block (@code{hs-hide-block}). |
1547 (@kbd{M-x hs-show-region}) and @kbd{C-c L} (@kbd{M-x hs-hide-level}) | 1545 @item C-c C-s |
1548 with obvious functions and @kbd{S-mouse-2} toggles hiding of a block | 1546 Show the current block (@code{hs-show-block}). |
1549 with the mouse. | 1547 @item C-c C-c |
1548 Either hide or show the current block (@code{hs-toggle-hiding}) | |
1549 @item S-Mouse-2 | |
1550 Either hide or show the block you click on (@code{hs-mouse-toggle-hiding}) | |
1551 @item C-c C-M-h | |
1552 Hide all top-level blocks (@code{hs-hide-all}). | |
1553 @item C-c C-M-s | |
1554 Show everything in the buffer (@code{hs-show-all}). | |
1555 @item C-c C-l | |
1556 Hide all blocks @var{n} levels below this block | |
1557 (@code{hs-hide-level}). | |
1558 @end table | |
1550 | 1559 |
1551 @vindex hs-hide-comments-when-hiding-all | 1560 @vindex hs-hide-comments-when-hiding-all |
1552 @vindex hs-show-hidden-short-form | 1561 @vindex hs-show-hidden-short-form |
1553 @vindex hs-isearch-open | 1562 @vindex hs-isearch-open |
1554 @vindex hs-special-modes-alist | 1563 @vindex hs-special-modes-alist |
1555 Hideshow is customized by the variables | 1564 These user options exist for customizing Hideshow mode. |
1565 | |
1556 @table @code | 1566 @table @code |
1557 @item hs-hide-comments-when-hiding-all | 1567 @item hs-hide-comments-when-hiding-all |
1558 Specifies whether @kbd{hs-hide-all} should hide comments too. | 1568 Non-@code{nil} says that @kbd{hs-hide-all} should hide comments too. |
1559 @item hs-show-hidden-short-form | 1569 @item hs-show-hidden-short-form |
1560 Specifies whether or not the last line in a form is omitted (saving | 1570 Non-@code{nil} says to omit the last line in a form (saving screen |
1561 screen space). | 1571 space). |
1562 @item hs-isearch-open | 1572 @item hs-isearch-open |
1563 Specifies what kind of hidden blocks to open in Isearch mode. | 1573 Specifies what kind of hidden blocks to open in Isearch mode. |
1564 @item hs-special-modes-alist | 1574 @item hs-special-modes-alist |
1575 Specifies | |
1565 Initializes Hideshow variables for different modes. | 1576 Initializes Hideshow variables for different modes. |
1566 @end table | 1577 @end table |
1567 | 1578 |
1568 @node Glasses | 1579 @node Glasses |
1569 @section Glasses minor mode | 1580 @section Glasses minor mode |
1570 @cindex Glasses mode | 1581 @cindex Glasses mode |
1571 @cindex identifiers, unreadable | 1582 @cindex identifiers, making long ones readable |
1572 @cindex StudlyCaps | 1583 @cindex StudlyCaps, making them readable |
1573 @findex glasses-mode | 1584 @findex glasses-mode |
1574 | 1585 |
1575 Glasses minor mode makes @samp{unreadableIdentifiersLikeThis} readable | 1586 Glasses minor mode makes @samp{unreadableIdentifiersLikeThis} |
1576 by displaying underscores between all the pairs of lower and upper | 1587 readable by altering the display. It can do this in two different |
1577 English letters or by emboldening the capitals. The text is not | 1588 ways: by displaying underscores between an lower-case letter and the |
1578 altered, only the display, so that you can use this mode on code written | 1589 following capital letter, or by emboldening the capital letters. It |
1579 with such a convention for separating words in identifiers without | 1590 does not alter the buffer text, only the way they display, so you can |
1580 modifying the code. It can be customized under the group | 1591 use it even on read-only buffers. You can use the command @kbd{M-x |
1581 @samp{glasses}. You can use it by adding @code{glasses-mode} to the | 1592 glasses-mode} to enable or disable the mode; you can also add |
1582 mode hook of appropriate programming modes. | 1593 @code{glasses-mode} to the mode hook of appropriate programming |
1583 | 1594 language major modes. |
1584 | 1595 |
1585 @node Documentation | 1596 @node Documentation |
1586 @section Documentation Commands | 1597 @section Documentation Commands |
1587 | 1598 |
1588 As you edit Lisp code to be run in Emacs, the commands @kbd{C-h f} | 1599 As you edit Lisp code to be run in Emacs, the commands @kbd{C-h f} |
1612 (@code{info-lookup-symbol}) to view the Info documentation for a symbol. | 1623 (@code{info-lookup-symbol}) to view the Info documentation for a symbol. |
1613 You specify the symbol with the minibuffer; by default, it uses the | 1624 You specify the symbol with the minibuffer; by default, it uses the |
1614 symbol that appears in the buffer at point. The major mode determines | 1625 symbol that appears in the buffer at point. The major mode determines |
1615 where to look for documentation for the symbol---which Info files and | 1626 where to look for documentation for the symbol---which Info files and |
1616 which indices. You can also use @kbd{M-x info-lookup-file} to look for | 1627 which indices. You can also use @kbd{M-x info-lookup-file} to look for |
1617 documentation for a file name. Currently the modes supported by | 1628 documentation for a file name. Currently this supports the following |
1618 Info-lookup are: Awk, Autoconf, Bison, C, Emacs Lisp, LaTeX, M4, | 1629 modes: Awk, Autoconf, Bison, C, Emacs Lisp, LaTeX, M4, |
1619 Makefile, Octave, Perl, Scheme and Texinfo. The relevant Info files | 1630 Makefile, Octave, Perl, Scheme and Texinfo, provided you have installed |
1620 mostly must be obtained separately, typically from the appropriate GNU | 1631 the relevant Info files, which are typically available with the appropriate GNU |
1621 package. | 1632 package. |
1622 | 1633 |
1623 @findex manual-entry | 1634 @findex manual-entry |
1624 @cindex manual pages | 1635 @cindex manual pages |
1625 You can read the ``man page'' for an operating system command, library | 1636 You can read the ``man page'' for an operating system command, library |
1632 named @samp{*Man @var{topic}*}. These buffers use a special major mode, | 1643 named @samp{*Man @var{topic}*}. These buffers use a special major mode, |
1633 Man mode, that facilitates scrolling and examining other manual pages. | 1644 Man mode, that facilitates scrolling and examining other manual pages. |
1634 For details, type @kbd{C-h m} while in a man page buffer. | 1645 For details, type @kbd{C-h m} while in a man page buffer. |
1635 | 1646 |
1636 @cindex sections of manual pages | 1647 @cindex sections of manual pages |
1637 Man pages are subdivided into @dfn{sections}, and some man pages have | 1648 Man pages are classified into @dfn{sections}; sometimes there are |
1638 identical names, but belong to different sections. To read a man page | 1649 man pages with the same name in different sections. To read a man |
1639 from a certain section, type @kbd{@var{topic}(@var{section})} or | 1650 page from a specific section, type @samp{@var{topic}(@var{section})} or |
1640 @kbd{@var{section} @var{topic}} when @kbd{M-x manual-entry} prompts for | 1651 @samp{@var{section} @var{topic}} when @kbd{M-x manual-entry} prompts |
1641 the topic. For example, to read the man page for the C library function | 1652 for the topic. For example, to read the man page for the C library |
1642 @code{chmod} (as opposed to a command by the same name), type @kbd{M-x | 1653 function @code{chmod} (as opposed to a command by the same name), type |
1643 manual-entry @key{RET} chmod(2v) @key{RET}} (assuming @code{chmod} is in | 1654 @kbd{M-x manual-entry @key{RET} chmod(2v) @key{RET}} (assuming |
1644 section @code{2v}). | 1655 @code{chmod} is in section @samp{2v}). |
1645 | 1656 |
1646 If you do not specify a section, the results depend on how the | 1657 If you do not specify a section, the results depend on how the |
1647 @code{man} command works on your system. Some of them display only the | 1658 @code{man} command works on your system. Some of them display only |
1648 first man page they find, others display all the man pages, and you can | 1659 the first man page they find. Others display all man pages that have |
1649 page between them with the @kbd{M-n} and @kbd{M-p} keys. The mode line | 1660 the specified name, so you can page between them with the @kbd{M-n} |
1650 shows how many manual pages are available in the Man buffer. | 1661 and @kbd{M-p} keys. The mode line shows how many manual pages are |
1662 available in the Man buffer. | |
1651 | 1663 |
1652 @vindex Man-fontify-manpage-flag | 1664 @vindex Man-fontify-manpage-flag |
1653 For a long man page, setting the faces properly can take substantial | 1665 For a long man page, setting the faces properly can take substantial |
1654 time. By default, Emacs uses faces in man pages if Emacs can display | 1666 time. By default, Emacs uses faces in man pages if Emacs can display |
1655 different fonts or colors. You can turn off use of faces in man pages | 1667 different fonts or colors. You can turn off use of faces in man pages |
1662 | 1674 |
1663 @findex woman | 1675 @findex woman |
1664 @cindex manual pages, on MS-DOS/MS-Windows | 1676 @cindex manual pages, on MS-DOS/MS-Windows |
1665 An alternative way of reading manual pages is the @kbd{M-x woman} | 1677 An alternative way of reading manual pages is the @kbd{M-x woman} |
1666 command@footnote{The name of the command, @code{woman}, is an acronym | 1678 command@footnote{The name of the command, @code{woman}, is an acronym |
1667 for ``w/o (without) man'', since it doesn't use the @code{man} | 1679 for ``w/o (without) man,'' since it doesn't use the @code{man} |
1668 program.}. Unlike @kbd{M-x man}, it does not run any external programs | 1680 program.}. Unlike @kbd{M-x man}, it does not run any external |
1669 to format and display the man pages, instead it does that entirely in | 1681 programs to format and display the man pages; instead it does the job |
1670 Emacs Lisp. Thus, it is useful on systems such as MS-Windows, where the | 1682 in Emacs Lisp, so it works on systems such as MS-Windows, where the |
1671 @code{man} program and the programs it runs are not readily available. | 1683 @code{man} program and other the programs it needs are not readily |
1672 When invoked, @kbd{M-x woman} prompts for a name of a manual page and | 1684 available. @kbd{M-x woman} prompts for a name of a manual page, and |
1673 provides completion based on the list of manual pages that are installed | 1685 provides completion based on the list of manual pages that are |
1674 on your machine; the list of available manual pages is computed | 1686 installed on your machine; the list of available manual pages is |
1675 automatically the first time you invoke @code{woman}. The word at point | 1687 computed automatically the first time you invoke @code{woman}. The |
1676 in the current buffer is used to suggest the default name of the manual | 1688 word at point in the current buffer is used to suggest the default |
1677 page. | 1689 name of the manual page. |
1678 | 1690 |
1679 With a numeric argument, @kbd{M-x woman} recomputes the list of the | 1691 With a numeric argument, @kbd{M-x woman} recomputes the list of the |
1680 manual pages used for completion. This is useful if you add or delete | 1692 manual pages used for completion. This is useful if you add or delete |
1681 manual pages. | 1693 manual pages. |
1682 | 1694 |
1736 @cindex change log | 1748 @cindex change log |
1737 @kindex C-x 4 a | 1749 @kindex C-x 4 a |
1738 @findex add-change-log-entry-other-window | 1750 @findex add-change-log-entry-other-window |
1739 The Emacs command @kbd{C-x 4 a} adds a new entry to the change log | 1751 The Emacs command @kbd{C-x 4 a} adds a new entry to the change log |
1740 file for the file you are editing | 1752 file for the file you are editing |
1741 (@code{add-change-log-entry-other-window}). If that file is actually a | 1753 (@code{add-change-log-entry-other-window}). If that file is actually |
1742 backup file, it makes an entry appropriate for the file's parent. This | 1754 a backup file, it makes an entry appropriate for the file's |
1743 is useful for making log entries by comparing a version with deleted | 1755 parent---that is useful for making log entries for functions that |
1744 functions. | 1756 have been deleted in the current version. |
1745 | 1757 |
1746 A change log file contains a chronological record of when and why you | 1758 A change log file contains a chronological record of when and why you |
1747 have changed a program, consisting of a sequence of entries describing | 1759 have changed a program, consisting of a sequence of entries describing |
1748 individual changes. Normally it is kept in a file called | 1760 individual changes. Normally it is kept in a file called |
1749 @file{ChangeLog} in the same directory as the file you are editing, or | 1761 @file{ChangeLog} in the same directory as the file you are editing, or |
1781 own item. Normally there should be a blank line between items. When | 1793 own item. Normally there should be a blank line between items. When |
1782 items are related (parts of the same change, in different places), group | 1794 items are related (parts of the same change, in different places), group |
1783 them by leaving no blank line between them. The second entry above | 1795 them by leaving no blank line between them. The second entry above |
1784 contains two items grouped in this way. | 1796 contains two items grouped in this way. |
1785 | 1797 |
1798 @kbd{C-x 4 a} visits the change log file and creates a new entry | |
1799 unless the most recent entry is for today's date and your name. It | |
1800 also creates a new item for the current file. For many languages, it | |
1801 can even guess the name of the function or other object that was | |
1802 changed. | |
1803 | |
1786 @vindex add-log-keep-changes-together | 1804 @vindex add-log-keep-changes-together |
1787 @kbd{C-x 4 a} visits the change log file and creates a new entry | 1805 When the option @code{add-log-keep-changes-together} is |
1788 unless the most recent entry is for today's date and your name. It also | 1806 non-@code{nil}, @kbd{C-x 4 a} adds to any existing entry for the file |
1789 creates a new item for the current file. For many languages, it can | 1807 rather than starting a new entry. |
1790 even guess the name of the function or other object that was changed. | |
1791 When the option @code{add-log-keep-changes-together} is set, @kbd{C-x 4 | |
1792 a} adds to any existing entry for the file rather than starting a new | |
1793 entry. | |
1794 | 1808 |
1795 @vindex change-log-version-info-enabled | 1809 @vindex change-log-version-info-enabled |
1796 @vindex change-log-version-number-regexp-list | 1810 @vindex change-log-version-number-regexp-list |
1797 @cindex file version in change log entries | 1811 @cindex file version in change log entries |
1798 If the value of the variable @code{change-log-version-info-enabled} is | 1812 If the value of the variable @code{change-log-version-info-enabled} |
1799 non-nil, the file's version number is automatically added to change log | 1813 is non-@code{nil}, @kbd{C-x 4 a} ads the file's version number to the |
1800 entries. The search for the file's version number is performed based on | 1814 change log entry. It finds the version number by searching the first |
1801 regular expressions from the variable | 1815 ten percent of the file, using regular expressions from the variable |
1802 @code{change-log-version-number-regexp-list}, which can be customized | 1816 @code{change-log-version-number-regexp-list}. |
1803 (versions of files that are under version control systems are known to | |
1804 Emacs through the version-control interface). | |
1805 | 1817 |
1806 @cindex Change Log mode | 1818 @cindex Change Log mode |
1807 @findex change-log-mode | 1819 @findex change-log-mode |
1808 The change log file is visited in Change Log mode. In this major | 1820 The change log file is visited in Change Log mode. In this major |
1809 mode, each bunch of grouped items counts as one paragraph, and each | 1821 mode, each bunch of grouped items counts as one paragraph, and each |
1810 entry is considered a page. This facilitates editing the entries. | 1822 entry is considered a page. This facilitates editing the entries. |
1811 @kbd{C-j} and auto-fill indent each new line like the previous line; | 1823 @kbd{C-j} and auto-fill indent each new line like the previous line; |
1812 this is convenient for entering the contents of an entry. | 1824 this is convenient for entering the contents of an entry. |
1813 | 1825 |
1814 @findex change-log-merge | 1826 @findex change-log-merge |
1815 The command @kbd{M-x change-log-merge} can be used to merge other log | 1827 You can use the command @kbd{M-x change-log-merge} to merge other |
1816 files into a buffer in Change Log Mode, preserving the date ordering | 1828 log files into a buffer in Change Log Mode, preserving the date |
1817 of entries with either the current or old-style date formats. | 1829 ordering of entries. |
1818 | 1830 |
1819 @findex change-log-redate | 1831 @findex change-log-redate |
1820 @cindex converting change log date style | 1832 @cindex converting change log date style |
1821 Versions of Emacs before 20.1 used a different format for the time of | 1833 Versions of Emacs before 20.1 used a different format for the time of |
1822 the change log entry: | 1834 the change log entry: |
1824 @smallexample | 1836 @smallexample |
1825 Fri May 25 11:23:23 1993 Richard Stallman <rms@@gnu.org> | 1837 Fri May 25 11:23:23 1993 Richard Stallman <rms@@gnu.org> |
1826 @end smallexample | 1838 @end smallexample |
1827 | 1839 |
1828 @noindent | 1840 @noindent |
1829 The @kbd{M-x change-log-redate} command converts all the old-style date | 1841 The @kbd{M-x change-log-redate} command converts all the old-style |
1830 entries in the change log file visited in the current buffer to the new | 1842 date entries in the change log file visited in the current buffer to |
1831 format, so that all entries are kept in unified format. This is handy | 1843 the new format, to make the file uniform in style. This is handy when |
1832 when the entries are contributed by many different people some of whom | 1844 entries are contributed by many different people, some of whom use old |
1833 still use old versions of Emacs. | 1845 versions of Emacs. |
1834 | 1846 |
1835 Version control systems are another way to keep track of changes in your | 1847 Version control systems are another way to keep track of changes in your |
1836 program and keep a change log. @xref{Log Buffer}. | 1848 program and keep a change log. @xref{Log Buffer}. |
1837 | 1849 |
1838 @node Authors | 1850 @node Authors |
1851 individual packages and people who made changes in source files, and | 1863 individual packages and people who made changes in source files, and |
1852 puts the information it gleans into a buffer named @samp{*Authors*}. | 1864 puts the information it gleans into a buffer named @samp{*Authors*}. |
1853 You can then edit the contents of that buffer and merge it with the | 1865 You can then edit the contents of that buffer and merge it with the |
1854 exisiting @file{AUTHORS} file. | 1866 exisiting @file{AUTHORS} file. |
1855 | 1867 |
1868 Do not assume that this command finds all the contributors; don't | |
1869 assume that a person not listed in the output was not a contributor. | |
1870 If you merged in someone's contribution and did not put his name | |
1871 in the change log, he won't show up in @kbd{M-x authors} either. | |
1872 | |
1856 @node Tags | 1873 @node Tags |
1857 @section Tags Tables | 1874 @section Tags Tables |
1858 @cindex tags table | 1875 @cindex tags table |
1859 | 1876 |
1860 A @dfn{tags table} is a description of how a multi-file program is | 1877 A @dfn{tags table} is a description of how a multi-file program is |
1880 | 1897 |
1881 @cindex C++ class browser, tags | 1898 @cindex C++ class browser, tags |
1882 @cindex tags, C++ | 1899 @cindex tags, C++ |
1883 @cindex class browser, C++ | 1900 @cindex class browser, C++ |
1884 @cindex Ebrowse | 1901 @cindex Ebrowse |
1885 The Ebrowse is a separate facility tailored for C++, with tags and a | 1902 See also the Ebrowse facility, which is tailored for C++. @xref{,,, |
1886 class browser. @xref{,,, ebrowse, Ebrowse User's Manual}. | 1903 ebrowse, Ebrowse User's Manual}. |
1887 | 1904 |
1888 @menu | 1905 @menu |
1889 * Tag Syntax:: Tag syntax for various types of code and text files. | 1906 * Tag Syntax:: Tag syntax for various types of code and text files. |
1890 * Create Tags Table:: Creating a tags table with @code{etags}. | 1907 * Create Tags Table:: Creating a tags table with @code{etags}. |
1891 * Etags Regexps:: Create arbitrary tags using regular expressions. | 1908 * Etags Regexps:: Create arbitrary tags using regular expressions. |
1901 Here is how tag syntax is defined for the most popular languages: | 1918 Here is how tag syntax is defined for the most popular languages: |
1902 | 1919 |
1903 @itemize @bullet | 1920 @itemize @bullet |
1904 @item | 1921 @item |
1905 In C code, any C function or typedef is a tag, and so are definitions of | 1922 In C code, any C function or typedef is a tag, and so are definitions of |
1906 @code{struct}, @code{union} and @code{enum}. You can tag function | 1923 @code{struct}, @code{union} and @code{enum}. |
1907 declarations and external variables in addition to function definitions | |
1908 by giving the @samp{--declarations} option to @code{etags}. | |
1909 @code{#define} macro definitions and @code{enum} constants are also | 1924 @code{#define} macro definitions and @code{enum} constants are also |
1910 tags, unless you specify @samp{--no-defines} when making the tags table. | 1925 tags, unless you specify @samp{--no-defines} when making the tags table. |
1911 Similarly, global variables are tags, unless you specify | 1926 Similarly, global variables are tags, unless you specify |
1912 @samp{--no-globals}. Use of @samp{--no-globals} and @samp{--no-defines} | 1927 @samp{--no-globals}. Use of @samp{--no-globals} and @samp{--no-defines} |
1913 can make the tags table file much smaller. | 1928 can make the tags table file much smaller. |
1914 | 1929 |
1930 You can tag function declarations and external variables in addition | |
1931 to function definitions by giving the @samp{--declarations} option to | |
1932 @code{etags}. | |
1933 | |
1915 @item | 1934 @item |
1916 In C++ code, in addition to all the tag constructs of C code, member | 1935 In C++ code, in addition to all the tag constructs of C code, member |
1917 functions are also recognized, and optionally member variables if you | 1936 functions are also recognized, and optionally member variables if you |
1918 use the @samp{--members} option. Tags for variables and functions in | 1937 use the @samp{--members} option. Tags for variables and functions in |
1919 classes are named @samp{@var{class}::@var{variable}} and | 1938 classes are named @samp{@var{class}::@var{variable}} and |
1920 @samp{@var{class}::@var{function}}. @code{operator} functions tags are | 1939 @samp{@var{class}::@var{function}}. @code{operator} definitions have |
1921 named, for example @samp{operator+}. | 1940 tag names like @samp{operator+}. |
1922 | 1941 |
1923 @item | 1942 @item |
1924 In Java code, tags include all the constructs recognized in C++, plus | 1943 In Java code, tags include all the constructs recognized in C++, plus |
1925 the @code{interface}, @code{extends} and @code{implements} constructs. | 1944 the @code{interface}, @code{extends} and @code{implements} constructs. |
1926 Tags for variables and functions in classes are named | 1945 Tags for variables and functions in classes are named |
1966 @item | 1985 @item |
1967 In Ada code, functions, procedures, packages, tasks, and types are | 1986 In Ada code, functions, procedures, packages, tasks, and types are |
1968 tags. Use the @samp{--packages-only} option to create tags for | 1987 tags. Use the @samp{--packages-only} option to create tags for |
1969 packages only. | 1988 packages only. |
1970 | 1989 |
1971 With Ada, it is possible to have the same name used for different | 1990 In Ada, the same name can be used for different kinds of entity |
1972 entity kinds (e.g.@: the same name for a procedure and a function). Also, | 1991 (e.g.@:, for a procedure and for a function). Also, for things like |
1973 for things like packages, procedures and functions, there is the spec | 1992 packages, procedures and functions, there is the spec (i.e.@: the |
1974 (i.e.@: the interface) and the body (i.e.@: the implementation). To | 1993 interface) and the body (i.e.@: the implementation). To make it |
1975 facilitate the choice to the user, a tag value is appended with a | 1994 easier to pick the definition you want, Ada tag name have suffixes |
1976 qualifier: | 1995 indicating the type of entity: |
1977 | 1996 |
1978 @table @asis | 1997 @table @samp |
1979 @item function | 1998 @item /b |
1980 @kbd{/f} | 1999 package body. |
1981 @item procedure | 2000 @item /f |
1982 @kbd{/p} | 2001 function. |
1983 @item package spec | 2002 @item /k |
1984 @kbd{/s} | 2003 task. |
1985 @item package body | 2004 @item /p |
1986 @kbd{/b} | 2005 procedure. |
1987 @item type | 2006 @item /s |
1988 @kbd{/t} | 2007 package spec. |
1989 @item task | 2008 @item /t |
1990 @kbd{/k} | 2009 type. |
1991 @end table | 2010 @end table |
1992 | 2011 |
1993 So, as an example, @kbd{M-x find-tag bidule/b} will go directly to the | 2012 Thus, @kbd{M-x find-tag @key{RET} bidule/b @key{RET}} will go |
1994 body of the package @var{bidule} while @kbd{M-x find-tag bidule} will | 2013 directly to the body of the package @code{bidule}, while @kbd{M-x |
1995 just search for any tag @var{bidule}. | 2014 find-tag @key{RET} bidule @key{RET}} will just search for any tag |
2015 @code{bidule}. | |
1996 | 2016 |
1997 @item | 2017 @item |
1998 In assembler code, labels appearing at the beginning of a line, | 2018 In assembler code, labels appearing at the beginning of a line, |
1999 followed by a colon, are tags. | 2019 followed by a colon, are tags. |
2000 | 2020 |
2062 etags @var{inputfiles}@dots{} | 2082 etags @var{inputfiles}@dots{} |
2063 @end example | 2083 @end example |
2064 | 2084 |
2065 @noindent | 2085 @noindent |
2066 The @code{etags} program reads the specified files, and writes a tags | 2086 The @code{etags} program reads the specified files, and writes a tags |
2067 table named @file{TAGS} in the current working directory. You can | 2087 table named @file{TAGS} in the current working directory. |
2068 intermix compressed and plain text source file names. @code{etags} | 2088 |
2069 knows about the most common compression formats, and does the right | 2089 If the specified files don't exist, @code{etags} looks for |
2070 thing. So you can compress all your source files and have @code{etags} | 2090 compressed versions of them and uncompresses them to read them. Under |
2071 look for compressed versions of its file name arguments, if it does not | 2091 MS-DOS, @code{etags} also looks for file names like @file{mycode.cgz} |
2072 find uncompressed versions. Under MS-DOS, @code{etags} also looks for | 2092 if it is given @samp{mycode.c} on the command line and @file{mycode.c} |
2073 file names like @samp{mycode.cgz} if it is given @samp{mycode.c} on the | 2093 does not exist. |
2074 command line and @samp{mycode.c} does not exist. | |
2075 | 2094 |
2076 @code{etags} recognizes the language used in an input file based on | 2095 @code{etags} recognizes the language used in an input file based on |
2077 its file name and contents. You can specify the language with the | 2096 its file name and contents. You can specify the language with the |
2078 @samp{--language=@var{name}} option, described below. | 2097 @samp{--language=@var{name}} option, described below. |
2079 | 2098 |
2080 If the tags table data become outdated due to changes in the files | 2099 If the tags table data become outdated due to changes in the files |
2081 described in the table, the way to update the tags table is the same way it | 2100 described in the table, the way to update the tags table is the same |
2082 was made in the first place. It is not necessary to do this often. | 2101 way it was made in the first place. But it is not necessary to do |
2102 this very often. | |
2083 | 2103 |
2084 If the tags table fails to record a tag, or records it for the wrong | 2104 If the tags table fails to record a tag, or records it for the wrong |
2085 file, then Emacs cannot possibly find its definition. However, if the | 2105 file, then Emacs cannot possibly find its definition. However, if the |
2086 position recorded in the tags table becomes a little bit wrong (due to | 2106 position recorded in the tags table becomes a little bit wrong (due to |
2087 some editing in the file that the tag definition is in), the only | 2107 some editing in the file that the tag definition is in), the only |
2092 So you should update a tags table when you define new tags that you want | 2112 So you should update a tags table when you define new tags that you want |
2093 to have listed, or when you move tag definitions from one file to another, | 2113 to have listed, or when you move tag definitions from one file to another, |
2094 or when changes become substantial. Normally there is no need to update | 2114 or when changes become substantial. Normally there is no need to update |
2095 the tags table after each edit, or even every day. | 2115 the tags table after each edit, or even every day. |
2096 | 2116 |
2097 One tags table can effectively include another. Specify the included | 2117 One tags table can virtually include another. Specify the included |
2098 tags file name with the @samp{--include=@var{file}} option when creating | 2118 tags file name with the @samp{--include=@var{file}} option when |
2099 the file that is to include it. The latter file then acts as if it | 2119 creating the file that is to include it. The latter file then acts as |
2100 contained all the files specified in the included file, as well as the | 2120 if it covered all the source files specified in the included file, as |
2101 files it directly contains. | 2121 well as the files it directly contains. |
2102 | 2122 |
2103 If you specify the source files with relative file names when you run | 2123 If you specify the source files with relative file names when you run |
2104 @code{etags}, the tags file will contain file names relative to the | 2124 @code{etags}, the tags file will contain file names relative to the |
2105 directory where the tags file was initially written. This way, you can | 2125 directory where the tags file was initially written. This way, you can |
2106 move an entire directory tree containing both the tags file and the | 2126 move an entire directory tree containing both the tags file and the |
2131 @samp{--language=none} to turn off language-specific processing | 2151 @samp{--language=none} to turn off language-specific processing |
2132 entirely; then @code{etags} recognizes tags by regexp matching alone | 2152 entirely; then @code{etags} recognizes tags by regexp matching alone |
2133 (@pxref{Etags Regexps}). | 2153 (@pxref{Etags Regexps}). |
2134 | 2154 |
2135 @samp{etags --help} prints the list of the languages @code{etags} | 2155 @samp{etags --help} prints the list of the languages @code{etags} |
2136 knows, and the file name rules for guessing the language. It also prints | 2156 knows, and the file name rules for guessing the language. It also prints |
2137 a list of all the available @code{etags} options, together with a short | 2157 a list of all the available @code{etags} options, together with a short |
2138 explanation. | 2158 explanation. |
2139 | 2159 |
2140 @node Etags Regexps | 2160 @node Etags Regexps |
2141 @subsection Etags Regexps | 2161 @subsection Etags Regexps |
2171 (as will usually be the case), you should add a @var{nameregexp}, to | 2191 (as will usually be the case), you should add a @var{nameregexp}, to |
2172 pick out just the tag. This will enable Emacs to find tags more | 2192 pick out just the tag. This will enable Emacs to find tags more |
2173 accurately and to do completion on tag names more reliably. You can | 2193 accurately and to do completion on tag names more reliably. You can |
2174 find some examples below. | 2194 find some examples below. |
2175 | 2195 |
2176 The option @samp{--ignore-case-regex} (or @samp{-c}) is like | 2196 The option @samp{--ignore-case-regex} (or @samp{-c}) works like |
2177 @samp{--regex}, except that the regular expression provided will be | 2197 @samp{--regex}, except that matching ignores case. This is |
2178 matched without regard to case, which is appropriate for various | 2198 appropriate for certain programming languages. |
2179 programming languages. | |
2180 | 2199 |
2181 The @samp{-R} option deletes all the regexps defined with | 2200 The @samp{-R} option deletes all the regexps defined with |
2182 @samp{--regex} options. It applies to the file names following it, as | 2201 @samp{--regex} options. It applies to the file names following it, as |
2183 you can see from the following example: | 2202 you can see from the following example: |
2184 | 2203 |
2193 @var{reg1} to recognize additional tags in @file{voo.doo}, and both | 2212 @var{reg1} to recognize additional tags in @file{voo.doo}, and both |
2194 @var{reg1} and @var{reg2} to recognize additional tags in | 2213 @var{reg1} and @var{reg2} to recognize additional tags in |
2195 @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp | 2214 @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp |
2196 matching, to recognize tags in @file{los.er}. | 2215 matching, to recognize tags in @file{los.er}. |
2197 | 2216 |
2198 A regular expression can be bound to a given language, by prepending | 2217 You can specify a regular expression for a particular language, by |
2199 it with @samp{@{lang@}}. When you do this, @code{etags} will use the | 2218 writing @samp{@{lang@}} in front of it. Then @code{etags} will use |
2200 regular expression only for files of that language. @samp{etags --help} | 2219 the regular expression only for files of that language. (@samp{etags |
2201 prints the list of languages recognised by @code{etags}. The following | 2220 --help} prints the list of languages recognised by @code{etags}.) The |
2202 example tags the @code{DEFVAR} macros in the Emacs source files. | 2221 following example tags the @code{DEFVAR} macros in the Emacs source |
2203 @code{etags} applies this regular expression to C files only: | 2222 files, for the C language only: |
2204 | 2223 |
2205 @smallexample | 2224 @smallexample |
2206 --regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' | 2225 --regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' |
2207 @end smallexample | 2226 @end smallexample |
2208 | 2227 |
2209 @noindent | 2228 @noindent |
2210 This feature is particularly useful when storing a list of regular | 2229 This feature is particularly useful when you store a list of regular |
2211 expressions in a file. The following option syntax instructs | 2230 expressions in a file. The following option syntax instructs |
2212 @code{etags} to read two files of regular expressions. The regular | 2231 @code{etags} to read two files of regular expressions. The regular |
2213 expressions contained in the second file are matched without regard to | 2232 expressions contained in the second file are matched without regard to |
2214 case. | 2233 case. |
2215 | 2234 |
2218 @end smallexample | 2237 @end smallexample |
2219 | 2238 |
2220 @noindent | 2239 @noindent |
2221 A regex file contains one regular expressions per line. Empty lines, | 2240 A regex file contains one regular expressions per line. Empty lines, |
2222 and lines beginning with space or tab are ignored. When the first | 2241 and lines beginning with space or tab are ignored. When the first |
2223 character in a line is @samp{@@}, @code{etags} assumes that the rest of | 2242 character in a line is @samp{@@}, @code{etags} assumes that the rest |
2224 the line is the name of a file of regular expressions. This means that | 2243 of the line is the name of a file of regular expressions; thus, one |
2225 such files can be nested. All the other lines are taken to be regular | 2244 such file can include another file. All the other lines are taken to |
2226 expressions. For example, one can create a file called | 2245 be regular expressions. If the first non-whitespace text on the line |
2227 @samp{emacs.tags} with the following contents (the first line in the | 2246 is @samp{--}, that line is a comment. |
2228 file is a comment): | 2247 |
2248 For example, one can create a file called @samp{emacs.tags} with the | |
2249 following contents: | |
2229 | 2250 |
2230 @smallexample | 2251 @smallexample |
2231 -- This is for GNU Emacs source files | 2252 -- This is for GNU Emacs C source files |
2232 @{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/ | 2253 @{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/ |
2233 @end smallexample | 2254 @end smallexample |
2234 | 2255 |
2235 @noindent | 2256 @noindent |
2236 and then use it like this: | 2257 and then use it like this: |
2254 --regex='/[ \t]*global[ \t].*/' \ | 2275 --regex='/[ \t]*global[ \t].*/' \ |
2255 *.m | 2276 *.m |
2256 @end smallexample | 2277 @end smallexample |
2257 | 2278 |
2258 @noindent | 2279 @noindent |
2259 Note that tags are not generated for scripts so that you have to add a | 2280 Note that tags are not generated for scripts, so that you have to add |
2260 line by yourself of the form `###key <script-name>' if you want to jump | 2281 a line by yourself of the form @samp{###key @var{scriptname}} if you |
2261 to it. | 2282 want to jump to it. |
2262 | 2283 |
2263 @item | 2284 @item |
2264 Tag Tcl files: | 2285 Tag Tcl files: |
2265 | 2286 |
2266 @smallexample | 2287 @smallexample |
2269 | 2290 |
2270 @item | 2291 @item |
2271 Tag VHDL files: | 2292 Tag VHDL files: |
2272 | 2293 |
2273 @smallexample | 2294 @smallexample |
2274 --language=none \ | 2295 etags --language=none \ |
2275 --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \ | 2296 --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \ |
2276 --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\ | 2297 --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\ |
2277 \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/' | 2298 \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/' |
2278 @end smallexample | 2299 @end smallexample |
2279 @end itemize | 2300 @end itemize |
2280 | 2301 |
2281 @node Select Tags Table | 2302 @node Select Tags Table |
2282 @subsection Selecting a Tags Table | 2303 @subsection Selecting a Tags Table |
2412 match a specified regular expression. It is just like @kbd{M-.} except | 2433 match a specified regular expression. It is just like @kbd{M-.} except |
2413 that it does regexp matching instead of substring matching. | 2434 that it does regexp matching instead of substring matching. |
2414 | 2435 |
2415 @node Tags Search | 2436 @node Tags Search |
2416 @subsection Searching and Replacing with Tags Tables | 2437 @subsection Searching and Replacing with Tags Tables |
2417 @cindex search and replace in several program files | 2438 @cindex search and replace in multiple files |
2418 @cindex multiple-file search and replace (with tag tables) | 2439 @cindex multiple-file search and replace |
2419 | 2440 |
2420 The commands in this section visit and search all the files listed in the | 2441 The commands in this section visit and search all the files listed in the |
2421 selected tags table, one by one. For these commands, the tags table serves | 2442 selected tags table, one by one. For these commands, the tags table serves |
2422 only to specify a sequence of files to search. | 2443 only to specify a sequence of files to search. |
2423 | 2444 |
2453 ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x | 2474 ordinary @kbd{M-x query-replace-regexp}. It searches much like @kbd{M-x |
2454 tags-search}, but repeatedly, processing matches according to your | 2475 tags-search}, but repeatedly, processing matches according to your |
2455 input. @xref{Replace}, for more information on query replace. | 2476 input. @xref{Replace}, for more information on query replace. |
2456 | 2477 |
2457 @vindex tags-case-fold-search | 2478 @vindex tags-case-fold-search |
2458 @cindex case-sensitivity, and tags search | 2479 @cindex case-sensitivity and tags search |
2459 You can control the case-sensitivity of tags search commands by | 2480 You can control the case-sensitivity of tags search commands by |
2460 customizing the value of the variable @code{tags-case-fold-search}. The | 2481 customizing the value of the variable @code{tags-case-fold-search}. The |
2461 default is to use the same setting as the value of | 2482 default is to use the same setting as the value of |
2462 @code{case-fold-search} (@pxref{Search Case}). | 2483 @code{case-fold-search} (@pxref{Search Case}). |
2463 | 2484 |
2507 way it appears in the tags table. Do not include a directory as part of | 2528 way it appears in the tags table. Do not include a directory as part of |
2508 the file name unless the file name recorded in the tags table includes a | 2529 the file name unless the file name recorded in the tags table includes a |
2509 directory. | 2530 directory. |
2510 | 2531 |
2511 @findex tags-apropos | 2532 @findex tags-apropos |
2533 @vindex tags-apropos-verbose | |
2512 @kbd{M-x tags-apropos} is like @code{apropos} for tags | 2534 @kbd{M-x tags-apropos} is like @code{apropos} for tags |
2513 (@pxref{Apropos}). It reads a regexp, then finds all the tags in the | 2535 (@pxref{Apropos}). It finds all the tags in the selected tags table |
2514 selected tags table whose entries match that regexp, and displays the | 2536 whose entries match @var{regexp}, and displays them. If the variable |
2515 tag names found. | 2537 @code{tags-apropos-verbose} is non-@code{nil}, it displays the names |
2538 of the tags files together with the tag names. | |
2539 | |
2540 @vindex tags-tag-face | |
2516 @vindex tags-apropos-additional-actions | 2541 @vindex tags-apropos-additional-actions |
2517 You can display additional output with @kbd{M-x tags-apropos} by customizing | 2542 You can customize the appearance of the output with the face |
2518 the variable @code{tags-apropos-additional-actions}. See its | 2543 @code{tags-tag-face}. You can display additional output with @kbd{M-x |
2519 documentation for details. | 2544 tags-apropos} by customizing the variable |
2520 @vindex tags-apropos-verbose | 2545 @code{tags-apropos-additional-actions}---see its documentation for |
2521 Setting the variable @code{tags-apropos-verbose} to a non-nil value | 2546 details. |
2522 causes @kbd{M-x tags-apropos} to display the names of the tags files | 2547 |
2523 together with the tag names. | 2548 You can also use the collection of tag names to complete a symbol |
2524 @vindex tags-tag-face | 2549 name in the buffer. @xref{Symbol Completion}. |
2525 The face @code{tags-tag-face} can be used to customize the appearance of | |
2526 tags in the output of @kbd{M-x tags-apropos}. | |
2527 | |
2528 You can also perform completion in the buffer on the name space of tag | |
2529 names in the current tags tables. @xref{Symbol Completion}. | |
2530 | 2550 |
2531 @node Imenu | 2551 @node Imenu |
2532 @section Imenu | 2552 @section Imenu |
2533 @cindex indexes of buffer contents | 2553 @cindex indexes of buffer contents |
2534 @cindex buffer content indexes | 2554 @cindex buffer content indexes |
2535 @cindex tags | 2555 @cindex tags |
2536 | 2556 |
2537 The Imenu facility provides mode-specific indexes of the contents of | 2557 The Imenu facility is another way to find definitions or sections |
2538 single buffers and provides selection from a menu. Selecting a menu | 2558 in a file. It is similar in spirit to Tags, but operates on a single |
2539 item takes you to the indexed point in the buffer, in a similar way to | 2559 buffer only, and works entirely within Emacs with no need for a separate |
2540 the Tags facility. Indexing is typically by names of program routines | 2560 tags table. |
2541 and variables but in Texinfo mode, for instance, node names are indexed. | |
2542 Most major modes for which it is appropriate have Imenu support. | |
2543 | 2561 |
2544 @findex imenu | 2562 @findex imenu |
2545 @findex imenu-add-menu-bar-index | 2563 @findex imenu-add-menu-bar-index |
2546 @kbd{M-x imenu} builds the index if necessary and presents you with an | 2564 If you type @kbd{M-x imenu}, it reads the name of a section or |
2547 electric buffer menu from which to select an entry (with completion). | 2565 definition in the current buffer, then goes to that section or |
2548 If you bind @code{imenu} to a mouse event (@pxref{Mouse Buttons}) and | 2566 definition. You can use completion to specify the name, and a |
2549 invoke it that way, the index will appear as a popup menu; there is no | 2567 complete list of possible names is always displayed. |
2550 such binding by default. You can add an index menubar on the menubar | 2568 |
2551 with @kbd{imenu-add-menu-bar-index}. | 2569 Alternatively you can bind the command @code{imenu} to a mouse |
2552 | 2570 click. Then it displays mouse menus for you to select the section or |
2553 Some major modes provide facilities for invoking Imenu; otherwise you | 2571 definition you want. You can also add the buffer's index to the menu |
2554 could add @code{imenu-add-menu-bar-index} to a major mode's hook to | 2572 bar by calling @code{imenu-add-menu-bar-index}. If you want to have |
2555 generate an index for each buffer created in that mode. (If you do | 2573 this menu bar item available for all buffers in a certain major mode, |
2556 that, it takes some time to generate the index when finding a file, | 2574 you can do this by adding @code{imenu-add-menu-bar-index} to its mode |
2557 depending on the file's size and the complexity of the indexing function | 2575 hook. But then you will have to wait for the buffer to be searched |
2558 for that mode.) | 2576 for sections and definitions, each time you visit a file which uses |
2577 that mode. | |
2559 | 2578 |
2560 @vindex imenu-auto-rescan | 2579 @vindex imenu-auto-rescan |
2561 The index should be regenerated (via the @samp{*Rescan*} menu item) when | 2580 When you change the contents of a buffer, if you add or delete |
2562 indexable items are added to or deleted from the buffer. Rescanning is | 2581 definitions or sections, you can update the buffer's index to |
2563 done when a menu selction is requested if the option | 2582 correspond to the new contents by invoking the @samp{*Rescan*} item in |
2564 @code{imenu-auto-rescan} is set. By default buffer positions are in | 2583 the menu. Rescanning happens automatically if |
2565 terms of markers, so that changing non-indexable text doesn't require | 2584 @code{imenu-auto-rescan} is non-@code{nil}. There is no need to |
2566 rescanning. | 2585 rescan because of small changes in the text. |
2567 | 2586 |
2568 @vindex imenu-sort-function | 2587 @vindex imenu-sort-function |
2569 The way the menus are sorted can be customized via the option | 2588 You can customize the way the menus are sorted via the variable |
2570 @code{imenu-sort-function}. By default names are ordered as they occur | 2589 @code{imenu-sort-function}. By default names are ordered as they |
2571 in the buffer; alphabetic sorting is provided as an alternative. | 2590 occur in the buffer; alphabetic sorting is provided as an alternative. |
2572 | 2591 |
2573 Imenu provides the information used by Which Function mode (@pxref{Which | 2592 Imenu provides the information to guide Which Function mode |
2574 Function}). It may also be used by Speedbar (@pxref{Speedbar}). | 2593 (@pxref{Which Function}). The Speedbar can also use it |
2594 (@pxref{Speedbar}). | |
2575 | 2595 |
2576 @node Emerge, C Modes, Imenu, Programs | 2596 @node Emerge, C Modes, Imenu, Programs |
2577 @section Merging Files with Emerge | 2597 @section Merging Files with Emerge |
2578 @cindex Emerge | 2598 @cindex Emerge |
2579 @cindex merging files | 2599 @cindex merging files |
2974 @cindex mode, C | 2994 @cindex mode, C |
2975 @cindex mode, Objective C | 2995 @cindex mode, Objective C |
2976 @cindex mode, CORBA IDL | 2996 @cindex mode, CORBA IDL |
2977 @cindex mode, Pike | 2997 @cindex mode, Pike |
2978 | 2998 |
2979 This section describes special features available in C, C++, | 2999 This section gives a brief description of the special features |
2980 Objective-C, Java, CORBA IDL, and Pike modes. When we say ``C mode and | 3000 available in C, C++, Objective-C, Java, CORBA IDL, and Pike modes. |
2981 related modes,'' those are the modes we mean. | 3001 (These are called ``C mode and related modes.'') @xref{Top, CC Mode, |
2982 | 3002 ccmode, , CC Mode}, for a more extensive description of these modes |
2983 Additional information is available in the separate manual for these | 3003 and their special features. |
2984 modes. @xref{Top, CC Mode, ccmode, , CC Mode}. | |
2985 | 3004 |
2986 @menu | 3005 @menu |
2987 * Motion in C:: | 3006 * Motion in C:: |
2988 * Electric C:: | 3007 * Electric C:: |
2989 * Hungry Delete:: | 3008 * Hungry Delete:: |
3274 @itemx M-x global-cwarn-mode | 3293 @itemx M-x global-cwarn-mode |
3275 @findex cwarn-mode | 3294 @findex cwarn-mode |
3276 @findex global-cwarn-mode | 3295 @findex global-cwarn-mode |
3277 @cindex CWarn mode | 3296 @cindex CWarn mode |
3278 @cindex suspicious constructions in C, C++ | 3297 @cindex suspicious constructions in C, C++ |
3279 CWarn minor mode highlights suspicious C and C++ constructions: | 3298 CWarn minor mode highlights certain suspicious C and C++ constructions: |
3280 | 3299 |
3281 @itemize @bullet{} | 3300 @itemize @bullet{} |
3282 @item | 3301 @item |
3283 Assignments inside expressions, including variations like @samp{+=}; | 3302 Assignments inside expressions. |
3284 @item | 3303 @item |
3285 Semicolon following immediately after @samp{if}, @samp{for}, and @samp{while} | 3304 Semicolon following immediately after @samp{if}, @samp{for}, and @samp{while} |
3286 (except after a @samp{do @dots{} while} statement); | 3305 (except after a @samp{do @dots{} while} statement); |
3287 @item | 3306 @item |
3288 C++ functions with reference parameters. | 3307 C++ functions with reference parameters. |
3289 @end itemize | 3308 @end itemize |
3290 | 3309 |
3291 @noindent | 3310 @noindent |
3292 You can activate the mode either by customizing @code{global-cwarn-mode} | 3311 You can enable the mode for one buffer with the command @kbd{M-x |
3293 or by adding @code{cwarn-mode} to @code{c-mode-common-hook}. It | 3312 cwarn-mode}, or for all suitable buffers with the command @kbd{M-x |
3294 requires Font Lock mode to be active. | 3313 global-cwarn-mode} or by customizing the variable |
3314 @code{global-cwarn-mode}. You must also enable Font Lock mode to make | |
3315 it work. | |
3295 | 3316 |
3296 @item M-x hide-ifdef-mode | 3317 @item M-x hide-ifdef-mode |
3297 @findex hide-ifdef-mode | 3318 @findex hide-ifdef-mode |
3298 @cindex Hide-ifdef mode | 3319 @cindex Hide-ifdef mode |
3299 Hide-ifdef minor mode hides selected code within @samp{#if} and | 3320 Hide-ifdef minor mode hides selected code within @samp{#if} and |
3300 @samp{#ifdef} preprocessor blocks. You can activate it by adding | 3321 @samp{#ifdef} preprocessor blocks. See the documentation string of |
3301 @code{hide-ifdef-mode} to @code{c-mode-common-hook}. See the mode's | 3322 @code{hide-ifdef-mode} for more information. |
3302 help for more information. | 3323 |
3324 @item M-x ff-find-related-file | |
3325 @cindex related files | |
3326 @findex ff-find-related-file | |
3327 @vindex ff-related-file-alist | |
3328 Find a file ``related'' in a special way to the file visited by the | |
3329 current buffer. Typically this will be the header file corresponding | |
3330 to a C/C++ source file, or vice versa. The variable | |
3331 @code{ff-related-file-alist} specifies how to compute related file | |
3332 names. | |
3303 @end table | 3333 @end table |
3304 | 3334 |
3305 @node Comments in C | 3335 @node Comments in C |
3306 @subsection Comments in C Modes | 3336 @subsection Comments in C Modes |
3307 | 3337 |
3336 starting delimiter of a block comment on a line by itself. The default | 3366 starting delimiter of a block comment on a line by itself. The default |
3337 value is @code{t}, which puts the comment-start delimiter @samp{/*} at | 3367 value is @code{t}, which puts the comment-start delimiter @samp{/*} at |
3338 the beginning of the first line of the comment text. | 3368 the beginning of the first line of the comment text. |
3339 @end table | 3369 @end table |
3340 | 3370 |
3341 | |
3342 @node Fortran | 3371 @node Fortran |
3343 @section Fortran Mode | 3372 @section Fortran Mode |
3344 @cindex Fortran mode | 3373 @cindex Fortran mode |
3345 @cindex mode, Fortran | 3374 @cindex mode, Fortran |
3346 | 3375 |
3360 | 3389 |
3361 @cindex Fortran77 | 3390 @cindex Fortran77 |
3362 @cindex Fortran90 | 3391 @cindex Fortran90 |
3363 @findex f90-mode | 3392 @findex f90-mode |
3364 @findex fortran-mode | 3393 @findex fortran-mode |
3365 Note that Fortan mode described here (obtained with the | 3394 Fortan mode is meant for editing Fortran77 ``fixed format'' source |
3366 @code{fortran-mode} command) is for editing the old Fortran77 | 3395 code. For editing the modern Fortran90 ``free format'' source code, |
3367 idiosyncratic `fixed format' source form. For editing the modern | 3396 use F90 mode (@code{f90-mode}). Emacs normally uses Fortran mode for |
3368 Fortran90 `free format' source form (which is supported by the GNU | 3397 files with extension @samp{.f}, @samp{.F} or @samp{.for}, and F90 mode |
3369 Fortran compiler) use @code{f90-mode}. | 3398 for the extension @samp{.f90}. GNU Fortran supports both kinds of |
3370 | 3399 format. |
3371 By default @code{fortran-mode} is invoked on files with extension | |
3372 @samp{.f}, @samp{.F} or @samp{.for} and @code{f90-mode} is invoked for | |
3373 the extension @samp{.f90}. | |
3374 | 3400 |
3375 @menu | 3401 @menu |
3376 * Motion: Fortran Motion. Moving point by statements or subprograms. | 3402 * Motion: Fortran Motion. Moving point by statements or subprograms. |
3377 * Indent: Fortran Indent. Indentation commands for Fortran. | 3403 * Indent: Fortran Indent. Indentation commands for Fortran. |
3378 * Comments: Fortran Comments. Inserting and aligning comments. | 3404 * Comments: Fortran Comments. Inserting and aligning comments. |
3379 * Autofill: Fortran Autofill. Auto fill minor mode for Fortran. | 3405 * Autofill: Fortran Autofill. Auto fill minor mode for Fortran. |
3380 * Columns: Fortran Columns. Measuring columns for valid Fortran. | 3406 * Columns: Fortran Columns. Measuring columns for valid Fortran. |
3381 * Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords. | 3407 * Abbrev: Fortran Abbrev. Built-in abbrevs for Fortran keywords. |
3382 * Misc: Fortran Misc. Other Fortran mode features. | |
3383 @end menu | 3408 @end menu |
3384 | 3409 |
3385 @node Fortran Motion | 3410 @node Fortran Motion |
3386 @subsection Motion Commands | 3411 @subsection Motion Commands |
3387 | 3412 |
3388 In addition to the normal commands for moving by and operating on | 3413 In addition to the normal commands for moving by and operating on |
3389 `defuns' (Fortran subprograms---functions | 3414 ``defuns'' (Fortran subprograms---functions and subroutines), Fortran |
3390 and subroutines) Fortran mode provides special commands to move by statements. | 3415 mode provides special commands to move by statements. |
3391 | 3416 |
3392 @kindex C-c C-p @r{(Fortran mode)} | 3417 @table @kbd |
3393 @kindex C-c C-n @r{(Fortran mode)} | 3418 @kindex C-c C-n @r{(Fortran mode)} |
3394 @findex fortran-previous-statement | |
3395 @findex fortran-next-statement | 3419 @findex fortran-next-statement |
3396 | |
3397 @table @kbd | |
3398 @item C-c C-n | 3420 @item C-c C-n |
3399 Move to beginning of current or next statement | 3421 Move to beginning of current or next statement |
3400 (@code{fortran-next-statement}). | 3422 (@code{fortran-next-statement}). |
3423 | |
3424 @kindex C-c C-p @r{(Fortran mode)} | |
3425 @findex fortran-previous-statement | |
3401 @item C-c C-p | 3426 @item C-c C-p |
3402 Move to beginning of current or previous statement | 3427 Move to beginning of current or previous statement |
3403 (@code{fortran-previous-statement}). | 3428 (@code{fortran-previous-statement}). |
3404 @end table | 3429 @end table |
3405 | 3430 |
3418 * Conv: ForIndent Conv. Conventions you must obey to avoid trouble. | 3443 * Conv: ForIndent Conv. Conventions you must obey to avoid trouble. |
3419 * Vars: ForIndent Vars. Variables controlling Fortran indent style. | 3444 * Vars: ForIndent Vars. Variables controlling Fortran indent style. |
3420 @end menu | 3445 @end menu |
3421 | 3446 |
3422 @node ForIndent Commands | 3447 @node ForIndent Commands |
3423 @subsubsection Fortran-Specific Indentation and Filling Commands | 3448 @subsubsection Fortran Indentation and Filling Commands |
3424 | 3449 |
3425 @table @kbd | 3450 @table @kbd |
3426 @item C-M-j | 3451 @item C-M-j |
3427 Break the current line and set up a continuation line | 3452 Break the current line and set up a continuation line |
3428 (@code{fortran-split-line}). | 3453 (@code{fortran-split-line}). |
3456 which joins a continuation line back to the previous line, roughly as | 3481 which joins a continuation line back to the previous line, roughly as |
3457 the inverse of @code{fortran-split-line}. The point must be on a | 3482 the inverse of @code{fortran-split-line}. The point must be on a |
3458 continuation line when this command is invoked. | 3483 continuation line when this command is invoked. |
3459 | 3484 |
3460 @kindex M-q @r{(Fortran mode)} | 3485 @kindex M-q @r{(Fortran mode)} |
3461 Fortran mode defines the function for filling paragraphs such that | 3486 @kbd{M-q} in Fortran mode fills the comment block or statement that |
3462 @kbd{M-q} fills the comment block or statement around point. Filling a | 3487 point is in. This removes any excess statement continuations. |
3463 statement removes excess statement continuations. | |
3464 | 3488 |
3465 @node ForIndent Cont | 3489 @node ForIndent Cont |
3466 @subsubsection Continuation Lines | 3490 @subsubsection Continuation Lines |
3467 @cindex Fortran continuation lines | 3491 @cindex Fortran continuation lines |
3468 | 3492 |
3750 @item C-c C-r | 3774 @item C-c C-r |
3751 Display a ``column ruler'' momentarily above the current line | 3775 Display a ``column ruler'' momentarily above the current line |
3752 (@code{fortran-column-ruler}). | 3776 (@code{fortran-column-ruler}). |
3753 @item C-c C-w | 3777 @item C-c C-w |
3754 Split the current window horizontally temporarily so that it is 72 | 3778 Split the current window horizontally temporarily so that it is 72 |
3755 columns wide. This may help you avoid making lines longer than the | 3779 columns wide (@code{fortran-window-create-momentarily}). This may |
3756 72-character limit that some Fortran compilers impose | 3780 help you avoid making lines longer than the 72-character limit that |
3757 (@code{fortran-window-create-momentarily}). | 3781 some Fortran compilers impose. |
3782 @item C-u C-c C-w | |
3783 Split the current window horizontally so that it is 72 columns wide | |
3784 (@code{fortran-window-create}). You can then continue editing. | |
3785 @item M-x fortran-strip-sequence-nos | |
3786 Delete all text in column 72 and beyond. | |
3758 @end table | 3787 @end table |
3759 | 3788 |
3760 @kindex C-c C-r @r{(Fortran mode)} | 3789 @kindex C-c C-r @r{(Fortran mode)} |
3761 @findex fortran-column-ruler | 3790 @findex fortran-column-ruler |
3762 @vindex fortran-column-ruler | |
3763 The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column | 3791 The command @kbd{C-c C-r} (@code{fortran-column-ruler}) shows a column |
3764 ruler momentarily above the current line. The comment ruler is two lines | 3792 ruler momentarily above the current line. The comment ruler is two lines |
3765 of text that show you the locations of columns with special significance in | 3793 of text that show you the locations of columns with special significance in |
3766 Fortran programs. Square brackets show the limits of the columns for line | 3794 Fortran programs. Square brackets show the limits of the columns for line |
3767 numbers, and curly brackets show the limits of the columns for the | 3795 numbers, and curly brackets show the limits of the columns for the |
3770 Note that the column numbers count from zero, as always in GNU Emacs. | 3798 Note that the column numbers count from zero, as always in GNU Emacs. |
3771 As a result, the numbers may be one less than those you are familiar | 3799 As a result, the numbers may be one less than those you are familiar |
3772 with; but the positions they indicate in the line are standard for | 3800 with; but the positions they indicate in the line are standard for |
3773 Fortran. | 3801 Fortran. |
3774 | 3802 |
3803 @vindex fortran-column-ruler-fixed | |
3804 @vindex fortran-column-ruler-tabs | |
3775 The text used to display the column ruler depends on the value of | 3805 The text used to display the column ruler depends on the value of |
3776 the variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is | 3806 the variable @code{indent-tabs-mode}. If @code{indent-tabs-mode} is |
3777 @code{nil}, then the value of the variable | 3807 @code{nil}, then the value of the variable |
3778 @code{fortran-column-ruler-fixed} is used as the column ruler. | 3808 @code{fortran-column-ruler-fixed} is used as the column ruler. |
3779 Otherwise, the variable @code{fortran-column-ruler-tab} is displayed. | 3809 Otherwise, the variable @code{fortran-column-ruler-tab} is displayed. |
3780 By changing these variables, you can change the column ruler display. | 3810 By changing these variables, you can change the column ruler display. |
3781 | 3811 |
3812 @kindex C-c C-w @r{(Fortran mode)} | |
3813 @findex fortran-window-create-momentarily | |
3814 @kbd{C-c C-w} (@code{fortran-window-create-momentarily}) temporarily | |
3815 splits the current window horizontally, making a window 72 columns | |
3816 wide, so you can see which lines that is too long. Type a space to | |
3817 restore the normal width. | |
3818 | |
3782 @kindex C-u C-c C-w @r{(Fortran mode)} | 3819 @kindex C-u C-c C-w @r{(Fortran mode)} |
3783 @findex fortran-window-create | 3820 @findex fortran-window-create |
3784 For even more help, use @kbd{M-x fortran-window-create}), a | 3821 You can also split the window horizontally and continue editing with |
3785 command which splits the current window horizontally, making a window 72 | 3822 the split in place. To do this, use @kbd{C-u C-c C-w} (@code{M-x |
3786 columns wide. By editing in this window you can immediately see when you | 3823 fortran-window-create}). By editing in this window you can |
3787 make a line too wide to be correct Fortran. | 3824 immediately see when you make a line too wide to be correct Fortran. |
3788 | 3825 |
3789 @kindex C-c C-w @r{(Fortran mode)} | 3826 @findex fortran-strip-sequence-nos |
3790 @findex fortran-window-create-momentarily | 3827 The command @kbd{M-x fortran-strip-sequence-nos} deletes all text in |
3791 Also, @kbd{C-c C-w} (@code{fortran-window-create-momentarily}) can be | 3828 column 72 and beyond, on all lines in the current buffer. This is the |
3792 used temporarily to split the current window horizontally, making a | 3829 easiest way to get rid of old sequence numbers. |
3793 window 72 columns wide to check column widths rather than to edit in | |
3794 this mode. The normal width is restored when you type a space. | |
3795 | 3830 |
3796 @node Fortran Abbrev | 3831 @node Fortran Abbrev |
3797 @subsection Fortran Keyword Abbrevs | 3832 @subsection Fortran Keyword Abbrevs |
3798 | 3833 |
3799 Fortran mode provides many built-in abbrevs for common keywords and | 3834 Fortran mode provides many built-in abbrevs for common keywords and |
3811 to @samp{continue}, provided Abbrev mode is enabled.@refill | 3846 to @samp{continue}, provided Abbrev mode is enabled.@refill |
3812 | 3847 |
3813 Type @samp{;?} or @samp{;C-h} to display a list of all the built-in | 3848 Type @samp{;?} or @samp{;C-h} to display a list of all the built-in |
3814 Fortran abbrevs and what they stand for. | 3849 Fortran abbrevs and what they stand for. |
3815 | 3850 |
3816 @node Fortran Misc | |
3817 @subsection Other Fortran Mode Commands | |
3818 | |
3819 The command @kbd{fortran-strip-sqeuence-nos} can be used to remove text | |
3820 past Fortran column 72, which is typically old `sequence numbers'. | |
3821 | |
3822 @node Asm Mode | 3851 @node Asm Mode |
3823 @section Asm Mode | 3852 @section Asm Mode |
3824 | 3853 |
3825 @cindex Asm mode | 3854 @cindex Asm mode |
3826 @cindex Assembler mode | 3855 @cindex assembler mode |
3827 Asm mode is a major mode for editing files of assembler code. It | 3856 Asm mode is a major mode for editing files of assembler code. It |
3828 defines these commands: | 3857 defines these commands: |
3829 | 3858 |
3830 @table @kbd | 3859 @table @kbd |
3831 @item @key{TAB} | 3860 @item @key{TAB} |