summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/easymenu.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1999-01-15 03:21:44 +0000
committerRichard M. Stallman <rms@gnu.org>1999-01-15 03:21:44 +0000
commitbec64ef6b86b331a7c074681508da95779006c44 (patch)
treee9b347f524c2ad17b65b6ddaa1cc906f8725d8ee /lisp/emacs-lisp/easymenu.el
parent820cd5291fa53b68dfa6f9f203f8884283c92a36 (diff)
downloademacs-bec64ef6b86b331a7c074681508da95779006c44.tar.gz
(easy-menu-get-map): Fix bugs in prev change.
Diffstat (limited to 'lisp/emacs-lisp/easymenu.el')
-rw-r--r--lisp/emacs-lisp/easymenu.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 04c4a94e5d6..a8a50db923e 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -479,14 +479,17 @@ NAME should be a string, the name of the element to be removed."
;; 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))))))