Java KDE Linux Commands DOS Disk Commands Email man Pages Printing Home


Introduction to XEmacs



This document is a guide to basic commands used in XEmacs to help you get started. More in depth information can be found at http://www.xemacs.org.

What is Emacs?

XEmacs is a version of the Emacs program. It is a self-documenting, customisable, extensible, real-time display editor. XEmacs adds a lot by giving a GUI, content-based formatting, and short cuts based on the type of file being edited.

Quick Start
If you just want to get into XEmacs and don't want to be bogged down with in depth descriptions of what it's all about then this part should get you quickly started in opening, saving and editing files.

Environment
Here you'll get an explanation of the features in the XEmacs environment.

More In Depth Stuff
This part of the document explains more advanced features of XEmacs.

Control Keys
A list of the keyboard shortcuts used to issue commands in XEmacs.

Quick Start

Starting XEmacs

To bring up an XEmacs window type in 'XEmacs' from a shell and hit the return button. You should now have in front of you an XEmacs window, with a default buffer *scratch*.

Opening Files

To open a file choose 'File' then 'Open' from the menu or select the 'Open' icon by left clicking your mouse. A window will appear with a list of your directories in the left hand frame. The contents of each directory is displayed in the right hand frame. Use your middle mouse button to select a directory, a subdirectory or the contents of a directory or subdirectory. Alternatively, you can type in the path and name of the file you wish to open in the line at the bottom of the frame.

XEmacs only needs to be opened once, multiple files can be edited by opening several frames or switching between buffers. To open another file in a new window choose 'File' then 'Open in Other Window' from the menu. To delete the frame select 'File' then 'Delete Frame'. Alternatively, if you wish to open another file in the same window choose 'File' then 'Open' from the menu.

Editing Files

Editing files in XEmacs is pretty straightforward. Text can be cut, copied and pasted by selecting the region of text with your mouse and choosing the appropriate command from the 'Edit' menu. Note: To select just one word of text, place the mouse cursor over the word and double click the left mouse button. The 'Undo' command will undo all changes made to text in a buffer (up to 8000 characters). It can be invoked by selecting the 'Undo' icon or selecting 'Edit'followed by 'Undo'. The spell checker will run through a document and highlight any words it doesn't recognise. To select the spell checker either left click on the 'Spell' icon or select 'Apps' then 'Spell-Check Buffer' or select 'Edit', 'Spell' then 'Check Buffer'. A spell-check buffer will appear at the top of the window and if any spelling errors are detected a choice of potential replacement words will be offered with a number in brackets along side the word. If you wish to replace the text with any of the choices offered then select its appropriate number and the word will be automatically replaced. If no changes are to be made to the text press the space bar and the spell checker will move to the next unrecognised word in the document. If the word is to be added to the dictionary so the spell checker will recognise it in future spell checks press 'i' or 'I'.

Saving Files and Exiting

To save a file select 'File' and 'Save (name of file)' or select the 'Save' icon. To save a file under a new name select 'File' then 'Save Buffer As...'. You will be prompted for the new file name. To delete the current buffer select 'File' followed by 'Delete Buffer (name of file)'. If any unsaved changes have been made to the buffer you will be asked whether or not you wish to save the changes before the buffer is deleted. To exit XEmacs select 'File' then 'Exit XEmacs'. The system will check the list of buffers in the process and ask if you wish to save any unsaved buffers.

Environment

Buffer

A buffer is the basic editing unit. You can have multiple buffers but can only edit one buffer at a time.

Windows

The window is the area in which the buffer is displayed. A window will automatically be opened for you when you start up XEmacs.

Echo Area

The echo area is the area at the very bottom of the XEmacs screen and is used to interact with you. If you are typing slowly the characters you are entering will appear in the echo area. The echo area also displays error messages to you.

Mode Line

The mode line is above the echo area on the XEmacs screen. It lets you know what is happening in your current window. e.g.

--**-XEmacs: emacs.html (HTML [html] Font)----44%---------------------------------------

This line describes information about the text you are editing and the status of XEmacs. The above example broken down means:

--**- The stars signify that editing has been carried out on this file since you opened it. When you first open a file it will look like '-----' as no editing will have been carried out. If the file is read only it would look like '--%%-'.
XEmacs: emacs.html Tells you the filename, in this case emacs.html.
(HTML [html] Font): This part of the mode line tells you which editing mode you are in. In this example you are in 'html mode'
----44%--------------------------------------: This informs you of where you are in your document. In this case it is saying you are 43% of the way through the full document. If you are at the top of the document it will display 'TOP' and - not surprisingly - will display 'BOTTOM' if you are at the bottom of the document















