aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1996-02-21 21:44:28 +0000
committerKarl Heuer1996-02-21 21:44:28 +0000
commit6d7a48321cadbbc238afca3f16bf8d4c719ac754 (patch)
tree95b3a98f15ca56cc382ca2e06fc50b24e26fb87c
parent8545ff2f55bbf16290a989cc6864d5b510db5f97 (diff)
downloademacs-6d7a48321cadbbc238afca3f16bf8d4c719ac754.tar.gz
emacs-6d7a48321cadbbc238afca3f16bf8d4c719ac754.zip
(imenu-buffer-menubar): Add defvar.
(imenu-update-menubar): Make a buffer-specific copy of the local map.
-rw-r--r--lisp/imenu.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 2e9d9be1cbb..d3f66b3e610 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -790,12 +790,26 @@ NAME is a string used to name the menu bar item.
790See `imenu' for more information." 790See `imenu' for more information."
791 (interactive "sImenu menu item name: ") 791 (interactive "sImenu menu item name: ")
792 (define-key (current-local-map) [menu-bar index] 792 (define-key (current-local-map) [menu-bar index]
793 (cons name (nconc (make-sparse-keymap "Imenu") (make-sparse-keymap)))) 793 (cons name (nconc (make-sparse-keymap "Imenu")
794 (make-sparse-keymap))))
794 (add-hook 'menu-bar-update-hook 'imenu-update-menubar)) 795 (add-hook 'menu-bar-update-hook 'imenu-update-menubar))
795 796
797(defvar imenu-buffer-menubar nil)
798
796(defun imenu-update-menubar () 799(defun imenu-update-menubar ()
797 (and (current-local-map) 800 (and (current-local-map)
798 (keymapp (lookup-key (current-local-map) [menu-bar index])) 801 (keymapp (lookup-key (current-local-map) [menu-bar index]))
802 (progn
803 (or (local-variable-p 'imenu-buffer-menubar)
804 ;; Make a buffer-specific copy of the local map
805 ;; so that we don't affect other buffers with the same major mode.
806 (let ((newmap (make-sparse-keymap)))
807 (define-key (current-local-map) [menu-bar index]
808 (cons name (nconc (make-sparse-keymap "Imenu")
809 (make-sparse-keymap)))))
810 (use-local-map (append newmap (current-local-map))))
811 (make-local-variable 'imenu-buffer-menubar)
812 t)
799 (let ((index-alist (imenu--make-index-alist t))) 813 (let ((index-alist (imenu--make-index-alist t)))
800 ;; Don't bother updating if the index-alist has not changed 814 ;; Don't bother updating if the index-alist has not changed
801 ;; since the last time we did it. 815 ;; since the last time we did it.