diff options
| author | Francesco Potortì | 1999-11-01 16:40:40 +0000 |
|---|---|---|
| committer | Francesco Potortì | 1999-11-01 16:40:40 +0000 |
| commit | aca0be23e8c4c73bb810ca3aa72962c7e6d921d5 (patch) | |
| tree | 33cfc4faafc8b51a1b45bb5bffa038293962d379 /man/programs.texi | |
| parent | 79ddc9c971569b56505443c338639350ba0a5a5f (diff) | |
| download | emacs-aca0be23e8c4c73bb810ca3aa72962c7e6d921d5.tar.gz emacs-aca0be23e8c4c73bb810ca3aa72962c7e6d921d5.zip | |
Document regexp changes in etags.
Diffstat (limited to 'man/programs.texi')
| -rw-r--r-- | man/programs.texi | 108 |
1 files changed, 69 insertions, 39 deletions
diff --git a/man/programs.texi b/man/programs.texi index 56e2ff8718f..68057d81a25 100644 --- a/man/programs.texi +++ b/man/programs.texi | |||
| @@ -1604,7 +1604,7 @@ recorded is called a @dfn{tag}. | |||
| 1604 | @menu | 1604 | @menu |
| 1605 | * Tag Syntax:: Tag syntax for various types of code and text files. | 1605 | * Tag Syntax:: Tag syntax for various types of code and text files. |
| 1606 | * Create Tags Table:: Creating a tags table with @code{etags}. | 1606 | * Create Tags Table:: Creating a tags table with @code{etags}. |
| 1607 | * Using Regexps:: Create arbitrary tags using regular expressions. | 1607 | * Etags Regexps:: Create arbitrary tags using regular expressions. |
| 1608 | * Select Tags Table:: How to visit a tags table. | 1608 | * Select Tags Table:: How to visit a tags table. |
| 1609 | * Find Tag:: Commands to find the definition of a specific tag. | 1609 | * Find Tag:: Commands to find the definition of a specific tag. |
| 1610 | * Tags Search:: Using a tags table for searching and replacing. | 1610 | * Tags Search:: Using a tags table for searching and replacing. |
| @@ -1804,9 +1804,9 @@ have a limit on its length. The simplest way to circumvent this limit | |||
| 1804 | is to tell @code{etags} to read the file names from its standard input, | 1804 | is to tell @code{etags} to read the file names from its standard input, |
| 1805 | by typing a dash in place of the file names, like this: | 1805 | by typing a dash in place of the file names, like this: |
| 1806 | 1806 | ||
| 1807 | @example | 1807 | @smallexample |
| 1808 | find . -name "*.[chCH]" -print | etags - | 1808 | find . -name "*.[chCH]" -print | etags - |
| 1809 | @end example | 1809 | @end smallexample |
| 1810 | 1810 | ||
| 1811 | Use the option @samp{--language=@var{name}} to specify the language | 1811 | Use the option @samp{--language=@var{name}} to specify the language |
| 1812 | explicitly. You can intermix these options with file names; each one | 1812 | explicitly. You can intermix these options with file names; each one |
| @@ -1815,38 +1815,33 @@ applies to the file names that follow it. Specify | |||
| 1815 | language from the file names and file contents. Specify | 1815 | language from the file names and file contents. Specify |
| 1816 | @samp{--language=none} to turn off language-specific processing | 1816 | @samp{--language=none} to turn off language-specific processing |
| 1817 | entirely; then @code{etags} recognizes tags by regexp matching alone | 1817 | entirely; then @code{etags} recognizes tags by regexp matching alone |
| 1818 | (@pxref{Using Regexps}). @samp{etags --help} prints the list of the | 1818 | (@pxref{Etags Regexps}). |
| 1819 | languages @code{etags} knows, and the file name rules for guessing the | 1819 | |
| 1820 | language. | 1820 | @samp{etags --help} prints the list of the languages @code{etags} |
| 1821 | knows, and the file name rules for guessing the language. It also prints | ||
| 1822 | a list of all the available @code{etags} options, together with a short | ||
| 1823 | explanation. | ||
| 1821 | 1824 | ||
| 1822 | @node Using Regexps | 1825 | @node Etags Regexps |
| 1823 | @subsection Using Regexps | 1826 | @subsection Etags Regexps |
| 1824 | 1827 | ||
| 1825 | The @samp{--regex} option provides a general way of recognizing tags | 1828 | The @samp{--regex} option provides a general way of recognizing tags |
| 1826 | based on regexp matching. You can freely intermix it with file names. | 1829 | based on regexp matching. You can freely intermix it with file names. |
| 1827 | Each @samp{--regex} option adds to the preceding ones, and applies only | 1830 | Each @samp{--regex} option adds to the preceding ones, and applies only |
| 1828 | to the following files. The syntax is: | 1831 | to the following files. The syntax is: |
| 1829 | 1832 | ||
| 1830 | @example | 1833 | @smallexample |
| 1831 | --regex=/@var{tagregexp}[/@var{nameregexp}]/ | 1834 | --regex=/@var{tagregexp}[/@var{nameregexp}]/ |
| 1832 | @end example | 1835 | @end smallexample |
| 1833 | |||
| 1834 | or | ||
| 1835 | |||
| 1836 | @example | ||
| 1837 | --ignore-case-regex=/@var{tagregexp}[/@var{nameregexp}]/ | ||
| 1838 | @end example | ||
| 1839 | 1836 | ||
| 1840 | @noindent | 1837 | @noindent |
| 1841 | where @var{tagregexp} is used to match the lines to tag. The second | 1838 | where @var{tagregexp} is used to match the lines to tag. It is always |
| 1842 | form for the option syntax ignores the case when searching a match for | 1839 | anchored, that is, it behaves as if preceded by @samp{^}. If you want |
| 1843 | the regular expression. @var{tagregexp} is always anchored, that is, it | 1840 | to account for indentation, just match any initial number of blanks by |
| 1844 | behaves as if preceded by @samp{^}. If you want to account for | 1841 | beginning your regular expression with @samp{[ \t]*}. In the regular |
| 1845 | indentation, just match any initial number of blanks by beginning your | 1842 | expressions, @samp{\} quotes the next character, and @samp{\t} stands |
| 1846 | regular expression with @samp{[ \t]*}. In the regular expressions, | 1843 | for the tab character. Note that @code{etags} does not handle the other |
| 1847 | @samp{\} quotes the next character, and @samp{\t} stands for the tab | 1844 | C escape sequences for special characters. |
| 1848 | character. Note that @code{etags} does not handle the other C escape | ||
| 1849 | sequences for special characters. | ||
| 1850 | 1845 | ||
| 1851 | @cindex interval operator (in regexps) | 1846 | @cindex interval operator (in regexps) |
| 1852 | The syntax of regular expressions in @code{etags} is the same as in | 1847 | The syntax of regular expressions in @code{etags} is the same as in |
| @@ -1863,19 +1858,19 @@ pick out just the tag. This will enable Emacs to find tags more | |||
| 1863 | accurately and to do completion on tag names more reliably. You can | 1858 | accurately and to do completion on tag names more reliably. You can |
| 1864 | find some examples below. | 1859 | find some examples below. |
| 1865 | 1860 | ||
| 1866 | The option @samp{--case-folded-regexp} (or @samp{-c}) si like | 1861 | The option @samp{--ignore-case-regex} (or @samp{-c}) is like |
| 1867 | @samp{--regex}, except that the regular expression provided will be | 1862 | @samp{--regex}, except that the regular expression provided will be |
| 1868 | matched with case folded, i.e. case-insensitively, which is appropriate | 1863 | matched without regard to case, which is appropriate for various |
| 1869 | for various programming languages. | 1864 | programming languages. |
| 1870 | 1865 | ||
| 1871 | The @samp{-R} option deletes all the regexps defined with | 1866 | The @samp{-R} option deletes all the regexps defined with |
| 1872 | @samp{--regex} options. It applies to the file names following it, as | 1867 | @samp{--regex} options. It applies to the file names following it, as |
| 1873 | you can see from the following example: | 1868 | you can see from the following example: |
| 1874 | 1869 | ||
| 1875 | @example | 1870 | @smallexample |
| 1876 | etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \ | 1871 | etags --regex=/@var{reg1}/ voo.doo --regex=/@var{reg2}/ \ |
| 1877 | bar.ber -R --lang=lisp los.er | 1872 | bar.ber -R --lang=lisp los.er |
| 1878 | @end example | 1873 | @end smallexample |
| 1879 | 1874 | ||
| 1880 | @noindent | 1875 | @noindent |
| 1881 | Here @code{etags} chooses the parsing language for @file{voo.doo} and | 1876 | Here @code{etags} chooses the parsing language for @file{voo.doo} and |
| @@ -1885,17 +1880,55 @@ Here @code{etags} chooses the parsing language for @file{voo.doo} and | |||
| 1885 | @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp | 1880 | @file{bar.ber}. @code{etags} uses the Lisp tags rules, and no regexp |
| 1886 | matching, to recognize tags in @file{los.er}. | 1881 | matching, to recognize tags in @file{los.er}. |
| 1887 | 1882 | ||
| 1888 | Here are some more examples. The regexps are quoted to protect them | 1883 | A regular expression can be bound to a given language, by prepending |
| 1889 | from shell interpretation. | 1884 | it with @samp{@{lang@}}. When you do this, @code{etags} will use the |
| 1885 | regular expression only for files of that language. @samp{etags --help} | ||
| 1886 | prints the list of languages recognised by @code{etags}. The following | ||
| 1887 | example tags the @code{DEFVAR} macros in the Emacs source files. | ||
| 1888 | @code{etags} applies this regular expression to C files only: | ||
| 1890 | 1889 | ||
| 1891 | @itemize @bullet | 1890 | @smallexample |
| 1892 | @item | 1891 | --regex='@{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' |
| 1893 | Tag the @code{DEFVAR} macros in the emacs source files: | 1892 | @end smallexample |
| 1893 | |||
| 1894 | @noindent | ||
| 1895 | This feature is particularly useful when storing a list of regular | ||
| 1896 | expressions in a file. The following option syntax instructs | ||
| 1897 | @code{etags} to read two files of regular expressions. The regular | ||
| 1898 | expressions contained in the second file are matched without regard to | ||
| 1899 | case. | ||
| 1900 | |||
| 1901 | @smallexample | ||
| 1902 | --regex=@@first-file --ignore-case-regex=@@second-file | ||
| 1903 | @end smallexample | ||
| 1904 | |||
| 1905 | @noindent | ||
| 1906 | A regex file contains one regular expressions per line. Empty lines, | ||
| 1907 | and lines beginning with space or tab are ignored. When the first | ||
| 1908 | character in a line is @samp{@@}, @code{etags} assumes that the rest of | ||
| 1909 | the line is the name of a file of regular expressions. This means that | ||
| 1910 | such files can be nested. All the other lines are taken to be regular | ||
| 1911 | expressions. For example, one can create a file called | ||
| 1912 | @samp{emacs.tags} with the following contents (the first line in the | ||
| 1913 | file is a comment): | ||
| 1914 | |||
| 1915 | @smallexample | ||
| 1916 | -- This is for GNU Emacs source files | ||
| 1917 | @{c@}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/ | ||
| 1918 | @end smallexample | ||
| 1919 | |||
| 1920 | @noindent | ||
| 1921 | and then use it like this: | ||
| 1894 | 1922 | ||
| 1895 | @smallexample | 1923 | @smallexample |
| 1896 | --regex='/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/' | 1924 | etags --regex=@@emacs.tags *.[ch] */*.[ch] |
| 1897 | @end smallexample | 1925 | @end smallexample |
| 1898 | 1926 | ||
| 1927 | Here are some more examples. The regexps are quoted to protect them | ||
| 1928 | from shell interpretation. | ||
| 1929 | |||
| 1930 | @itemize @bullet | ||
| 1931 | |||
| 1899 | @item | 1932 | @item |
| 1900 | Tag VHDL files (this example is a single long line, broken here for | 1933 | Tag VHDL files (this example is a single long line, broken here for |
| 1901 | formatting reasons): | 1934 | formatting reasons): |
| @@ -1915,9 +1948,6 @@ Tag Tcl files (this last example shows the usage of a @var{nameregexp}): | |||
| 1915 | @end smallexample | 1948 | @end smallexample |
| 1916 | @end itemize | 1949 | @end itemize |
| 1917 | 1950 | ||
| 1918 | For a list of the other available @code{etags} options, execute | ||
| 1919 | @code{etags --help}. | ||
| 1920 | |||
| 1921 | @node Select Tags Table | 1951 | @node Select Tags Table |
| 1922 | @subsection Selecting a Tags Table | 1952 | @subsection Selecting a Tags Table |
| 1923 | 1953 | ||