Mercurial > emacs
changeset 8085:c7eb887a1e78
(easy-menu-change): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 29 Jun 1994 16:28:50 +0000 |
parents | 6746cdbec82b |
children | 9f6348616e4d |
files | lisp/emacs-lisp/easymenu.el |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/easymenu.el Wed Jun 29 15:26:29 1994 +0000 +++ b/lisp/emacs-lisp/easymenu.el Wed Jun 29 16:28:50 1994 +0000 @@ -104,6 +104,20 @@ (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))