diff options
| author | Lute Kamstra | 2003-10-03 11:49:22 +0000 |
|---|---|---|
| committer | Lute Kamstra | 2003-10-03 11:49:22 +0000 |
| commit | 10ee4e90194e147aa33f48b016561980b9ad010e (patch) | |
| tree | eb0c42056c441b60774434cd7f88dcc8948de6fa | |
| parent | be2fdba9dfa211aadf2bd5da9c778e1ee3eb96d0 (diff) | |
| download | emacs-10ee4e90194e147aa33f48b016561980b9ad010e.tar.gz emacs-10ee4e90194e147aa33f48b016561980b9ad010e.zip | |
(Major Mode Conventions): Mention third way to set up Imenu.
(Imenu): A number of small fixes.
Delete documentation of internal variable imenu--index-alist.
Document the return value format of imenu-create-index-function
functions.
| -rw-r--r-- | lispref/ChangeLog | 9 | ||||
| -rw-r--r-- | lispref/modes.texi | 101 |
2 files changed, 67 insertions, 43 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index ebaaec22bb7..234133c78e2 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2003-10-03 Lute Kamstra <Lute.Kamstra@cwi.nl> | ||
| 2 | |||
| 3 | * modes.texi (Major Mode Conventions): Mention third way to set up | ||
| 4 | Imenu. | ||
| 5 | (Imenu): A number of small fixes. | ||
| 6 | Delete documentation of internal variable imenu--index-alist. | ||
| 7 | Document the return value format of imenu-create-index-function | ||
| 8 | functions. | ||
| 9 | |||
| 1 | 2003-09-30 Richard M. Stallman <rms@gnu.org> | 10 | 2003-09-30 Richard M. Stallman <rms@gnu.org> |
| 2 | 11 | ||
| 3 | * processes.texi (Network): Say what stopped datagram connections do. | 12 | * processes.texi (Network): Say what stopped datagram connections do. |
diff --git a/lispref/modes.texi b/lispref/modes.texi index b346dad99cc..fb287b162b8 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -236,7 +236,9 @@ setting up a buffer-local value for the variable | |||
| 236 | @item | 236 | @item |
| 237 | The mode should specify how Imenu should find the definitions or | 237 | The mode should specify how Imenu should find the definitions or |
| 238 | sections of a buffer, by setting up a buffer-local value for the | 238 | sections of a buffer, by setting up a buffer-local value for the |
| 239 | variable @code{imenu-generic-expression} or | 239 | variable @code{imenu-generic-expression}, for the pair of variables |
| 240 | @code{imenu-prev-index-position-function} and | ||
| 241 | @code{imenu-extract-index-name-function}, or for the variable | ||
| 240 | @code{imenu-create-index-function} (@pxref{Imenu}). | 242 | @code{imenu-create-index-function} (@pxref{Imenu}). |
| 241 | 243 | ||
| 242 | @item | 244 | @item |
| @@ -1702,12 +1704,12 @@ particular major mode. | |||
| 1702 | @code{imenu-generic-expression}: | 1704 | @code{imenu-generic-expression}: |
| 1703 | 1705 | ||
| 1704 | @defvar imenu-generic-expression | 1706 | @defvar imenu-generic-expression |
| 1705 | This variable, if non-@code{nil}, specifies regular expressions for | 1707 | This variable, if non-@code{nil}, is a list that specifies regular |
| 1706 | finding definitions for Imenu. In the simplest case, elements should | 1708 | expressions for finding definitions for Imenu. Simple elements of |
| 1707 | look like this: | 1709 | @code{imenu-generic-expression} look like this: |
| 1708 | 1710 | ||
| 1709 | @example | 1711 | @example |
| 1710 | (@var{menu-title} @var{regexp} @var{subexp}) | 1712 | (@var{menu-title} @var{regexp} @var{index}) |
| 1711 | @end example | 1713 | @end example |
| 1712 | 1714 | ||
| 1713 | Here, if @var{menu-title} is non-@code{nil}, it says that the matches | 1715 | Here, if @var{menu-title} is non-@code{nil}, it says that the matches |
| @@ -1717,10 +1719,10 @@ for this element should go in a submenu of the buffer index; | |||
| 1717 | in the top level of the buffer index. | 1719 | in the top level of the buffer index. |
| 1718 | 1720 | ||
| 1719 | The second item in the list, @var{regexp}, is a regular expression | 1721 | The second item in the list, @var{regexp}, is a regular expression |
| 1720 | (@pxref{Regular Expressions}); anything in the buffer that it matches is | 1722 | (@pxref{Regular Expressions}); anything in the buffer that it matches |
| 1721 | considered a definition, something to mention in the buffer index. The | 1723 | is considered a definition, something to mention in the buffer index. |
| 1722 | third item, @var{subexp}, indicates which subexpression in @var{regexp} | 1724 | The third item, @var{index}, is a non-negative integer that indicates |
| 1723 | matches the definition's name. | 1725 | which subexpression in @var{regexp} matches the definition's name. |
| 1724 | 1726 | ||
| 1725 | An element can also look like this: | 1727 | An element can also look like this: |
| 1726 | 1728 | ||
| @@ -1728,11 +1730,13 @@ An element can also look like this: | |||
| 1728 | (@var{menu-title} @var{regexp} @var{index} @var{function} @var{arguments}@dots{}) | 1730 | (@var{menu-title} @var{regexp} @var{index} @var{function} @var{arguments}@dots{}) |
| 1729 | @end example | 1731 | @end example |
| 1730 | 1732 | ||
| 1731 | Each match for this element creates a special index item which, if | 1733 | Like in the previous case, each match for this element creates an |
| 1732 | selected by the user, calls @var{function} with arguments consisting of | 1734 | index item. However, if this index item is selected by the user, it |
| 1733 | the item name, the buffer position, and @var{arguments}. | 1735 | calls @var{function} with arguments consisting of the item name, the |
| 1736 | buffer position, and @var{arguments}. | ||
| 1734 | 1737 | ||
| 1735 | For Emacs Lisp mode, @var{pattern} could look like this: | 1738 | For Emacs Lisp mode, @code{imenu-generic-expression} could look like |
| 1739 | this: | ||
| 1736 | 1740 | ||
| 1737 | @c should probably use imenu-syntax-alist and \\sw rather than [-A-Za-z0-9+] | 1741 | @c should probably use imenu-syntax-alist and \\sw rather than [-A-Za-z0-9+] |
| 1738 | @example | 1742 | @example |
| @@ -1756,9 +1760,10 @@ Setting this variable makes it buffer-local in the current buffer. | |||
| 1756 | @end defvar | 1760 | @end defvar |
| 1757 | 1761 | ||
| 1758 | @defvar imenu-case-fold-search | 1762 | @defvar imenu-case-fold-search |
| 1759 | This variable controls whether matching against | 1763 | This variable controls whether matching against the regular |
| 1760 | @var{imenu-generic-expression} is case-sensitive: @code{t}, the default, | 1764 | expressions in the value of @code{imenu-generic-expression} is |
| 1761 | means matching should ignore case. | 1765 | case-sensitive: @code{t}, the default, means matching should ignore |
| 1766 | case. | ||
| 1762 | 1767 | ||
| 1763 | Setting this variable makes it buffer-local in the current buffer. | 1768 | Setting this variable makes it buffer-local in the current buffer. |
| 1764 | @end defvar | 1769 | @end defvar |
| @@ -1786,11 +1791,11 @@ For example, Fortran mode uses it this way: | |||
| 1786 | (setq imenu-syntax-alist '(("_$" . "w"))) | 1791 | (setq imenu-syntax-alist '(("_$" . "w"))) |
| 1787 | @end example | 1792 | @end example |
| 1788 | 1793 | ||
| 1789 | The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} | 1794 | The @code{imenu-generic-expression} regular expressions can then use |
| 1790 | instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be | 1795 | @samp{\\sw+} instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this |
| 1791 | inconvenient when the mode needs to limit the initial character | 1796 | technique may be inconvenient when the mode needs to limit the initial |
| 1792 | of a name to a smaller set of characters than are allowed in the rest | 1797 | character of a name to a smaller set of characters than are allowed in |
| 1793 | of a name. | 1798 | the rest of a name. |
| 1794 | 1799 | ||
| 1795 | Setting this variable makes it buffer-local in the current buffer. | 1800 | Setting this variable makes it buffer-local in the current buffer. |
| 1796 | @end defvar | 1801 | @end defvar |
| @@ -1823,37 +1828,47 @@ Setting this variable makes it buffer-local in the current buffer. | |||
| 1823 | variable @code{imenu-create-index-function}: | 1828 | variable @code{imenu-create-index-function}: |
| 1824 | 1829 | ||
| 1825 | @defvar imenu-create-index-function | 1830 | @defvar imenu-create-index-function |
| 1826 | This variable specifies the function to use for creating a buffer index. | 1831 | This variable specifies the function to use for creating a buffer |
| 1827 | The function should take no arguments, and return an index for the | 1832 | index. The function should take no arguments, and return an index |
| 1828 | current buffer. It is called within @code{save-excursion}, so where it | 1833 | alist for the current buffer. It is called within |
| 1829 | leaves point makes no difference. | 1834 | @code{save-excursion}, so where it leaves point makes no difference. |
| 1830 | 1835 | ||
| 1831 | The default value is a function that uses | 1836 | The index alist can have three types of elements. Simple elements |
| 1832 | @code{imenu-generic-expression} to produce the index alist. If you | 1837 | look like this: |
| 1833 | specify a different function, then @code{imenu-generic-expression} is | ||
| 1834 | not used. | ||
| 1835 | 1838 | ||
| 1836 | Setting this variable makes it buffer-local in the current buffer. | 1839 | @example |
| 1837 | @end defvar | 1840 | (@var{index-name} . @var{index-position}) |
| 1841 | @end example | ||
| 1842 | |||
| 1843 | Selecting a simple element has the effect of moving to position | ||
| 1844 | @var{index-position} in the buffer. Special elements look like this: | ||
| 1838 | 1845 | ||
| 1839 | @defvar imenu-index-alist | 1846 | @example |
| 1840 | This variable holds the index alist for the current buffer. | 1847 | (@var{index-name} @var{index-position} @var{function} @var{arguments}@dots{}) |
| 1841 | Setting it makes it buffer-local in the current buffer. | 1848 | @end example |
| 1842 | 1849 | ||
| 1843 | Simple elements in the alist look like @code{(@var{index-name} | 1850 | Selecting a special element performs: |
| 1844 | . @var{index-position})}. Selecting a simple element has the effect of | 1851 | |
| 1845 | moving to position @var{index-position} in the buffer. | 1852 | @example |
| 1853 | (funcall @var{function} | ||
| 1854 | @var{index-name} @var{index-position} @var{arguments}@dots{}) | ||
| 1855 | @end example | ||
| 1846 | 1856 | ||
| 1847 | Special elements look like @code{(@var{index-name} @var{position} | 1857 | A nested sub-alist element looks like this: |
| 1848 | @var{function} @var{arguments}@dots{})}. Selecting a special element | ||
| 1849 | performs | ||
| 1850 | 1858 | ||
| 1851 | @example | 1859 | @example |
| 1852 | (funcall @var{function} @var{index-name} @var{position} @var{arguments}@dots{}) | 1860 | (@var{index-name} @var{sub-alist}) |
| 1853 | @end example | 1861 | @end example |
| 1854 | 1862 | ||
| 1855 | A nested sub-alist element looks like @code{(@var{index-name} | 1863 | It creates a submenu specified by @var{sub-alist}. |
| 1856 | @var{sub-alist})}. | 1864 | |
| 1865 | The default value of @code{imenu-create-index-function} is a function | ||
| 1866 | that uses @code{imenu-prev-index-position-function} and | ||
| 1867 | @code{imenu-extract-index-name-function} to produce the index alist. | ||
| 1868 | However, if either of these two variables is @code{nil}, the default | ||
| 1869 | function uses @code{imenu-generic-expression} instead. | ||
| 1870 | |||
| 1871 | Setting this variable makes it buffer-local in the current buffer. | ||
| 1857 | @end defvar | 1872 | @end defvar |
| 1858 | 1873 | ||
| 1859 | @node Font Lock Mode | 1874 | @node Font Lock Mode |