Chapter 11. Installing Edit Modes

jEdit looks for edit modes in two locations; the modes subdirectory of the jEdit settings directory, and the modes subdirectory of the jEdit install directory. The location of the settings directory is system-specific; see the section called “The jEdit Settings Directory”.

Each mode directory contains a catalog file. All edit modes contained in that directory must be listed in the catalog, otherwise they will not be available to jEdit.

Catalogs, like modes themselves, are written in XML. They consist of a single MODES tag, with a number of MODE tags inside. Each mode tag associates a mode name with an XML file, and specifies the file name and first line pattern for the mode. A sample mode catalog looks as follows:

<?xml version="1.0"?>
<!DOCTYPE CATALOG SYSTEM "catalog.dtd">

<MODES>
    <MODE NAME="shellscript" FILE="shellscript.xml"
        FILE_NAME_GLOB="*.sh"
        FIRST_LINE_GLOB="#!/*sh*" />
</MODES>

In the above example, a mode named “shellscript” is defined, and is used for files whose names end with .sh, or whose first line starts with “#!/” and contains “sh”.

The MODE tag supports the following attributes:

Glob pattern syntax is described in Appendix D, Glob Patterns.

Tip

If an edit mode in the user-specific catalog has the same name as an edit mode in the system catalog, the version in the user-specific catalog will override the system default.