![]() |
Further customization of the interface | ![]() |
Having written a working interface between your system and TeXmacs, you may want to improve it further. Below we will discuss a few directions for possible improvement.
First of all, you may want to customize the keyboard behavior inside a myplugin-session and add appropriate menus. The procedure for doing that is described in the chapter about the Scheme extension language and you may add such support to the file init-myplugin.scm (or, better, to separate modules which are loaded from this file). The predicate in-myplugin?, which is automatically defined by plugin-configure, can be used in order to restrict keyboard shortcuts and menus to sessions of your plug-in. We again recommend you to take a look at the plug-ins which are shipped with TeXmacs inside the directory $TEXMACS_PATH/plugins.
Certain output from your system might require special markup. For instance, assume that you want to associate an invisible type to each subexpression in the output. Then you may create a macro exprtype with two arguments in a style package myplugin.ts and send LaTeX expressions like \exprtype{1}{Integer} to TeXmacs during the output. If the package myplugin.ts can be found in the style path (for instance in myplugin/packages/session/myplugin.ts), then it is automatically added to the document when a myplugin-session is inserted.
In case you connected your system to TeXmacs using pipes, you may directly execute TeXmacs commands during the output from your system by incorporating pieces of code of the form
[DATA_BEGIN]command:scheme-program[DATA_END] |
in your output. Inversely, a Scheme program may send input to your system and retrieve the result using (plugin-eval "myplugin" "default" input), which is synchronous, or using the asynchronous routine silent-feed. The command extern-exec which was used for this purpose in older versions of TeXmacs no longer exists. See the internals of the plug-in system for more details.