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

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