/* TEACH-EMACS-SUIX-3, EMACSSRC>EMACS*, Environments group, 09/11/84
/* EMACS Tutorial for Standard User Interface with eXtensions - file 3 of 4
/* Copyright (c) 1984, Prime Computer Inc., Natick, MA 01760

You are looking at Part 3 of the EMACS tutorial for the standard interface
with extensions.  This module will teach you the following EMACS functions:

     File management
     Buffer management
     Window management
     Overlay mode

This tutorial  assumes  that  you  have mastered the basic EMACS commands
discussed in TEACH-EMACS-SUIX-1 & 2.  If you don't feel comfortable using those
commands, you should go back to TEACH-EMACS-SUIX-1 or 2 and practice with
them for a while.

Note:  This tutorial follows the  conventions of TEACH-EMACS-SUIX-1 -- you are
expected to press {NEXT SCREEN} when you come to the end of each screen and
follow all instructions preceded by ">>".


Remember that you can use  the  search  commands  to  refer  to  the  "Command
Summary" sections if you want information about commands quickly.


BUFFERS
_______

One of  EMACS' nicest features is its ability to control more than one file at
a time.  It does this by using multiple  buffers.   A  buffer  is  a  sort  of
working environment set aside for you to use to edit text.  Each file you edit
is placed  in  a buffer.  Although you can only edit one buffer at a time, you
can switch to a different one as often as you like.

Each buffer in EMACS has a name, which is always displayed in  parentheses  at
the bottom  of your screen.  The name of the buffer you're working with now is
called  "TEACH-EMACS-SUIX-3".  If you look  down at the bottom of your screen,
you will see it in parentheses.

EMACS buffers generally have the same names as the files they contain.  If you
look down  at  the  bottom  of  your screen again, you'll see that is the case
right now.  The full Prime pathname which describes  this  file  is  displayed
next to the name of the buffer.


The Mode Line
-------------

The area  of  the  screen  that gives you information about your current EMACS
buffer is called the mode line.  As you go along,  you'll  discover  that  the
mode line  gives  you all sorts of information about what's going on in EMACS.

The number following the word "EMACS" on the mode line tells you  the  version
of EMACS  that  you're using.  An asterisk (*) in the mode line tells you that
the current buffer contains modified text that hasn't been saved to a file.

>> To demonstrate, simply press the space bar to insert a space.  Notice that
the asterisk now appears in the mode line.  The asterisk appears no matter how
insignificant the change may seem.

If you don't specify a filename when you start up EMACS, it puts  you  into  a
buffer it  calls  "main".   Otherwise, it puts you into a buffer with the same
name as the file you specified.


Switching to a New Buffer
-------------------------

To switch to or create a new buffer, you can use the {CTRL-X}B command.   This
command prompts  you for a buffer name.  It is similar to the {FIND FILE}
command described in "TEACH-EMACS-SUIX-1", but it lets you choose the name of
the buffer instead of automatically assigning it a name.  This way, you can work
with two different versions of the same file.

Another good thing about creating a buffer yourself is that it doesn't have to
contain a permanent file.  You can use buffers for  different  purposes  while
you're in EMACS without having to worry about a file.

Try {CTRL-X}B  now.   Remember,  that  since  it  switches  you to a different
buffer, these instructions will disappear from your screen.  When you're ready
to come back to this buffer to continue with the tutorial, you'll have to press
{CTRL-X}B again, followed by the buffer name "TEACH-EMACS-SUIX-3" and {RETURN},
to get back.  (As a time-saving hint, {CTRL-X}B{RETURN} will return you to the
LAST buffer you were working with.)


>> Go ahead and type {CTRL-X}B.  When you're prompted for a buffer name, type
   in the  name  NEW  and confirm with {RETURN}.  Once you get to your new
   buffer, insert some text and play around with it for awhile.  When you're
   ready to  come  back  to  this tutorial, type:

     {CTRL-X}B{RETURN}

Notice that EMACS remembered your place when you came  back  to  this  buffer.
This is very useful when you start switching around to many different buffers.


Getting a List of Buffers
-------------------------

When you don't remember the names of all the buffers you've been working with,
you can  use  the  {CTRL-X}{CTRL-B}  command.  It lists all the buffers you've
used so far, the files they contain, whether or not they contain unsaved text,
and how many lines long they are.  Try this command now.


>> Press {CTRL-X}{CTRL-B} and watch a list of buffers appear at the top of your
   screen.  (It will disappear with your next command.)


If TEACH-EMACS-SUIX-3 is the only file you've been working with since
you invoked EMACS, it will be the only one listed. If you've worked with any
others, they will be listed as well.

FILES
_____

When you  work  with a file in EMACS, you are not really working with the file
itself.  Instead, you are working with a copy of the file EMACS has placed  in
a buffer.   As was mentioned in TEACH-EMACS-SUIX-1, you must save your text in a
file if you want to keep it permanently.  If you don't save your changes,  the
original version  of  the file remains unchanged.  Once you save your changes,
they become the new version of the file.


Saving Text ew current buffer.



>> Now move the cursor to window 2 again using {OTHER FILE}.  Then type
   {CTRL-X}B followed by "new" {RETURN} to move the buffer called "new" into
   window  2, making it the current buffer.  Don't forget to use {OTHER FILE}
   to move to the top window when you need to read these instructions.


Notice that  the  mode  line has changed again.  It now reads "new" to reflect
the current buffer.


>> Play around with the text  in  the  two  windows  for  awhile.   Try  using
   different EMACS  commands.   Press {WRITE FILE} to save the text in the
   buffer "new" under any name you choose.  Then put a different  buffer  into
   the bottom window using {FIND FILE} or {CTRL-X}B.


>> When you're ready to get back to one window again, move the cursor  to  the
   top window.  Then press the {2 FILE ON/OFF} key.  Notice that the
   {2 FILE ON/OFF} key switches between one and two windows.

This file will take up the entire screen again.  If you had left the cursor in
the bottom  window,  the  buffer  in  that  window  would now be on the screen
instead.


Command Summary
---------------

These are the commands for working with multiple windows:

                                                              PT45 template
      {2 FILE ON/OFF}    Divides screen into two horizontal    {ON/OFF}
                         windows or make one window again
                         depending on if you had one or two
                         windows before pressing the key.

      {OTHER FILE}       Moves point to other window.


OVERLAY MODE
------------

By now you've worked with EMACS  long  enough  to  notice  how  EMACS  inserts
characters into  a buffer.  As EMACS inserts each new character, it shifts the
text following it on the line over one space.  Sometimes you  won't  want  the
insertion process  to  work this way.  To change it, you can use overlay mode.
Overlay mode permits you to enter new characters onto  a  line  without  moving
other text.

Like other  modes in EMACS, overlay mode works in the current buffer only.  If
you switch to a new buffer, the usual method of inserting text will  still  be
in effect.   However, if you leave the current buffer in overlay mode, work in
a new one, and then go back to the first buffer, EMACS will remember that  you
had overlay mode in effect for that buffer.

Try overlay mode now:


>> Press {INSERT/OVERLAY} to switch to overlay mode.


Watch the notation "overlay" appear in the mode line to remind you that you've
put overlay mode in effect.


>> Then move to a different line of text in this file and press in some text at
   the beginning.  Notice how the new text overwrites  the  old  text  on  the
   line.


>> Now press {INSERT/OVERLAY} to turn off overlay mode.  Again, this is one
   of those "toggle" keys.


The "overlay" notation will disappear from the mode  line  and  any  text  you
insert will be done in the usual manner.


Command Summary
---------------

Use the following command for overlay mode:

     {INSERT/OVERLAY}      Puts overlay mode or insert mode in effect in the
                           current buffer depending on which mode was in effect
                           before pressing the key.


CONCLUSION
----------

This concludes TEACH-EMACS-SUIX-3.


>> If you want to  continue  on  to  TEACH-EMACS-SUIX-4  (or  another  file),
   press {FIND FILE} followed  by TEACH-EMACS-SUIX-4 (or the name of the other
   file) and {RETURN}.


>> If you want to get out of EMACS and back to PRIMOS, press {QUIT EMACS}.
   If you see the message:
        "Above list of modified buffer(s) not saved to file(s).  Quit anyway?"
   Enter "YES".



END OF TEACH-EMACS-SUIX-3
