summaryrefslogtreecommitdiff
path: root/lisp/imenu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/imenu.el')
-rw-r--r--lisp/imenu.el105
1 files changed, 21 insertions, 84 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index b5cd18a689d..7fc57c10526 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -36,14 +36,6 @@
;; A mode-specific function is called to generate the index. It is
;; then presented to the user, who can choose from this index.
-;;
-;; The package comes with a set of example functions for how to
-;; utilize this package.
-
-;; There are *examples* for index gathering functions/regular
-;; expressions for C/C++ and Lisp/Emacs Lisp but it is easy to
-;; customize for other modes. A function for jumping to the chosen
-;; index position is also supplied.
;;; History:
;; Thanks go to
@@ -81,25 +73,20 @@ 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)
-
+ :type 'boolean)
(defcustom imenu-max-item-length 60
"If a number, truncate Imenu entries to that length."
:type '(choice integer
- (const :tag "Unlimited"))
- :group 'imenu)
+ (const :tag "Unlimited")))
(defcustom imenu-auto-rescan nil
"Non-nil means Imenu should always rescan the buffers."
- :type 'boolean
- :group 'imenu)
+ :type 'boolean)
(defcustom imenu-auto-rescan-maxout 600000
"Imenu auto-rescan is disabled in buffers larger than this size (in bytes)."
:type 'integer
- :group 'imenu
:version "26.2")
(defcustom imenu-use-popup-menu 'on-mouse
@@ -109,13 +96,11 @@ 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))
- :group 'imenu)
+ (other :tag "Always" t)))
(defcustom imenu-eager-completion-buffer t
"If non-nil, eagerly popup the completion buffer."
:type 'boolean
- :group 'imenu
:version "22.1")
(defcustom imenu-after-jump-hook nil
@@ -123,8 +108,7 @@ If `on-mouse' use a popup menu when `imenu' was invoked with the mouse."
Useful things to use here include `reposition-window', `recenter', and
\(lambda () (recenter 0)) to show at top of screen."
- :type 'hook
- :group 'imenu)
+ :type 'hook)
;;;###autoload
(defcustom imenu-sort-function nil
@@ -143,39 +127,23 @@ 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"))
- :group 'imenu)
+ (function :tag "Another function")))
(defcustom imenu-max-items 25
"Maximum number of elements in a mouse menu for Imenu."
- :type 'integer
- :group 'imenu)
-
-;; No longer used. KFS 2004-10-27
-;; (defcustom imenu-scanning-message "Scanning buffer for index (%3d%%)"
-;; "Progress message during the index scanning of the buffer.
-;; If non-nil, user gets a message during the scanning of the buffer.
-;;
-;; Relevant only if the mode-specific function that creates the buffer
-;; index use `imenu-progress-message', and not useful if that is fast, in
-;; which case you might as well set this to nil."
-;; :type '(choice string
-;; (const :tag "None" nil))
-;; :group 'imenu)
+ :type 'integer)
(defcustom imenu-space-replacement "."
"The replacement string for spaces in index names.
Used when presenting the index in a completion buffer to make the
names work as tokens."
- :type '(choice string (const nil))
- :group 'imenu)
+ :type '(choice string (const nil)))
(defcustom imenu-level-separator ":"
"The separator between index names of different levels.
Used for making mouse-menu titles and for flattening nested indexes
with name concatenation."
- :type 'string
- :group 'imenu)
+ :type 'string)
(defcustom imenu-generic-skip-comments-and-strings t
"When non-nil, ignore text inside comments and strings.
@@ -183,11 +151,10 @@ Only affects `imenu-default-create-index-function' (and any
alternative implementation of `imenu-create-index-function' that
uses `imenu--generic-function')."
:type 'boolean
- :group 'imenu
:version "24.4")
;;;###autoload
-(defvar imenu-generic-expression nil
+(defvar-local imenu-generic-expression nil
"List of definition matchers for creating an Imenu index.
Each element of this list should have the form
@@ -223,13 +190,10 @@ characters which normally have \"symbol\" syntax are considered to have
\"word\" syntax during matching.")
;;;###autoload(put 'imenu-generic-expression 'risky-local-variable t)
-;;;###autoload
-(make-variable-buffer-local 'imenu-generic-expression)
-
;;;; Hooks
;;;###autoload
-(defvar imenu-create-index-function 'imenu-default-create-index-function
+(defvar-local imenu-create-index-function 'imenu-default-create-index-function
"The function to use for creating an index alist of the current buffer.
It should be a function that takes no arguments and returns
@@ -237,11 +201,9 @@ an index alist of the current buffer. The function is
called within a `save-excursion'.
See `imenu--index-alist' for the format of the buffer index alist.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-create-index-function)
;;;###autoload
-(defvar imenu-prev-index-position-function 'beginning-of-defun
+(defvar-local imenu-prev-index-position-function 'beginning-of-defun
"Function for finding the next index position.
If `imenu-create-index-function' is set to
@@ -251,21 +213,17 @@ file.
The function should leave point at the place to be connected to the
index and it should return nil when it doesn't find another index.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-prev-index-position-function)
;;;###autoload
-(defvar imenu-extract-index-name-function nil
+(defvar-local imenu-extract-index-name-function nil
"Function for extracting the index item name, given a position.
This function is called after `imenu-prev-index-position-function'
finds a position for an index item, with point at that position.
It should return the name for that index item.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-extract-index-name-function)
;;;###autoload
-(defvar imenu-name-lookup-function nil
+(defvar-local imenu-name-lookup-function nil
"Function to compare string with index item.
This function will be called with two strings, and should return
@@ -275,15 +233,11 @@ If nil, comparison is done with `string='.
Set this to some other function for more advanced comparisons,
such as \"begins with\" or \"name matches and number of
arguments match\".")
-;;;###autoload
-(make-variable-buffer-local 'imenu-name-lookup-function)
;;;###autoload
-(defvar imenu-default-goto-function 'imenu-default-goto-function
+(defvar-local imenu-default-goto-function 'imenu-default-goto-function
"The default function called when selecting an Imenu item.
The function in this variable is called when selecting a normal index-item.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-default-goto-function)
(defun imenu--subalist-p (item)
@@ -293,26 +247,11 @@ The function in this variable is called when selecting a normal index-item.")
(not (functionp (cadr item)))))
(defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
- "Macro to display a progress message.
-RELPOS is the relative position to display.
-If RELPOS is nil, then the relative position in the buffer
-is calculated.
-PREVPOS is the variable in which we store the last position displayed."
-
+ "This macro is obsolete and does nothing."
+ (declare (obsolete nil "28.1"))
;; Made obsolete/empty, as computers are now faster than the eye, and
;; it had problems updating the messages correctly, and could shadow
;; more important messages/prompts in the minibuffer. KFS 2004-10-27.
-
-;; `(and
-;; imenu-scanning-message
-;; (let ((pos ,(if relpos
-;; relpos
-;; `(imenu--relative-position ,reverse))))
-;; (if ,(if relpos t
-;; `(> pos (+ 5 ,prevpos)))
-;; (progn
-;; (message imenu-scanning-message pos)
-;; (setq ,prevpos pos)))))
)
@@ -554,7 +493,8 @@ Non-nil arguments are in recursive calls."
(setq alist nil res elt))))
res))
-(defvar imenu-syntax-alist nil
+;;;###autoload
+(defvar-local imenu-syntax-alist nil
"Alist of syntax table modifiers to use while in `imenu--generic-function'.
The car of the assocs may be either a character or a string and the
@@ -564,8 +504,6 @@ a string, all the characters in the string get the specified syntax.
This is typically used to give word syntax to characters which
normally have symbol syntax to simplify `imenu-expression'
and speed-up matching.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-syntax-alist)
(defun imenu-default-create-index-function ()
"Default function to create an index alist of the current buffer.
@@ -607,14 +545,13 @@ The alternate method, which is the one most often used, is to call
;;; Generic index gathering function.
;;;
-(defvar imenu-case-fold-search t
+;;;###autoload
+(defvar-local imenu-case-fold-search t
"Defines whether `imenu--generic-function' should fold case when matching.
This variable should be set (only) by initialization code
for modes which use `imenu--generic-function'. If it is not set, but
`font-lock-defaults' is set, then font-lock's setting is used.")
-;;;###autoload
-(make-variable-buffer-local 'imenu-case-fold-search)
;; This function can be called with quitting disabled,
;; so it needs to be careful never to loop!