-(defvar imenu-auto-rescan nil
- "*Non-nil means Imenu should always rescan the buffers.")
-
-(defvar imenu-auto-rescan-maxout 60000
- "* auto-rescan is disabled in buffers larger than this.
-This variable is buffer-local.")
-
-(defvar imenu-always-use-completion-buffer-p nil
- "*Set this to non-nil for displaying the index in a completion buffer.
+(defgroup imenu nil
+ "Mode-specific buffer indexes."
+ :group 'matching
+ :group 'frames
+ :group 'convenience
+ :link '(custom-manual "(elisp)Imenu"))
+
+(defcustom imenu-use-markers t
+ "*Non-nil means use markers instead of integers for Imenu buffer positions.
+
+Setting this to nil makes Imenu work a little faster but editing the
+buffer will make the generated index positions wrong.
+
+This might not yet be honored by all index-building functions."
+ :type 'boolean
+ :group 'imenu)
+
+
+(defcustom imenu-max-item-length 60
+ "*If a number, truncate Imenu entries to that length."
+ :type '(choice integer
+ (const :tag "Unlimited"))
+ :group 'imenu)
+
+(defcustom imenu-auto-rescan nil
+ "*Non-nil means Imenu should always rescan the buffers."
+ :type 'boolean
+ :group 'imenu)
+
+(defcustom imenu-auto-rescan-maxout 60000
+ "*Imenu auto-rescan is disabled in buffers larger than this size (in bytes).
+This variable is buffer-local."
+ :type 'integer
+ :group 'imenu)
+
+(defvar imenu-always-use-completion-buffer-p nil)
+(make-obsolete-variable 'imenu-always-use-completion-buffer-p
+ 'imenu-use-popup-menu "21.4")
+
+(defcustom imenu-use-popup-menu
+ (if imenu-always-use-completion-buffer-p
+ (not (eq imenu-always-use-completion-buffer-p 'never))
+ 'on-mouse)
+ "Use a popup menu rather than a minibuffer prompt.
+If nil, always use a minibuffer prompt.
+If t, always use a popup menu,
+If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
+ :type '(choice (const :tag "On Mouse" on-mouse)
+ (const :tag "Never" nil)
+ (other :tag "Always" t)))
+
+(defcustom imenu-eager-completion-buffer
+ (not (eq imenu-always-use-completion-buffer-p 'never))
+ "If non-nil, eagerly popup the completion buffer."
+ :type 'boolean)
+
+(defcustom imenu-after-jump-hook nil
+ "*Hooks called after jumping to a place in the buffer.
+
+Useful things to use here include `reposition-window', `recenter', and
+\(lambda () (recenter 0)) to show at top of screen."
+ :type 'hook
+ :group 'imenu)