The emacs text editor is extremely powerful and has so many features,
no one uses them all. But you can run any text editor in the world,
knowing only six procedures. Here they are for emacs, the one we use
in our Unix courses:
Let's create a new file junk3. You can do this by typing a
command in an terminal window or with the mouse from the desktop
Launch menu with our course setup. The command is
emacs junk3 &
You should see a mostly empty new window on your screen with the title
emacs.... Position this window so that both it and this
tutorial window are visible at the same time. (The ampersand &
in this command is useful, since it frees up the parent window for
further commands.)
To use the window menu, select Application->emacs to open the
emacs window. Then inside the emacs window, use the File->Open
File pulldown menu and type the name of the file that you want to
open, followed by the ``Enter'' key.
Click with the Mouse in the emacs window where you want to make the
insertion. Then simply start typing. Type a couple of lines of
anything.
To move around in the window, either point and click with the Mouse
(left button), or use the arrow keys. Practise this operation.
Insert some more text. Notice that insertions go directly under the
cursor position.
There are two ways to delete text. The Backspace key deletes one
character immediately before the cursor. The Ctrl-d key combination
deletes one character immediately beneath the cursor. (Notice that
Ctrl-d had an entirely different meaning in the terminal window,
namely, ``end-of-file''.)
To save your work, type Ctrl-x Ctrl-s or select File, Save
Buffer in the pulldown menu.
To exit emacs, type Ctrl-x Ctrl-c or select File, Exit
Emacs in the pulldown menu. If you forgot to save your work, emacs
will ask you if you want to in the space at the bottom of the window.
Type y at the prompt to signify that you want it saved.
Use ls and more in the terminal window to verify that your
new file is as expected. After you have created the file junk3
as specified, try editing it. Do this by starting the editor with the
same command emacs junk3 & that you used to create it in the
first place. Now you should see your old file as it was when you left
it.
The emacs pull-down menus access a variety of functions. The various
keyboard shortcuts are also indicated so you can learn the most common
ones.
If you want to learn more now, the emacs editor has its own tutorial
that is accessed by typing Ctrl-h t. Try it.
When you are done practising, exit emacs using Ctrl-x Ctrl-c or
use the pulldown menu.