(xemacs.info)Menu Customization


Prev: Help Menu Up: Pull-down Menus
Enter node , (file) or (file)node

2.4.8 Customizing XEmacs Menus
------------------------------

You can customize any of the pull-down menus by adding or removing menu
items and disabling or enabling existing menu items.

   The following functions are available:
`add-menu: (MENU-PATH MENU-NAME MENU-ITEMS &optional BEFORE)'
     Add a menu to the menu bar or one of its submenus.

`add-menu-item: (MENU-PATH ITEM-NAME FUNCTION'
     ENABLED-P &optional BEFORE) Add a menu item to a menu, creating
     the menu first if necessary.

`delete-menu-item: (PATH)'
     Remove the menu item defined by PATH from the menu hierarchy.

`disable-menu-item: (PATH)'
     Disable the specified menu item.

`enable-menu-item: (PATH)'
     Enable the specified previously disabled menu item.

`relabel-menu-item: (PATH NEW-NAME)'
     Change the string of the menu item specified by PATH to NEW-NAME.


   Use the function `add-menu' to add a new menu or submenu.  If a menu
or submenu of the given name 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', the menu is added to the menu bar 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, which is the name of the menu item

   * A symbol naming a command, or a form to evaluate

   * `t' or `nil' to indicate whether the item is selectable

   The optional argument BEFORE is the name of the menu before which
the new menu or submenu should be added.  If the menu is already
present, it is not moved.

   The function `add-menu-item' adds a menu item to the specified menu,
creating the menu first if necessary.  If the named item already
exists, the menu remains unchanged.

   MENU-PATH identifies the menu into which the new menu item 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.

   ITEM-NAME is the string naming the menu item to add.

   FUNCTION is the command to invoke when this menu item is selected.
If it is a symbol, it is invoked with `call-interactively', in the same
way that functions bound to keys are invoked.  If it is a list, the
list is simply evaluated.

   ENABLED-P controls whether the item is selectable or not.  It should
be `t', `nil', or a form to evaluate to decide.  This form will be
evaluated just before the menu is displayed, and the menu item will be
selectable if that form returns non-`nil'.

   For example, to make the `rename-file' command available from the
File menu, use the following code:

     (add-menu-item '("File") "Rename File" 'rename-file t)

   To add a submenu of file management commands using a File Management
item, use the following code:

     (add-menu-item '("File" "File Management") "Copy File" 'copy-file t)
     (add-menu-item '("File" "File Management") "Delete File" 'delete-file t)
     (add-menu-item '("File" "File Management") "Rename File" 'rename-file t)

   The optional BEFORE argument is the name of a menu item before which
the new item should be added.  If the item is already present, it is
not moved.

   To remove a specified menu item from the menu hierarchy, use
`delete-menu-item'.

   PATH is a list of strings that identify the position of the menu
item in the menu hierarchy.  `("File" "Save")' means the menu item
called Save under the top level File menu.  `("Menu" "Foo" "Item")'
means the menu item called Item under the Foo submenu of Menu.

   To disable a menu item, use `disable-menu-item'.  The disabled menu
item is grayed and can no longer be selected.  To make the item
selectable again, use `enable-menu-item'.  `disable-menu-item' and
`enable-menu-item' both have the argument PATH.

   To change the string of the specified menu item, use
`relabel-menu-item'. This function also takes the argument PATH.

   NEW-NAME is the string to which the menu item will be changed.


automatically generated by info2www version 1.2.2.9