aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-12-29 22:54:37 +0000
committerRichard M. Stallman1998-12-29 22:54:37 +0000
commita2c896c3c4b92b5d796d3be56fb3f76fd8ac77c1 (patch)
treeb1976b482d5004aaec46915b52632088438fd89b
parentbf7f4e9066f5bd53ca8d7ac448b53aae3bd092bc (diff)
downloademacs-a2c896c3c4b92b5d796d3be56fb3f76fd8ac77c1.tar.gz
emacs-a2c896c3c4b92b5d796d3be56fb3f76fd8ac77c1.zip
(easy-menu-get-map): Change global map only if this menu exists in the
global map already, and not in the local map. (easy-menu-do-add-item): Fix error message.
-rw-r--r--lisp/emacs-lisp/easymenu.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index e88db0952cc..f29279c7876 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -269,7 +269,7 @@ shadow\\(Double\\)?Etched\\(In\\|Out\\)\\(Dash\\)?\\)\\)$"
269 (if (and (or no-name cache-specified) 269 (if (and (or no-name cache-specified)
270 (or (null cache) (stringp cache) (vectorp cache))) 270 (or (null cache) (stringp cache) (vectorp cache)))
271 (setq prop (cons :key-sequence (cons cache prop)))))) 271 (setq prop (cons :key-sequence (cons cache prop))))))
272 (t (error "Invalid menu item in easymenu."))) 272 (t (error "Invalid menu item in easymenu")))
273 (easy-menu-define-key menu (if (stringp name) (intern name) name) 273 (easy-menu-define-key menu (if (stringp name) (intern name) name)
274 (and (not remove) 274 (and (not remove)
275 (cons 'menu-item 275 (cons 'menu-item
@@ -403,13 +403,21 @@ NAME should be a string, the name of the element to be removed."
403 ;; Return a sparse keymap in which to add or remove an item. 403 ;; Return a sparse keymap in which to add or remove an item.
404 ;; MAP and PATH are as defined in `easy-menu-add-item'. 404 ;; MAP and PATH are as defined in `easy-menu-add-item'.
405 (if (null map) 405 (if (null map)
406 (setq map (lookup-key global-map 406 (setq map (or (lookup-key (current-local-map)
407 (vconcat '(menu-bar) (mapcar 'intern path)))) 407 (vconcat '(menu-bar) (mapcar 'intern path)))
408 (lookup-key global-map
409 (vconcat '(menu-bar) (mapcar 'intern path)))
410 (let ((new (make-sparse-keymap)))
411 (define-key (current-local-map)
412 (vconcat '(menu-bar) (mapcar 'intern path)) new)
413 new)))
408 (if (and (symbolp map) (not (keymapp map))) 414 (if (and (symbolp map) (not (keymapp map)))
409 (setq map (symbol-value map))) 415 (setq map (symbol-value map)))
410 (if path (setq map (lookup-key map (vconcat (mapcar 'intern path)))))) 416 (if path (setq map (lookup-key map (vconcat (mapcar 'intern path))))))
411 (while (and (symbolp map) (keymapp map)) 417 (while (and (symbolp map) (keymapp map))
412 (setq map (symbol-function map))) 418 (setq map (symbol-function map)))
419 (unless map
420 (error "Menu specified in easy-menu is not defined"))
413 (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map)) 421 (or (keymapp map) (error "Malformed menu in easy-menu: (%s)" map))
414 map) 422 map)
415 423