More In Depth Stuff

Searching

XEmacs can search through text for strings. You can choose to do a forward search or a backward search. Choose 'Edit' followed by 'Search' from the menu for a forward search or 'Edit' followed by 'Search Backward' for a backward search. Now look in the echo area. You should see the command 'I-search' appearing as a prompt. All you have to do now is type in the string you wish to search for. Notice that XEmacs will search incrementally for the string i.e. it will search to find anything that matches what you've typed so far. If a match is found, you can accept the match by pressing 'return' or search for more occurences of the match by pressing C-s for each new occurence. If the search fails a message will appear in the echo area informing you of this fact. Note:You can edit the text you have placed in the echo area so far by using the 'delete' key or you can exit the search by typing C-g.

Multiple Windows

XEmacs can have several windows, these are all contained within a single X window and do not overlap. Say you have one window open in your frame at present, to open another window in the frame select 'File' then 'Open in Other Window'. You will then be prompted to choose a filename, after you have selected a filename, another window will appear in the frame containing the file you selected. To open another file (giving you three files in your frame) you would first of all place your cursor in the window you wish to split then split the window by selecting 'File' then 'Split Window'. This will split your window in two with each window displaying the same file. To then open a file in the other window all you have to do is place your cursor in the window and do a 'File', 'Open'.

To delete a window, place the cursor in the window you wish to delete and select 'File' followed by 'Un-Split (Keep Others). This will delete the window you selected and keep the remaining windows. Alternatively, you can choose to delete all windows apart from one by placing your cursor in the window you wish to keep and selecting 'File' then 'Un-Split (Keep This)'.

Major Mode and Minor Mode

XEmacs has many different major and minor modes. Major modes are used to edit text of a certain type, i.e. C, HTML, Lisp, Java, LaTex etc. Within that mode certain functions are redefined to suit the needs of the text being edited. When you open a file XEmacs will usually select the correct mode for that file, e.g. if you open a file named file.html, it will select HTML mode because of the extension to the filename. You can select the mode you wish to work in using meta keys.

The minor mode provides features which can be turned on or off at an time. Minor modes include: automatic word wrapping, overwrite, automatic save, display line number, colour text. Minor modes are selected using the meta key followed by 'x' then the name of the minor mode you wish to be in.

A list of commands for the mode you are in can be found by selecting 'Help' from the XEmacs menu, then 'Commands and Keys' followed by 'Mode'.

Control Keys and Meta Keys

XEmacs commands can also be invoked using the control keys and meta keys. The CONTROL key is likely to be labelled as 'Ctrl' on your keyboard and the META key is usually labelled 'Alt'. The META key can also be invoked using the 'Esc' key followed by the character. Some useful commands are:

N.B. C-chr means hold down the CONTROL key while typing the character
M-chr means hold down the META key while typing the character

Key Function Key Function Key Function
C-v Move forward one screenful C-x C-f Open a file C-m New line
M-v Move backward one screenful C-x C-s Save a file M-c Capitalise word
C-p Move to previous line C-x C-w Save file as M-e Move forward a sentence
C-n Move to the next line C-x C-c Exit XEmacs M-g Goto line number
C-b Move backward over the text M-< Move to the start of the document C-h F View XEmacs FAQ
C-f Move forward over the text M-> Move to the end of the document C-h q Quit help
M-f Move forward one word C-x u Undo last change C-h t Help with tutorial
M-b Move backward one word C-x C-s Save a file C-x C-o Delete blank lines
C-a Move to the beginning of a line C-g Stop a command executing C-h i Info
C-e Move to the end of a line C-x C-b List buffers M-% Replace word with new word
M-v Move backward one screenful C-x 1 Expands window to occupy full screen C-x m List of mode commands
C-s Forward search C-d Delete the next character after the cursor M-x c-mode Selects C mode
C-r Backward search M-d Delete the next word after the cursor M-x html-mode Selects html mode
C-x 2 Splits the screen in to two windows C-k Kill from the cursor position to end of line M-x lisp-mode Selects lisp mode
C-M-v Scroll through the bottom window M-k Kill to the end of the current sentence M-x tex-mode Selects mode for LaTex documents
C-x o Switches between windows C-j Newline and indent











































Kathleen McLean
Last modified: Mon Oct 25 10:19:50 BST 1999