Example of a plug-in with |
Consider the world plug-in in the directory
$TEXMACS_PATH/examples/plugins
This plug-in shows how to extend TeXmacs with some additional
world/progs/init-world.scm
In order to test the world plug-in, you should recursively copy the directory
$TEXMACS_PATH/examples/plugins/world
to $TEXMACS_PATH/plugins or $TEXMACS_HOME_PATH/plugins.
When relaunching TeXmacs, the plug-in should now be automatically
recognized (a
The file init-world.scm essentially contains the following code:
(define (world-initialize)
(menu-extend texmacs-extra-menu
(=> "World"
("Hello world" (insert-string
"Hello world")))))
(plugin-configure world
(:require #t)
(:initialize (world-initialize)))
The configuration option :require specifies a condition which needs to be satisfied for the plug-in to be detected by TeXmacs (later on, this will for instance allow us to check whether certain programs exist on the system). The configuration is aborted if the requirement is not fulfilled.
The option :initialize specifies an instruction which
will be executed during the initialization (modulo the fulfillment of
the requirement). In our example, we just create a new top level menu