PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/doc/users-guide/installing-modes.xml

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