(lispref.info)Menu Format

Next: Menubar Format Up: Menus

Format of Menus

   A menu is described using a "menu description", which is a list of
menu items, strings, and submenus.  The menu description specifies which
items are present in the menu, what function each item invokes, and
whether the item is selectable or not.  Pop-up menus are directly
described with a menu description, while menubars are described slightly
differently (see below).

   The first element of a menu must be a string, which is the name of
the menu.  This is the string that will be displayed in the parent menu
or menubar, if any.  This string is not displayed in the menu itself,
except in the case of the top level pop-up menu, where there is no
parent.  In this case, the string will be displayed at the top of the
menu if `popup-menu-titles' is non-`nil'.

   The rest of the menu consists of elements as follows:

   * A "menu item", which is a vector of three or four elements as

        - the name of the menu item (a string);

        - the "callback" of that item;

        - whether this item is active (selectable);

        - and an optional string to append to the name.

     If the callback of a menu item 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'.

     The third element of a menu item should either be `t', `nil', or a
     form to evaluate (with no arguments) to decide whether this item
     should be selectable.

     The fourth element of a menu item is a convenient way of adding
     the name of a command's "argument" to the menu, like `Kill Buffer

   * If an element of a menu is a string, then that string will be
     presented in the menu as unselectable text.

   * If an element of a menu is a string consisting solely of hyphens,
     then that item will be presented as a solid horizontal line.

   * If an element of a menu is a list, it is treated as a submenu.
     The name of that submenu (the first element in the list) will be
     used as the name of the item representing this menu on the parent.

   The syntax, more precisely:

        form		:=  <something to pass to `eval'>
        command	:=  <a symbol or string, to pass to `call-interactively'>
        callback 	:=  command | form
        active-p	:=  <t, nil, or a form to evaluate to decide whether this
     		    item should be selectable>
        text		:=  <string, non selectable>
        name		:=  <string>
        argument	:=  <string>
        menu-item	:=  '['  name callback active-p [ argument ]  ']'
        menu		:=  '(' name [ menu-item | menu | text ]+ ')'

automatically generated by info2www