Skip to Main Content

How Docs


Use XEmacs

NOTE: This document refers to software or hardware that is not currently supported by the University of Wyoming Information Technology Client Support Services. Although the information is believed to be correct, be aware that since no support is available, this information may be out-of-date or possibly no longer valid.

XEmacs is a screen-oriented text editor available on FRONTIER (formerly ASUWlink). There are a couple of conventions to keep in mind when following these instructions. Note that what you see on the screen may not appear exactly the same as here.

  • <Ctrl>+a means to hold down the <Ctrl> key while typing the specified character. For example, <Ctrl>+g means hold down the <Ctrl> key while typing g
  • <Esc>, x means press the <Esc> key, then type the specified character. For example, <Esc>, g means press the <Esc> key and release it. Then type g.
  • <Enter> means press the Return or Enter key.

Note: XEmacs documentation frequently refers to the meta key. The majority of keyboards do not have such a key, so the <Esc> key typically functions as the meta key.

Entering and Exiting XEmacs

To start XEmacs and edit a file simply enter at the shell prompt: xemacs filename

This will open the file. The screen is divided into three parts. The first, and also the biggest, is the file area. Next, towards the bottom, is the mode line, where XEmacs can display information about the editing session. Last, at the very bottom, is the echo area, where XEmacs displays error and other informational messages. In addition, commands that require further input, such as a search string, will appear here.

To exit XEmacs, enter the command <Ctrl>+x, <Ctrl>+c If you have made any unsaved changes to the file, XEmacs will ask if you wish to save them.

Moving Around

The arrow keys are used for moving around one character or line at a time. Other cursor movements are:

  • <Ctrl>+a Move the cursor to the beginning of the line
  • <Ctrl>+e Move the cursor to the end of the line
  • <Ctrl>+v Scrolls forward in the file by one screen’s worth
  • <Esc>, b Moves backward one word
  • <Esc>, f Moves forward one word
  • <Esc>, v Scrolls backward in the file by one screen’s worth
  • <Esc>, < Moves to the beginning of the file (where < is the less than symbol)
  • <Esc>, > Moves to the end of the file (where > is the greater than symbol)
  • <Esc>, g number <Enter> Moves to the line in the file as specified by number

Adding and Deleting Text

Basic text entry is accomplished by simply typing. To delete characters, use the Backspace key, which will delete characters to the left of the cursor. <Ctrl>+d will delete characters under the cursor.

To delete lines, position the cursor at the beginning of the line, then use <Ctrl>+k This command first deletes the contents of the line, leaving a blank line. Applying the command a second time will delete the blank line. Use <Ctrl>+d to delete the character under the cursor.

Deleting a block of text involves setting marks to designate the beginning and end of the block. Use the command <Ctrl>+@ to set the beginning of the block (to do this involves holding down the control and shift keys, then pressing @). Next, move to the end of the block. As you move the selected text will appear highlighted. Type the command <Ctrl>+w to delete the highlighted text.

A quick way to copy blocks of text is to first perform the actions to delete a block of text, then use the command <Ctrl>+y to bring back the text. This command may then be used to copy that same block of text elsewhere in the file.

A handy way to save your file on the fly is to use the command <Ctrl>+x <Ctrl>+s.

Search and Replace

Searches in XEmacs are generally case insensitive, unless upper case characters are part of the search, and then the search becomes case sensitive. To execute a search in XEmacs, use the following commands:

  • <Ctrl>+s Perform searches in the forward direction. XEmacs responds in the echo area with I-search: here the search string is then entered, follow by a return key: I-search: string <Enter>
  • <Ctrl>+r Performs a search in the backward direction; otherwise behaves the same as forward searches

There are two kinds of replaces: a global replace where all occurrences of a string are replaced, and a query-replace, where confirmation is asked before the replacement is made.

A global replace is performed by the following command:

  • <Esc>, x replace-string XEmacs will then ask for the string you want replaced
  • Enter the string, followed by a return: Replace string: oldstring <Enter>
  • XEmacs next asks for the replacement string: Replace string oldstring with: newstring <Enter>
  • XEmacs will then replace all occurrences of the oldstring with the newstring.
    A query-replace is done as follows:
  • <Esc>, % XEmacs first asks for the string to be replaced
  • Enter the string, followed by a return: Query-replace: oldstring <Enter>
  • XEmacs will next ask for the replacement string: Query-replace oldstring with: newstring <Enter>
  • XEmacs will search for and stop at each occurrence of the string it finds and then ask for confirmation before replacement. Type either the letter y or the space bar for yes, or the letter n for no.

Query-replace can be ended with a <Ctrl>+g. Conversely, the ! (exclamation point) tells XEmacs to perform the remaining replacements without confirmation. (Note: <Ctrl>+g can be used to end many XEmacs actions.)

Undoing Changes

XEmacs allows practically any and all changes to a file to be undone. The command to do this is: <Ctrl>+x u

Executing this command once will undo the most recently made modification. Repeated uses of this command will undo changes in reverse order.


Help on XEmacs is available on-line from the man pages at the system prompt: man xemacs

Help is also available within XEmacs via the command <Ctrl>+h. Help in XEmacs has several levels. The easiest method to start with is to use the help command followed by two question marks: <Ctrl>+h, ?, ? This displays a list of all available help options. For general XEmacs info, use the command <Ctrl>+h, i and select the XEmacs entry; type the letter q to return to your file. A brief XEmacs tutorial is available by entering the command <Ctrl>+h, t.


Reviewed: 0706 By: CD

Additional help with the installation and configuration of
UW-supported software is available:
Contact the IT Help Desk at 766-HELP (4357), option 1
Contact the IT Help Desk at 766-HELP (4357), option 1
Come to the student computer lab in the lobby of the
Information Technology Center.

Footer Navigation

University of Wyoming
1000 E. University Ave. Laramie, WY 82071 // UW Operators (307) 766-1121 // Contact Us