## 3 How to invoke PSGML

PSGML defines major modes called `sgml-mode` and `xml-mode`. Files with extensions `.sgml`, `.sgm` or `.dtd` will automatically be edited in SGML mode. To edit some other file in SGML mode, type `M-x sgml-mode RET` after finding the file. To edit XML files, type `M-x xml-mode RET`.

If you can modify the file you can add a Local Variables list (see Local Variables in Files in The Emacs Editor) to the end of the file. This can make Emacs automatically set sgml mode and user options when the file is loaded. The simplest Local Variables list would look like:

    <!--
    Local Variables:
    mode: sgml
    End:
    -->

You can also put a line at the top of the file to tell emacs to use sgml mode:

    <!-- -*- sgml -*- -->

For XML replace ‘`sgml`’ with ‘`xml`’ in the above examples. But remember that you can’t have a comment before the SGML declaration or the XML declaration.