You are looking at the XEmacs tutorial.  See end for copyrights and conditions.

XEmacs commands generally involve the CONTROL key (sometimes labeled
CTRL or CTL) or the META key. "META" is a traditional Emacs term; on
most keyboards, the key is labeled "Alt". (On Sun keyboards, the META
key is labeled with a diamond, and is *NOT* the Alt key, which also
exists.) On some TTY's, there is no META key; in this case, use ESC.
Rather than write out META or CONTROL each time we want you to prefix a
character, we'll use the following abbreviations:

 C-<chr>  means hold the CONTROL key while typing the character <chr>
	  Thus, C-f would be: hold the CONTROL key and type f.
 M-<chr>  means hold the META (i.e. Alt) key down while typing <chr>.
          (See above for Sun keyboards and TTY's.)

Important note: to end the XEmacs session, type C-x C-c.  (Two characters.)

To move to the next screen, type <Next> (often labeled PgDn).  On TTY's,
you may not have such a key; use C-v instead. (Hold down the CONTROL key
while typing v.)

To move to the previous screen, type <Prior> (often labeled PgUp).  On
TTY's, use M-v. (Remember, this means META + v; if you have no META or Alt
key that works, press and release ESC, then type v.)

The characters ">>" at the left margin indicate directions for you to
try using a command.  For instance:

