XEMACS: THE BASICS

XEmacs is a customizable, display-oriented text editor. Though intended primarily for programmers, it is also an excellent choice for general-purpose editing, Web-page design, preparation of TEX files, and so on.

On MathLAN, you can start up XEmacs by moving the mouse pointer onto the sheet-of-paper icon (with the red letters XE) on the GNOME front panel and clicking the left mouse button. Alternatively, you can start it from a terminal window by typing xemacs, followed by the name of the file you want to edit, and finally an ampersand:

xemacs frogs.txt &

When XEmacs is started, it displays an introductory copyright announcement and a few suggestions for first-time users. This message vanishes as soon as you start typing, and it also goes away after a minute or two even if you do nothing.

Across the top of the XEmacs window, you'll see a thin gray bar with several words printed on it, typically File, Edit, Apps, Options, Buffers, Tools, and (at the right end) Help. Each word is the header of a menu, which appears when you move the mouse pointer onto it and click the left mouse button. To select an item from this menu, move the mouse pointer onto it and click the left mouse button; this also causes the menu to disappear.

Beneath this line, you'll see a toolbar -- a row of icons. If you move the mouse pointer onto any of these icons, you'll see at the bottom of the XEmacs window a short description of the operation that is performed when and if you click on the icon. The two that are of immediate importance are ``Open a file'' (the leftmost icon, resembling a dog-eared sheet of paper) and ``Save buffer'' (the floppy-disk icon, third from the left).

If you started XEmacs without specifying any particular file, you'll probably want to begin your session by clicking on the ``Open a file'' icon. A pop-up window will appear, inviting you either to select a file from the directory in which XEmacs was started (by moving the mouse pointer onto its name, as displayed in the pop-up window, and clicking the middle mouse button) or to type in the name of the file you want to open or to create. XEmacs helpfully types in for you the name of the current directory, but you can erase part or all of this if you want a file that is elsewhere. Press the OK button when the file name is right. If the file you specify already exists, XEmacs loads it for editing; if not, it creates an empty file under that name.

To enter text, just type in the characters. All printable characters show up on screen and in your file exactly as they are typed. Control characters and ``meta'' characters, on the other hand, activate various editing operations in XEmacs. A control character is generated when you hold down either of the <Ctrl> keys and press another key at the same time. Similarly, a meta character is generated when you hold down the <Alt> key to the left of the space bar and press another key at the same time. Nearly all of the possible control and meta characters denote editing functions in XEmacs, so don't be surprised if unusual things happen when you type control or meta characters either deliberately or accidentally. (Don't panic if unusual things happen, either. XEmacs has an ``Undo edit'' operation on the toolbar -- it's the one that looks like an eraser, eighth from the left -- that will usually get you out of any editing trouble.)

A red ``editing cursor'' marks the position at which insertions or deletions take effect. Clicking the left mouse button at any position in the text moves the editing cursor to that position. To delete characters to the left of the cursor, press the <Backspace> key.

You exit from XEmacs by selecting the Exit XEmacs item from the File menu. If you have modified any files in the course of your XEmacs session without specifically saving the modifications, the program will ask you about each modified file by displaying a pop-up window containing the question

Save file /home/spelvin/frogs.txt?

Clicking on the rectangle marked Yes will save the file, then shut down XEmacs; clicking on No will shut down XEmacs without saving the file; clicking on Cancel will return you to with XEmacs session, as if you had never tried to exit.

If you choose the No option on any file, XEmacs will double-check by asking you to confirm your decision in another pop-up window:

Modified buffers exist; exit anyway?

Again, clicking on Yes confirms that you want to shut down the program without saving the text; clicking on No or on Cancel returns you to XEmacs.

To save a file without leaving XEmacs, click on the ``Save buffer'' (floppy disk) icon. (It's also possible to save it under a different name than the one you originally supplied, by selecting Save As ...) from the File menu; you'll be prompted, in the ``mini-buffer'' at the very bottom of the XEmacs window, for the new file name.) To start editing a different file, click once again on the ``Open a file'' icon, type in the name of the new file (it will appear in the mini-buffer), and press <Enter>.

In addition to the files you explicitly ask XEmacs to save, the program creates two kinds of backup files: (1) Instead of discarding the previous version of a file that you edit, XEmacs renames it by adding a tilde, ~, at the end. (2) While XEmacs is running, it usually takes an extra copy of the file that you're editing from time to time and stores this ``insurance copy'' under a name formed by putting a mesh character, #, at each end of the file name (e.g., #frogs.txt#). This insurance file is deleted automatically if you exit normally from XEmacs, but it remains in your current directory if there's a power failure or if you accidentally log out or close the XEmacs window without saving the file you're working on. If you're wondering about the occasional appearance of the words Auto-saving ... done in the mini-buffer, they refer to this occasional updating of the insurance copy of the file. XEmacs pays attention to the rate at which you are typing and tries to time the updating operation so that it won't interrupt the flow of your characters onto the screen, so you'll often see this notice flicker past when you pause for a moment's thought.

To learn more about XEmacs, you can read the guide for new users, Getting started with XEmacs. (It describes XEmacs as it was in 1994, but the most common operations haven't changed.)

The entire text of the reference manual is accessible through the on-line help system, which you can start to explore by entering XEmacs and clicking on the lower-case i icon in the XEmacs toolbar (fourth from the right). A quick-reference card is available on the World Wide Web at http://www.math.grinnell.edu/mathlan/xemacs-quick-reference.ps.

(laurel leaf logo)

created August 2, 2000
last revised June 29, 2001

John David Stone (stone@cs.grinnell.edu)