Writing your own plug-ins

In order to write a plug-in myplugin, you should start by creating a directory

    $TEXMACS_HOME_PATH/plugins/myplugin

where to put all your files (recall that $TEXMACS_HOME_PATH defaults to $HOME/.TeXmacs). In addition, you may create the following subdirectories (when needed):

bin
For binary files.
doc
For documentation (not yet supported).
langs
For language related files, such as dictionaries (not yet supported).
lib
For libraries.
packages
For style packages.
progs
For Scheme programs.
src
For source files.
styles
For style files.

As a general rule, files which are present in these subdirectories will be automatically recognized by TeXmacs at startup. For instance, if you provide a bin subdirectory, then

    $TEXMACS_HOME_PATH/plugins/myplugin/bin

will be automatically added to the PATH environment variable at startup. Notice that the subdirectory structure of a plug-in is very similar to the subdirectory structure of $TEXMACS_PATH.

Example 1. The easiest type of plug-in only consists of data files, such as a collection of style files and packages. In order to create such a plug-in, it suffices to create directories

    $TEXMACS_HOME_PATH/plugins/myplugin
    $TEXMACS_HOME_PATH/plugins/myplugin/styles
    $TEXMACS_HOME_PATH/plugins/myplugin/packages

and to put your style files and packages in the last two directories. After restarting TeXmacs, your style files and packages will automatically appear in the DocumentStyle and DocumentUse package menus.

For more complex plug-ins, such as plug-ins with additional Scheme or C++ code, one usually has to provide a Scheme configuration file

    $TEXMACS_HOME_PATH/plugins/myplugin/progs/init-myplugin.scm

This configuration file should contain an instruction of the following form

(plugin-configure myplugin

configuration-options)

Here the configuration-options describe the principal actions which have to be undertaken at startup, including sanity checks for the plug-in. In the next sections, we will describe some simple examples of plug-ins and their configuration. Many other examples can be found in the directories

    $TEXMACS_PATH/examples/plugins
    $TEXMACS_PATH/plugins

Some of these are described in more detail in the chapter about writing new interfaces.

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