Creating your own dynamic menus

You may define (or modify) a (part of a) menu with name name using

(menu-bind name . prog)

and append new entries to an existing (part of a) menu with name name using

(menu-extend name . prog)

Here prog is a program which represents the entries of the menu. In particular, you may take a look at the files in the directory

    $TEXMACS_PATH/progs/menu

in order to see how the standard TeXmacs menus are defined.

More precisely, the program prog in menu-set or menu-append is a list of entries of one of the following forms:

(=> "pulldown menu name" menu-definition)

(-> "pullright menu name" menu-definition)

("entry" action)

–-

(if condition menu-definition)

(link variable)

The constructors => and -> are used to create pulldown or pullright menus and menu-definition should contain a program which creates the submenu. The constructor ("entry" action) creates an ordinary entry, where action will be compiled and executed when you click on entry. Items of a menu may be separated using –-. The constructor if is used for inserting menu items only if a certain condition is satisfied (for instance, if we are in math mode).

Finally, if you declared a menu name, then you may use this menu indirectly using the link constructor. This indirect way of declaring submenus has two advantages

The main TeXmacs menus are texmacs-menu, texmacs-popup-menu, texmacs-main-icons, texmacs-context-icons and texmacs-extra-icons. Other standard indirect menus are file-menu, edit-menu, insert-menu, text-menu, paragraph-menu, document-menu, options-menu and help-menu.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".