Truncate imenu items.
Make use of markers or integers an option.
(imenu-use-markers, imenu-max-item-length): New variables.
(imenu-max-items): Doc fix.
(imenu-example--name-and-position): Handle imenu-use-markers.
(imenu-default-create-index-function): Likewise.
(imenu--generic-function): Likewise.
(imenu--truncate-items): New function.
(imenu--make-index-alist): Call imenu--truncate-items.
(imenu--generic-function): Fixed probably a typo: named appeared
twice in an item. Put function after name and beg in a special
item because a normal item has name and beg (for orthogonality).
(imenu-add-to-menubar): First test to see if the mode supports imenu.
(imenu--menubar-select): Use the defined variable imenu-rescan-item.
(imenu-default-goto-function): New subroutine, broken out of `imenu'.
(imenu-default-goto-function): New variable.
(imenu): Made it use the above function, via that variable.
Keep subalists at top level too.
Name the split-off submenus from the first item in them.
(imenu--generic-function): Avoid adding nil as elt of the result.
(imenu--split-menu): Handle imenu-sort-function here.
(imenu--mouse-menu, imenu-update-menubar): Not here.
(imenu--mouse-menu): Rewrite second half--handle nested menus reliably.
(imenu--create-keymap-2): Include ITEM in the leaf menu-item.
(imenu-create-submenu-name): Function deleted.
(imenu-example--create-lisp-index): Don't use it.
(imenu--generic-function): Don't use imenu-create-submenu-name.
(imenu-submenu-name-format): Variable deleted.
(imenu--split-menu): Use TITLE as the head of the new list.
Don't split if everything fits in one level.
(imenu--split-submenus): New function.
(imenu-update-menubar): Use imenu--split-submenus.
(imenu--mouse-menu): Use imenu--split-submenus.
(imenu-add-to-menubar): Use an ordinary menu bar submenu.
Add imenu-add-to-menubar to menu-bar-update-hook to update the submenu.
(imenu--make-index-alist): Add noerror argument.
(imenu--menubar-select): New function.
(imenu--create-keymap-1, imenu--create-keymap-2): New arg COMMANDS.
(imenu): Allow a string as arg.
(imenu-generic-c++-expression, imenu-generic-c-expression)
(imenu-generic-ada-expression, imenu-generic-texinfo-expression)
(imenu-generic-latex-expression): Vars deleted; now handled by the
major modes themselves.
(imenu--scanning-method-alist): Var deleted.
(imenu-default-create-index-function): Don't use that alist.
(imenu-auto-rescan): New variable.
(imenu-auto-rescan-maxout): New variable.
(imenu-generic-expression): Doc changes.
(imenu-generic-lisp-expression): New variable.
(imenu-generic-c-expression): New variable.
(imenu-example--generic-c++-expression): Changed the name to
imenu-generic-c++-expression.
(imenu-example--generic-texinfo-expression): Changed the name to
imenu-generic-texinfo-expression.
(imenu-example--generic-latex-expression): Changed the name to
imenu-generic-latex-expression.
(imenu--scanning-method-alist): New variable.
(imenu--split-menu): Changed it to make the title "Index menu"
instead of "Function menus".
(imenu--make-index-alist): Changed to handle auto rescan.
(imenu--create-keymap-2): New function to create a keymap.
(imenu--create-keymap-1): New function.
(imenu--in-alist): New function.
(imenu-default-create-index-function): Changed to handle
imenu--scanning-method-alist).
(imenu--generic-extract-name): Removed.
(imenu--generic-function): Rewritten to handle submenus.
(imenu--mouse-menu): Changed to handle keymaps.
(imenu-example--generic-c++-expression): New variable.
(imenu-example--generic-texinfo-expression): New variable.
(imenu-example--generic-latex-expression): New variable.
(imenu-example--create-c++-index): Deleted.
(imenu-example--function-name-regexp-c++): Deleted.
(imenu--generic-function): New function.
(imenu--generic-extract-name): New function.
(imenu-default-create-index-function): Added the generic function calls for
the provided examples.