[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Entering and Exiting Emacs

While using Emacs you should be familiar with the following three terms:

Buffer

A buffer is a region of memory holding characters. It is the basic editing unit; one buffer corresponds to one piece of text being edited. You can have multiple buffers but you can edit only one buffer at any one time. For more information, See (xemacs)Buffers section ‘Buffers’ in XEmacs User’s Manual.

File

A file is a region of disk space holding characters. Emacs edits a file by reading it into a buffer, editing that buffer and writing out the buffer back to the file. To save your work permanently you have to write it to a file. So after you load and work with a file, you have to save it back.

Windows

A window is a rectangular region in which a buffer is displayed. You can open multiple windows with multiple buffers and edit them by selecting the corresponding buffer. Initially, when you start emacs, it will automatically open up a window for you.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Entering Emacs

To enter Emacs type xemacs and press the Return key at the shell i.e. xemacs <RET>. This will bring up an emacs window with ‘*scratch*’ as the default buffer because Emacs must always have a buffer to work on. Then choose the Open... option from the File menu on the menubar at the top of the frame. It will prompt you to enter a filename. After you enter the filename, Emacs will read that file into the current buffer. You can also type :

 
xemacs <filename> <RET> 

directly which will bring up an Emacs frame with the filename as the buffer.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Emacs Frame

When you run XEmacs under X, a menu bar on top of the Emacs frame provides access to pull-down menus of file, edit, and help-related commands. The menus only provide convenient shortcuts, the options that they provide are available via key commands. You can invoke those commands from the keyboard also. For many of the options, their corresponding key commands are displayed right besides them. The five default menus on the menubar that you will see on the frame are File, Edit, Options, Buffers and Help. See (xemacs)XEmacs Pull-down Menus section ‘XEmacs Pull-down Menus’ in XEmacs User’s Manual, for detailed information on the functions provided by the pull-down menus.

The Emacs frame has a rectangle shaped box at the extreme right and you can drag it up or down to scroll the window accordingly. Clicking on the arrows also serves the same purpose.

The last line in your window is ‘the Mode line’ which will give you a description of what’s going on in that particular window. See section The Mode Line, for more information. Below the mode line is the ‘Echo area’. Emacs uses this area to interact with the user. See section The Echo Area.

If you wish to open another file in a new window after you enter XEmacs, select Open in New Frame... from the File menu, which will prompt you for a filename and open a new window with that filename as the current buffer. If you want to open a new file in the same window, select Open.. from the File menu. You need to enter XEmacs only once, you can edit multiple files by opening several other frames or by switching between buffers.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.3 Exiting Emacs

There are two commands for exiting Emacs, one for suspending Emacs and the other for killing Emacs. Suspending means stopping Emacs temporarily and returning control to the shell, allowing you to resume editing later in the same Emacs job, with the same files, same kill ring, same undo history, and so on. This is the usual way to exit. Killing Emacs means destroying the Emacs job. You can run Emacs again later, but you will get a fresh Emacs; there is no way to resume the same editing session after it has been killed.

C-z

Suspend Emacs (suspend-emacs). If used under the X window system, this command will shrink the X window containing the Emacs frame to an icon. Clicking on the icon will resume that Emacs process again. See (xemacs)Exiting Emacs section ‘Exiting Emacs’ in XEmacs User’s Manual.

C-x C-c

Kill Emacs (save-buffers-kill-emacs). You can also select Exit Emacs option from the File menu to kill that Emacs process. If you haven’t saved the file, Emacs will ask you if you wish to save the file before killing that process.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 The Mode Line

When you enter XEmacs, each text window’s last line is a mode line which describes what is going on in that window. Normally, the mode line looks like :

 
--ch-XEmacs: buf     (major minor)----pos------

This gives information about the buffer being displayed in the window: the buffer’s name, what major and minor modes are in use, whether the buffer’s text has been changed, and how far down the buffer you are currently looking.

The ch contains :

**

if the text in the buffer has been edited

--

if the text in the buffer has not been edited

%%

if the buffer is a read-only-buffer i.e. it cannot be edited

buf is the name of the window’s chosen buffer. If you are editing a file (which is the selected buffer), the file name appears in buf. See (xemacs)Buffers section ‘Buffers’ in XEmacs User’s Manual.

pos contains :

All

if your entire file is visible on the screen.

Top

if you are looking at the beginning of the file.

Bot

if you are looking at the end of the file.

nn%

nn will be a number corresponding to the percentage of the file above the top of the screen, for example ‘52’, which means that 52% of the file is above the top of the screen.

major is the name of the major mode in effect in the buffer. At any time, each buffer is in one and only one major mode. The available major modes include Fundamental mode (the least specialized), Text mode, Lisp mode, and C mode. See (xemacs)Major Modes section ‘Major Modes’ in XEmacs User’s Manual, for details on how the modes differ and how you select one.

minor is a list of some of the minor modes that are turned on in the window’s chosen buffer. For example, ‘Fill’ means that Auto Fill mode is on which means that lines are broken automatically when they become too wide. See (xemacs)Minor Modes section ‘Minor Modes’ in XEmacs User’s Manual, for more information on various minor modes and how to enable them.

You can also display time in the mode line. See (xemacs)The Mode Line section ‘The Mode Line’ in XEmacs User’s Manual, for more information regarding the mode line.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.5 The Echo Area

The line at the bottom of the frame (below the mode line) is the echo area. Emacs uses this area to communicate with you:


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Aidan Kehoe on December 27, 2016 using texi2html 1.82.