PageRenderTime 108ms CodeModel.GetById 103ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/doc/users-guide/installing-modes.xml

#
XML | 68 lines | 63 code | 2 blank | 3 comment | 0 complexity | 1ce5dd36eef0c23dafb3b700db1936c8 MD5 | raw file
 1<!-- jEdit buffer-local properties: -->
 2<!-- :indentSize=1:noTabs=true: -->
 3<!-- :xml.root=users-guide.xml: -->
 4
 5<chapter id="installing-modes"><title>Installing Edit Modes</title>
 6 <para>
 7  jEdit looks for edit modes in two locations; the
 8  <filename>modes</filename> subdirectory of
 9  the jEdit settings directory, and the
10  <filename>modes</filename> subdirectory of the jEdit install directory.
11  The location of the settings directory is system-specific;
12  see <xref linkend="settings-directory" />.
13 </para>
14 <para>
15  Each mode directory contains a <filename>catalog</filename> file. All edit
16  modes contained in that directory must be listed in the catalog, otherwise
17  they will not be available to jEdit.
18 </para>
19 <para>
20  Catalogs, like modes themselves, are written in XML. They consist of a
21  single <literal>MODES</literal>
22  tag, with a number of <literal>MODE</literal> tags inside. Each mode tag
23  associates a mode name with an XML file, and specifies the file name
24  and first line pattern for the mode. A sample mode catalog looks as
25  follows:
26 </para>
27 <programlisting><![CDATA[<?xml version="1.0"?>
28<!DOCTYPE CATALOG SYSTEM "catalog.dtd">
29
30<MODES>
31    <MODE NAME="shellscript" FILE="shellscript.xml"
32        FILE_NAME_GLOB="*.sh"
33        FIRST_LINE_GLOB="#!/*sh*" />
34</MODES>]]></programlisting>
35 <para>
36  In the above example, a mode named <quote>shellscript</quote> is
37  defined, and is used for files whose names end with
38  <filename>.sh</filename>, or
39  whose first line starts with <quote>#!/</quote> and contains
40  <quote>sh</quote>.
41 </para>
42 <para>
43  The <literal>MODE</literal> tag supports the following attributes:
44 </para>
45 <itemizedlist>
46  <listitem><para><literal>NAME</literal> - the name of the edit mode, as it
47  will appear in the <guimenuitem>Buffer Options</guimenuitem> dialog box, the
48  status bar, and so on.</para></listitem>
49  <listitem><para><literal>FILE</literal> - the name of the XML file
50  containing the mode definition.</para></listitem>
51  <listitem><para><literal>FILE_NAME_GLOB</literal> - files whose names match
52  this glob pattern will be opened in this edit mode.</para></listitem>
53  <listitem><para><literal>FIRST_LINE_GLOB</literal> - files whose first line
54  matches
55  this glob pattern will be opened in this edit mode.</para></listitem>
56 </itemizedlist>
57 <para>
58  Glob pattern syntax is described in
59  <xref linkend="globs" />.
60 </para>
61 <tip>
62  <para>
63   If an edit mode in the user-specific catalog has the same name as
64   an edit mode in the system catalog, the version in the user-specific catalog
65   will override the system default.
66  </para>
67 </tip>
68</chapter>