# HG changeset patch # User Richard M. Stallman # Date 916370504 0 # Node ID 516b3dad7381a24adb44536ae38081a3616dcf4d # Parent 96a0e2b175a75e9ff3bf30389b1e25abdf8debb2 (easy-menu-get-map): Fix bugs in prev change. diff -r 96a0e2b175a7 -r 516b3dad7381 lisp/emacs-lisp/easymenu.el --- a/lisp/emacs-lisp/easymenu.el Thu Jan 14 20:28:50 1999 +0000 +++ b/lisp/emacs-lisp/easymenu.el Fri Jan 15 03:21:44 1999 +0000 @@ -479,14 +479,17 @@ ;; Return a sparse keymap in which to add or remove an item. ;; MAP and PATH are as defined in `easy-menu-add-item'. (if (null map) - (setq map (or (lookup-key (current-local-map) - (vconcat '(menu-bar) (mapcar 'intern path))) - (lookup-key global-map - (vconcat '(menu-bar) (mapcar 'intern path))) - (let ((new (make-sparse-keymap))) - (define-key (current-local-map) - (vconcat '(menu-bar) (mapcar 'intern path)) new) - new))) + (let ((local (lookup-key (current-local-map) + (vconcat '(menu-bar) (mapcar 'intern path)))) + (global (lookup-key global-map + (vconcat '(menu-bar) (mapcar 'intern path))))) + (if (and local (not (integerp local))) + (setq map local) + (if (and global (not (integerp global))) + (setq map global) + (setq map (make-sparse-keymap)) + (define-key (current-local-map) + (vconcat '(menu-bar) (mapcar 'intern path)) map)))) (if (and (symbolp map) (not (keymapp map))) (setq map (symbol-value map))) (if path (setq map (lookup-key map (vconcat (mapcar 'intern path))))))