| Creating an SGML Document on Emacs: Version 0.2 | ||
|---|---|---|
| Prev | ||
The SGML mode menu contains many of the same functions that are in the standard text mode menu. The following tables contain the most useful functions for creating SGML documents:
Table 2. Buffers menu
| Option | Description | Shortcut |
| Lists all buffers currently in use. Click on the buffer you want to bring to the top (and make active). | none |
Table 3. The Files menu
| Option | Description | Shortcut |
| Open File | Find an existing file or open an new one | C-x-f |
| Save Buffer | Save a file | C-x-s |
| Save Buffer As | Save file under a new name | C-x-w |
| Insert File | Insert a file into current buffer at cursor position | C-x i |
| Kill Current Buffer | Delete the current buffer | none |
| Make new Frame | Open a new window | C-x 5 2 |
| Split Window | Divide window vertically | C-x 2 |
| One Window | Delete all windows except the one marked by the cursor | C-x 1 |
| Exit Emacs | Save all buffers and exit | C-x-c |
Table 4. The SGML menu
| Option | Description | Shortcut |
| Show Context | Show nesting of elements at cursor position (element1 in element2 in element3) | C-c-c |
| What Element | Show where cursor is located (in what nested position) | C-c-w |
| Validate | Validate the document with an SGML parser | C-c-v |
| List Valid Tags | Show tags that are valid at the cursor position | C-c-t |
| File Options | Change settings for file handling (omit tag, indent, etc.) | none |
| User Options | Add/remove optional warnings, autosave, etc. | none |
Table 5. The Modify menu
| Option | Description | Shortcut |
| Normalize | Normalize buffer by filling in omitted tags and expanding empty tags (this one is dangerous - it may add the wrong tags!) | none |
| Make Character Reference | Convert a character/symbol to it's ASCII representation preceded by & (will show the literal character/symbol in the document) | C-c # |
| Unmake Character Reference | should convert character reference back to the original character/symbol: however, it doesn't seem to work! | none |
| Change Element Name | Replace the name of the current element with a new name | C-c = |
| Edit Attributes | Change attributes for the tag marked by the cursocurrent element's immediate tag | C-c-a |
| Kill Markup | Place cursor on left bracket of tag; command deletes the tag | C-c-k |
| Kill Element | Place cursor on left bracket of opening tag; command deletes the entire element | Meta-C-k |
| Untag Element | Place cursor anywhere on element; removes tags | C-c - |
| Trim and Leave Element | Moves the tag(s) immediately following the cursor up to the same line as the cursor | C-c-z |
Table 6. The Move menu
| Option | Description | Shortcut |
| Next Trouble spot | Move forward to next point where something is wrong with the structure | C-c-o |
| Next Data Field | Move forward to next point where data is allowed | C-c-d |
| Forward Element | Move cursor to beginning of current element | Meta-C-f |
| Backward Element | Move cursor to end of current element | Meta-C-b |
| Backward Up Element | Move backward out of the current element level | Meta-C-u |
| Beginning of Element | Move to after the start tag of the current element | Meta-C-a |
| End of Element | Move to before the end tag of the current element | Meta-C-e |
Table 7. The Markup menu
| Option | Description | Shortcut |
| Insert Element | Place cursor at location where new element is desired; the command shows a pop-up menu of all possible tags for that position; selection of a tag inserts the starting and closing tags for that element | none |
| Insert Start-Tag | Same as for Insert Element, but places only the starting tag in position | none |
| Insert End-Tag | Pop-up menu shows all possible closing tags for the cursor position | none |
| End Current Element | Inserts a valid closing tag after the current element | C-c / |
| Tag Region | Place cursor at start of element; selection of a tag from the pop-up menu will enclose the element within the selected tags | none |
| Insert Attribute | Place the cursor anywhere on an element; pop-up menus will allow you to add attributes to that particular element | none |
| Insert Entity | A pop-up menu provides a list of entities; selection places the entity at the cursor position | none |
| Add Element to Element | A pop-up menu provides a list of tags; selection places both the starting and the closing tags at the end of an element marked by the cursor |
Table 8. The View menu
| Option | Description | Shortcut |
| Fold Element | Hides the element (shows '...' in its place) | C-c-f-e |
| Fold Subelement | Hides the elements in the content of the element marked by cursor (shows '...' in their places) | C-c-f-s |
| Unfold Line | Restores folded line to original condition | C-c-s |
| Unfold Element | Unfolds a folded element | C-c-u-e |
| Expand | Unfolds a folded region | C-c-f-x |
| Fold Region | Hides all elements and tags in the region highlighted by clicking and dragging the cursor ( only '<region start tag>...' is displayed ) | C-c-f-r |
| Unfold All | Unfolds all folded elements in the document | C-c-u-a |
| Hide Tags | Hides all tags in the document | none |
| Hide Attributes | Hides all attributes | none |
| Show All Tags | Redisplays all hidden tags | none |
Table 9. The DTD menu
| Option | Description | Shortcut |
| Parse DTD | Find tags/structure available for document type | C-c-p |
| Insert DTD | Select DTD from menu and insert into document. The following lines must be placed in the .emacs configuration file: (setq sgml-custom-dtd '( ("DocBook 3.1 Article" "<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook V3.1//EN\">") ) ) | none |
| Info | Provides a detailed description of DTDs, elements, attributes, etc. | |
| Load Parsed DTD | Load a previously parsed DTD (may be faster than re parsing) | none |
| Save Parsed DTD | Save a DTD (to prevent having to parse it again later) | none |
Finally, there are two options from the Help menu that may be of use. The first option is Apropos Commands (C-h a. It's also accessible from the menu: Help->Describe->Apropos Commands),which lets you enter the name of a command. It will also show further details about using the command. The second option is Describe Buffer Modes (C-h m. Also accessible from the menu: Help->Describe->Describe Buffer Modes); it shows details about the current emacs mode.