From: Richard M. Stallman Date: Wed, 29 Jun 1994 16:28:50 +0000 (+0000) Subject: (easy-menu-change): New function. X-Git-Tag: emacs-19.34~7768 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=88153c473ed8a29eed6c21c7bbcafbcafe620f97;p=emacs.git (easy-menu-change): New function. --- diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el index e853ade3ffb..e2eda651c8f 100644 --- a/lisp/emacs-lisp/easymenu.el +++ b/lisp/emacs-lisp/easymenu.el @@ -104,6 +104,20 @@ is a list of menu items, as above." (setq menu-items (cdr menu-items))) menu)) +(defun easy-menu-change (path name items) + "Change menu found at PATH as item NAME to contain ITEMS. +PATH is a list of strings for locating the menu containing NAME in the +menu bar. ITEMS is a list of menu items, as in `easy-menu-define'. +These items entirely replace the previous items in that map. + +Call this from `activate-menubar-hook' to implement dynamic menus." + (let ((map (key-binding (apply 'vector + 'menu-bar + (mapcar 'intern (append path (list name))))))) + (if (keymapp map) + (setcdr map (cdr (easy-menu-create-keymaps name items))) + (error "Malformed menu in `easy-menu-change'")))) + (defmacro easy-menu-remove (menu)) (defmacro easy-menu-add (menu &optional map))