]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lmenu.el
(byte-compile-warning-types): Add interactive-only.
[gnu-emacs] / lisp / emacs-lisp / lmenu.el
index eceda361b8920f8cf26870f84f50fc927e5bad6d..ab29ed972fcb71dc467831323dba8365c06dfeca 100644 (file)
@@ -21,6 +21,8 @@
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
 ;;; Code:
 
 \f
@@ -141,7 +143,7 @@ If the `callback' of a button is a symbol, then it must name a command.
 It will be invoked with `call-interactively'.  If it is a list, then it is
 evaluated with `eval'.
 
-One (and only one) of the buttons may be `nil'.  This marker means that all
+One (and only one) of the buttons may be nil.  This marker means that all
 following buttons should be flushright instead of flushleft.
 
 The syntax, more precisely:
@@ -395,6 +397,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))
+
 \f
 
 (defvar put-buffer-names-in-file-menu t)
@@ -413,4 +436,5 @@ NEW-NAME is the string that the menu item will be printed as from now on."
 \f
 (provide 'lmenu)
 
+;;; arch-tag: 7051c396-2837-435a-ae11-b2d2e2af8fc1
 ;;; lmenu.el ends here