Variable: imenu-sort-function

imenu-sort-function is a customizable variable defined in imenu.el.gz.

Value

nil

Documentation

The function to use for sorting the index mouse-menu.

Affects only the mouse index menu. If you want to change the sorting order of completions, you can customize the option completion-category-overrides and set display-sort-function for the category imenu.

Set this to nil if you don't want any sorting (faster). The items in the menu are then presented in the order they were found in the buffer.

Set it to imenu--sort-by-name if you want alphabetic sorting.

The function should take two arguments and return t if the first element should come before the second. The arguments are cons cells;
(NAME . POSITION). Look at imenu--sort-by-name for an example.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/imenu.el.gz
;;;###autoload
(defcustom imenu-sort-function nil
  "The function to use for sorting the index mouse-menu.

Affects only the mouse index menu.  If you want to change
the sorting order of completions, you can customize
the option `completion-category-overrides' and set
`display-sort-function' for the category `imenu'.

Set this to nil if you don't want any sorting (faster).
The items in the menu are then presented in the order they were found
in the buffer.

Set it to `imenu--sort-by-name' if you want alphabetic sorting.

The function should take two arguments and return t if the first
element should come before the second.  The arguments are cons cells;
\(NAME . POSITION).  Look at `imenu--sort-by-name' for an example."
  :type '(choice (const :tag "No sorting" nil)
		 (const :tag "Sort by name" imenu--sort-by-name)
                 (function :tag "Another function")))