10 Index Menu
PHP mode provides a menu of the functions and classes
defined in the current buffer. The menu is pretty simple,
but is helpful when navigating large files. The contents of
the menu also provide a good overview to the user about the
file's contents.
To enable this menu, run the following command.
- M-x imenu-add-menubar-index
- Scan the file for functions and class declarations, then add
a menu item called “Index” to the menu bar.
In the menu will be any one or more of the following menu
items.
- ‘All Functions’
- A sub-menu containing the names of functions defined in the
current buffer. Clicking on a function name will visit the
location of the function's definition.
- ‘Classes’
- A sub-menu containing the names of classes defined in the
current buffer. Clicking on a class name will visit the
location of the class's definition.
- ‘Public Methods, Private Methods, Protected Methods’
- Each of these three “method” sub-menus list the names of
objects methods defined as “public”, “private” or
“protected”. Clicking on a method name will visit the
location of the function's definition.
- ‘*Rescan*’
- Rescan the contents of the current buffer, and update both
the indexes the entries in the menu.
To have Emacs automatically rescan the current buffer,
change the setting for imenu-auto-rescan
to non-nil
with either M-x customize-variable RET
php-completion-file RET, or by setting its value in your
Emacs initialization file (~/.emacs).