aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLute Kamstra2003-10-03 11:49:22 +0000
committerLute Kamstra2003-10-03 11:49:22 +0000
commit10ee4e90194e147aa33f48b016561980b9ad010e (patch)
treeeb0c42056c441b60774434cd7f88dcc8948de6fa
parentbe2fdba9dfa211aadf2bd5da9c778e1ee3eb96d0 (diff)
downloademacs-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/ChangeLog9
-rw-r--r--lispref/modes.texi101
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 @@
12003-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
12003-09-30 Richard M. Stallman <rms@gnu.org> 102003-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
237The mode should specify how Imenu should find the definitions or 237The mode should specify how Imenu should find the definitions or
238sections of a buffer, by setting up a buffer-local value for the 238sections of a buffer, by setting up a buffer-local value for the
239variable @code{imenu-generic-expression} or 239variable @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
1705This variable, if non-@code{nil}, specifies regular expressions for 1707This variable, if non-@code{nil}, is a list that specifies regular
1706finding definitions for Imenu. In the simplest case, elements should 1708expressions for finding definitions for Imenu. Simple elements of
1707look 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
1713Here, if @var{menu-title} is non-@code{nil}, it says that the matches 1715Here, 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;
1717in the top level of the buffer index. 1719in the top level of the buffer index.
1718 1720
1719The second item in the list, @var{regexp}, is a regular expression 1721The 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
1721considered a definition, something to mention in the buffer index. The 1723is considered a definition, something to mention in the buffer index.
1722third item, @var{subexp}, indicates which subexpression in @var{regexp} 1724The third item, @var{index}, is a non-negative integer that indicates
1723matches the definition's name. 1725which subexpression in @var{regexp} matches the definition's name.
1724 1726
1725An element can also look like this: 1727An 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
1731Each match for this element creates a special index item which, if 1733Like in the previous case, each match for this element creates an
1732selected by the user, calls @var{function} with arguments consisting of 1734index item. However, if this index item is selected by the user, it
1733the item name, the buffer position, and @var{arguments}. 1735calls @var{function} with arguments consisting of the item name, the
1736buffer position, and @var{arguments}.
1734 1737
1735For Emacs Lisp mode, @var{pattern} could look like this: 1738For Emacs Lisp mode, @code{imenu-generic-expression} could look like
1739this:
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
1759This variable controls whether matching against 1763This variable controls whether matching against the regular
1760@var{imenu-generic-expression} is case-sensitive: @code{t}, the default, 1764expressions in the value of @code{imenu-generic-expression} is
1761means matching should ignore case. 1765case-sensitive: @code{t}, the default, means matching should ignore
1766case.
1762 1767
1763Setting this variable makes it buffer-local in the current buffer. 1768Setting 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
1789The @code{imenu-generic-expression} patterns can then use @samp{\\sw+} 1794The @code{imenu-generic-expression} regular expressions can then use
1790instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this technique may be 1795@samp{\\sw+} instead of @samp{\\(\\sw\\|\\s_\\)+}. Note that this
1791inconvenient when the mode needs to limit the initial character 1796technique may be inconvenient when the mode needs to limit the initial
1792of a name to a smaller set of characters than are allowed in the rest 1797character of a name to a smaller set of characters than are allowed in
1793of a name. 1798the rest of a name.
1794 1799
1795Setting this variable makes it buffer-local in the current buffer. 1800Setting 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.
1823variable @code{imenu-create-index-function}: 1828variable @code{imenu-create-index-function}:
1824 1829
1825@defvar imenu-create-index-function 1830@defvar imenu-create-index-function
1826This variable specifies the function to use for creating a buffer index. 1831This variable specifies the function to use for creating a buffer
1827The function should take no arguments, and return an index for the 1832index. The function should take no arguments, and return an index
1828current buffer. It is called within @code{save-excursion}, so where it 1833alist for the current buffer. It is called within
1829leaves point makes no difference. 1834@code{save-excursion}, so where it leaves point makes no difference.
1830 1835
1831The default value is a function that uses 1836The index alist can have three types of elements. Simple elements
1832@code{imenu-generic-expression} to produce the index alist. If you 1837look like this:
1833specify a different function, then @code{imenu-generic-expression} is
1834not used.
1835 1838
1836Setting 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
1843Selecting 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
1840This variable holds the index alist for the current buffer. 1847(@var{index-name} @var{index-position} @var{function} @var{arguments}@dots{})
1841Setting it makes it buffer-local in the current buffer. 1848@end example
1842 1849
1843Simple elements in the alist look like @code{(@var{index-name} 1850Selecting a special element performs:
1844. @var{index-position})}. Selecting a simple element has the effect of 1851
1845moving 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
1847Special elements look like @code{(@var{index-name} @var{position} 1857A nested sub-alist element looks like this:
1848@var{function} @var{arguments}@dots{})}. Selecting a special element
1849performs
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
1855A nested sub-alist element looks like @code{(@var{index-name} 1863It creates a submenu specified by @var{sub-alist}.
1856@var{sub-alist})}. 1864
1865The default value of @code{imenu-create-index-function} is a function
1866that uses @code{imenu-prev-index-position-function} and
1867@code{imenu-extract-index-name-function} to produce the index alist.
1868However, if either of these two variables is @code{nil}, the default
1869function uses @code{imenu-generic-expression} instead.
1870
1871Setting 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