diff options
| author | Karl Heuer | 1997-11-11 03:54:00 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-11-11 03:54:00 +0000 |
| commit | e536ef56263c5d097efe25d18221c6c1f835507d (patch) | |
| tree | ac479d65da2426e1d5cbe966f59031d440c2ae22 /lisp | |
| parent | 7ef5c4312d5fa0fbbfbc6d6f6f50414b5e00b5af (diff) | |
| download | emacs-e536ef56263c5d097efe25d18221c6c1f835507d.tar.gz emacs-e536ef56263c5d097efe25d18221c6c1f835507d.zip | |
(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.
Diffstat (limited to 'lisp')
| -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 | |||
| 619 | Their results are gathered into an index alist." | 619 | Their results are gathered into an index alist." |
| 620 | ;; These should really be done by setting imenu-create-index-function | 620 | ;; These should really be done by setting imenu-create-index-function |
| 621 | ;; in these major modes. But save that change for later. | 621 | ;; in these major modes. But save that change for later. |
| 622 | (cond ((and (fboundp imenu-prev-index-position-function) | 622 | (cond ((and imenu-prev-index-position-function |
| 623 | (fboundp imenu-extract-index-name-function)) | 623 | imenu-extract-index-name-function) |
| 624 | (let ((index-alist '()) | 624 | (let ((index-alist '()) |
| 625 | prev-pos name) | 625 | prev-pos name) |
| 626 | (goto-char (point-max)) | 626 | (goto-char (point-max)) |
| @@ -902,20 +902,20 @@ The returned value is of the form (INDEX-NAME . INDEX-POSITION)." | |||
| 902 | NAME is a string used to name the menu bar item. | 902 | NAME is a string used to name the menu bar item. |
| 903 | See the command `imenu' for more information." | 903 | See the command `imenu' for more information." |
| 904 | (interactive "sImenu menu item name: ") | 904 | (interactive "sImenu menu item name: ") |
| 905 | (if (or (not (eq imenu-create-index-function | 905 | (if (or (and imenu-prev-index-position-function |
| 906 | 'imenu-default-create-index-function)) | 906 | imenu-extract-index-name-function) |
| 907 | (and (fboundp imenu-prev-index-position-function) | 907 | imenu-generic-expression |
| 908 | (fboundp imenu-extract-index-name-function)) | 908 | (not (eq imenu-create-index-function |
| 909 | (and imenu-generic-expression)) | 909 | 'imenu-default-create-index-function))) |
| 910 | (let ((newmap (make-sparse-keymap)) | 910 | (let ((newmap (make-sparse-keymap)) |
| 911 | (menu-bar (lookup-key (current-local-map) [menu-bar]))) | 911 | (menu-bar (lookup-key (current-local-map) [menu-bar]))) |
| 912 | (define-key newmap [menu-bar] | 912 | (define-key newmap [menu-bar] |
| 913 | (append (make-sparse-keymap) menu-bar)) | 913 | (append (make-sparse-keymap) menu-bar)) |
| 914 | (define-key newmap [menu-bar index] | 914 | (define-key newmap [menu-bar index] |
| 915 | (cons name (nconc (make-sparse-keymap "Imenu") | 915 | (cons name (nconc (make-sparse-keymap "Imenu") |
| 916 | (make-sparse-keymap)))) | 916 | (make-sparse-keymap)))) |
| 917 | (use-local-map (append newmap (current-local-map))) | 917 | (use-local-map (append newmap (current-local-map))) |
| 918 | (add-hook 'menu-bar-update-hook 'imenu-update-menubar)) | 918 | (add-hook 'menu-bar-update-hook 'imenu-update-menubar)) |
| 919 | (error "The mode `%s' does not support Imenu" mode-name))) | 919 | (error "The mode `%s' does not support Imenu" mode-name))) |
| 920 | 920 | ||
| 921 | (defvar imenu-buffer-menubar nil) | 921 | (defvar imenu-buffer-menubar nil) |