summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2001-03-18 21:57:41 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2001-03-18 21:57:41 +0000
commitd914e1a8756ce60c915fcd05028917fd338533d1 (patch)
tree88de4f94a35d08d4d5e85899808cffafb9c430b8 /lisp/emacs-lisp
parent0f6465a643d70ff5a581cecb27dd92970776a243 (diff)
downloademacs-d914e1a8756ce60c915fcd05028917fd338533d1.tar.gz
(add-menu): Re-added (was erroneously removed).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/lmenu.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/lmenu.el b/lisp/emacs-lisp/lmenu.el
index eceda361b89..c28b5551cfa 100644
--- a/lisp/emacs-lisp/lmenu.el
+++ b/lisp/emacs-lisp/lmenu.el
@@ -395,6 +395,27 @@ NEW-NAME is the string that the menu item will be printed as from now on."
(set-menubar-dirty-flag)
item))
+;; XEmacs compatibility
+(defun add-menu (menu-path menu-name menu-items &optional before)
+ "Add a menu to the menubar or one of its submenus.
+If the named menu exists already, it is changed.
+MENU-PATH identifies the menu under which the new menu should be inserted.
+ It is a list of strings; for example, (\"File\") names the top-level \"File\"
+ menu. (\"File\" \"Foo\") names a hypothetical submenu of \"File\".
+ If MENU-PATH is nil, then the menu will be added to the menubar itself.
+MENU-NAME is the string naming the menu to be added.
+MENU-ITEMS is a list of menu item descriptions.
+ Each menu item should be a vector of three elements:
+ - a string, the name of the menu item;
+ - a symbol naming a command, or a form to evaluate;
+ - and a form whose value determines whether this item is selectable.
+BEFORE, if provided, is the name of a menu before which this menu should
+ be added, if this menu is not on its parent already. If the menu is already
+ present, it will not be moved."
+ (or menu-name (error "must specify a menu name"))
+ (or menu-items (error "must specify some menu items"))
+ (add-menu-item-1 nil menu-path menu-name menu-items t before))
+
(defvar put-buffer-names-in-file-menu t)