# HG changeset patch # User Karl Heuer # Date 879220440 0 # Node ID c42156dab61bc1fcef43af41b12d4047457ac3e9 # Parent b87f3ba0e1d79b3c3a949a9156eccfbfdf1bc19c (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. diff -r b87f3ba0e1d7 -r c42156dab61b lisp/imenu.el --- a/lisp/imenu.el Tue Nov 11 03:26:55 1997 +0000 +++ b/lisp/imenu.el Tue Nov 11 03:54:00 1997 +0000 @@ -619,8 +619,8 @@ 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 @@ 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)