PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/doc/users-guide/installing-modes.xml

#
XML | 68 lines | 63 code | 2 blank | 3 comment | 0 complexity | 1ce5dd36eef0c23dafb3b700db1936c8 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. <!-- jEdit buffer-local properties: -->
  2. <!-- :indentSize=1:noTabs=true: -->
  3. <!-- :xml.root=users-guide.xml: -->
  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 as
  24. follows:
  25. </para>
  26. <programlisting><![CDATA[<?xml version="1.0"?>
  27. <!DOCTYPE CATALOG SYSTEM "catalog.dtd">
  28. <MODES>
  29. <MODE NAME="shellscript" FILE="shellscript.xml"
  30. FILE_NAME_GLOB="*.sh"
  31. FIRST_LINE_GLOB="#!/*sh*" />
  32. </MODES>]]></programlisting>
  33. <para>
  34. In the above example, a mode named <quote>shellscript</quote> is
  35. defined, and is used for files whose names end with
  36. <filename>.sh</filename>, or
  37. whose first line starts with <quote>#!/</quote> and contains
  38. <quote>sh</quote>.
  39. </para>
  40. <para>
  41. The <literal>MODE</literal> tag supports the following attributes:
  42. </para>
  43. <itemizedlist>
  44. <listitem><para><literal>NAME</literal> - the name of the edit mode, as it
  45. will appear in the <guimenuitem>Buffer Options</guimenuitem> dialog box, the
  46. status bar, and so on.</para></listitem>
  47. <listitem><para><literal>FILE</literal> - the name of the XML file
  48. containing the mode definition.</para></listitem>
  49. <listitem><para><literal>FILE_NAME_GLOB</literal> - files whose names match
  50. this glob pattern will be opened in this edit mode.</para></listitem>
  51. <listitem><para><literal>FIRST_LINE_GLOB</literal> - files whose first line
  52. matches
  53. this glob pattern will be opened in this edit mode.</para></listitem>
  54. </itemizedlist>
  55. <para>
  56. Glob pattern syntax is described in
  57. <xref linkend="globs" />.
  58. </para>
  59. <tip>
  60. <para>
  61. If an edit mode in the user-specific catalog has the same name as
  62. an edit mode in the system catalog, the version in the user-specific catalog
  63. will override the system default.
  64. </para>
  65. </tip>
  66. </chapter>