%FEDORA-ENTITIES-EN; ]> Emacs and PSGML Mode PSGML Emacs Emacs PSGML mode You can use the PSGML mode available for Emacs to make it easier to write in XML format. PSGML mode provides syntax-highlighting, tag completion, and more.
Installing PSGML To install PSGML, use the yum command: yum install psgml
Setting Up Your <filename>.emacs</filename> File Emacs configuration file .emacs For Emacs to parse your DocBook documents correctly, you must have a .emacs file. Cut and paste the following into your existing .emacs file or create a new one that contains the following lines: If you have a wheel mouse and are using Emacs version 21, you can add the following to your .emacs file so your wheel will work in Emacs: If you are using the older version 20 of Emacs, add the following instead:
Customizing Emacs Emacs customizing .Xresources Emacs colors Emacs font Emacs geometry The colors, font, and geometry (default size of window) for Emacs in your ~/.Xresources file. The format for the settings is emacs.keyword:value. The following is a sample ~/.Xresources file. Note If you have other settings in your ~/.Xresources, add the following to the end of the file. After modifying this file, execute the following command: xrdb -merge ~/.Xresources Then restart Emacs to apply the changes.
Basic Emacs Commands The Meta key is usually the Alt key. Emacs Commands Shortcut Description Ctrl c , Ctrl p Parse DTD Ctrl c , Shift ,, Tab Display list of valid tags Ctrl c , Shift , , type beginning of tag, Tab Complete the tag Ctrl g Cancel a command in the minibuffer Ctrl c , / Close tag Ctrl a Move cursor to beginning of line Ctrle Move cursor to the end of the line CtrlHome Move cursor to the beginning of the file CtrlEnd Move cursor to the end of the file Ctrlk Cut line Ctrl y Paste line Ctrl s Search forward in the file Ctrlr Search backwards in the file Meta$ Check spelling of current word Metax ispell-word, Enter Check spelling of current word Metax ispell-buffer, Enter Check spelling of current buffer Ctrlx , Ctrlf Open file Ctrlx , Ctrls Save file Ctrlx , Ctrlc Exit Emacs and prompt to save files if necessary Meta q Fill paragraph Ctrlc , Ctrla Edit attributes for a tag (for example, you can edit the url attribute of the ulink tag) Ctrl c , Ctrlc Exit edit attributes
Examples The table or reference card of Emacs and PSGML commands can be confusing for beginners. This section provides some examples of how to use them.
Tag Completion Note This section assumes that you have already parsed the DTD file. To avoid having to type a tag repeatedly, use the key combination Ctrl-c, followed by <. At the bottom of the Emacs window, the following prompt appears: Tag: < To view a list of available tags, use either the Tab or ?. If you know the first few letters of a tag, enter them, followed by Tab. If the letters uniquely identify a tag, that tag appears. If more than one completion exists, a complete list of possible tags appears. If you hit Ctrl c , <, k, a prompt appears similar to the example below: ]]>
Tag Closure After you open a tag, you must close it. The easiest way to close an open tag is to use the key sequence Ctrl c , /. This sequence closes the most recently opened tag.
Other Emacs Tasks
Working with One Window Sometimes in Emacs, the window becomes split, with tags completions or other text in an alternate window. To return to a single window, use the key sequence Ctrl x , 1.
Saving Work To save your work, use the key sequence Ctrl x , Ctrl s .
The "Clear/Quit" Command If the tag completion process becomes unwieldy or confusing, use the keysequence Ctrl g to exit back to the text. Emacs clears any prompts and returns to the buffer text.
Opening a new file To open a new file, use the key sequence Ctrl x , Ctrl f . A prompt appears at the bottom of the Emacs window. Enter the file name, using Tab completion if desired, of the file you wish to open.
Closing <application>Emacs</application> To close Emacs use the key sequence Ctrl x , Ctrl c . If you have not saved your work, Emacs prompts you to save any changed files.
Additional Resources Additional Emacs and PSGML references are available at the following locations: Emacs Quick Reference Guide Emacs reference card that comes with the emacs package. You can print it out as a reference. — /usr/share/emacs/version/etc/refcard.ps Read Editing XML with Emacs and PSGML in /usr/share/doc/psgml-version/psgml.ps. Emacs/PSGML Quick Reference is a reference table of Emacs commands for PSGML mode. PSGML Tricks