/jEdit/tags/jedit-4-0-pre5/doc/users-guide/installing-modes.xml
XML | 63 lines | 59 code | 2 blank | 2 comment | 0 complexity | 0c0a8e7e93aa495ee0a06949fcb0e856 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- <!-- jEdit buffer-local properties: -->
- <!-- :indentSize=1:noTabs=true: -->
- <chapter id="installing-modes"><title>Installing Edit Modes</title>
- <para>
- jEdit looks for edit modes in two locations; the
- <filename>modes</filename> subdirectory of
- the jEdit settings directory, and the
- <filename>modes</filename> subdirectory of the jEdit install directory.
- The location of the settings directory is system-specific;
- see <xref linkend="settings-directory" />.
- </para>
- <para>
- Each mode directory contains a <filename>catalog</filename> file. All edit
- modes contained in that directory must be listed in the catalog, otherwise
- they will not be available to jEdit.
- </para>
- <para>
- Catalogs, like modes themselves, are written in XML. They consist of a
- single <literal>MODES</literal>
- tag, with a number of <literal>MODE</literal> 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 like
- follows:
- </para>
- <programlisting><![CDATA[<?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>]]></programlisting>
- <para>
- In the above example, a mode named <quote>shellscript</quote> is
- defined, and is used for files whose names end with
- <filename>.sh</filename>, or
- whose first line starts with <quote>#!/</quote> and contains
- <quote>sh</quote>.
- </para>
- <para>
- The <literal>MODE</literal> tag supports the following attributes:
- </para>
- <itemizedlist>
- <listitem><para><literal>NAME</literal> - the name of the edit mode, as it
- will appear in the <guimenuitem>Buffer Options</guimenuitem> dialog box, the
- status bar, and so on</para></listitem>
- <listitem><para><literal>FILE</literal> - the name of the XML file
- containing the mode definition</para></listitem>
- <listitem><para><literal>FILE_NAME_GLOB</literal> - files whose names match
- this glob pattern will be opened in this edit mode. See
- <xref linkend="globs" /> for information about glob patterns</para></listitem>
- <listitem><para><literal>FIRST_LINE_GLOB</literal> - files whose first line
- matches
- this glob pattern will be opened in this edit mode. See
- <xref linkend="globs" /> for information about glob patterns</para></listitem>
- </itemizedlist>
- <para>
- If an edit mode is defined in the user-specific catalog with the same name as
- an edit mode in the global catalog, the version in the user-specific catalog
- will be used instead of the other version.
- </para>
- </chapter>