The first thing that you need to know is how to move around from place
to place in the text. You already know how to move forward one screen,
with C-v. To move backwards one screen, type M-v (hold down the META key
-and type v, or type <ESC>v if you do not have a META or EDIT key).
+and type v, or type <ESC>v if you do not have a META, EDIT, or ALT key).
>> Try typing M-v and then C-v, a few times.
There are several ways you can do this. The most basic way is to use
the commands C-p, C-b, C-f, and C-n. Each of these commands moves the
cursor one row or column in a particular direction on the screen.
-Here is a table showing these four commands and shows the directions
-they move:
+Here is a table showing these four commands and the directions they
+move:
Previous line, C-p
:
Each of text line ends with a Newline character, which serves to
separate it from the following line. The last line in your file ought
-to have a Newline at the end (but Emacs does not require have one).
+to have a Newline at the end (but Emacs does not require it to have
+one).
>> Try to C-b at the beginning of a line. It should move to
the end of the previous line. This is because it moves back
You can also move the cursor with the arrow keys, if your terminal has
arrow keys. We recommend learning C-b, C-f, C-n and C-p for three
reasons. First, they work on all kinds of terminals. Second, once
-you gain practice at using Emacs, you will find that typing these CTRL
+you gain practice at using Emacs, you will find that typing these Control
characters is faster than typing the arrow keys (because you do not
have to move your hands away from touch-typing position). Third, once
-you form the habit of using these CTRL character commands, you can
+you form the habit of using these Control character commands, you can
easily learn to use other advanced cursor motion commands as well.
Most Emacs commands accept a numeric argument; for most commands, this
serves as a repeat-count. The way you give a command a repeat count
is by typing C-u and then the digits before you type the command. If
-you have a META or EDIT key, there is another alternative way to enter
-a numeric argument: type the digits while holding down the META or
-EDIT key. We recommend learning the C-u method because it works on
-any terminal.
+you have a META (or EDIT or ALT) key, there is another, alternative way
+to enter a numeric argument: type the digits while holding down the
+META key. We recommend learning the C-u method because it works on
+any terminal. The numeric argument is also called a "prefix argument",
+because you type the argument before the command it applies to.
For instance, C-u 8 C-f moves forward eight characters.
>> Try using C-n or C-p with a numeric argument, to move the cursor
to a line near this one with just one command.
-Most commands use the numeric argument as a repeat count. Certain
-exceptional commands use it differently. C-v and M-v are among the
-exceptions. When given an argument, they scroll the screen up or down
-by that many lines, rather than by a screenfuls. For example, C-u 4
-C-v scrolls the screen by 4 lines.
+Most commands use the numeric argument as a repeat count, but some
+commands use it in some other way. Several commands (but none of
+those you have learned so far) use it as a flag--the presence of a
+prefix argument, regardless of its value, makes the command do
+something different.
+
+C-v and M-v are another kind of exception. When given an argument,
+they scroll the screen up or down by that many lines, rather than by a
+screenful. For example, C-u 8 C-v scrolls the screen by 8 lines.
>> Try typing C-u 8 C-v now.
question. Normally, if you do not want to execute the disabled
command, answer the question with "n".
->> Type <ESC> : (which is a disabled command),
+>> Type C-x C-l (which is a disabled command),
then type n to answer the question.
>> Type C-x 1 and see the documentation listing window disappear.
+This command is unlike the other commands you have learned in that it
+consists of two characters. It starts with the character Control-x.
+There is a whole series of commands that start with Control-x; many of
+them have to do with windows, files, buffers, and related things.
+These commands are two, three or four characters long.
+
* INSERTING AND DELETING
------------------------
character, but let's not worry about that). C-k and M-k are like C-e
and M-e, sort of, in that lines are opposite sentences.
+You can also kill any part of the buffer with one uniform method.
+Move to one end of that part, and type C-@ or C-SPC (either one).
+Move to the other end of that part, and type C-w. That kills
+all the text between the two positions.
+
+>> Move the cursor to the Y at the start of the previous paragraph.
+>> Type C-SPC. Emacs should display a message "Mark set"
+ at the bottom of the screen.
+>> Move the cursor to the n in "end", on the second line of the
+ paragraph.
+>> Type C-w. This will kill the text starting from the Y,
+ and ending just before the n.
+
When you delete more than one character at a time, Emacs saves the
deleted text so that you can bring it back. Bringing back killed text
is called "yanking". You can yank the killed text either at the same
which follows that line.
Note that a single C-k kills the contents of the line, and a second
-C-k kills the line itself, and make all the other lines move up. C-k
+C-k kills the line itself, and makes all the other lines move up. C-k
treats a numeric argument specially: it kills that many lines AND
their contents. This is not mere repetition. C-u 2 C-k kills two
lines and their newlines; typing C-k twice would not do that.
you kill something else? C-y would yank the more recent kill. But
the previous text is not lost. You can get back to it using the M-y
command. After you have done C-y to get the most recent kill, typing
-M-Y replaces that yanked text with the previous kill. Typing M-y
+M-y replaces that yanked text with the previous kill. Typing M-y
again and again brings in earlier and earlier kills. When you have
reached the text you are looking for, you do not have to do anything to
keep it. Just go on with your editing, leaving the yanked text where
but it is easier to type several times in a row. The disadvantage of
C-_ is that on some keyboards it is not obvious how to type it. That
is why we provide C-x u as well. On some terminals, you can type C-_
-by typing / while holding down CTRL.
+by typing / while holding down CONTROL.
A numeric argument to C-_ or C-x u acts as a repeat count.
In order to make the text you edit permanent, you must put it in a
file. Otherwise, it will go away when your invocation of Emacs goes
-away. You put your editing in a file by "finding" the file. (This is
-also called "visiting" the file.)
+away. In order to put your text in a file, you must "find" the file
+before you enter the text. (This is also called "visiting" the file.)
Finding a file means that you see the contents of the file within
Emacs. In many ways, it is as if you were editing the file itself.
you later decide that your changes were a mistake.
If you look near the bottom of the screen you will see a line that
-begins and ends with dashes, and contains the string "Emacs:
-TUTORIAL". This part of the screen always shows the name of the file
-that you are visiting. Right now, you are visiting a file called
-"TUTORIAL" which is your personal scratch copy of the Emacs tutorial.
-Whatever file you find, that file's name will appear in that precise
-spot.
-
-The commands for finding and saving files are unlike the other
-commands you have learned in that they consist of two characters.
-They both start with the character Control-x. There is a whole series
-of commands that start with Control-x; many of them have to do with
-files, buffers, and related things. These commands are two, three or
-four characters long.
-
-Another thing about the command for finding a file is that you have
-to say what file name you want. We say the command "reads an argument
-from the terminal" (in this case, the argument is the name of the
-file). After you type the command
+begins and ends with dashes, and starts with "--:-- TUTORIAL" or
+something like that. This part of the screen normally shows the name
+of the file that you are visiting. Right now, you are visiting a file
+called "TUTORIAL" which is your personal scratch copy of the Emacs
+tutorial. When you find a file with Emacs, that file's name will
+appear in that precise spot.
+
+One special thing about the command for finding a file is that you
+have to say what file name you want. We say the command "reads an
+argument from the terminal" (in this case, the argument is the name of
+the file). After you type the command
C-x C-f Find a file
Finally, type C-x C-f TUTORIAL <Return>
to come back to the tutorial.
-Emacs stores each file's text inside an object called a "buffer."
+Emacs stores each file's text inside an object called a "buffer".
Finding a file makes a new buffer inside Emacs. To see a list of the
-buffers that current exist in your Emacs job, type
+buffers that currently exist in your Emacs job, type
C-x C-b List buffers
It should ask you whether to save the buffer named TUTORIAL.
Answer yes to the question by typing "y".
+
* EXTENDING THE COMMAND SET
---------------------------
C-x C-s Save file.
C-x C-b List buffers.
C-x C-c Quit Emacs.
+ C-x 1 Delete all but one window.
C-x u Undo.
Named eXtended commands are commands which are used even less
If the computer crashes, you can recover your auto-saved editing by
finding the file normally (the file you were editing, not the auto
-save file) and then typing M-x recover file<return>. When it asks for
-confirmation, type yes<return> to go ahead and recover the auto-save
+save file) and then typing M-x recover file<Return>. When it asks for
+confirmation, type yes<Return> to go ahead and recover the auto-save
data.
* ECHO AREA
-----------
-If Emacs sees that you are typing commands slowly it shows them to you
-at the bottom of the screen in an area called the "echo area." The echo
-area contains the bottom line of the screen.
+If Emacs sees that you are typing multicharacter commands slowly, it
+shows them to you at the bottom of the screen in an area called the
+"echo area". The echo area contains the bottom line of the screen.
* MODE LINE
-----------
-The line immediately above the echo area it is called the "mode line".
+The line immediately above the echo area is called the "mode line".
The mode line says something like this:
---**-Emacs: TUTORIAL (Fundamental)--L670--58%----------------
+--:** TUTORIAL (Fundamental)--L670--58%----------------
This line gives useful information about the status of Emacs and
the text you are editing.
--Bot--. If you are looking at text so small that all of it fits on
the screen, the mode line says --All--.
+The L and digits indicate position in another way: they give the
+current line number of point.
+
The stars near the front mean that you have made changes to the text.
Right after you visit or save a file, that part of the mode line shows
no stars, just dashes.
what you are using now. It is an example of a "major mode".
Emacs has many different major modes. Some of them are meant for
-editing different languages and or kinds of text, such as Lisp mode,
+editing different languages and/or kinds of text, such as Lisp mode,
Text mode, etc. At any time one and only one major mode is active,
and its name can always be found in the mode line just where
"Fundamental" is now.
programming language has a different idea of what a comment should
look like, each major mode has to insert comments differently. Each
major mode is the name of an extended command, which is how you can
-switchto that mode. For example, M-x fundamental-mode is a command to
+switch to that mode. For example, M-x fundamental-mode is a command to
switch to Fundamental mode.
If you are going to be editing English text, such as this file, you
should probably use Text Mode.
->> Type M-x text-mode<Return>.
+>> Type M-x text mode<Return>.
-Don't worry, none of the commands you have learned changes Emacs in
+Don't worry, none of the Emacs commands you have learned changes in
any great way. But you can observe that M-f and M-b now treat
apostrophes as part of words. Previously, in Fundamental mode,
M-f and M-b treated apostrophes as word-separators.
>> Type C-x 1 to remove the documentation from the screen.
Major modes are called major because there are also minor modes.
-Minor modes are not to the major modes, just minor modifications of
-them. Each minor mode can be turned on or off by itself, independent
-of all other minor modes, and independent of your major mode. So you
-can use no minor modes, or one minor mode, or any combination of
-several minor modes.
+Minor modes are not alternatives to the major modes, just minor
+modifications of them. Each minor mode can be turned on or off by
+itself, independent of all other minor modes, and independent of your
+major mode. So you can use no minor modes, or one minor mode, or any
+combination of several minor modes.
One minor mode which is very useful, especially for editing English
text, is Auto Fill mode. When this mode is on, Emacs breaks the line
in between words automatically whenever you insert text and make a
line that is too wide.
-You can turn Auto Fill mode on by doing M-x auto-fill-mode<Return>.
-When the mode is on, you can turn it off by doing M-x
-auto-fill-mode<Return>. If the mode is off, this command turns it on,
+You can turn Auto Fill mode on by doing M-x auto fill mode<Return>.
+When the mode is on, you can turn it off again by doing M-x
+auto fill mode<Return>. If the mode is off, this command turns it on,
and if the mode is on, this command turns it off. We say that the
command "toggles the mode".
->> Type M-x auto-fill-mode<Return> now. Then insert a line of "asdf "
+>> Type M-x auto fill mode<Return> now. Then insert a line of "asdf "
over again until you see it divide into two lines. You must put in
spaces between them because Auto Fill breaks lines only at spaces.
characters with it. Then set the margin back to 70 using
C-x f again.
-If you makes changes in the middle of a paragraph, Auto Fill mode
+If you make changes in the middle of a paragraph, Auto Fill mode
does not re-fill it for you.
To re-fill the paragraph, type M-q (Meta-q) with the cursor inside
that paragraph.
>> Move the cursor into the previous paragraph and type M-q.
+
* SEARCHING
-----------
When you type C-s you'll notice that the string "I-search" appears as
a prompt in the echo area. This tells you that Emacs is in what is
called an incremental search waiting for you to type the thing that
-you want to search for. <RET> terminates a search.
+you want to search for. <Return> terminates a search.
>> Now type C-s to start a search. SLOWLY, one letter at a time,
type the word 'cursor', pausing after you type each
Now you have searched for "cursor", once.
>> Type C-s again, to search for the next occurrence of "cursor".
>> Now type <Delete> four times and see how the cursor moves.
->> Type <RET> to terminate the search.
+>> Type <Return> to terminate the search.
Did you see what happened? Emacs, in an incremental search, tries to
go to the occurrence of the string that you've typed out so far. To
go to the next occurrence of 'cursor' just type C-s again. If no such
-occurrence exists Emacs beeps and tells you the search is currently
-"failing", C-g would also terminate the search.
+occurrence exists, Emacs beeps and tells you the search is currently
+"failing". C-g would also terminate the search.
NOTE: On some systems, typing C-s will freeze the screen and you will
see no further output from Emacs. This indicates that an operating
through the other window sequentially with C-M-v.
C-M-v is an example of a CONTROL-META character. If you have a real
-META key, you can type C-M-v by holding down both CTRL and META while
-typing v. It does not matter whether CTRL or META "comes first,"
+META key, you can type C-M-v by holding down both CONTROL and META while
+typing v. It does not matter whether CONTROL or META "comes first,"
because both of these keys act by modifying the characters you type.
If you do not have a real META key, and you use ESC instead, the order
-does matter: you must type ESC followed by CTRL-v; CTRL-ESC v will not
-work. This is because ESC is a character in its own right, not a
-modifier key.
+does matter: you must type ESC followed by Control-v, because
+Control-ESC v will not work. This is because ESC is a character in
+its own right, not a modifier key.
>> Type C-x 1 (in the top window) to get rid of the bottom window.
If you have typed C-h and decide you do not want any help, just
type C-g to cancel it.
-(Some sites rebind the character C-h. They really should not do this
-as a blanket measure, so complain to the system administrator.
-Meanwhile, if C-h does not display a message about help at the bottom
-of the screen, try typing M-x help RET instead.)
+(Some sites change the meaning of the character C-h. They really
+should not do this as a blanket measure for all users, so you have
+grounds to complain to the system administrator. Meanwhile, if C-h
+does not display a message about help at the bottom of the screen, try
+typing the F1 key or M-x help <Return> instead.)
-The most basic HELP feature is C-h c. Type C-h, a c, and a
-command character or sequence, and Emacs displays a very brief
+The most basic HELP feature is C-h c. Type C-h, the character c, and
+a command character or sequence; then Emacs displays a very brief
description of the command.
->> Type C-h c Control-p.
+>> Type C-h c C-p.
The message should be something like
C-p runs the command previous-line
have already learned.
Multi-character commands such as C-x C-s and (if you have no META or
-EDIT key) <ESC>v are also allowed after C-h c.
+EDIT or ALT key) <ESC>v are also allowed after C-h c.
To get more information about a command, use C-h k instead of C-h c.
->> Type C-h k Control-p.
+>> Type C-h k C-p.
This displays the documentation of the function, as well as its
name, in an Emacs window. When you are finished reading the
all the commands whose names contain that keyword.
These commands can all be invoked with Meta-x.
For some commands, Command Apropos will also list a one
- or two character sequence runs the same command.
+ or two character sequence which runs the same command.
>> Type C-h a file<Return>.
you found something unclear, don't sit and blame yourself - complain!
-COPYING
--------
+* COPYING
+---------
This tutorial descends from a long line of Emacs tutorials
starting with the one written by Stuart Cracraft for the original Emacs.