Next: Display, Previous: Managing the DTD, Up: Top [Contents][Index]
• Insert | Inserting Markup | |
• Complete | Markup completion | |
• Information | Showing information | |
• Indent | Indentation according to structure | |
• Move | Move in the element structure | |
• Attributes | Editing attributes | |
• Change and delete | Changing and deleting markup | |
• Translating characters and entities |
The commands that insert start-tags works only if the document has an associated DTD.
Keyboard commands for inserting:
Will ask, for the tag to insert, in the mini-buffer with completion on the
tags that are valid at point (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.
Insert start and end-tags for an 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.
Inserts a new element in the current element where it is legal. Prompts for element name with completion. The completion list contains all elements that could be added to the current element somewhere, without making the content invalid. This assumes that the content is valid to begin with. Currently this list only has regular elements, not inclusions. The new element will be inserted as late as possible in the current element (unless prefix argument is given, then as early as possible.)
Makes the region into a new element (sgml-tag-region
). Reads
element name from mini-buffer with completion as for C-c C-e.
Inserts an end-tag for the current element (sgml-insert-end-tag
).
Split the current element at point. If repeated, the containing element will be split before the beginning of then current element.
Typical use is to start a new paragraph element when inside a paragraph.
Read attribute name and value from mini-buffer and insert attribute
specification (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):
Give keyboard access to the customized part of the Markup menu. Emacs will prompt for the markup to insert using the menu line as selector. (See sgml-custom-markup below.)
Menu bar:
Selecting from this menu will insert markup. The menu contains sub menus with tags and with entities, some other markup and a user defined section.
Sub menus:
Pops up a menu of valid elements and insert start and end-tags for the selected element. Selections from the menu works like the C-c C-e command.
Pops up a menu of valid start-tags and insert the selected tag. The menu has the same start-tags as the completion list for C-c <.
Pops up a menu of valid end-tags and insert the selected tag.
Pops up a menu of valid elements and tag the region with the selection. Selections from the menu works like the C-c C-r command.
Menu of all general entities defined in the DTD.
Pops up a menu of all elements valid somewhere in the current element. The menu contains all elements that could be added to the current element somewhere, without making the content invalid. The new element will be inserted as late as possible in the current element.
Pops up a menu with all the attributes of an element. The element is either the one which start-tag is immediately before point or the element after point. Selecting from this menu edits the attribute specification list for the element.
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-3). 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 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).
If non-nil, inserting a start-tag using the context menu will also insert the corresponding end-tag.
If non-nil, automatically inserts required elements in the content of an inserted element.
If non-nil, will show legal tags inside elements with omissible start-tags and legal tags beyond omissible end-tags.
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.
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>"))
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.
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.
Next: Information, Previous: Insert, Up: Edit [Contents][Index]
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.
Shows in the message area: context at point, if in a tag or in mixed
content and the open elements (sgml-show-context
). The form of
the string is controled by the user option
sgml-show-context-function
.
Shows what element the character after point (under the cursor) belongs
to; also shows context of element (sgml-what-element
).
Show information about the current element type and the valid element following the point.
Show the major element structure in a separate buffer (‘*Document structure*’). That buffer can be used to navigate the document, like an Occur buffer (see Other Search-and-Loop Commands in The Emacs Editor). The structure shows container elements and the text of the first child element (if it is not a container). This works best for document types which uses containers and title structure (e.g. ‘<div> <title>Heder</title> ..</div>’). PSGML uses a heuristic rule to identify container elements: it should have element content and be non empty. You can configure exceptions from this rule using a process instruction in the DTD (see Customizing DTD).
To include an element type el1 that would otherwise be excluded:
<?PSGML element el1 structure=t?>
To exclude an element type el2 that would otherwise be included:
<?PSGML element el2 structure=ignore?>
List contextually valid tags (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.
The value shold be a function that generates a string from an element
and the current markup type (if any). There are two ready made
functions for this. The function sgml-show-context-standard
,
the default, generates a string like ‘#PCDATA in para in chapter
in book’. The function sgml-show-context-backslash
generates a
string like ‘book\chapter\para’.
Next: Move, Previous: Information, Up: Edit [Contents][Index]
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.
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.
If non-nil, indent in data/mixed context also.
Next: Attributes, Previous: Indent, Up: Edit [Contents][Index]
These commands move in the element structure. The commands uses knowledge of SGML syntax, and if available the specific DTD.
Move to the (content) beginning of the current element
(sgml-beginning-of-element
).
Move to the (content) end of the current element (sgml-end-of-element
).
Move forward by element (sgml-forward-element
).
Move backward by element (sgml-backward-element
).
Move up to before current element (sgml-backward-up-element
).
Move up to after current element (sgml-up-element
).
Move down to the (content) beginning of the next element
(sgml-down-element
).
Move to the next place where data is allowed (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).
Next: Change and delete, Previous: Move, Up: Edit [Contents][Index]
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:
Go to the beginning of the value field
(sgml-edit-attrib-field-start
).
Go to the end of the value field
(sgml-edit-attrib-field-end
).
Clear the value field
(sgml-edit-attrib-clear
).
Set the value field to ‘#DEFAULT’
(sgml-edit-attrib-default
). This is a special value that will
make the attribute be implied.
Next: Translating characters and entities, Previous: Attributes, Up: Edit [Contents][Index]
Change the name of the current element (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.
Kill next tag, markup declaration or process instruction
(sgml-kill-markup
).
Kill the element following the cursor (sgml-kill-element
).
Remove tags from current element (sgml-untag-element
).
Convert character after point to a character reference
(sgml-make-character-reference
). If called with a numeric
argument, convert a character reference back to a normal character.
Fills an element as a paragraph (sgml-fill-element
). This is a
substitute for the normal fill-paragraph
. The command uses
heuristics to decide what should be a paragraph.
Short references to text entities are expanded to the replacement text
of the entity other short references are expanded into general entity
references. If argument, to-entity, is non-nil
, or if
called interactive with numeric prefix argument, all short references
are replaced by generally entity references.
Normalize the document in the buffer. This will
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.
If non-nil, sgml-normalize
will trim off white space from end of
element when adding end-tag.
Default: t
.
Previous: Change and delete, Up: Edit [Contents][Index]
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.
Previous: Change and delete, Up: Edit [Contents][Index]