Example of a plug-in with |
Consider the example of the minimal plug-in in the directory
$TEXMACS_PATH/examples/plugins
It consists of the following files:
minimal/Makefile minimal/progs/init-minimal.scm minimal/src/minimal.cpp
In order to try the plug-in, you first have to recursively copy the directory
$TEXMACS_PATH/examples/plugins/minimal
to $TEXMACS_PATH/progs or $TEXMACS_HOME_PATH/progs. Next, running the Makefile using
make
will compile the program minimal.cpp and create a binary
minimal/bin/minimal.bin
When relaunching TeXmacs, the plug-in should now be automatically recognized.
The minimal plug-in demonstrates a minimal interface between TeXmacs and an extern program; the program minimal.cpp is explained in more detail in the chapter about writing interfaces. The initialization file init-minimal.scm essentially contains the following code:
(plugin-configure minimal
(:require (url-exists-in-path?
"minimal.bin"))
(:launch "minimal.bin")
(:session "Minimal"))
The :require option checks whether minimal.bin
indeed exists in the path (so this will fail if you forgot to run the
Makefile). The :launch option
specifies how to launch the extern program. The :session
option indicates that it will be possible to create sessions for the
minimal plug-in using