diff options
author | Karl Heuer <kwzh@gnu.org> | 1997-11-11 03:54:00 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1997-11-11 03:54:00 +0000 |
commit | ada06c55d7b2192a2544eb6baa86a796f6377281 (patch) | |
tree | 44b293a94d4769b5f3b070949cbe3ed01333ff97 | |
parent | c91b0a79097f8f63ec1c1144ee0581486ea54451 (diff) | |
download | emacs-ada06c55d7b2192a2544eb6baa86a796f6377281.tar.gz |
(imenu-default-create-index-function):
Test imenu-prev-index-position-function and
imenu-extract-index-name-function for non-nil, not fboundp.
(imenu-add-to-menubar): Likewise.
-rw-r--r-- | lisp/imenu.el | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el index 89757767e5e..a054c756a23 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -619,8 +619,8 @@ Moves point to end of buffer and then repeatedly calls Their results are gathered into an index alist." ;; These should really be done by setting imenu-create-index-function ;; in these major modes. But save that change for later. - (cond ((and (fboundp imenu-prev-index-position-function) - (fboundp imenu-extract-index-name-function)) + (cond ((and imenu-prev-index-position-function + imenu-extract-index-name-function) (let ((index-alist '()) prev-pos name) (goto-char (point-max)) @@ -902,20 +902,20 @@ The returned value is of the form (INDEX-NAME . INDEX-POSITION)." NAME is a string used to name the menu bar item. See the command `imenu' for more information." (interactive "sImenu menu item name: ") - (if (or (not (eq imenu-create-index-function - 'imenu-default-create-index-function)) - (and (fboundp imenu-prev-index-position-function) - (fboundp imenu-extract-index-name-function)) - (and imenu-generic-expression)) - (let ((newmap (make-sparse-keymap)) - (menu-bar (lookup-key (current-local-map) [menu-bar]))) - (define-key newmap [menu-bar] - (append (make-sparse-keymap) menu-bar)) - (define-key newmap [menu-bar index] - (cons name (nconc (make-sparse-keymap "Imenu") - (make-sparse-keymap)))) - (use-local-map (append newmap (current-local-map))) - (add-hook 'menu-bar-update-hook 'imenu-update-menubar)) + (if (or (and imenu-prev-index-position-function + imenu-extract-index-name-function) + imenu-generic-expression + (not (eq imenu-create-index-function + 'imenu-default-create-index-function))) + (let ((newmap (make-sparse-keymap)) + (menu-bar (lookup-key (current-local-map) [menu-bar]))) + (define-key newmap [menu-bar] + (append (make-sparse-keymap) menu-bar)) + (define-key newmap [menu-bar index] + (cons name (nconc (make-sparse-keymap "Imenu") + (make-sparse-keymap)))) + (use-local-map (append newmap (current-local-map))) + (add-hook 'menu-bar-update-hook 'imenu-update-menubar)) (error "The mode `%s' does not support Imenu" mode-name))) (defvar imenu-buffer-menubar nil) |