%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, you must execute the command xrdb -merge ~/.Xresources and restart Emacs for the changes to take place.
Basic Emacs Commands The Meta key is usually the Alt key. Emacs Commands Shortcut Description Metax sgml-parse-prolog, Enter Parse DTD Metax sgml-save-dtd, Enter Save the Parse DTD Metax sgml-load-dtd, Enter Load 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 loaded the DTD file (.ced). Instead of typing a tag each time you need to use it, use the key combination Ctrl-c, followed by <. At the bottom of the Emacs window, you will see: Tag: < To view a list of available tags, use either the Tab or ?. Or, if you know the first few letters of a tag, you can enter them followed by Tab for a complete list of available tags beginning with those letters or for a tag completion. Try the following: Type Ctrl-c followed by <. Then enter the letter k, followed by Tab. You may have to use the Tab key several times to get a complete list. The output should look similar to the example below: Click mouse-2 on a completion to select it. In this buffer, type RET to select the completion near point. Possible completions are: <keycap> <keycode> <keycombo> <keysym>
Tag Closure Once you have started the tag of choice, you must close it. The easiest way to close an open tag is to use the keycombo Ctrl-c, followed by /. This will close the closest open tag you have.
Other Emacs Tasks Working with one window: Sometimes in Emacs the window becomes split (with tags completions or other text in the bottom window). The easiest way to get it back so that only your XML and text appear on one screen is to use the keycombo Ctrl-x, followed by 1. Saving your work: To save your work, use the following keycombo, Ctrl-x followed by Ctrl-s. The "clear/quit" command: I have found on some occasions that I have gotten too far into the tag completion process and need to just exit back out to my text. The easiest way to do this is the keycombo Ctrl-g. This command quits what you have been doing within the file, without quitting the file itself. Opening a new file: To open a new file, use the keycombo Ctrl-x followed by Ctrl-f. At the bottom of the emacs window, you will be able to enter in the file name (using Tab completion if needed) of the file you wish to open. Closing emacs: The easiest way to close emacs is to use the keycombo Ctrl-x followed by Ctrl-c. If you have not saved your work, it will prompt you to save the file, otherwise it will just quit the current emacs session you have been working with.
Additional Resources Additional Emacs and PSGML references are available at the following locations: http://wks.uts.ohio-state.edu/unix_course/intro-135.htmlEmacs 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. http://www.snee.com/bob/sgmlfree/psgmqref.htmlEmacs/PSGML Quick Reference is a reference table of Emacs commands for PSGML mode. http://www.snee.com/bob/sgmlfree/emcspsgm.htmlPSGML Tricks