Go to the previous, next section.

General

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.

If you can modify the file you can add a Local Variables list (see section '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 -*- -->

But remember that you can't have a comment before the SGML declaration.

You can use PSGML without specifying a DTD, it will the accept any tags and assume a content model of ANY and no tags can be omitted.

When PSGML needs contextual information it parses the document up to the point. During the parsing, it builds a parse tree. The parse tree is used to initialise the next parse, to avoid having to parse things already parsed. If the parse tree gets out of sync with the buffer strange warnings, about implied tags or out of context things, will probably result. Changes to the buffer is supposed to prune the tree of all outdated information. This is a tricky part, pruning to much makes for longer parse times and pruning to little leaves the parse tree out of sync with the buffer. The current algorithm to do this is quite drastic, even so bugs might remain in this code. If you suddenly gets some strange warnings, reset the parse tree with C-c C-b and try again.

Go to the previous, next section.