diff options
author | Richard M. Stallman <rms@gnu.org> | 1994-06-29 16:28:50 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1994-06-29 16:28:50 +0000 |
commit | 88153c473ed8a29eed6c21c7bbcafbcafe620f97 (patch) | |
tree | 03cf78583125e0f7b2d3e5bf025f44c6158afb3f /lisp/emacs-lisp/easymenu.el | |
parent | cbb35d7d1cdf59c4d3feedfbaba44cb61563ceff (diff) | |
download | emacs-88153c473ed8a29eed6c21c7bbcafbcafe620f97.tar.gz emacs-88153c473ed8a29eed6c21c7bbcafbcafe620f97.tar.bz2 emacs-88153c473ed8a29eed6c21c7bbcafbcafe620f97.zip |
(easy-menu-change): New function.
Diffstat (limited to 'lisp/emacs-lisp/easymenu.el')
-rw-r--r-- | lisp/emacs-lisp/easymenu.el | 14 |
1 files changed, 14 insertions, 0 deletions
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)) |