PageRenderTime 1ms CodeModel.GetById 118ms app.highlight 1ms RepoModel.GetById 49ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre3/doc/users-guide/installing-modes.xml

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