Link to USGS home page
Internal USGS Access Only

Using Xemacs To Edit Html

Xemacs is a very powerful text editor, and has a number of features that make it an html editor worth having (even more so than GNU Emacs).

Xemacs uses a <!DOCTYPE ...> line to determine the html version to use (HTML 4.01 Transitional by default).

Example Use

Open a New Document
Select toolbar:
Open...
browse to the directory where you want to create the file, and type in the name of the file you want to create. Xemacs will ask you for a document title, and insert an HTML template using your title into the file for you!
To colorize tags
Select menu items: Options>Syntax Highlighting>Colors and
Options>Syntax Highlighting>In This Buffer.
You can save these settings with menu option:
Options>Save Options
Tabbing
Typing a tab anywhere on a line will indent that line.
Right mouse options
Highlight the text you want to tag, press and hold the right mouse button to see what html is valid to insert at that location. You can also click into any area, and use the right mouse button to add a pair of matching tags
Format paragraphs
Click anywhere in a paragraph to be re-wrapped, and select menu option
Modify>Fill Element
Html-ize text
Convert special symbols by highlighting text to update, and selecting menu:
HTML>HTM-Quote Region

In order to have the line and column numbers displayed, which are very helpful in fixing html errors reported by weblint or validate, select menu Options>Display, and turn on "Line Numbers" and "Column Numbers". Save these settings by selecting menu Options>Save Options to Init File.

XEmacs tips for Editing html

Try to get into the habit of using the right mouse button to insert tags. Many people get frustrated because the tag they want doesn't appear. There is a reason for this! Only valid html is allowed.

View the files in the current directory
Click on the "Dired" (directory editor) button.
Turn On Line Numbers
You can make additional information available in the lower right hand corner of the screen incurred including the current line and column number.

From menu Options select Display.

Change the color of tags, such as A
  1. From the menu "Options", select "Edit Faces"
  2. On Solaris: In the lower window, find the color that you wish to change and click on the second column with the middle mouse button. Backspace over the name of the color you don't like and enter a new one. On Windows: Click on the triangle of the color you wish to change and set the features you want.
  3. To get back, On Solaris: click in the upper window and type "control-X 1". On NT: click on the button "Done" at the top of the window.
Unix: Preserve File Owner and Group
To keep the original ownership and access of edited files, add the following line to your C:\.xemacs file in Windows, or ~/.emacs file in Unix: (setq backup-by-copying-when-mismatch t)

If you have root access, this setting will allow you to edit documents without changing the owner of; an important consideration when many sites are set up so that the owner of a Web document gets any e-mail related to invalid links.

If the tag you want does not come up with the right mouse button

If no options come up
you may have an html error, such as an open quote. Try using the right mouse button just below the HEAD tag; If you are able to get a list of tags there you can work down the document until you don't, which should help you pinpoint the error.
If only three unfamiliar options appear
These are sub-listings arranged alpahbetically, click into the appropriate one to find your tag.
If you get a listing, but your tag isn't there
The tag might not be legal where you are trying to put it; for example IMG tags must be inside P tags in html 4.

Xemacs is available for Sun, other varieties of Unix, and Windows.


[up]
"Mastering a Web Site" online course
Created and maintained by Lorna Schmid and David Boldt.
http://water.usgs.gov/usgs/training/webmaster/xemacs.html    
Last modified: Mon Aug 11 18:51:53 EDT 2003