Go to the previous, next section.

Inserting Markup

The commands that insert start tags works only if the document has an associated DTD.

A list of valid tags is computed for a postition in the buffer and is used for a menus and completion. The list will contain:

  1. The end tag for the current element unless sgml-balanced-tag-edit is non-nil. Furthermore it will contain end tags for enclosing elements if sgml-omittag-transparent is non-nil, and the necessary omitted end tag declarations has been made in the DTD.

  2. The start tags of all elements that could occur after point. If sgml-omittag-transparent is nil, the above will be limited to the elements that can occur within the current element.

Another type of computed list is a list of valid element names. This list is also used for completion. If sgml-omittag-transparent is nil, the list will only contain the elements that can be in the content of the current element.

The commands are:

C-c <
Will ask for the tag to insert in the minibuffer with completion on the the tags that are valid at point. (sgml-insert-tag)

If the option sgml-balanced-tag-edit is non-nil, inserting a start tag will also insert the corresponding end tag. If in addition sgml-auto-insert-required-elements is non-nil, tags for elements required between the inserted tags will also be inserted.

C-c C-e
Insert start and end tags for an element. The name of the element is read from the minibuffer with completion on valid elements. (sgml-insert-element)

Required elements in the content will be automatically inserted if the option sgml-auto-insert-required-elements is non-nil.

C-c C-r
Makes the region into a new element. Reads element name from minibuffer with completion. (sgml-tag-region)

C-c /
Inserts an end tag for the current element. (sgml-insert-end-tag)

Menu bar:

`Markup'
Selecting from this menu will insert markup. The menu contains two sub-menus with tags and with entities, some other markup and a user defined section.

Sub menus:

`Insert tag'
Will popup a menu of valid tags. The tags list is as described above. Selections from the menu works like the C-c < command. With the following exception:

You can tag a region, with start and end tag, using the `Insert tag' menu. There are two ways to indicate the region to mark:

    `'
    Use the normal mouse commands to mark region.

    For this to work you muse either use transient mark mode (see section 'Transient Mark Mode' 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).

    `'
    Alternatively make a secondary selection, this is done by holding down the meta key and using the mouse buttons. See section 'Secondary selection' in The Emacs Editor. Some window managers intercepts these events, which make it hard use the secondary selection in Emacs.

`Insert entity'
Menu of all general entitys defined in the DTD.

User Options

sgml-balanced-tag-edit
If non-nil, inserting a start tag will also insert the corresponding end tag.

sgml-auto-insert-required-elements
If non-nil, automatically insert required elements in the content of an inserted element.

sgml-omittag-transparent
If non-nil, will show legal tags inside elements with omitable start tags and legal tags beyond omitable end tags.

sgml-tag-region-if-active
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.

Go to the previous, next section.