GNU TeXmacsUser manualReferenceAboutEnglish·Français·Deutsch·Español·Italiano·中文
Creating your own dynamic menus

You may define a menu with name name either using

(menu-bind name . def)

or

(tm-menu (name) . def)

Here def 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. In the case of tm-menu, it is possible to specify additional arguments, which makes it possible to dynamically construct more complex menus which depend on parameters.

More precisely, the program def in menu-bind or tm-menu 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)
(when condition menu-definition)
(link variable)
(former)

The constructors => and -> are used to create pulldown or pullright menus and menu-definition should contain a program which creates the submenu. In the main (or system) menu bar all root items are pulldown menus and all submenus of these are pullright. Both pulldown and pullright may be used in toolbars or other widgets.

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), whereas while always inserts the item but deactivates (e.g. greying it out) it condition is not met.

If you declared a menu name, then you may use this menu indirectly using the link constructor, thus one may link any such “indirect” submenu to as many menus as desired.

Finally, new items may be added to any given menu a posteriori using former, as in the following example:

(tm-menu (tools-menu)
  (former)
  ---
  ("New item" (noop)))

The main TeXmacs menus are:

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".