diff options
| author | Phillip Rulon | 1999-09-24 13:55:29 +0000 |
|---|---|---|
| committer | Phillip Rulon | 1999-09-24 13:55:29 +0000 |
| commit | 020e8fdf930a1e4bc00f89d39a42a2a444a533c1 (patch) | |
| tree | fadf233b054d10f06c405c0ca0dab3f2f6f0aba3 | |
| parent | 66f54605e12ff94855ddedbf2f31cb0705ec469d (diff) | |
| download | emacs-020e8fdf930a1e4bc00f89d39a42a2a444a533c1.tar.gz emacs-020e8fdf930a1e4bc00f89d39a42a2a444a533c1.zip | |
(imenu-after-jump-hook): New variable.
(imenu): Run menu-after-jump-hook.
(imenu-name-lookup-function): New variable.
(imenu--in-alist): Use those variables.
| -rw-r--r-- | lisp/imenu.el | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index f9028d34ef0..2f1ad7c9c0c 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el | |||
| @@ -116,6 +116,14 @@ Another non-nil value means always display the index in a completion buffer." | |||
| 116 | (other :tag "Always" t)) | 116 | (other :tag "Always" t)) |
| 117 | :group 'imenu) | 117 | :group 'imenu) |
| 118 | 118 | ||
| 119 | (defcustom imenu-after-jump-hook nil | ||
| 120 | "*Hooks called after jumping to a place in the buffer. | ||
| 121 | |||
| 122 | Useful things to use here include `reposition-window', `recenter', and | ||
| 123 | \(lambda () (recenter 0)) to show at top of screen." | ||
| 124 | :type 'hook | ||
| 125 | :group 'imenu) | ||
| 126 | |||
| 119 | ;;;###autoload | 127 | ;;;###autoload |
| 120 | (defcustom imenu-sort-function nil | 128 | (defcustom imenu-sort-function nil |
| 121 | "*The function to use for sorting the index mouse-menu. | 129 | "*The function to use for sorting the index mouse-menu. |
| @@ -257,6 +265,22 @@ This variable is local in all buffers.") | |||
| 257 | (make-variable-buffer-local 'imenu-extract-index-name-function) | 265 | (make-variable-buffer-local 'imenu-extract-index-name-function) |
| 258 | 266 | ||
| 259 | ;;;###autoload | 267 | ;;;###autoload |
| 268 | (defvar imenu-name-lookup-function nil | ||
| 269 | "Function to compare string with index item. | ||
| 270 | |||
| 271 | This function will be called with two strings, and should return | ||
| 272 | non-nil if they match. | ||
| 273 | |||
| 274 | If nil, comparison is done with `string='. | ||
| 275 | Set this to some other function for more advanced comparisons, | ||
| 276 | such as \"begins with\" or \"name matches and number of | ||
| 277 | arguments match\". | ||
| 278 | |||
| 279 | This variable is local in all buffers.") | ||
| 280 | ;;;###autoload | ||
| 281 | (make-variable-buffer-local 'imenu-name-lookup-function) | ||
| 282 | |||
| 283 | ;;;###autoload | ||
| 260 | (defvar imenu-default-goto-function 'imenu-default-goto-function | 284 | (defvar imenu-default-goto-function 'imenu-default-goto-function |
| 261 | "The default function called when selecting an Imenu item. | 285 | "The default function called when selecting an Imenu item. |
| 262 | The function in this variable is called when selecting a normal index-item.") | 286 | The function in this variable is called when selecting a normal index-item.") |
| @@ -649,7 +673,9 @@ as a way for the user to ask to recalculate the buffer's index alist." | |||
| 649 | (cond ((listp tail) | 673 | (cond ((listp tail) |
| 650 | (if (setq res (imenu--in-alist str tail)) | 674 | (if (setq res (imenu--in-alist str tail)) |
| 651 | (setq alist nil))) | 675 | (setq alist nil))) |
| 652 | ((string= str head) | 676 | ((if imenu-name-lookup-function |
| 677 | (funcall imenu-name-lookup-function str head) | ||
| 678 | (string= str head)) | ||
| 653 | (setq alist nil res elt)))) | 679 | (setq alist nil res elt)))) |
| 654 | res)) | 680 | res)) |
| 655 | 681 | ||
| @@ -1072,7 +1098,8 @@ for more information." | |||
| 1072 | (position (if is-special-item | 1098 | (position (if is-special-item |
| 1073 | (cadr index-item) (cdr index-item))) | 1099 | (cadr index-item) (cdr index-item))) |
| 1074 | (rest (if is-special-item (cddr index-item)))) | 1100 | (rest (if is-special-item (cddr index-item)))) |
| 1075 | (apply function (car index-item) position rest))))) | 1101 | (apply function (car index-item) position rest)))) |
| 1102 | (run-hooks 'imenu-after-jump-hook)) | ||
| 1076 | 1103 | ||
| 1077 | (provide 'imenu) | 1104 | (provide 'imenu) |
| 1078 | 1105 | ||