PSGML is a major mode for editing SGML and XML documents. It works with GNU Emacs 19.34, 20.3 and later or with XEmacs 19.9 and later. PSGML contains a simple SGML parser and can work with any DTD. Functions provided includes menus and commands for inserting tags with only the contextually valid tags, identification of structural errors, editing of attribute values in a separate window with information about types and defaults, and structure based editing.
SGML, a language for encoding the structure of a document, is an ISO standard: ISO 8879:1986 "Information processing - Text and office systems - Standard Generalized Markup Language (SGML)".
A good introduction to SGML is A Gentle Introduction to SGML produced by Text Encoding Initiative (this is really chapter 2 of TEI P3). This can be found on
ftp://ftp.ifi.uio.no/pub/SGML/TEI/P3SG.DOC.
A SGML document has three major parts, in order:
<!SGML "ISO 8879:1986" ... >)
<!DOCTYPE name ... >)
<name> ... </name>)
The SGML declaration contains general information about character sets, concrete syntax, and SGML features used. PSGML does not use the SGML Declaration, it can be left out, and if included is ignored. Many SGML systems allow the SGML declaration to be defaulted. PSGML always use the Concrete Reference Syntax but without limitations on lengths. Features used has to be indicated with variables (see SGML declaration).
The document type declaration specifies the valid elements and entities and how they can be nested. A document type is usually needed, but can reside in another file (see Managing the DTD).
The system declaration for PSGML:
SYSTEM "ISO 8879:1986"
CHARSET
BASESET "ISO 646-1983//CHARSET
International Reference Version (IRV)//ESC 2/5 4/0"
DESCSET 0 128 0
CAPACITY PUBLIC "ISO 8879:1986//CAPACITY Reference//EN"
FEATURES
MINIMIZE DATATAG NO OMITTAG YES RANK NO SHORTTAG YES
LINK SIMPLE NO IMPLICIT NO EXPLICIT NO
OTHER CONCUR NO SUBDOC YES 1 FORMAL YES
SCOPE DOCUMENT
SYNTAX PUBLIC "ISO 8879:1986//SYNTAX Reference//EN"
VALIDATE
GENERAL NO MODEL NO EXCLUDE NO CAPACITY NO
NONSGML NO SGML NO FORMAL NO
SDIF PACK NO UNPACK NO
To install PSGML you first need to uncompress and unpack the source
archive. This is done with the gunzip and tar commands.
gunzip psgml-1.2.0.tar.gz; tar xf psgml-1.2.0.tar
This should create a subdirectory to the current directory with the
source code. This directory contains a configure command (see the
file INSTALL for more information about configure). You can use the
configure command to configure the package or you can load the
file psgml-maint and execute the psgml-compile-files
command.
Place the *.el and the *.elc files in a directory where
Emacs can find it (i.e. one of the directories in the load-path
variable, you can add a directory to this variable in your
.emacs.)
If you use the configure approach, compile psgml with make
and the you can run make install to install it in the system
library site-lisp. The location of site-lisp is figured
out by configure, but you can change it in the Makefile.
Put the following line in your .emacs:
(autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t) (autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
You may also want to set up search paths for external entities, See Entity manager.
The psgml.info is the documentation for PSGML in the info format.
You can read this with the Emacs command C-u C-h i. You can also
install the file in your systems info directory and edit the
dir file to include psgml.info in the menu.
The info file psgml.info is created from the texinfo file
psgml.texi. The texinfo file can also be used to create a hard
copy of the documentation. To do this you need the TeX program and a
copy of texinfo.tex.
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 file variables 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.
SGML can refer to an external file (really entity) with an external identifier, this is a public identifier or a system identifier, or both.
A typical public identifier looks like
PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN"
where "ISO 8879:1986" is the owner, "ENTITIES" is the text class and "Added Latin 1" is the text description (and "EN" is language).
A system identifier looks like
SYSTEM "htmlplus.dtd"
where "htmlplus.dtd" is a system-specific identifier.
To map external identifiers to file names, PSGML first searches entity
catalog files and then search the list of file name templates in the
variable sgml-public-map.
The catalog format is according to SGML/Opens resolution on entity
management. The catalog consists of a series of entries and comments. A
comment is delimited by -- like in a markup declaration.
The entry types recognized are described in the following table.
public pubid file
entity name file
% the
rest of the name will be matched against parameter entities.
doctype name file
sgmldecl file
sgml-validate-command).
When PSGML is looking for the file containing an external entity, the following things will be tried in order:
sgml-system-identifiers-are-preferred
is non-nil and there is no elements containing %s in
sgml-public-map. If the system identifier is a relative file name
it will be relative to the directory containing the defining entity.
sgml-local-catalogs and
sgml-catalog-files in order. For each catalog look first for
entries matching the public identifier, if any. Then look for other
matching entries in the order they appear in the catalog.
Currently an entry will be ignored if it is matching but its file is non-existent or unreadable. (This is under reconsideration, perhaps it should signal error instead).
sgml-system-identifiers-are-preferred is nil
and there is no elements containing %s in sgml-public-map.
sgml-public-map. Using the catalogs are
preferred. The sgml-public-map may disappear in a future version
of PSGML (not soon though).
The sgml-public-map variable can contain a list of file name
templates where %P will be substituted with the whole public
identifier, owner is substituted for %O, public text class for
%C, and public text description for %D. The text class
will be converted to lower case and the owner and description will be
transliterated according to the variable
sgml-public-transliterations. The templates in the list is tried
in order until an existing file is found. The sgml-public-map is
modeled after sgmls environment variable SGML_PATH and
psgml understand the following substitution characters: %%, %N, %P, %S,
%Y, %C, %L, %O, %T, and %V. The default value of
sgml-public-map is taken from the environment variable
SGML_PATH.
Given the public identifier above and the file name template
/usr/local/lib/sgml/%o/%c/%d, the resulting file name is
/usr/local/lib/sgml/ISO_8879:1986/entities/Added_Latin_1
Note: blanks are transliterated to _ (and also / to
%) and the text class is down cased.
| sgml-catalog-files | User Option |
This is a list of catalog entry files.
The files are in the format defined in the SGML Open Draft Technical
Resolution on Entity Management. The Emacs variable is initialized from
the environment variable SGML_CATALOG_FILES or if this variable
is undefined the default is
("CATALOG" "/usr/local/lib/sgml/CATALOG")
|
| sgml-local-catalogs | User Option |
A list of SGML entity catalogs to be searched first when parsing the
buffer. This is used in addition to sgml-catalog-files, and
sgml-public-map. This variable is automatically local to the
buffer.
|
| sgml-system-identifiers-are-preferred | User Option |
If nil, PSGML will look up external entities by searching the
catalogs in sgml-local-catalogs and sgml-catalog-files and
only if the entity is not found in the catalogs will a given system
identifier be used. If the variable is non-nil and a system identifier is
given, the system identifier will be used for the entity. If no system
identifier is given the catalogs will searched.
|
| sgml-public-map | User Option |
This should be a list of file name templates. This variable is
initialized from the environment variable SGML_PATH. This is
the same environment variable that sgmls uses. If the
environment variable is undefined the default is
("%S" "/usr/local/lib/sgml/%o/%c/%d")
|
PSGML can not validate an SGML document (see below what it can
and can't do). If you have a validating SGML parser, like
sgmls, you can run the parser on your file with the
command C-c C-v (sgml-validate).
Some variables control this function:
| sgml-validate-command | User Option |
|
The shell command to validate an SGML document.
This is a If If sgml-validate-command is a list, then every element should be a
string. The strings will be tried in order and
The default value is |
| sgml-validate-files | User Option |
If non-nil, a function of no arguments that returns a list of
file names. These file names will serve as the arguments to the
sgml-validate-command format control string instead of
the defaults.
|
| sgml-declaration | User Option |
| The name of the SGML declaration file. |
| sgml-offer-save | User Option |
If non-nil, C-c C-v (sgml-validate) will ask about
saving modified buffers before running the validate command.
The default value is t.
|
The built-in parser can find some markup errors. The command C-c
C-o (sgml-next-trouble-spot) is the best way to use the built-in
parser for this. To check the whole file go to the beginning of the
buffer and use C-c C-o.
Some of the markup errors not found are:
PSGML does not understand the SGML declaration, it accepts one in the
file but it is ignored. If you have the SGML declaration in another
file you can make sgmls use it when you use the C-c C-v
(sgml-validate) command (see Validate).
PSGML has some options in what features it uses and what markup it creates. You have to set these options to make PSGML's behavior consistent with your SGML declaration and personal preferences.
| sgml-omittag | User Option |
Set this to t if the SGML declaration has OMITTAG YES and
to nil otherwise.
|
| sgml-shorttag | User Option |
Set this to t if the SGML declaration has SHORTTAG YES and
to nil otherwise.
|
| sgml-always-quote-attributes | User Option |
If non-nil, quote all attribute values inserted after finishing edit
attributes. If this variable is nil and sgml-shorttag is
non-nil, attribute values that consists of only name characters
will not be quoted.
|
| sgml-minimize-attributes | User Option |
Determines minimization of attributes inserted by edit-attributes. If
non-nil, omit attribute name if the attribute value is from a token
group. If max, omit attributes with default value. Minimization
will only be done if they produce legal SGML (assuming
sgml-omittag and sgml-shorttag are set correctly).
|
PSGML needs to know about the DTD you are using for many of its commands.
If you do not have a DOCTYPE declaration in your file,
PSGML will try assume that there is one of the form
<!DOCTYPE name SYSTEM>
where name is the value of sgml-default-doctype-name, if
the value is non-nil, else the GI of the first tag will be used.
PSGML will try to parse the document type declaration the first time
you do something that needs to parse the document or immediately if the
variable sgml-auto-activate-dtd is t. You can also
initiate the parsing of the document type declaration with the command
sgml-parse-prolog. Big DTDs take some time to parse.
When the DTD has been parsed or loaded the name of the document element
will be displayed in the mode line inside brackets. If there was an
error parsing the DTD or there is no DTD, the mode line will display
[ANY] (*** this is not really correct! a DTD will be established
even if there are missing entities, it may even be empty).
If parsing the DTD takes too long time you can arrange to have PSGML cache an internal complied version of the DTD. Caching can be done of DTD fragments in favourable situations. It is possible to have an external DTD subset cached but still have an internal DTD subset as long as the internal subset does not define parameter entities that affect the parsing of the external subset (*** what is the exact conditions?, probably you can't use the cached external subset if the internal subset defines parameter entities that are also defined in the external subset with another value).
To enable caching you have to create special catalog files, hereafter
called ECAT files due to (temporary) lack of imagination. These catalogs
have similar syntax to the entity catalogs and there are two variables
containing lists of catalogs to search: sgml-ecat-files and
sgml-local-ecat-files. The ECAT files can contain the following
types of entries:
file dtdfile entitydef cfile
[ name1 literal1 name2 literal2 ... ]Using entitydef will modify the DTD subset by defining the parameter entity with name name1 to be literal1, .... The cached version of the subset will be created with those entity definitions, and when PSGML search for a matching cached subset will check that the parameter entities in entitydef has been defined with those values before trying to use
cfile.
public pubid entitydef cfile
| sgml-recompile-out-of-date-cdtd | User Option |
If non-nil, out of date compiled DTDs will be automatically
recompiled. If the value is ask, PSGML will ask before
recompiling. A nil value will cause PSGML to silently load an out
of date compiled DTD. A DTD that refers to undefined external entities
is always out of date, thus in such case it can be useful to set this
variable to nil.
|
Previous versions of PSGML have had another way of speeding up DTD parsing. This code remains in this version of PSGML, but is not actively maintained and may disappear in the future.
You can save the parsed DTD in a file using the command M-x sgml-save-dtd. Next time PSGML can load that file instead of parsing the DTD. For PSGML to find the saved DTD you must either save the DTD using the default name or do a M-x sgml-save-options after saving the DTD. To directly use an already parsed and saved DTD, load the file containing the saved DTD with the command M-x sgml-load-dtd.
| sgml-default-dtd-file | User Option |
This is the default file name for saved DTD. This is set by
sgml-mode to the buffer file name less extension plus the
extension .ced, if that file exists. Can be changed in the Local
variables section of the file.
|
You can have the DOCTYPE declaration in another file by setting
sgml-doctype to the other file.
| sgml-parent-document | User Option |
|
Used when the current file is part of a bigger document.
The variable describes how the current file's content fit into the element hierarchy. The variable should have the form (parent-file context-element* top-element (has-seen-element*)?)
|
*** Describe the DTD menu in general. Describe customized entries for special DTDs. Mention C-c C-u C-d for inserting a DOCTYPE from keyboard.
If you change the doctype you must execute sgml-parse-prolog,
changes in the doctype are not automatically recognized.
| sgml-custom-dtd | User Option |
|
Menu entries to be added to the DTD menu. The value should be a list of
entries to be added to the DTD menu.
Every entry should be a list. The first element of the entry is a string
used as the menu entry. The second element is a string containing a
doctype declaration (this can be nil if no doctype). The rest of the
list should be a list of variables and values. For backward
compatibility a single string instead of a variable is assigned to
When an entry is selected from the DTD menu, the doctype declaration will be inserted, the variables will be set to the values in the entry and a local variables list will be created in the buffer. Example: (("HTML" nil
sgml-default-dtd-file "~/sgml/html.ced"
sgml-omittag nil sgml-shorttag nil)
("HTML+" "<!doctype htmlplus system 'htmlplus.dtd'>"
"~/sgml/htmlplus.ced"
sgml-omittag t sgml-shorttag nil)
("DOCBOOK" "<!doctype docbook system 'docbook.dtd'>"
"~/sgml/docbook.ced"
sgml-omittag nil sgml-shorttag t)))
|
PSGML can list various information about the current DTD. The following commands can be used via M-x and can also be found in the DTD menu.
sgml-general-dtd-info
sgml-describe-element-type
sgml-describe-entity
sgml-list-elements
sgml-list-attributes
sgml-list-terminals
sgml-list-occur-in-elements
sgml-list-content-elements
The commands that insert start-tags works only if the document has an associated DTD.
Keyboard commands for inserting:
sgml-insert-tag).
If sgml-auto-insert-required-elements is non-nil, tags for elements
required between the inserted tags will also be inserted.
The list of valid tags, computed for a position in the buffer, will contain:
sgml-omittag-transparent is nil, the above will be limited to the
elements that can occur within the current element.
sgml-insert-element). The name of the element is read
from the mini-buffer with completion on valid elements. If
sgml-insert-end-tag-on-new-line is non-nil or the
element has element content, the end-tag will be inserted on a
new line after the start-tag.
If sgml-omittag-transparent is nil, the list of valid elements
will only contain the elements that can be in the content of the current
element.
Required elements in the content will be automatically inserted if the
option sgml-auto-insert-required-elements is non-nil.
When the content model demands an element but there is more
than one to choose from, a comment can be inserted with the
available choices if the option
sgml-insert-missing-element-comment is non-nil.
sgml-tag-region). Reads
element name from mini-buffer with completion as for C-c C-e.
sgml-insert-end-tag).
Typical use is to start a new paragraph element when inside a paragraph.
sgml-insert-attribute). If point is immediately
after a start-tag, this command operates on that start-tag. Otherwise
the command will operate on the element after point.
The attribute name will be read with completion. If the attribute has a token list as declared value the attribute value will also be read with completion. The prompt for attribute value will typically look like:
Value for attribute (type Default: current value):
Menu bar:
Markup
Sub menus:
Insert element
Insert start-tag
Insert end-tag
Tag region
Insert entity
Add Element to Element
Insert attribute
The menu has a sub menu for every attribute which declared value is a token list. The rest of the attributes are collected in one sub menu. For the token list attributes, selecting a value will insert that attribute-value pair. Selecting some other attribute reads the attribute-value from the mini-buffer and inserts the attribute value pair.
A menu is also available directly with a mouse button click in the buffer. In GNU Emacs it is the first mouse button combined with shift (S-<mouse-1>). In Lucid Emacs it is bound to the third mouse button. The mouse button click will pop-up a menu of valid tags or a menu of attributes if the point is in a start-tag. The attributes menu works as the "Insert attribute" menu from the menu-bar. The tags list is the list of valid tags described above for command C-c <. Selection from the tags menu works like the C-c < command, with the following exception:
You can tag a region, with start and end-tag. There are two ways to indicate the region to mark:
For this to work you must either use transient mark mode
(see Transient Mark in The Emacs Editor) or set the option sgml-tag-region-if-active to non-nil
(don't set this unless you are sure that you want it).
| sgml-balanced-tag-edit | User Option |
| If non-nil, inserting a start-tag using the context menu will also insert the corresponding end-tag. |
| sgml-auto-insert-required-elements | User Option |
| If non-nil, automatically inserts required elements in the content of an inserted element. |
| sgml-omittag-transparent | User Option |
| If non-nil, will show legal tags inside elements with omissible start-tags and legal tags beyond omissible end-tags. |
| sgml-tag-region-if-active | User Option |
If non-nil, the Insert tags menu will tag a region if the region
is considered active by emacs. If nil, region must be active and
transient-mark-mode must be on for the region to be tagged.
|
| sgml-custom-markup | User Option |
Menu entries to be added to the Markup menu. The value should be a list
of lists of two strings. The first string is the menu line and the
second string is the text inserted when the menu item is selected. The
second string can contain a \r where the cursor should be left.
Also, if a selection is made according to the same rules as for the
S-mouse-1 menu, the selection is replaced with the second string
and \r is replaced with the selection.
Example: (("Version1" "<![%Version1[\r]]>")
("New page" "<?NewPage>"))
|
| sgml-insert-missing-element-comment | User Option |
If non-nil, and sgml-auto-insert-required-elements also true,
sgml-insert-element will insert a comment if there is an
element required but there is more than one to choose from.
|
| sgml-insert-end-tag-on-new-line | User Option |
If non-nil, sgml-insert-element will put the end-tag on
a new line after the start-tag. Useful on slow terminals if you
find the end-tag after the cursor irritating.
|
If you are typing in markup directly, M-TAB will help you by
completing a tag name, an entity name or a markup declaration name. If
you type M-TAB after a plain word, ispell-complete-word
will be invoked instead.
If you have typed (-!- marks the position of point)
&At-!-
and type M-TAB (assuming you use the ISOLat1
entity set) you get:
Ã-!-
Commands for showing information obtained by parsing the buffer.
sgml-show-context).
sgml-what-element).
sgml-list-valid-tags). Displays
information about current element, all valid end-tags, valid start-tags
in current element, and start-tags valid at this point but in other
elements together with the tags omitted.
You can make the mode-line display the name of the current open element
by setting the sgml-live-element-indicator variable. Setting
this will make all commands slower due to the work needed to keep the
mode-line up to date.
| sgml-live-element-indicator | User Option |
|
If non-nil, indicate current element in mode line.
NOTE: Setting this implies that every command can cause a parse. |
You can indent a line according to the depth of element nesting at the
beginning of the line. To indent the current line use <TAB>.
You can also use <LFD> (newline-and-indent) to start a
new line with correct indentation.
| sgml-indent-step | User Option |
|
How much to increment indent for every element level. If nil, no
indentation.
If this is nil, <TAB> will insert a tab instead of indenting. |
| sgml-indent-data | User Option |
| If non-nil, indent in data/mixed context also. |
These commands move in the element structure. The commands uses knowledge of SGML syntax, and if available the specific DTD.
sgml-beginning-of-element).
sgml-end-of-element).
sgml-forward-element).
sgml-backward-element).
sgml-backward-up-element).
sgml-up-element).
sgml-down-element).
sgml-next-data-field).
You can also move to the next place where there is some structural error with C-c C-o (see Validate).
If you want to change the attributes of a start-tag you can simply edit
them directly in the buffer. Or you can place the cursor at or after
the start-tag and use the sgml-edit-attributes command, available
from the SGML-menu or on C-c C-a. This will create a new
Emacs window with all possible attributes listed in the form
attribute name = current value.
The current value may be shown as #DEFAULT if the attribute
has not been given a value in the start-tag. The list also contains the
attributes declaration as a comment. Note also that the current
value is show without eventual quotes.
It is now possible to edit the attribute values. You can move to the
next attribute with <TAB>. If you want to let an attribute
have its default value use C-c C-d, this will insert a
#DEFAULT in the value field.
If Emacs is running in an X window, the #DEFAULT will be
underlined to distinguish it from normal values.
Finish the editing with C-c C-c; this will replace the attribute values in the main buffer with those edited. Note that values will be quoted as needed.
If you want to abort the editing, you can remove the window with C-x 0 or if you want it neat, kill the buffer and remove the window.
Some other keys are:
sgml-edit-attrib-field-start).
sgml-edit-attrib-field-end).
sgml-edit-attrib-clear).
#DEFAULT
(sgml-edit-attrib-default). This is a special value that will
make the attribute be implied.
sgml-change-element-name).
Tries to translate attribute specifications. An attribute will be
translated to an attribute with the same name. If the new element has
no attribute with the same name, the attribute will be ignored. If
there is an attribute with the same name but different declared content,
a warning is given.
ID attributes are handled specially, an attribute with declared value ID
will always be translated to the attribute with declared value ID.
sgml-kill-markup).
sgml-kill-element).
sgml-untag-element).
sgml-make-character-reference). If called with a numeric
argument, convert a character reference back to a normal character.
sgml-fill-element). This is a
substitute for the normal fill-paragraph. The command uses
heuristics to decide what should be a paragraph.
nil, or if
called interactive with numeric prefix argument, all short references
are replaced by generally entity references.
There is one argument, to-entity, with the same meaning as for
sgml-expand-all-shortrefs.
There is one option for the normalize command. With its default value, normalize may actually change the data content of some elements. But only by removing some white-space from the end of elements with omitted end-tags.
| sgml-normalize-trims | User Option |
If non-nil, sgml-normalize will trim off white space from end of
element when adding end-tag.
Default: |
Set the variable sgml-display-char-list-filename to a file that
contains mappings between all characters present in the presentation
character set, and their "standard replacement text" names, e.g. "å"
-> "[aring ]", e.t.c.
The default value for this variable is `iso88591.map'.
Then use the functions (also in the Modify menu)
sgml-charent-to-display-char
sgml-display-char-to-charent
to translate between entities and characters.
With these commands you can make parts of the text temporarily invisible to make it easier to see the overall structure of your text.
When folding a region all the lines but the first will be invisible. The first line of the region will still be visible with an ellipsis at the end.
See Outline Mode in The Emacs Editor.
sgml-fold-region).
sgml-fold-element).
This command can also fold the SGML declaration or the DOCTYPE
declaration.
sgml-fold-subelement).
sgml-unfold-line).
sgml-unfold-element).
sgml-unfold-all).
sgml-expand-element). If the current element is folded this
expands what is visible.
*** Describe hide-tags
PSGML can highlight the markup giving the markup a different face
(see Faces in The Emacs Editor).
The highlighting will only be done if the variable sgml-set-face
is non-nil. The default settings make tags bold and comments
italic, but this can be modified with the variable
sgml-markup-faces. When highlighting is on PSGML will parse after
every command until the whole buffer has been parsed or user event
occurs.
To remove the highlighting type M-x sgml-clear-faces.
| sgml-set-face | User Option |
| If non-nil, psgml will set the face of parsed markup. |
| sgml-markup-faces | User Option |
A list of markup to face mappings.
Each element looks like (markup-type . face).
Possible values for markup-type is:
|
*** describe sgml-save-options
| sgml-ignore-undefined-elements | User Option |
Start-tags for undefined elements will either be ignored, if
sgml-ignore-undefined-elements is t, or assumed to be
acceptable in the current element and defined with O O ANY
|
| sgml-range-indicator-max-length | User Option |
|
Maximum number of characters used from the first and last entry
of a sub-menu to indicate the range of that menu.
This is used for long menus of elements, tags or entities that are split
into |
If you encounter something that you think is a bug, please report it. Try to include a clear description of the undesired behaviour. A test case that exhibits the bug, would also be useful.
You can report a bug with the command M-x sgml-submit-bug-report.
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 initialize the next parse, to avoid having to parse
things already parsed. Changes to the buffer is supposed to prune
the tree of all outdated information. But if you get strange
complaints from the parser, try and back up a bit and use C-c
C-o (sgml-next-trouble-spot).
<LFD>: Indent
<TAB>: Indent, Attributes
C-a: Attributes
C-c #: Change and delete
C-c +: Insert
C-c -: Change and delete
C-c /: Insert
C-c <: Insert
C-c =: Change and delete
C-c C-a: Attributes
C-c C-c: Information, Attributes
C-c C-d: Attributes, Move, Attributes
C-c C-e: Insert
C-c C-f C-e: Fold
C-c C-f C-r: Fold
C-c C-f C-s: Fold
C-c C-f C-x: Fold
C-c C-i: Insert
C-c C-k: Attributes, Change and delete
C-c C-n: Move
C-c C-o: Validate
C-c C-q: Change and delete
C-c C-r: Insert
C-c C-s: Fold
C-c C-t: Information
C-c C-u C-a: Fold
C-c C-u C-d: Inserting a DOCTYPE
C-c C-u C-e: Fold
C-c C-u C-l: Fold
C-c C-u C-m: Insert
C-c C-v: Validate
C-c C-w: Information
C-c RET: Insert
C-e: Attributes
C-M-a: Move
C-M-b: Move
C-M-d: Move
C-M-e: Move
C-M-f: Move
C-M-k: Change and delete
C-M-u: Move
M-TAB: Complete
newline-and-indent: Indent
S-<mouse-1>: Insert
sgml-add-element-to-element: Insert
sgml-always-quote-attributes: SGML declaration
sgml-auto-activate-dtd: Managing the DTD
sgml-auto-insert-required-elements: Insert
sgml-backward-element: Move
sgml-backward-up-element: Move
sgml-balanced-tag-edit: Insert
sgml-beginning-of-element: Move
sgml-catalog-files: Entity manager
sgml-change-element-name: Change and delete
sgml-charent-to-display-char: Translating characters and entities
sgml-clear-faces: Highlight
sgml-complete: Complete
sgml-custom-dtd: Inserting a DOCTYPE
sgml-custom-markup: Insert
sgml-declaration: Validate
sgml-default-doctype-name: Managing the DTD
sgml-default-dtd-file: Precompiled DTD Subsets
sgml-describe-element-type: Information from the DTD
sgml-describe-entity: Information from the DTD
sgml-display-char-to-charent: Translating characters and entities
sgml-doctype: Using a Split Document
sgml-down-element: Move
sgml-ecat-files: Precompiled DTD Subsets
sgml-edit-attrib-clear: Attributes
sgml-edit-attrib-default: Attributes
sgml-edit-attrib-field-end: Attributes
sgml-edit-attrib-field-start: Attributes
sgml-edit-attributes: Attributes
sgml-end-of-element: Move
sgml-expand-all-shortrefs: Change and delete
sgml-expand-element: Fold
sgml-fill-element: Change and delete
sgml-fold-element: Fold
sgml-fold-region: Fold
sgml-fold-subelement: Fold
sgml-forward-element: Move
sgml-general-dtd-info: Information from the DTD
sgml-ignore-undefined-elements: Miscellaneous options
sgml-indent-data: Indent
sgml-indent-or-tab: Indent
sgml-indent-step: Indent
sgml-insert-attribute: Insert
sgml-insert-element: Insert
sgml-insert-end-tag: Insert
sgml-insert-end-tag-on-new-line: Insert
sgml-insert-missing-element-comment: Insert
sgml-insert-tag: Insert
sgml-kill-element: Change and delete
sgml-kill-markup: Change and delete
sgml-list-attributes: Information from the DTD
sgml-list-content-elements: Information from the DTD
sgml-list-elements: Information from the DTD
sgml-list-occur-in-elements: Information from the DTD
sgml-list-terminals: Information from the DTD
sgml-list-valid-tags: Information
sgml-live-element-indicator: Information
sgml-load-dtd: Precompiled DTD Subsets
sgml-local-catalogs: Entity manager
sgml-local-ecat-files: Precompiled DTD Subsets
sgml-make-character-reference: Change and delete
sgml-markup-faces: Highlight
sgml-max-menu-size: Miscellaneous options
sgml-minimize-attributes: SGML declaration
sgml-mode: Invoke
sgml-next-data-field: Move
sgml-next-trouble-spot: Validate
sgml-normalize: Change and delete
sgml-normalize-trims: Change and delete
sgml-offer-save: Validate
sgml-omittag: SGML declaration
sgml-omittag-transparent: Insert
sgml-parent-document: Using a Split Document
sgml-parse-prolog: Managing the DTD
sgml-public-map: Entity manager
sgml-range-indicator-max-length: Miscellaneous options
sgml-recompile-out-of-date-cdtd: Precompiled DTD Subsets
sgml-save-dtd: Precompiled DTD Subsets
sgml-set-face: Highlight
sgml-shorttag: SGML declaration
sgml-show-context: Information
sgml-split-element: Insert
sgml-system-identifiers-are-preferred: Entity manager
sgml-tag-region: Insert
sgml-tag-region-if-active: Insert
sgml-unfold-all: Fold
sgml-unfold-element: Fold
sgml-unfold-line: Fold
sgml-untag-element: Change and delete
sgml-up-element: Move
sgml-validate: Validate
sgml-validate-command: Validate
sgml-validate-files: Validate
sgml-what-element: Information