Variable: imenu-generic-expression
imenu-generic-expression is a buffer-local variable defined in
imenu.el.gz.
Documentation
List of definition matchers for creating an Imenu index.
Each element of this list should have the form
(MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...])
MENU-TITLE should be nil (in which case the matches for this
element are put in the top level of the buffer index) or a
string (which specifies the title of a submenu into which the
matches are put).
REGEXP is a regular expression matching a definition construct
which is to be displayed in the menu. REGEXP may also be a
function of no arguments. If REGEXP is a function, it is
expected to search backwards, return non-nil if it finds a
definition construct, and set match-data for that construct.
INDEX is an integer specifying which subexpression of REGEXP
matches the definition's name; this subexpression is displayed as
the menu item.
FUNCTION, if present, specifies a function to call when the index
item is selected by the user. This function is called with
arguments consisting of the item name, the buffer position, and
the ARGUMENTS.
The variable imenu-case-fold-search determines whether or not
the regexp matches are case sensitive, and imenu-syntax-alist
can be used to alter the syntax table for the search.
If non-nil this pattern is passed to imenu--generic-function to
create a buffer index.
For example, see the value of fortran-imenu-generic-expression
used by fortran-mode with imenu-syntax-alist set locally so that
characters which normally have "symbol" syntax are considered to have
"word" syntax during matching.
Source Code
;; Defined in /usr/src/emacs/lisp/imenu.el.gz
;;;###autoload
(defvar-local imenu-generic-expression nil
"List of definition matchers for creating an Imenu index.
Each element of this list should have the form
(MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...])
MENU-TITLE should be nil (in which case the matches for this
element are put in the top level of the buffer index) or a
string (which specifies the title of a submenu into which the
matches are put).
REGEXP is a regular expression matching a definition construct
which is to be displayed in the menu. REGEXP may also be a
function of no arguments. If REGEXP is a function, it is
expected to search backwards, return non-nil if it finds a
definition construct, and set `match-data' for that construct.
INDEX is an integer specifying which subexpression of REGEXP
matches the definition's name; this subexpression is displayed as
the menu item.
FUNCTION, if present, specifies a function to call when the index
item is selected by the user. This function is called with
arguments consisting of the item name, the buffer position, and
the ARGUMENTS.
The variable `imenu-case-fold-search' determines whether or not
the regexp matches are case sensitive, and `imenu-syntax-alist'
can be used to alter the syntax table for the search.
If non-nil this pattern is passed to `imenu--generic-function' to
create a buffer index.
For example, see the value of `fortran-imenu-generic-expression'
used by `fortran-mode' with `imenu-syntax-alist' set locally so that
characters which normally have \"symbol\" syntax are considered to have
\"word\" syntax during matching.")