Mercurial > hg > xemacs-beta
comparison man/xemacs/programs.texi @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children | 11054d720c21 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
43 There are editing commands to operate on them. | 43 There are editing commands to operate on them. |
44 * Defuns:: Each program is made up of separate functions. | 44 * Defuns:: Each program is made up of separate functions. |
45 There are editing commands to operate on them. | 45 There are editing commands to operate on them. |
46 * Grinding:: Adjusting indentation to show the nesting. | 46 * Grinding:: Adjusting indentation to show the nesting. |
47 * Matching:: Insertion of a close-delimiter flashes matching open. | 47 * Matching:: Insertion of a close-delimiter flashes matching open. |
48 * Comments:: Inserting, filling and aligning comments. | 48 * Comments:: Inserting, illing and aligning comments. |
49 * Balanced Editing:: Inserting two matching parentheses at once, etc. | 49 * Balanced Editing:: Inserting two matching parentheses at once, etc. |
50 * Lisp Completion:: Completion on symbol names in Lisp code. | 50 * Lisp Completion:: Completion on symbol names in Lisp code. |
51 * Documentation:: Getting documentation of functions you plan to call. | 51 * Documentation:: Getting documentation of functions you plan to call. |
52 * Change Log:: Maintaining a change history for your program. | 52 * Change Log:: Maintaining a change history for your program. |
53 * Tags:: Go direct to any function in your program in one | 53 * Tags:: Go direct to any function in your program in one |
506 indentation is computed by @kbd{C-M-q}; if the value is a number, | 506 indentation is computed by @kbd{C-M-q}; if the value is a number, |
507 @kbd{C-M-q} need not recalculate indentation for the following lines | 507 @kbd{C-M-q} need not recalculate indentation for the following lines |
508 until the end of the list. | 508 until the end of the list. |
509 @end table | 509 @end table |
510 | 510 |
511 @node C Indent, , Lisp Indent, Grinding | 511 @node C Indent,, Lisp Indent, Grinding |
512 @subsection Customizing C Indentation | 512 @subsection Customizing C Indentation |
513 | 513 |
514 Two variables control which commands perform C indentation and when. | 514 Two variables control which commands perform C indentation and when. |
515 | 515 |
516 @vindex c-auto-newline | 516 @vindex c-auto-newline |
882 @kindex M-( | 882 @kindex M-( |
883 @kindex M-) | 883 @kindex M-) |
884 @findex insert-parentheses | 884 @findex insert-parentheses |
885 @findex move-over-close-and-reindent | 885 @findex move-over-close-and-reindent |
886 The commands @kbd{M-(} (@code{insert-parentheses}) and @kbd{M-)} | 886 The commands @kbd{M-(} (@code{insert-parentheses}) and @kbd{M-)} |
887 (@code{move-over-close-and-reindent}) are designed to facilitate a style of | 887 (@code{move-over-close-@*and-reindent}) are designed to facilitate a style of |
888 editing which keeps parentheses balanced at all times. @kbd{M-(} inserts a | 888 editing which keeps parentheses balanced at all times. @kbd{M-(} inserts a |
889 pair of parentheses, either together as in @samp{()}, or, if given an | 889 pair of parentheses, either together as in @samp{()}, or, if given an |
890 argument, around the next several sexps, and leaves point after the open | 890 argument, around the next several sexps, and leaves point after the open |
891 parenthesis. Instead of typing @kbd{( F O O )}, you can type @kbd{M-( F O | 891 parenthesis. Instead of typing @kbd{( F O O )}, you can type @kbd{M-( F O |
892 O}, which has the same effect except for leaving the cursor before the | 892 O}, which has the same effect except for leaving the cursor before the |
1010 A @dfn{tags table} is a description of how a multi-file program is | 1010 A @dfn{tags table} is a description of how a multi-file program is |
1011 broken up into files. It lists the names of the component files and the | 1011 broken up into files. It lists the names of the component files and the |
1012 names and positions of the functions (or other named subunits) in each | 1012 names and positions of the functions (or other named subunits) in each |
1013 file. Grouping the related files makes it possible to search or replace | 1013 file. Grouping the related files makes it possible to search or replace |
1014 through all the files with one command. Recording the function names | 1014 through all the files with one command. Recording the function names |
1015 and positions makes possible the @kbd{M-.} command which finds the | 1015 and positions makes possible the @kbd{M-.} command which finds the |
1016 definition of a function by looking up which of the files it is in. | 1016 definition of a function by looking up which of the files it is in. |
1017 | 1017 |
1018 Tags tables are stored in files called @dfn{tags table files}. The | 1018 Tags tables are stored in files called @dfn{tags table files}. The |
1019 conventional name for a tags table file is @file{TAGS}. | 1019 conventional name for a tags table file is @file{TAGS}. |
1020 | 1020 |
1027 normally include all functions and subroutines, and may also include | 1027 normally include all functions and subroutines, and may also include |
1028 global variables, data types, and anything else convenient. Each name | 1028 global variables, data types, and anything else convenient. Each name |
1029 recorded is called a @dfn{tag}. | 1029 recorded is called a @dfn{tag}. |
1030 | 1030 |
1031 @menu | 1031 @menu |
1032 * Tag Syntax:: Tag syntax for various types of code and text files. | 1032 * Tag Syntax:: Tag syntax for various types of code and text files. |
1033 * Create Tags Table:: Creating a tags table with @code{etags}. | 1033 * Create Tags Table:: Creating a tags table with @code{etags}. |
1034 * Etags Regexps:: Create arbitrary tags using regular expressions. | |
1035 * Select Tags Table:: How to visit a tags table. | 1034 * Select Tags Table:: How to visit a tags table. |
1036 * Find Tag:: Commands to find the definition of a specific tag. | 1035 * Find Tag:: Commands to find the definition of a specific tag. |
1037 * Tags Search:: Using a tags table for searching and replacing. | 1036 * Tags Search:: Using a tags table for searching and replacing. |
1038 * List Tags:: Listing and finding tags defined in a file. | 1037 * List Tags:: Listing and finding tags defined in a file. |
1039 @end menu | 1038 @end menu |
1040 | 1039 |
1041 @node Tag Syntax, Create Tags Table, Tags, Tags | 1040 @node Tag Syntax |
1042 @subsection Source File Tag Syntax | 1041 @subsection Source File Tag Syntax |
1043 | 1042 |
1044 Here is how tag syntax is defined for the most popular languages: | 1043 Here is how tag syntax is defined for the most popular languages: |
1045 | 1044 |
1046 @itemize @bullet | 1045 @itemize @bullet |
1047 @item | 1046 @item |
1048 In C code, any C function or typedef is a tag, and so are definitions of | 1047 In C code, any C function or typedef is a tag, and so are definitions of |
1049 @code{struct}, @code{union} and @code{enum}. You can tag function | 1048 @code{struct}, @code{union} and @code{enum}. @code{#define} macro |
1050 declarations and external variables in addition to function definitions | 1049 definitions and @code{enum} constants are also tags, unless you specify |
1051 by giving the @samp{--declarations} option to @code{etags}. | 1050 @samp{--no-defines} when making the tags table. Similarly, global |
1052 @code{#define} macro definitions and @code{enum} constants are also | 1051 variables are tags, unless you specify @samp{--no-globals}. Use of |
1053 tags, unless you specify @samp{--no-defines} when making the tags table. | 1052 @samp{--no-globals} and @samp{--no-defines} can make the tags table file |
1054 Similarly, global variables are tags, unless you specify | 1053 much smaller. |
1055 @samp{--no-globals}. Use of @samp{--no-globals} and @samp{--no-defines} | |
1056 can make the tags table file much smaller. | |
1057 | 1054 |
1058 @item | 1055 @item |
1059 In C++ code, in addition to all the tag constructs of C code, member | 1056 In C++ code, in addition to all the tag constructs of C code, member |
1060 functions are also recognized, and optionally member variables if you | 1057 functions are also recognized, and optionally member variables if you |
1061 use the @samp{--members} option. Tags for variables and functions in | 1058 use the @samp{--members} option. Tags for variables and functions in |
1062 classes are named @samp{@var{class}::@var{variable}} and | 1059 classes are named @samp{@var{class}::@var{variable}} and |
1063 @samp{@var{class}::@var{function}}. @code{operator} functions tags are | 1060 @samp{@var{class}::@var{function}}. |
1064 named, for example @samp{operator+}. | |
1065 | 1061 |
1066 @item | 1062 @item |
1067 In Java code, tags include all the constructs recognized in C++, plus | 1063 In Java code, tags include all the constructs recognized in C++, plus |
1068 the @code{interface}, @code{extends} and @code{implements} constructs. | 1064 the @code{extends} and @code{implements} constructs. Tags for variables |
1069 Tags for variables and functions in classes are named | 1065 and functions in classes are named @samp{@var{class}.@var{variable}} and |
1070 @samp{@var{class}.@var{variable}} and @samp{@var{class}.@var{function}}. | 1066 @samp{@var{class}.@var{function}}. |
1071 | 1067 |
1072 @item | 1068 @item |
1073 In La@TeX{} text, the argument of any of the commands @code{\chapter}, | 1069 In La@TeX{} text, the argument of any of the commands @code{\chapter}, |
1074 @code{\section}, @code{\subsection}, @code{\subsubsection}, | 1070 @code{\section}, @code{\subsection}, @code{\subsubsection}, |
1075 @code{\eqno}, @code{\label}, @code{\ref}, @code{\cite}, @code{\bibitem}, | 1071 @code{\eqno}, @code{\label}, @code{\ref}, @code{\cite}, @code{\bibitem}, |
1077 tag.@refill | 1073 tag.@refill |
1078 | 1074 |
1079 Other commands can make tags as well, if you specify them in the | 1075 Other commands can make tags as well, if you specify them in the |
1080 environment variable @code{TEXTAGS} before invoking @code{etags}. The | 1076 environment variable @code{TEXTAGS} before invoking @code{etags}. The |
1081 value of this environment variable should be a colon-separated list of | 1077 value of this environment variable should be a colon-separated list of |
1082 command names. For example, | 1078 commands names. For example, |
1083 | 1079 |
1084 @example | 1080 @example |
1085 TEXTAGS="def:newcommand:newenvironment" | 1081 TEXTAGS="def:newcommand:newenvironment" |
1086 export TEXTAGS | 1082 export TEXTAGS |
1087 @end example | 1083 @end example |
1103 @end itemize | 1099 @end itemize |
1104 | 1100 |
1105 Several other languages are also supported: | 1101 Several other languages are also supported: |
1106 | 1102 |
1107 @itemize @bullet | 1103 @itemize @bullet |
1108 | |
1109 @item | |
1110 In Ada code, functions, procedures, packages, tasks, and types are | |
1111 tags. Use the @samp{--packages-only} option to create tags for packages | |
1112 only. | |
1113 | |
1114 @item | 1104 @item |
1115 In assembler code, labels appearing at the beginning of a line, | 1105 In assembler code, labels appearing at the beginning of a line, |
1116 followed by a colon, are tags. | 1106 followed by a colon, are tags. |
1117 | 1107 |
1118 @item | 1108 @item |
1119 In Bison or Yacc input files, each rule defines as a tag the nonterminal | 1109 In Bison or Yacc input files, each rule defines as a tag the nonterminal |
1120 it constructs. The portions of the file that contain C code are parsed | 1110 it constructs. The portions of the file that contain C code are parsed |
1121 as C code. | 1111 as C code. |
1122 | 1112 |
1123 @item | 1113 @item |
1124 In Cobol code, tags are paragraph names; that is, any word starting in | 1114 In Cobol code, paragraphs names are the tags, i.e. any word starting in |
1125 column 8 and followed by a period. | 1115 column 8 and followed by a full stop. |
1126 | 1116 |
1127 @item | 1117 @item |
1128 In Erlang code, the tags are the functions, records, and macros defined | 1118 In Erlang code, the tags are the functions, records, and macros defined |
1129 in the file. | 1119 in the file. |
1130 | 1120 |
1131 @item | 1121 @item |
1132 In Fortran code, functions, subroutines and blockdata are tags. | 1122 In Fortran code, functions and subroutines are tags. |
1133 | 1123 |
1134 @item | 1124 @item |
1135 In Objective C code, tags include Objective C definitions for classes, | 1125 In Objective C code, tags include Objective C definitions for classes, |
1136 class categories, methods, and protocols. | 1126 class categories, methods and protocols. |
1137 | 1127 |
1138 @item | 1128 @item |
1139 In Pascal code, the tags are the functions and procedures defined in | 1129 In Pascal code, the tags are the functions and procedures defined in |
1140 the file. | 1130 the file. |
1141 | 1131 |
1142 @item | 1132 @item |
1143 In Perl code, the tags are the procedures defined by the @code{sub}, | 1133 In Perl code, the tags are the procedures defined by the @code{sub} |
1144 @code{my} and @code{local} keywords. Use @samp{--globals} if you want | 1134 keyword. |
1145 to tag global variables. | |
1146 | 1135 |
1147 @item | 1136 @item |
1148 In Postscript code, the tags are the functions. | 1137 In Postscript code, the tags are the functions. |
1149 | 1138 |
1150 @item | 1139 @item |
1151 In Prolog code, a tag name appears at the left margin. | 1140 In Prolog code, a tag name appears at the left margin. |
1152 | |
1153 @item | |
1154 In Python code, @code{def} or @code{class} at the beginning of a line | |
1155 generate a tag. | |
1156 @end itemize | 1141 @end itemize |
1157 | 1142 |
1158 You can also generate tags based on regexp matching | 1143 You can also generate tags based on regexp matching (@pxref{Create |
1159 (@pxref{Etags Regexps}) to handle other formats and languages. | 1144 Tags Table}) to handle other formats and languages. |
1160 | 1145 |
1161 @node Create Tags Table, Etags Regexps, Tag Syntax, Tags | 1146 @node Create Tags Table |
1162 @subsection Creating Tags Tables | 1147 @subsection Creating Tags Tables |
1163 @cindex @code{etags} program | 1148 @cindex @code{etags} program |
1164 | 1149 |
1165 The @code{etags} program is used to create a tags table file. It knows | 1150 The @code{etags} program is used to create a tags table file. It knows |
1166 the syntax of several languages, as described in | 1151 the syntax of several languages, as described in |
1175 @example | 1160 @example |
1176 etags @var{inputfiles}@dots{} | 1161 etags @var{inputfiles}@dots{} |
1177 @end example | 1162 @end example |
1178 | 1163 |
1179 @noindent | 1164 @noindent |
1180 The @code{etags} program reads the specified files, and writes a tags | 1165 The @code{etags} program reads the specified files, and writes a tags table |
1181 table named @file{TAGS} in the current working directory. You can | 1166 named @file{TAGS} in the current working directory. @code{etags} |
1182 intermix compressed and plain text source file names. @code{etags} | 1167 recognizes the language used in an input file based on its file name and |
1183 knows about the most common compression formats, and does the right | 1168 contents. You can specify the language with the |
1184 thing. So you can compress all your source files and have @code{etags} | |
1185 look for compressed versions of its file name arguments, if it does not | |
1186 find uncompressed versions. Under MS-DOS, @code{etags} also looks for | |
1187 file names like @samp{mycode.cgz} if it is given @samp{mycode.c} on the | |
1188 command line and @samp{mycode.c} does not exist. | |
1189 | |
1190 @code{etags} recognizes the language used in an input file based on | |
1191 its file name and contents. You can specify the language with the | |
1192 @samp{--language=@var{name}} option, described below. | 1169 @samp{--language=@var{name}} option, described below. |
1193 | 1170 |
1194 If the tags table data become outdated due to changes in the files | 1171 If the tags table data become outdated due to changes in the files |
1195 described in the table, the way to update the tags table is the same way it | 1172 described in the table, the way to update the tags table is the same way it |
1196 was made in the first place. It is not necessary to do this often. | 1173 was made in the first place. It is not necessary to do this often. |
1223 | 1200 |
1224 If you specify absolute file names as arguments to @code{etags}, then | 1201 If you specify absolute file names as arguments to @code{etags}, then |
1225 the tags file will contain absolute file names. This way, the tags file | 1202 the tags file will contain absolute file names. This way, the tags file |
1226 will still refer to the same files even if you move it, as long as the | 1203 will still refer to the same files even if you move it, as long as the |
1227 source files remain in the same place. Absolute file names start with | 1204 source files remain in the same place. Absolute file names start with |
1228 @samp{/}, or with @samp{@var{device}:/} on MS-DOS and MS-Windows. | 1205 @samp{/}, or with @samp{@var{device}:/} on MS-DOS and Windows. |
1229 | 1206 |
1230 When you want to make a tags table from a great number of files, you | 1207 When you want to make a tags table from a great number of files, you |
1231 may have problems listing them on the command line, because some systems | 1208 may have problems listing them on the command line, because some systems |
1232 have a limit on its length. The simplest way to circumvent this limit | 1209 have a limit on its length. The simplest way to circumvent this limit |
1233 is to tell @code{etags} to read the file names from its standard input, | 1210 is to tell @code{etags} to read the file names from its standard input, |
1234 by typing a dash in place of the file names, like this: | 1211 by typing a dash in place of the file names, like this: |
1235 | 1212 |
1236 @smallexample | 1213 @example |
1237 find . -name "*.[chCH]" -print | etags - | 1214 find . -name "*.[chCH]" -print | etags - |
1238 @end smallexample | 1215 @end example |
1239 | 1216 |
1240 Use the option @samp{--language=@var{name}} to specify the language | 1217 Use the option @samp{--language=@var{name}} to specify the language |
1241 explicitly. You can intermix these options with file names; each one | 1218 explicitly. You can intermix these options with file names; each one |
1242 applies to the file names that follow it. Specify | 1219 applies to the file names that follow it. Specify |
1243 @samp{--language=auto} to tell @code{etags} to resume guessing the | 1220 @samp{--language=auto} to tell @code{etags} to resume guessing the |
1244 language from the file names and file contents. Specify | 1221 language from the file names and file contents. Specify |
1245 @samp{--language=none} to turn off language-specific processing | 1222 @samp{--language=none} to turn off language-specific processing |
1246 entirely; then @code{etags} recognizes tags by regexp matching alone | 1223 entirely; then @code{etags} recognizes tags by regexp matching alone. |
1247 (@pxref{Etags Regexps}). | 1224 @samp{etags --help} prints the list of the languages @code{etags} knows, |
1248 | 1225 and the file name rules for guessing the language. |
1249 @samp{etags --help} prints the list of the languages @code{etags} | |
1250 knows, and the file name rules for guessing the language. It also prints | |
1251 a list of all the available @code{etags} options, together with a short | |
1252 explanation. | |
1253 | |
1254 @node Etags Regexps, Select Tags Table, Create Tags Table, Tags | |
1255 @subsection Etags Regexps | |
1256 | 1226 |
1257 The @samp{--regex} option provides a general way of recognizing tags | 1227 The @samp{--regex} option provides a general way of recognizing tags |
1258 based on regexp matching. You can freely intermix it with file names. | 1228 based on regexp matching. You can freely intermix it with file names. |
1259 Each @samp{--regex} option adds to the preceding ones, and applies only | 1229 Each @samp{--regex} option adds to the preceding ones, and applies only |
1260 to the following files. The syntax is: | 1230 to the following files. The syntax is: |
1261 | 1231 |
1262 @smallexample | 1232 @example |
1263 --regex=/@var{tagregexp}[/@var{nameregexp}]/ | 1233 --regex=/@var{tagregexp}[/@var{nameregexp}]/ |
1264 @end smallexample | 1234 @end example |
1265 | 1235 |
1266 @noindent | 1236 @noindent |
1267 where @var{tagregexp} is used to match the lines to tag. It is always | 1237 where @var{tagregexp} is used to match the lines to tag. It is always |
1268 anchored, that is, it behaves as if preceded by @samp{^}. If you want | 1238 anchored, that is, it behaves as if preceded by @samp{^}. If you want |
1269 to account for indentation, just match any initial number of blanks by | 1239 to account for indentation, just match any initial number of blanks by |
1279 @samp{\@{@var{m},@var{n}\@}}, and its meaning is to match the preceding | 1249 @samp{\@{@var{m},@var{n}\@}}, and its meaning is to match the preceding |
1280 expression at least @var{m} times and up to @var{n} times. | 1250 expression at least @var{m} times and up to @var{n} times. |
1281 | 1251 |
1282 You should not match more characters with @var{tagregexp} than that | 1252 You should not match more characters with @var{tagregexp} than that |
1283 needed to recognize what you want to tag. If the match is such that | 1253 needed to recognize what you want to tag. If the match is such that |
1284 more characters than needed are unavoidably matched by @var{tagregexp} | 1254 more characters than needed are unavoidably matched by @var{tagregexp}, |
1285 (as will usually be the case), you should add a @var{nameregexp}, to | 1255 you may find useful to add a @var{nameregexp}, in order to narrow the tag |
1286 pick out just the tag. This will enable Emacs to find tags more | 1256 scope. You can find some examples below. |
1287 accurately and to do completion on tag names more reliably. You can | |
1288 find some examples below. | |
1289 | |
1290 The option @samp{--ignore-case-regex} (or @samp{-c}) is like | |
1291 @samp{--regex}, except that the regular expression provided will be | |
1292 matched without regard to case, which is appropriate for various | |
1293 programming languages. | |
1294 | 1257 |
1295 The @samp{-R} option deletes all the regexps defined with | 1258 The @samp{-R} option deletes all the regexps defined with |
1296 @samp{--regex} options. It applies to the file names following it, as | 1259 @samp{--regex} options. It applies to the file names following it, as |
1297 you can see from the following example: | 1260 you can see from the following example: |
1298 | 1261 |
1299 @smallexample | 1262 @example |
1300 etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \ | 1263 etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \ |
1301 bar.ber -R --lang=lisp los.er | 1264 bar.ber -R --lang=lisp los.er |
1302 @end smallexample | 1265 @end example |
1303 | 1266 |
1304 @noindent | 1267 @noindent |
1305 Here @code{etags} chooses the parsing language for @file{voo.doo} and | 1268 Here @code{etags} chooses the parsing language for @file{voo.doo} and |
1306 @file{bar.ber} according to their contents. @code{etags} also uses | 1269 @file{bar.ber} according to their contents. @code{etags} also uses |
1307 @var{reg1} to recognize additional tags in @file{voo.doo}, and both | 1270 @var{reg1} to recognize additional tags in @file{voo.doo}, and both |
1308 @var{reg1} and @var{reg2} to recognize additional tags in | 1271 @var{reg1} and @var{reg2} to recognize additional tags in |
1309 @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp | 1272 @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp |
1310 matching, to recognize tags in @file{los.er}. | 1273 matching, to recognize tags in @file{los.er}. |
1311 | 1274 |
1312 A regular expression can be bound to a given language, by prepending | |
1313 it with @samp{@{lang@}}. When you do this, @code{etags} will use the | |
1314 regular expression only for files of that language. @samp{etags --help} | |
1315 prints the list of languages recognised by @code{etags}. The following | |
1316 example tags the @code{DEFVAR} macros in the Emacs source files. | |
1317 @code{etags} applies this regular expression to C files only: | |
1318 | |
1319 @smallexample | |
1320 --regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' | |
1321 @end smallexample | |
1322 | |
1323 @noindent | |
1324 This feature is particularly useful when storing a list of regular | |
1325 expressions in a file. The following option syntax instructs | |
1326 @code{etags} to read two files of regular expressions. The regular | |
1327 expressions contained in the second file are matched without regard to | |
1328 case. | |
1329 | |
1330 @smallexample | |
1331 --regex=@@first-file --ignore-case-regex=@@second-file | |
1332 @end smallexample | |
1333 | |
1334 @noindent | |
1335 A regex file contains one regular expressions per line. Empty lines, | |
1336 and lines beginning with space or tab are ignored. When the first | |
1337 character in a line is @samp{@@}, @code{etags} assumes that the rest of | |
1338 the line is the name of a file of regular expressions. This means that | |
1339 such files can be nested. All the other lines are taken to be regular | |
1340 expressions. For example, one can create a file called | |
1341 @samp{emacs.tags} with the following contents (the first line in the | |
1342 file is a comment): | |
1343 | |
1344 @smallexample | |
1345 -- This is for GNU Emacs source files | |
1346 @{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/ | |
1347 @end smallexample | |
1348 | |
1349 @noindent | |
1350 and then use it like this: | |
1351 | |
1352 @smallexample | |
1353 etags --regex=@@emacs.tags *.[ch] */*.[ch] | |
1354 @end smallexample | |
1355 | |
1356 Here are some more examples. The regexps are quoted to protect them | 1275 Here are some more examples. The regexps are quoted to protect them |
1357 from shell interpretation. | 1276 from shell interpretation. |
1358 | 1277 |
1359 @itemize @bullet | |
1360 | |
1361 @item | |
1362 Tag Octave files: | |
1363 | |
1364 @smallexample | |
1365 etags --language=none \ | |
1366 --regex='/[ \t]*function.*=[ \t]*\([^ \t]*\)[ \t]*(/\1/' \ | |
1367 --regex='/###key \(.*\)/\1/' \ | |
1368 --regex='/[ \t]*global[ \t].*/' \ | |
1369 *.m | |
1370 @end smallexample | |
1371 | |
1372 @noindent | 1278 @noindent |
1373 Note that tags are not generated for scripts so that you have to add a | 1279 Tag the @code{DEFVAR} macros in the emacs source files: |
1374 line by yourself of the form `###key <script-name>' if you want to jump | 1280 |
1375 to it. | 1281 @example |
1376 | 1282 --regex='/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' |
1377 @item | 1283 @end example |
1378 Tag Tcl files: | 1284 |
1379 | 1285 @noindent |
1380 @smallexample | 1286 Tag VHDL files (this example is a single long line, broken here for |
1381 etags --language=none --regex='/proc[ \t]+\([^ \t]+\)/\1/' *.tcl | 1287 formatting reasons): |
1382 @end smallexample | 1288 |
1383 | 1289 @example |
1384 @item | 1290 --language=none |
1385 Tag VHDL files: | 1291 --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' |
1386 | |
1387 @smallexample | |
1388 --language=none \ | |
1389 --regex='/[ \t]*\(ARCHITECTURE\|CONFIGURATION\) +[^ ]* +OF/' \ | |
1390 --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\ | 1292 --regex='/[ \t]*\(ATTRIBUTE\|ENTITY\|FUNCTION\|PACKAGE\ |
1391 \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/' | 1293 \( BODY\)?\|PROCEDURE\|PROCESS\|TYPE\)[ \t]+\([^ \t(]+\)/\3/' |
1392 @end smallexample | 1294 @end example |
1393 @end itemize | 1295 |
1394 | 1296 @noindent |
1395 @node Select Tags Table, Find Tag, Etags Regexps, Tags | 1297 Tag TCL files (this last example shows the usage of a @var{nameregexp}): |
1298 | |
1299 @example | |
1300 --lang=none --regex='/proc[ \t]+\([^ \t]+\)/\1/' | |
1301 @end example | |
1302 | |
1303 For a list of the other available @code{etags} options, execute | |
1304 @code{etags --help}. | |
1305 | |
1306 @node Select Tags Table, Find Tag, Create Tags Table, Tags | |
1396 @subsection Selecting a Tags Table | 1307 @subsection Selecting a Tags Table |
1397 | 1308 |
1398 @vindex tag-table-alist | 1309 @vindex tag-table-alist |
1399 At any time Emacs has one @dfn{selected} tags table, and all the commands | 1310 At any time Emacs has one @dfn{selected} tags table, and all the commands |
1400 for working with tags tables use the selected one. To select a tags table, | 1311 for working with tags tables use the selected one. To select a tags table, |
1422 | 1333 |
1423 For example: | 1334 For example: |
1424 | 1335 |
1425 @example | 1336 @example |
1426 (setq tag-table-alist | 1337 (setq tag-table-alist |
1427 '(("/usr/src/public/perl/" . "/usr/src/public/perl/perl-3.0/") | 1338 '(("/usr/src/public/perl/" . "/usr/src/public/perl/perl-3.0/") |
1428 ("\\.el$" . "/usr/local/emacs/src/") | 1339 ("\\.el$" . "/usr/local/emacs/src/") |
1429 ("/jbw/gnu/" . "/usr15/degree/stud/jbw/gnu/") | 1340 ("/jbw/gnu/" . "/usr15/degree/stud/jbw/gnu/") |
1430 ("" . "/usr/local/emacs/src/") | 1341 ("" . "/usr/local/emacs/src/") |
1431 )) | 1342 )) |
1432 @end example | 1343 @end example |
1433 | 1344 |
1434 The example defines the tags table alist in the following way: | 1345 The example defines the tags table alist in the following way: |
1435 | 1346 |
1436 @itemize @bullet | 1347 @itemize @bullet |
1538 @vindex tag-mark-stack-max | 1449 @vindex tag-mark-stack-max |
1539 | 1450 |
1540 @table @kbd | 1451 @table @kbd |
1541 @item tag-table-alist | 1452 @item tag-table-alist |
1542 Controls which tables apply to which buffers. | 1453 Controls which tables apply to which buffers. |
1543 @item tags-file-name | 1454 @item tags-file-name |
1544 Stores a default tags table. | 1455 Stores a default tags table. |
1545 @item tags-build-completion-table | 1456 @item tags-build-completion-table |
1546 Controls completion behavior. | 1457 Controls completion behavior. |
1547 @item buffer-tag-table | 1458 @item buffer-tag-table |
1548 Specifies a buffer-local table. | 1459 Specifies a buffer-local table. |
1549 @item make-tags-files-invisible | 1460 @item make-tags-files-invisible |
1550 Sets whether tags tables should be very hidden. | 1461 Sets whether tags tables should be very hidden. |
1551 @item tag-mark-stack-max | 1462 @item tag-mark-stack-max |
1552 Specifies how many tags-based hops to remember. | 1463 Specifies how many tags-based hops to remember. |
1553 @end table | 1464 @end table |
1554 | 1465 |
1555 @kindex C-x 4 . | 1466 @kindex C-x 4 . |
1556 @findex find-tag-other-window | 1467 @findex find-tag-other-window |
1642 file in the tags table and prepare to advance sequentially by files. | 1553 file in the tags table and prepare to advance sequentially by files. |
1643 @item M-x next-file | 1554 @item M-x next-file |
1644 Visit the next file in the selected tags table. | 1555 Visit the next file in the selected tags table. |
1645 @end table | 1556 @end table |
1646 | 1557 |
1647 @node List Tags, , Tags Search, Tags | 1558 @node List Tags,, Tags Search, Tags |
1648 @subsection Tags Table Inquiries | 1559 @subsection Tags Table Inquiries |
1649 | 1560 |
1650 @table @kbd | 1561 @table @kbd |
1651 @item M-x list-tags | 1562 @item M-x list-tags |
1652 Display a list of the tags defined in a specific program file. | 1563 Display a list of the tags defined in a specific program file. |
1827 If you fail to follow these conventions, the indentation commands may | 1738 If you fail to follow these conventions, the indentation commands may |
1828 indent some lines unaesthetically. However, a correct Fortran program will | 1739 indent some lines unaesthetically. However, a correct Fortran program will |
1829 retain its meaning when reindented even if the conventions are not | 1740 retain its meaning when reindented even if the conventions are not |
1830 followed. | 1741 followed. |
1831 | 1742 |
1832 @node ForIndent Vars, , ForIndent Conv, Fortran Indent | 1743 @node ForIndent Vars,, ForIndent Conv, Fortran Indent |
1833 @subsubsection Variables for Fortran Indentation | 1744 @subsubsection Variables for Fortran Indentation |
1834 | 1745 |
1835 @vindex fortran-do-indent | 1746 @vindex fortran-do-indent |
1836 @vindex fortran-if-indent | 1747 @vindex fortran-if-indent |
1837 @vindex fortran-continuation-indent | 1748 @vindex fortran-continuation-indent |
1984 For even more help, use @kbd{C-c C-w} (@code{fortran-window-create}), a | 1895 For even more help, use @kbd{C-c C-w} (@code{fortran-window-create}), a |
1985 command which splits the current window horizontally, resulting in a window 72 | 1896 command which splits the current window horizontally, resulting in a window 72 |
1986 columns wide. When you edit in this window, you can immediately see | 1897 columns wide. When you edit in this window, you can immediately see |
1987 when a line gets too wide to be correct Fortran. | 1898 when a line gets too wide to be correct Fortran. |
1988 | 1899 |
1989 @node Fortran Abbrev, , Fortran Columns, Fortran | 1900 @node Fortran Abbrev,, Fortran Columns, Fortran |
1990 @subsection Fortran Keyword Abbrevs | 1901 @subsection Fortran Keyword Abbrevs |
1991 | 1902 |
1992 Fortran mode provides many built-in abbrevs for common keywords and | 1903 Fortran mode provides many built-in abbrevs for common keywords and |
1993 declarations. These are the same sort of abbrevs that you can define | 1904 declarations. These are the same sort of abbrevs that you can define |
1994 yourself. To use them, you must turn on Abbrev mode. @pxref{Abbrevs}. | 1905 yourself. To use them, you must turn on Abbrev mode. @pxref{Abbrevs}. |
2004 automatically to @samp{continue}, provided Abbrev mode is enabled.@refill | 1915 automatically to @samp{continue}, provided Abbrev mode is enabled.@refill |
2005 | 1916 |
2006 Type @samp{;?} or @samp{;C-h} to display a list of all built-in | 1917 Type @samp{;?} or @samp{;C-h} to display a list of all built-in |
2007 Fortran abbrevs and what they stand for. | 1918 Fortran abbrevs and what they stand for. |
2008 | 1919 |
2009 @node Asm Mode, , Fortran, Programs | 1920 @node Asm Mode,, Fortran, Programs |
2010 @section Asm Mode | 1921 @section Asm Mode |
2011 | 1922 |
2012 @cindex Asm mode | 1923 @cindex Asm mode |
2013 Asm mode is a major mode for editing files of assembler code. It | 1924 Asm mode is a major mode for editing files of assembler code. It |
2014 defines these commands: | 1925 defines these commands: |