>>  Try typing <Next> and then <Prior>, a few times. (Or C-v and M-v,
    on TTY's.)

Note that there is an overlap of two lines when you move from screen to
screen; this provides some continuity so you can continue reading the text.

In general, every "cursor key" (the arrows and similar keys set off to the
right side of the keyboard) has an equivalent binding that uses only the
alphanumeric keys in combination with CONTROL and/or META, so that TTY
users can use XEmacs.

(In fact, in olden days, this "older way" was the only way to do things,
and you will still often see references to these keys as the "recommended"
way of doing things.  We don't actually recommend that you use these older
bindings in preference to the more obvious cursor keys, since the cursor
keys are easier to remember and usually more convenient to use.  However,
it's useful to know the older bindings, either in case you ever use a TTY
or so that you can make sense of references to them.  From now on, we will
mention the TTY bindings in parentheses, and expect that TTY users will
substitute them whenever we mention a cursor key.)

Now you may ask, what is a TTY?  A TTY (or "TeleTYpe")is a text-only
connection, the kind you get when you use the "telnet" program to log into
a remote site.  Up till 20 years ago or so, such text-only connections were
all that existed to communicate with a computer, usually via a "terminal"
(a combination keyboard and monochrome screen) connected directly to a
computer.  Nowadays, such dedicated TTY's are increasingly rare, and most
people only run into them when using telnet.  Emacs began in those olden
days, and it still carries some baggage from that time, but things have
greatly improved since then.  Now, you are probably using XEmacs under MS
Windows or X Windows, collectively termed a "window system".


* SUMMARY
---------

The following commands are useful for viewing screenfuls:

	<Next>	 Move forward one screenful (C-v on TTY's)
	<Prior>	 Move backward one screenful (M-v on TTY's)
	 C-l	 Clear frame and redisplay all the text,
		 moving the text around the cursor
		 to the center of the window.
		 (That's CONTROL-L, not CONTROL-1.)

>> Find the cursor, and note what text is near it. Then type C-l.
   Find the cursor again and notice that the same text is still near
   the cursor, but now it is in the center of the screen.
   If you press C-l again, this piece of text will move to the top of
   the screen.  Press C-l again, and it moves to the bottom.

* SOME TERMINOLOGY
------------------

All aspects of computers have terminology associated with them, and until
you master the terminology, things can seem overwhelming.  To add to this,
however, XEmacs has its own terminology, some of which of course includes
terms for concepts new to XEmacs.  Some XEmacs terminology, however, is
just nonstandard terms for familiar objects and concepts. (This is because
Emacs began a long time ago, when many standard things in today's computers
didn't exist, and others that did exist had different names.)

To make things easier for you, the most common XEmacs terms that you will
find in this tutorial are defined here, even though some have already been
defined above and others aren't discussed in detail until later.  This way,
if you come across an unfamiliar term, you know exactly where to look to
find the definition.  Don't worry if you don't understand all the terms; if
you keep reading the tutorial, eventually all the terms will be explained
in detail.

Term		Definition
--------------------------
C-		A keystroke involving the CONTROL key.  C-k is sometimes
		indicated as CONTROL + k or (not in XEmacs) ^K, and means
		to hold down the CONTROL key and hit the k key.
Info		The name of XEmacs' online documentation, accessed through
		C-h i.
M-		A keystroke involving the META key.  See META.
META		An abstract name for a particular modifier key, which has
		different correspondences depending on your keyboard.  On
		most keyboards, META is the Alt key, but on Sun keyboards it's
		a key labeled with a diamond, and *NOT* the Alt key, which
		also exists.  META can also be simulated by pressing ESC before
		the other key, but in reality this is just two separate keys,
		not a modifier plus a key: If you want to do M-f M-f, normally
		you can hold down (e.g.) Alt, hit f twice, and release the Alt,
		but when using ESC as META, you'd have to type ESC f ESC f.
TTY		A text-only connection to a computer, such as when you
		telnet into a machine.  See the previous section for more
		explanation.
binding		The command that's bound to a particular key sequence; you
		can find out what the binding is and how the command works
		using C-h k; it's also possible to change the bindings of
		key sequences, but this isn't discussed in the tutorial
buffer		A block of memory holding some text, such as the text of a
		file, email message, list of files in a directory, etc.  All
		visible windows are always displaying the text of some buffer,
		and more than one window can be displaying the same buffer.
		In this case, each buffer has a different value for point
		(see definition).
cursor		A block or bar showing where in the text the current insertion
		point is.
cursor key	Any of the keys used for moving the cursor, such as the arrow
		keys, <Next> and <Prior> (often labeled PgUp and PgDn),
		<Home> and <End>, etc.  Usually set off to the right of the
		main part of the keyboard, often painted gray.
echo area	A one-line area at the bottom of the frame where messages are
		output.  It shares the same space as the minibuffer, which
		works because the minibuffer is not active most of the time
		and is active only for short intervals. (Even then, if a
		message needs to be displayed, the minibuffer will temporarily
		disappear, the message will be displayed, and then the
		minibuffer will appear again in a few seconds.)
frame		Same as what's standardly called a "window" in a window system.
		TTY's only have one visible frame, but it's possible to create
		others and switch between them (sort of like if, in a window
		system, all your windows were maximized to take up the whole
		screen, so you could only see one at once).
isearch		Incremental search.  An Emacs invention that is a special,
		extra-efficient way of searching.  Each time you type a
		character in a search string, XEmacs immediately finds the
		next match for what you've typed so far.  This way, you avoid
		typing more keys than necessary to find what you're looking
		for.
key sequence	A sequence of one or more keystrokes that together make a
		command.  C-x C-f, C-x 5 0, C-l, and <Next> are all key
		sequences.  See also "binding".
keystroke	A combination of a key and a modifier (e.g. CONTROL, SHIFT,
		META).
kill		Standardly known as "cut".  Remove text and remember it, so
                that it can be "yanked" (standardly, "pasted") later.  Multiple
		"kills" are remembered, not only the most recent, and can be
		accessed using M-y.  "kill" is also sometimes used in general
                to refer to deleting anything other than text, e.g. buffers,
		toolbar items, local variables, subprocesses, abbreviations,
		or to terminating the XEmacs process.
minibuffer	A small buffer (usually one line, but it may expand as
		necessary) at the bottom of the frame, used when commands need
		input such as file names.
modeline	A status line, near the bottom of a window, showing the
		current file being edited, the current mode, the line number,
		etc. (If you split a frame into two windows, you get two
		modelines.)
point		The location in the text where the cursor is. (Technically,
		the cursor is *BETWEEN* two text characters, not on one.
		This is most obvious when you use the bar cursor.)
prefix argument An extra piece of information typed just before a command to
		be executed, which changes how the command works.  Prefix
		arguments typically come in two types: Numeric arguments,
		which specify repeat counts, screen lines to move to, etc.
		are are specified using META plus a number before a command;
		and flag arguments, which are just simple yes/no-type
		indications to do something differently (e.g. put point at
		the beginning of inserted text rather than at the end) and
		are specified using C-u before the command.
recursive edit	Used when you are in the middle of executing a long command
		(e.g. a search and replace), and want to temporarily make
		an edit to some text.  Indicated with brackets around the
		mode name.  It's unlikely you'll use this much, if at all,
		but it's useful to know how to get out if you accidentally
		get into this mode: use ESC ESC.
screen		The totality of everything that can be seen on the display.
		Also used in some expressions: "on/off the screen" means
		currently visible or invisible.  A "screenful" is the amount
		of text in a particular window that can be viewed at one time.
window		Non-overlapping division of a frame, standardly called a
		"pane".  Most often, there is only one window in a frame, and
		then the two terms become essentially synonymous. (Technically,
		however, the window includes the modeline below it but not
		the minibuffer.)
yank		Standardly known as "paste".  Insert text that was previously
		removed and remembered, a process known as "killing", or more
		standardly "cutting".


* BASIC CURSOR CONTROL
----------------------

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 and backward
one screen, but how do you move to a specific place within the text on
the screen?

There are several ways you can do this.  The most basic way is to use
the arrow keys, which we refer to as <Left>, <Right>, <Up>, and <Down>.
Each of these commands moves the cursor one row or column in a
particular direction on the screen.

On a TTY, the arrow keys should, hopefully, work the same, but they
might not, since TTY's are easy to misconfigure.  As mentioned above,
for all cursor-key bindings, there are equivalent alphanumeric ones.  In
this case, the bindings are unfortunately not at all obvious, since they
were chosen mnemonically and not visually.  Here is a table showing the
TTY bindings:
 
			  Previous line, C-p
				  :
				  :
   Backward, C-b .... Current cursor position .... Forward, C-f
				  :
				  :
			    Next line, C-n

>> Move the cursor to the line in the middle of that diagram using <Down>
   or <Up>.  Then type C-l to see the whole diagram centered in the window.
   (Remember, TTY users should substitute the appropriate bindings whenever
   necessary.  In this case, use C-n and C-p.)

Note the mnemonic significance of the TTY bindings: P for previous, N
for next, B for backward and F for forward.  If you're on a TTY, you
really should spend some time now etching these cursor bindings into
your brain.  These cursor positioning commands are the most fundamental
way to move around and you'll be using them ALL the time, so you will be
completely lost without them.

Even if you are on a window system and are not forced to learn these
bindings, you should try to memorize at least these four commands and in
particular their associated words, since variations on them show up in
many different keyboard commands, and knowing what they stand for can be
of tremendous help.


>> Do a few <Down>'s to bring the cursor down to this line.

>> Move into the line with <Right>'s and then up with <Up>'s.
   See what <Up> does when the cursor is in the middle of the line.

The location of the cursor in the text is also called "point".  You will
often see such references to "point" in the documentation, so remember
this term.

Each line of text 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.  XEmacs does not normally require it to have one, but
you can change this -- see the menu entry "Options->Editing->Newline at End
of File...". (More on menu entries later.)

>> Try to <Left> at the beginning of a line.  It should move to
   the end of the previous line.  This is because it moves back
   across the Newline character.

<Right> can move across a Newline just like <Left>.

>> Do a few more <Left>'s, so you get a feel for where the cursor is.
   Then do <Right>'s to return to the end of the line.
   Then do one more <Right> to move to the following line.

When you move past the top or bottom of the window, the text beyond
the edge shifts onto the screen.  This is called "scrolling".  It
enables XEmacs to move the cursor to the specified place in the text
without moving it off the screen.

>> Try to move the cursor off the bottom of the window with <Down>, and
   see what happens.

If moving by characters is too slow, you can move by words.  C-<Right>
(CONTROL + right-arrow key) moves forward a word and C-<Left> moves back a
word.  On TTY's, use M-f instead of C-<Right> and M-b instead of C-<Left>.

>> Type a few C-<Right>'s and C-<Left>'s.

When you are in the middle of a word, C-<Right> moves to the end of the
word.  When you are in whitespace between words, C-<Right> moves to the
end of the following word.  C-<Left> works likewise in the opposite
direction.

>> Type C-<Right> and C-<Left> a few times, interspersed with <Right>'s and
   <Left>'s so that you can observe the action of C-<Right> and C-<Left>
   from various places inside and between words.

Notice the parallel between <Right> and <Left> on the one hand, and
C-<Right> and C-<Left> on the other hand.  Also notice the parallel
between C-f and C-p on the one hand, and M-f and M-p on the other hand.
XEmacs tries fairly hard to maintain parallelism in keyboard commands to
make them easier to remember, and generally adding CONTROL or META to an
operation makes it "more so".  META goes beyond CONTROL, often making
the units of movement less basic in the process -- words vs. characters,
balanced parenthetical expressions vs. words, or sentences vs. lines.

Other important cursor motion commands are <Home> and <End> (beginning
and end of the line), and C-<Home> and C-<End> (beginning and end of the
whole text).  Note again the parallelism just mentioned.

On TTY's, use C-a and C-e for beginning and end of line, and M-< and M->
for beginning and end of text. (If it helps, think of A as the first
letter of the alphabet, and E as standing for "end".) Note that the <
and > chars (Less-than and Greater-than) are above the comma and period
on most keyboards, so you'll have to use the SHIFT key in conjunction
with META.  If you have no META, the order is very important: Type ESC
first, then type < or >.

>> Move the cursor to this line, then try <Home> and <End> a few times.

>> (Read this entire entry before doing anything!) Try C-<Home> now, to
   move to the beginning of the tutorial.  Then use <Next> repeatedly to
   move back here.

>> Try all of these commands now a few times for practice.
   These are the most often used commands.

Here is a summary of simple cursor-moving operations.  Don't worry if you
can't remember everything; you can always move back to this table for
reference.

        KEYSTROKE:      SEQUENCE                                TTY:

        <Prior> (PgUp)  Move backward a screen			M-v
        <Next> (PgDn)   Move forward a screen			C-v

	<Left>		Move backward a character		C-b
	<Right>		Move forward a character		C-f

	C-<Left>	Move backward a word			M-b
	C-<Right>	Move forward a word			M-f

	<Up>		Move to previous line			C-p
	<Down>		Move to next line			C-n

	C-<Up>		Move 6 lines up
	C-<Down>	Move 6 lines down

	<Home>		Move to beginning of line		C-a
	<End>		Move to end of line			C-e

	C-<Home>	Move to beginning of text		M-<
	C-<End>		Move to end of text			M->


* PREFIX ARGUMENTS
------------------

Most XEmacs 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 holding down the META key while typing the digits.  You really only
need to hold down META for the first digit; for this reason, an
alternative method is to simply hit the ESC key once, then type the
digits.  (This latter method works on TTY's as well.) The numeric
argument is also called a "prefix argument", because you type the
argument before the command it applies to.

For instance, M-8 <Right> moves forward eight characters.
	
>> Try using <Down> or <Up> with a numeric argument, to move the cursor
   to a line near this one with just one command.

Sometimes, commands use the term "prefix argument" to refer not to a
numeric argument, but to just a flag that makes the command do something
different if given. (We haven't encountered any such commands so far.) 
For such commands, the flag is normally given by typing C-u before the
command, but generally you can also specify any numeric argument -- the
actual number makes no difference.


* SCROLLBARS
------------

Unless you are on a TTY, there is probably a rectangular area called a
scroll bar at the right hand side of the XEmacs window.  You can scroll the
text by manipulating the scrollbar with the mouse.

The scrollbar has a button in the middle of it, called a thumb.  The
relative position of this thumb within the rectangle indicates where you
are within the file.  As you scroll up or down with the cursor keys, the
thumb will follow.

>> Try holding down the left button on the thumb and moving the mouse up
   and down.  You'll see that the text scrolls up and down as you move the
   mouse. (NOTE: Some scrollbars, such as the Athena scrollbars under X
   Windows, work differently.  On these, you will have to use the middle
   button, not the left one.)

>> Try clicking the left button in the area above the thumb.  This should
   scroll the text up by a screenful.  Similarly, clicking the button below
   the thumb will scroll down by a screenful. (NOTE: Under Athena, things
   work differently.) Holding the button down will cause the text to
   repeatedly scroll by a screenful.

>> Most scrollbars have arrows at the top and bottom of the rectangle.
   Clicking on these will scroll the text up or down by a line, and holding
   the button down will cause the text to repeatedly scroll by a line.


* USING THE MENU
----------------

Unless you are on a TTY, you will notice a menubar at the top of the
XEmacs frame.  You can use this menubar to access all the most common
XEmacs commands, such as "open a file".  You will find this easier at
first, because you don't need to remember the keystrokes necessary to
access any particular command.  Once you are comfortable with XEmacs, it
will be easy to begin using the keyboard commands because each menu item
with a corresponding keyboard command has the command listed next to it.

Note that there are many items in the menubar that have no exact
keyboard equivalents.  For example, the Buffers menu lists all of the
available buffers in most-recently used order.  You can switch to any
buffer by simply findings its name in the Buffers menu and selecting it.

You can also configure XEmacs so that you can use the META key to access
menu items -- the "accelerator" functionality that is standard under MS
Windows.  One easy way to do this in XEmacs is using the menu item
"Options->Menubars->Alt/Meta Selects Menu Items".

When this feature is on, you can select a menu or menu item using the
combination of META (i.e. Alt) plus the underlined letter of the menu item.
For example, to exit XEmacs, use M-f M-x.  We currently don't turn this on
by default because it interferes with the traditional usage of META in
XEmacs.  However, we may do this in the future: Only commands for which
there are top-level menus are shadowed by accelerator bindings, and for all
those commands, there are equivalents either using cursor keys or on the
menus.

When we mention a menu selection, it will be specified as just shown --
i.e. a string, with an arrow ("->") separating different submenus or items.
In this case, the menu entry just mentioned means "Click the Options menu
on the menubar, then the Menubars submenu, the the entry off of that
labeled "Alt/Meta Selects Menu Items".  In general, XEmacs is highly
customizable, and one of the easiest ways to make such customizations is
through the Options menu.

IMPORTANT: If you want a change on the Options menu to last beyond the
current XEmacs session, use "Options->Save Options to Init File".  This
way, it will be permanent.  Otherwise, all Options changes made in the
current session will be lost.


* WHEN XEMACS IS HUNG OR IN SOME STRANGE MODE
---------------------------------------------

If XEmacs stops responding to your commands, you can stop it safely by
typing C-g.  You can use C-g to stop a command which is taking too
long to execute.

You can also use C-g to discard a numeric argument or the beginning of
a command that you do not want to finish.

>> Type M-100 to make a numeric arg of 100 (remember, this means hold
   down META and type 100, or type ESC 1 0 0), then type C-g.  Now type
   <Right>.  It should move just one character, because you canceled the
   argument with C-g.

If XEmacs is in some strange mode and C-g isn't getting out of it, you
can use the all-purpose escape mechanism: ESC ESC. (On TTY's, you have
to use ESC ESC ESC.  The reasons for this are a bit complicated.)

Hitting ESC ESC will get you out of almost any weird mode, including
selected text, split windows, the minibuffer, recursive edits, "stranded
minibuffer requests", and the like.  If you have many problems at once,
each invocation of ESC ESC will get rid of one, so keep repeating until
everything's fixed.  REMEMBER: ESC ESC does not work if XEmacs is hung
doing some time-consuming operation or running broken code.  Use C-g for
that.


* DISABLED COMMANDS
-------------------

Some XEmacs commands are "disabled" so that beginning users cannot use
them by accident.

If you type one of the disabled commands, XEmacs displays a message
saying what the command was, and asking you whether you want to go
ahead and execute the command.

If you really want to try the command, type <Space> in answer to the
question.  Normally, if you do not want to execute the disabled
command, answer the question with "n".

>> Type `C-x n p' (which is a disabled command),
   then type n to answer the question.


* "WINDOWS", I.E. PANES
-----------------------

XEmacs can have several panes (i.e. non-overlapping divisions of a window
or a TTY screen), each displaying its own text.  For historical reasons,
these panes are called "windows", and what we normally think of as a
window is called a "frame".  XEmacs can also have multiple "frames"; this
is described later.  From now on, we omit the quotes around the XEmacs
terms, and if we need to use "window" in the standard sense, we will say
"window-system window".

At this stage it is better not to go too deeply into the techniques of
using multiple windows.  But you do need to know how to get rid of extra
windows that may appear to display help or output from certain commands.
Most of the time, your cursor will be in the new window; if this is the
case, simply type q.  Alternatively, you can type

	C-x 0	Delete window.

That is, CONTROL-x followed by the digit 0.  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.

>> Move the cursor to this line and type M-0 C-l.
   (That's a zero, not an Oh.)
>> Type CONTROL-h k CONTROL-f.
   See how this window shrinks, while a new one appears
   to display documentation on the CONTROL-f command.
 
>> Type q and see the documentation listing window disappear.

(Remember that C-l redraws the frame.  If you give a numeric argument to
this command, it means "redraw the frame and put the current line that
many lines from the top of the window."  So M-0 C-l means "redraw the
frame, putting the current line at the top.")


* INSERTING AND DELETING
------------------------

If you want to insert text, just type the text.  Characters which you can
see, such as A, 7, *, etc. are taken by XEmacs as text and inserted
immediately.  Type <Return> (the carriage-return key) to insert a Newline
character.

You can delete the last character you typed by typing <Backspace>.
<Backspace> is a key on the keyboard, which may be labeled simply with a
left arrow sign.

(NOTE: On a few misconfigured TTY's, typing <Backspace> may try to invoke
the help system; the symptom of this is a line like "C-h (Type ? for
further options)" at the bottom of the frame.  If this is the case, type
C-g to get out of this, and try using <Delete> from now on in place of
<Backspace>.)

More generally, <Backspace> deletes the character immediately before the
current cursor position.

>> Do this now--type a few characters, then delete them
   by typing <Backspace> a few times.  Don't worry about this file
   being changed; you will not alter the master tutorial.  This is
   your personal copy of it.

When a line of text gets too big for one line on the window, the line of
text is "continued" onto a second window line.  An arrow at the right
margin that hooks down and to the left (or a backslash ("\") on TTY's)
indicates a line which has been continued.

>> Insert text until you reach the right margin, and keep on inserting.
   You'll see a continuation line appear.

>> Use <Backspace>s to delete the text until the line fits on one window
   line again.  The continuation line goes away.

You can delete a Newline character just like any other character.
Deleting the Newline character between two lines merges them into
one line.  If the resulting combined line is too long to fit in the
window width, it will be displayed with a continuation line.

>> Move the cursor to the beginning of a line and type <Backspace>.  This
   merges that line with the previous line.

>> Type <Return> to reinsert the Newline you deleted.

Remember that most XEmacs commands can be given a repeat count;
this includes text characters.  Repeating a text character inserts
it several times.

>>  Try that now -- type M-8 * to insert ********.

You've now learned the most basic way of typing something in
XEmacs and correcting errors.  You can delete by words or lines
as well.  Here is a summary of the delete operations:

	<Backspace>   delete the character just before the cursor
        <Delete>      delete the next character after the cursor
	C-d   	      same as <Delete> but works on TTY's

	M-<Backspace> cut ("kill") the word immediately before the cursor
	M-<Delete>    cut ("kill") the next word after the cursor
        M-d	      same as M-<Delete> but works on TTY's

	C-k	      cut ("kill") from the cursor position to end of line
	M-k	      cut ("kill") to the end of the current sentence

Notice again the parallelism with no modifier vs. CONTROL vs. META that
was mentioned earlier -- although the parallels are not perfect.

(In the violent old days when Emacs first began, removing text that
could later be re-inserted was called "killing", and re-inserting was
called "yanking" -- evidently the designers of Emacs must have been
thinking of role-playing games, where killed characters could be easily
resurrected with the wave [yank?] of a magic wand.  In the more genteel
[and realistic] times we live in, the preferred terms are "cut" and
"paste".)

You can also kill any part of the buffer with one uniform method.  Under
window systems, the preferred method is to move to one end of that part,
hold the SHIFT key down, and use the cursor keys to move to the other
end.  Then release the SHIFT key and type C-w.  That kills all the text
between the two positions.

An alternative method, which also works on TTY's, is to move to one end of
the text, and type C-@ or C-<Space> (either one).
Move to the other end and type C-w.

>> Move the cursor to the A at the start of the previous paragraph.
>> Hold the SHIFT key down.
>> Move the cursor to the n in "end", on the third line of the
   paragraph.
>> Release the SHIFT key and type C-w.  This will kill the text starting
   from the A, and ending just before the n.

Now try it the other way.

>> Type C-/ to undo the killing, or C-_ or C-x u on TTY's.
>> Move the cursor to the same A again.
>> Type C-<Space>.  XEmacs should display a message "Mark set"
   at the bottom of the frame.
>> Move the cursor to the n in "end", on the third line of the
   paragraph.
>> Type C-w.  You will get the same result as previously.

The difference between "killing" and "deleting" is that "killed" text
can be reinserted, whereas "deleted" things cannot be reinserted.
Reinsertion of killed text is called "yanking".  Generally, the
commands that can remove a lot of text kill the text (they set up so
that you can yank the text), while the commands that remove just one
character, or just blank lines and spaces, do deletion (so you cannot
yank that text).

Normally, on a window system "killing" text stores it internally but
also puts it on the clipboard, just like Cut in a word processor, and
"yanking" takes text from the clipboard if available, just like Paste.
(This connection to the clipboard can be turned off from the Options
menu.) There are also menu items, "Edit->Cut" and "Edit->Paste", that
always connect with the clipboard, and equivalent Cut and Paste keys on
Sun keyboards.

>> Move the cursor to the  beginning of a line which is not empty.
   Then type C-k to kill the text on that line.
>> Type C-k a second time.  You'll see that it kills the Newline
   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 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.  M-2 C-k kills two
lines and their newlines; typing C-k twice would not do that.

Bringing back killed text is called "yanking".  (Think of it as
yanking back, or pulling back, some text that was taken away.)  You
can yank the killed text either at the same place where it was killed,
or at some other place in the buffer, or even in a different file.
You can yank the text several times, which makes multiple copies of
it.

The command for yanking is C-y.  It reinserts the last killed text,
after the current cursor position.

>> Try it; type C-y to yank the text back.

If you do several C-k's in a row, all of the killed text is saved
together, so that one C-y will yank all of the lines at once.

>> Do this now, type C-k several times.

Now to retrieve that killed text:

>> Type C-y.  Then move the cursor down a few lines and type C-y
   again.  You now see how to copy some text.

What do you do if you have some text you want to yank back, and then
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
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
it is.

If you M-y enough times, you come back to the starting point (the most
recent kill).

>> Kill a line, move around, kill another line.
   Then do C-y to get back the second killed line.
   Then do M-y and it will be replaced by the first killed line.
   Do more M-y's and see what you get.  Keep doing them until
   the second kill line comes back, and then a few more.
   If you like, you can try giving M-y positive and negative
   arguments.


* UNDO
------

If you make a change to the text, and then decide that it was a mistake,
you can undo the change with the undo command, C-/. (On TTY's, use C-_,
i.e. CONTROL + underscore, which is normally above the minus sign;
i.e. you will have to hold the SHIFT key down, as in CONTROL + SHIFT +
minus.  If that doesn't work, you can fall back to C-x u; but that has
the unfortunate property that it's difficult to execute several times in
a row.)

Normally, C-/ undoes the changes made by one command; if you repeat
the C-/ several times in a row, each repetition undoes one
additional command.

But there are two exceptions: commands that do not change the text do
not count (this includes cursor motion commands and scrolling
command), and self-inserting characters are usually handled in groups
of up to 20.  (This is to reduce the number of C-/'s you have to
type to undo insertion of text.)

>> Kill this line with C-k, then type C-/ and it should reappear.

A numeric argument to C-/ acts as a repeat count.

If you change your mind and want to redo changes that you've undone,
issue any command other than Undo (usually people move the cursor), and
then start undoing again.  This will undo your Undo changes; keep
hitting Undo, and you will eventually undo all the Undo's, and start
undoing your original changes.  Essentially, XEmacs treats each Undo as
a further change, and records them for undoing just like regular
commands; but as long as you keeping issuing Undo commands directly
after previous ones, XEmacs remembers where you are in the Undo history
so it can keep undoing.  Once you issue another command, XEmacs
"forgets" and resets its internal pointer to the end of the Undo
history.  This may seem confusing, so try it out:

>> Type a line of text above this one.
>> Move to the end of the line you just typed, and hit <Backspace>
   until you've deleted all characters.
>> Type C-/ a number of times to undo some of your deletions.
>> Move the cursor left.
>> Start typing C-/ again, and it will redo your deletions until there's
   no text left, then it will start undoing the original deletions.
   When all the text appears again, further C-/'s will undo the text you
   originally typed, in groups of up to 20 (see above).

As you just saw, you can undo deletion of text just as you can undo
killing of text.  The distinction between killing something and deleting
it affects whether you can yank it with C-y; it makes no difference for
undo.


* USING THE MOUSE
-----------------

On window systems, XEmacs is fully integrated with the mouse.  You can
position the text cursor by clicking the left button at the desired
location, and you can select text by dragging the left mouse button
across the text you want to select. (Or alternatively, click the left
mouse button at one end of the text, then move to the other end and use
Shift-click to select the text.)

The middle mouse button is commonly used to choose items that are
visible on the screen.  For example, if you enter Info (the on-line
XEmacs documentation) using C-h i or the Help menu, you can follow a
highlighted link by clicking the middle mouse button on it.  Similarly,
if you are typing a file name in (e.g. when prompted by "Find File") and
you hit <Tab> to show the possible completions, you can click the middle
mouse button on one of the completions to select it.  If you have a
two-button mouse, such as some MS Windows systems, you can click both
buttons simultaneously to simulate the middle button.

The right mouse button brings up a popup menu, called a "context menu"
because the contents vary depending on what context you're in, such as
the mode of the window you click in or the text under the mouse.  The
menu usually contains the commands most relevant to where you clicked,
so they're easier to access.

>> Press the right mouse button now.

Under X Windows, you may have to hold the button down in order to keep
the menu up.


* FILES
-------

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 XEmacs goes
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
XEmacs.  In many ways, it is as if you were editing the file itself.
However, the changes you make using XEmacs do not become permanent
until you "save" the file.  This is so you can avoid leaving a
half-changed file on the system when you do not want to.  Even when
you save, XEmacs leaves the original file under a changed name in case
you later decide that your changes were a mistake.

If you look near the bottom of the frame you will see a line that begins
and ends with dashes, and contains the string "XEmacs: TUTORIAL" or
something like that.  This part of the frame 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 XEmacs tutorial.
When you find a file with XEmacs, 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

XEmacs asks you to type the file name.  The file name you type appears
on the bottom line of the frame.  The bottom line is called the
minibuffer when it is used for this sort of input.  You can use
ordinary XEmacs editing commands to edit the file name.

While you are entering the file name (or any minibuffer input),
you can cancel the command with C-g.

>> Type C-x C-f, then type C-g.  This cancels the minibuffer,
   and also cancels the C-x C-f command that was using the
   minibuffer.  So you do not find any file.

When you have finished entering the file name, type <Return> to
terminate it.  Then C-x C-f command goes to work, and finds the file
you chose.  The minibuffer disappears when the C-x C-f command is
finished.

In a little while the file contents appear on the screen, and you can
edit the contents.  When you wish to make your changes permanent,
type the command

	C-x C-s   Save the file

This copies the text within XEmacs into the file.  The first time you
do this, XEmacs renames the original file to a new name so that it is
not lost.  The new name is made by adding "~" to the end of the
original file's name.

When saving is finished, XEmacs displays the name of the file written.
You should save fairly often, so that you will not lose very much
work if the system should crash.

>> Type C-x C-s, saving your copy of the tutorial.
   This should show "Wrote ...TUTORIAL" at the bottom of the frame.

NOTE: On some older TTY connections, typing C-s will freeze the screen
and you will see no further output from XEmacs.  This indicates that an
operating system "feature" called "flow control" is intercepting the C-s
and not letting it get through to XEmacs.  To unfreeze the screen, type
C-q.  Then see the section "Spontaneous Entry to Incremental Search" in
the XEmacs manual for advice on dealing with this "feature".

You can find an existing file, to view it or edit it.  You can also
find a file which does not already exist.  This is the way to create a
file with XEmacs: find the file, which will start out empty, and then
begin inserting the text for the file.  When you ask to "save" the
file, XEmacs will really create the file with the text that you have
inserted.  From then on, you can consider yourself to be editing an
already existing file.


* BUFFERS
---------

If you find a second file with C-x C-f, the first file remains
inside XEmacs.  You can switch back to it by finding it again with
C-x C-f.  This way you can get quite a number of files inside XEmacs.

>> Create a file named "foo" by typing  C-x C-f foo <Return>.
   Then insert some text, edit it, and save "foo" by typing  C-x C-s.
   Finally, type C-x C-f TUTORIAL <Return>
   to come back to the tutorial.

XEmacs stores each file's text inside an object called a "buffer".
Finding a file makes a new buffer inside XEmacs.  To see a list of the
buffers that currently exist in your XEmacs job, type

	C-x C-b   List buffers

>> Try C-x C-b now.

See how each buffer has a name, and it may also have a file name
for the file whose contents it holds.  Some buffers do not correspond
to files.  For example, the buffer named "*Buffer List*" does
not have any file.  It is the buffer which contains the buffer
list that was made by C-x C-b.  ANY text you see in an XEmacs window
is always part of some buffer.

>> Type ESC ESC to get rid of the buffer list. (Remember, three ESC's
   under TTY's.)

If you make changes to the text of one file, then find another file,
this does not save the first file.  Its changes remain inside XEmacs,
in that file's buffer.  The creation or editing of the second file's
buffer has no effect on the first file's buffer.  This is very useful,
but it also means that you need a convenient way to save the first
file's buffer.  It would be a nuisance to have to switch back to
it with C-x C-f in order to save it with C-x C-s.  So we have

	C-x s     Save some buffers

C-x s asks you about each buffer which contains changes that you have
not saved.  It asks you, for each such buffer, whether to save the
buffer.

>> Insert a line of text, then type C-x s.
   It should ask you whether to save the buffer named TUTORIAL.
   Answer yes to the question by typing "y".


* EXTENDING THE COMMAND SET
---------------------------

There are many, many more XEmacs commands than could possibly be put
on all the control and meta characters.  XEmacs gets around this with
the X (eXtend) command.  This comes in two flavors:

	C-x	Character eXtend.  Followed by one character.
	M-x	Named command eXtend.  Followed by a long name.

These are commands that are generally useful but used less than the
commands you have already learned about.  You have already seen two of
them: the file commands C-x C-f to Find and C-x C-s to Save.  Another
example is the command to end the XEmacs session--this is the command
C-x C-c.  (Do not worry about losing changes you have made; C-x C-c
offers to save each changed file before it kills the XEmacs.)

If you have installed the sample init.el file (we highly recommend this,
once you've gotten some familiarity with XEmacs; see "Help->Samples->View
Sample init.el"), you will find that C-x C-c does not exit XEmacs, but
instead outputs a message.  This is intentional, since C-x C-c is easy to
hit accidentally.  Instead, use the "File->Exit XEmacs" menu item to exit.

If you are on a TTY, and you want to exit temporarily to execute a shell
command, you should use C-z instead of C-x C-c.  Under TTY's, C-z
"suspends" XEmacs; that is, it returns to the shell but does not destroy
the XEmacs.  In the most common shells, you can resume XEmacs with the
`fg' command or with `%xemacs'. (On systems which do not implement
suspending, C-z creates a subshell running under XEmacs to give you the
chance to run other programs and return to XEmacs afterward; it does not
truly "exit" from XEmacs.  In this case, the shell command `exit' is the
usual way to get back to XEmacs from the subshell.)

There are many C-x commands.  Here is a list of the ones you have learned:

	C-x C-f		Find file.
	C-x C-s		Save file.
	C-x C-b		List buffers.
	C-x C-c		Quit XEmacs.
	C-x 0		Delete the current window.
	C-x u		Undo (TTY version).

Named eXtended commands are commands which are used even less
frequently, or commands which are used only in certain modes.  An
example is the command replace-string, which globally replaces one
string with another.  When you type M-x, XEmacs prompts you at the
bottom of the frame with M-x and you should type the name of the
command; in this case, "replace-string".  Just type "repl s<Tab>" and
XEmacs will complete the name.  (<Tab> is the Tab key, usually found
above the CapsLock or Shift key near the left edge of the keyboard.)
End the command name with <Return>.

The replace-string command requires two arguments--the string to be
replaced, and the string to replace it with.  You must end each
argument with <Return>.

>> Move the cursor to the blank line two lines below this one.
   Then type M-x repl s<Return>changed<Return>altered<Return>.

   Notice how this line has changed: you've replaced
   the word c-h-a-n-g-e-d with "altered" wherever it occurred,
   after the initial position of the cursor.


* AUTO SAVE
-----------

When you have made changes in a file, but you have not saved them yet,
they could be lost if your computer crashes.  To protect you from this,
XEmacs periodically writes an "auto save" file for each file that you
are editing.  The auto save file name has a # at the beginning and the
end; for example, if your file is named "hello.c", its auto save file's
name is usually "#hello.c#".  When you save the file in the normal way,
XEmacs deletes its auto save file.

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
data.


* ECHO AREA
-----------

If XEmacs sees that you are typing multicharacter commands slowly, it
shows them to you at the bottom of the frame in an area called the
"echo area".  The echo area contains the bottom line of the frame.


* MODELINE
----------

The line immediately above the echo area it is called the "modeline".
The mode line says something like this:

--**-XEmacs: TUTORIAL          (Fundamental)--L670--58%----------------

This line gives useful information about the status of XEmacs and
the text you are editing.

You already know what the filename means--it is the file you have
found.  -NN%-- indicates your current position in the text; it means
that NN percent of the text is above the top of the window.  If the
top of the file is on the screen, it will say --Top-- instead of
--00%--.  If the bottom of the text is on the screen, it will say
--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.

The part of the mode line inside the parentheses is to tell you what
editing modes you are in.  The default mode is Fundamental which is
what you are using now.  It is an example of a "major mode".  

XEmacs has many different major modes.  Some of them are meant for
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.

Each major mode makes a few commands behave differently.  For example,
there are commands for creating comments in a program, and since each
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
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>.

Don't worry, none of the XEmacs commands you have learned changes in
any great way.  But you can observe that C-<Right> and C-<Left> now treat
apostrophes as part of words.  Previously, in Fundamental mode,
C-<Right> and C-<Left> treated apostrophes as word-separators.

Major modes usually make subtle changes like that one: most commands
do "the same job" in each major mode, but they work a little bit
differently.

To view documentation on your current major mode, type C-h m.

>> Use M-4 C-l to bring this line near the top of the window.
>> Type C-h m, to see how Text mode differs from Fundamental mode.
>> Type q to remove the documentation from the screen.

Major modes are called major because there are also 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, XEmacs 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 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 "
   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.

The margin is usually set at 70 characters, but you can change it
with the C-x f command.  You should give the margin setting you want
as a numeric argument.

>> Type C-x f with an argument of 20.  (M-20 C-x f).
   Then type in some text and see XEmacs fill lines of 20
   characters with it.  Then set the margin back to 70 using
   C-x f again.

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
-----------

XEmacs can do searches for strings (these are groups of contiguous
characters or words) either forward through the text or backward
through it.  Searching for a string is a cursor motion command;
it moves the cursor to the next place where that string appears.

The XEmacs search command is different from the search commands
of most editors, in that it is "incremental".  This means that the
search happens while you type in the string to search for.

The command to initiate a search is C-s for forward search, and C-r
for reverse search.  BUT WAIT!  Don't try them now.

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 XEmacs is in what is
called an incremental search waiting for you to type the thing that
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
   character to notice what happens to the cursor.
   Now you have searched for "cursor", once.
>> Type C-s again, to search for the next occurrence of "cursor".
>> Now type <Backspace> four times and see how the cursor moves.
>> Type <Return> to terminate the search.

Did you see what happened?  XEmacs, in an incremental search, tries to
go to the occurrence of the string that you've typed out so far,
highlighting it for your convenience.  To go to the next occurrence of
'cursor' just type C-s again.  If no such occurrence exists XEmacs
beeps and tells you the search is currently "failing", C-g would also
terminate the search.

NOTE: On some older TTY connections, typing C-s will freeze the screen
and you will see no further output from XEmacs.  This indicates that an
operating system "feature" called "flow control" is intercepting the C-s
and not letting it get through to XEmacs.  To unfreeze the screen, type
C-q.  Then see the section "Spontaneous Entry to Incremental Search" in
the XEmacs manual for advice on dealing with this "feature".

If you are in the middle of an incremental search and type <Backspace>,
you'll notice that the last character in the search string is erased
and the search backs up to the last place of the search.  For
instance, suppose you have typed "c", to search for the first
occurrence of "c".  Now if you type "u", the cursor will move
to the first occurrence of "cu".  Now type <Backspace>.  This erases
the "u" from the search string, and the cursor moves back to
the first occurrence of "c".

If you are in the middle of a search and type a control or meta
character (with a few exceptions--characters that are special in
a search, such as C-s and C-r), the search is terminated.

The C-s starts a search that looks for any occurrence of the search
string AFTER the current cursor position.  If you want to search for
something earlier in the text, type C-r instead.  Everything that we
have said about C-s also applies to C-r, except that the direction of
the search is reversed.


* MULTIPLE "WINDOWS" (I.E. PANES)
---------------------------------

One of the nice features of XEmacs is that you can split the current
frame (i.e. window-system window) into more than one pane, or "window"
in XEmacs parlance.

>> Move the cursor to this line and type M-0 C-l (that's zero, not Oh,
   and CONTROL-L, not CONTROL-1).

>> Now type C-x 2 which splits the frame into two windows.
   Both windows display this tutorial.  The cursor stays in the top window.

>> Type M-<Next> to scroll the bottom window.
   (C-M-v on TTY's.  If you do not have a real META key, type ESC C-v.)

>> Type C-<Tab> to move the cursor to the bottom window. (Use C-x o -- "o"
   for "other" -- on TTY's.)

>> Use <Next> and <Prior> in the bottom window to scroll it.
   Keep reading these directions in the top window.

>> Type C-<Tab> again to move the cursor back to the top window.
   The cursor in the top window is just where it was before.

You can keep using C-<Tab> to switch between the windows.  Each
window has its own cursor position, but only one window actually
shows the cursor.  All the ordinary editing commands apply to the
window that the cursor is in.  We call this the "selected window".

If you have more than two windows, C-<Tab> cycles between them, and
C-Sh-<Tab> (i.e. CONTROL-SHIFT-TAB) in the opposite direction. (There is
no TTY equivalent for C-Sh-<Tab>.)

The commands M-<Prior> and M-<Next> are very useful when you are editing
text in one window and using the other window just for reference.  You
can keep the cursor always in the window where you are editing, and
scroll forward or back through the other window with these commands.

On TTY's, use C-M-v in place of M-<Next>, and there's no equivalent of
M-<Prior>.  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 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
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 had typed C-x 1 in the bottom window, that would get rid
of the top one.  Think of this command as "Keep just one
window--the window I am already in.")

You do not have to display the same buffer in both windows.  If you
use C-x C-f to find a file in one window, the other window does not
change.  You can find a file in each window independently.

Here is another way to use two windows to display two different
things:

>> Type C-x 4 f followed by the name of one of your files.
   End with <Return>.  See the specified file appear in the bottom
   window.  The cursor goes there, too.

>> Type C-<Tab> to go back to the top window, and C-x 1 to delete
   the bottom window.


* MULTIPLE "FRAMES" (I.E. WINDOW-SYSTEM WINDOWS)
------------------------------------------------

On window systems, you can also create multiple "frames", or
window-system windows.  These exist independently of each other at the
top level, just like separate programs. (There is no support for the MS
Windows feature called MDI, or Multiple Document Interface, where
multiple overlapping child windows exist inside of a single top-level
window.)

The commands for frames are similar to those for windows, but begin with
"C-x 5".

>> Type C-x 5 2 to create a new frame.

>> Move the mouse into it, and click. (On X Windows, you may not need
   to click; this depends on the window manager.)

>> Scroll up or down.  Note that, just like for XEmacs windows, two frames
   can be showing the same buffer but in different positions.

>> Type C-x 2.  Note that each frame can have separate windows,
   independently of other frames.

>> Type C-x 5 o (or Alt-Tab under MS Windows) to go back to the first frame.
   (That's a small Oh, for "other".)

>> Type C-x 5 0 to kill the old frame. (That's a zero.)

>> Note that we're still here!  XEmacs will not exit until all frames
   are deleted, no matter what order they were created in.

>> Type C-x 1 to get back to one window.

You can also use C-x 5 f to open a file in a new frame, just like C-x 4
f opens a file in a new window in the same frame.


* RECURSIVE EDITING LEVELS
--------------------------

Sometimes you will get into what is called a "recursive editing
level".  This is indicated by square brackets in the mode line,
surrounding the parentheses around the major mode name.  For
example, you might see [(Fundamental)] instead of (Fundamental).

To get out of the recursive editing level, use the all-purpose escape
mechanism mentioned earlier: ESC ESC. (Remember, it's ESC ESC ESC on
TTY's.)  You can also use it for eliminating extra windows, canceling a
selection, and getting out of the minibuffer.

>> Type M-x to get into a minibuffer; then type ESC ESC to get out.

You cannot use C-g to get out of a recursive editing level.  This is
because C-g is used for canceling commands and arguments WITHIN the
recursive editing level.


* GETTING MORE HELP
-------------------

In this tutorial we have tried to supply just enough information to
get you started using XEmacs.  There is so much available in XEmacs that
it would be impossible to explain it all here.  However, you may want
to learn more about XEmacs since it has many other useful features.
XEmacs provides commands for reading documentation about XEmacs
commands.  These "help" commands all start with the character
CONTROL-h, which is called "the Help character".

To use the Help features, type the C-h character, and then a
character saying what kind of help you want.  If you are REALLY lost,
type C-h ? ? and XEmacs will tell you what kinds of help it can give.
If you have typed C-h and decide you do not want any help, just
type C-g to cancel it.

(Note for TTY users: 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 frame, try
typing the F1 key or M-? instead.)

The most basic HELP feature is C-h c.  Type C-h, the character c, and
a command character or sequence; then XEmacs displays a very brief
description of the command.

>> Type C-h c <Up>.
  The message should be something like

	up runs the command previous-line

This tells you the "name of the function".  Function names are used
mainly for customizing and extending XEmacs.  But since function names
are chosen to indicate what the command does, they can serve also as
very brief documentation--sufficient to remind you of commands you
have already learned.

Multi-character commands such as C-x C-s and <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 <Up>.

This displays the documentation of the function, as well as its
name, in an XEmacs window.  When you are finished reading the
output, type q to get rid of the help text.

Here are some other useful C-h options:

   C-h f	Describe a function.  You type in the name of the
		function.

>> Try typing C-h f previous-line<Return>.
   This displays all the information XEmacs has about the
   function which implements the <Up> command.

A similar command C-h v displays the documentation of variables whose
values you can set to customize XEmacs behavior.  You need to type in
the name of the variable when XEmacs prompts for it.

   C-h a	Hyper Apropos.  Type in a keyword and XEmacs will list
		all the functions and variables whose names contain
		that keyword.  For commands that can be invoked with
		META-x, an asterisk will be displayed to the left.

>> Type C-h a newline<Return>.

This displays a list of all functions and variables with "newline" in
their names.  Press <Return> or click the middle mouse button to find
out more about a function or variable.  Type `q' to exit hyper-apropos.

   C-h i	Read On-line Manuals (a.k.a. Info).  This command puts
                you into a special buffer called `*info*' where you can
                read on-line manuals for the XEmacs packages installed
                on your system.  Type m xemacs <Return> to read the
                XEmacs manual.  If you have never before used Info, type
                ? and XEmacs will take you on a guided tour of Info mode
                facilities.  Once you are through with this tutorial,
                you should consult the XEmacs Info manual as your
                primary documentation.

* CONCLUSION
------------

Remember, to exit XEmacs permanently use the menu item "File->Exit XEmacs",
or type C-x C-c.  On TTY's, to temporarily exit to a shell, so that you can
come back in, use C-z.

This tutorial is meant to be understandable to all new users, so if you
found something unclear, don't sit and blame yourself - complain!


COPYRIGHTS, COPYING, ORIGINS
----------------------------

Copyright (c) 1985, 1996, 2012 Free Software Foundation.
Copyright (c) 2001 Ben Wing.
This tutorial is synched with FSF 21.0.106.

This tutorial descends from a long line of Emacs tutorials starting with
the one written by Stuart Cracraft for the original Emacs.  Ben Wing
updated the tutorial for X Windows.  Martin Buchholz and Hrvoje Niksic
added more corrections for XEmacs.  Ben Wing later synched up to FSF
21.0.105 and rehashed many sections to match the current XEmacs norms.

This version of the tutorial, like XEmacs, is copyrighted, and
comes with permission to distribute copies on certain conditions:

   Permission is granted to anyone to make or distribute verbatim copies
   of this document as received, in any medium, provided that the
   copyright notice and permission notice are preserved,
   and that the distributor grants the recipient permission
   for further redistribution as permitted by this notice.

   Permission is granted to distribute modified versions
   of this document, or of portions of it,
   under the above conditions, provided also that they
   carry prominent notices stating who last altered them.

The conditions for copying XEmacs itself are more complex, but in the
same spirit.  Please read the file COPYING and then do give copies of
XEmacs to your friends.  Help stamp out software obstructionism
("ownership") by using, writing, and sharing free software!
