Search                        Top                                  Index
TEACH BUFFERS                                Revised: A. Sloman Oct 1987


              MOVING AROUND FROM ONE FILE TO ANOTHER IN VED
              =============================================

This file assumes you have already  worked through TEACH TEACH and  that
you know how  to move  the cursor  around the  window, how  to make  the
window move up or down  the file you are  looking at using the  SCREENUP
and SCREENDOWN keys, how to insert and  delete text in a file, etc.  You
should also read TEACH VED  before this one, to  find out how to  create
files of your own, quit files, save them on the magnetic disc etc.

You should by  now have  learnt how to  switch between  two files  using
<ESC> x. If  you don't remember  how to do  it read TEACH  SWITCHWINDOW,
i.e. do:

    <ENTER> teach switchwindow <RETURN>

Use <ENTER> q

to "quit" that file when you have finished.

Occasionally when you  are developing  programs you will  find that  you
have more than two files 'on the  boil'. To be more precise, there  will
be temporary copies of the files stored in the editor VED, and for  each
one VED will remember how far you  have got, what changes you have  made
so far, etc.

But it is not possible (unless you have a very large screen with lots of
lines) to see more than TWO of the files at a time. This can make things
difficult, since the key-sequence <ESC> x will only switch you back  and
forth between two files. If  there is a third file,  how can you get  at
it?

One way is to ask for it by name - the same way as you originally got it
into the editor. E.g. to get this file you had to do: teach buffers. You
can always get this file back on the screen by doing:
    <ENTER> teach buffers

To prove  that, get  two more  teach files  onto the  screen, using  the
following command

    <ENTER> teach window

That will get TEACH WINDOW onto the  screen and put the cursor into  it,
then do:

    <ENTER> teach switchwindow

That will put another TEACH file  on the screen obscuring this one.  You
can then do

    <ENTER> teach buffers

That will put this file back in view.

Whenever a file is brought back into  view by an ENTER TEACH command  or
an ENTER VED  command, it leaves  the previous file  visible. So if  the
previous file was in the upper half  of the screen the new file will  be
in the lower half of  the screen. This can  seem a little confusing,  as
files will not necessarily re-appear where you last saw them if you have
more than three files on the go.

Try using <ENTER>  teach commands like  those above to  switch from  one
teach file to another.  Move the cursor to  different places each  time,
and notice how whe you go back to a file VED remembers where you were.

However if you QUIT a teach file, using ENTER q, then if you go back  to
it with an ENTER teach command VED will put you at the beginning of  the
file. Try that with TEACH WINDOW. I.e.  go to the file, move to the  end
of the file, then 'quit' it with ENTER q, then use

    ENTER teach window

to get back to it. You'll see that the cursor is put at the beginning of
the file.

NOTE: this file is called TEACH BUFFERS because we use the word 'buffer'
as a jargon  word to refer  to the temporary  copy of a  file which  VED
creates when you are editing the  file. There isn't really much  obvious
connection between this use of the  word and its ordinary meaning:  e.g.
it has nothing to do with railway buffers or buffer states. However,  it
is now common in computing jargon to use the word 'buffer' to refer to a
temporary store of information.

Thus when you are editing six files using VED we say that there are  six
buffers in VED.


-- QUITTING A FILE WITH ENTER q --------------------------------------

If you use ENTER teach to read a teach file, then that creates an  extra
buffer in VED. That buffer will stay there until you either log out,  or
tell VED that you want to 'Quit' that file by getting the file onto  the
screen (as explained  below) then typing  ENTER q. ENTER  q will  always
immediately get  rid of  a teach  file from  VED (though  the  permanent
version will remain on the disk.) However  if you use ENTER q on one  of
your own files VED  will first check whether  you have done anything  to
change the buffer. If you have, then  before it lets you quit VED  makes
sure that you really meant to.


To get a taste of that create a new file called junk1 with the command

        ENTER ved junk1

(use some other name if  you already have a  file with that name).  Then
type some rubbish in the file. Then try ENTER q. VED checks whether  you
want the file stored on  disc. You can press the  N key to quit  without
saving the file.

NB. If you have more than two files in VED then at most two of them  can
be visible at once. Although  the others are temporarily invisible,  the
buffers still  exist:  VED  keeps detailed  records  in  the  computer's
temporary memory. So  the disappearance from  the screen doesn't  always
mean the buffer has  gone. However when you  QUIT a file, using  ENTER q
then there is  no longer any  buffer for  that file in  VED. An  earlier
version may still exist on the disk, however, so that you can look at it
later. But any changes you have made during the current session will not
be recorded if you've Quit the file  and answered 'n' when asked if  VED
should write it.


-- SWITCHING BETWEEN YOUR OWN AND TEACH FILES -------------------------------

Just as you can do

    ENTER teach <name>

to go to a teach file called <name> , so you can use

    ENTER ved <name>

to go to a file of your own called <name>. To get some practice at doing
this try the following. Read the next set of instructions up to the  row
of asterisks and make a note of what  you have to do, since by the  time
you are half  way through,  the instructions will  no longer  be on  the
screen (though you can always get them back on the screen by ENTER teach
buffers).


-- SWITCHING BETWEEN YOUR OWN FILES -----------------------------------

Read down to the row of asterisks before you try out the suggestions  in
this section.

Create a new file of your own called TEST1 by giving the command

    ENTER ved test1

Then type into it something like 'This is my file called TEST1' Create a
new file of your own called TEST2 by giving the command

    ENTER ved test2

Then type into it  something like 'This is  my file called TEST2'  (That
file will cover up  these instructions.) Create a  new file of your  own
called TEST3 by giving the command

     ENTER ved test3

Then type into it  something like 'This is  my file called TEST3'  (That
file will cover up  your TEST1 file.) Try  switching back to your  TEST1
file by means of the command

     ENTER ved test1

Switch to each of the other files,  TEST2 and TEST3, in turn. Return  to
this file with the command

     ENTER teach buffers

(Actually 'ENTER teach' alone will do, as VED remembers which teach file
you were on - i.e. teach buffers - as long as you have not quit the file
with ENTER q)

Now return to the last of your own files, with the command

     ENTER ved

(If you don't give ENTER VED a  file name, it assumes you want the  same
file you last  looked at, other  than teach files.  However it will  not
take you back to a file which you have QUIT with ENTER q.) (Why not?)

Now return to this file using

      ENTER teach

Make sure  you have  a good  idea what's  going to  happen when  you  go
through those steps.
*************************NOW TRY DOING ALL THAT*************************


-- USING ESC e TO FIND OUT WHAT BUFFERS YOU HAVE -----------------------

The commands you have so far learnt  will enable you to get to any  file
you want at  any time.  However, if  you have  been working  on lots  of
files, you can easily forget which files are in the editor. You can  ask
VED to give you a list of  the names of files currently being looked  at
with the <ESC> e command. I.e.

    Press: <ESC>
    Type: e

For each file it will print out the name of the file, and an  associated
number. You can then  press the key corresponding  to the number to  get
that file on the screen.

If you are only looking at one file,  it will say so and go 'beep'.  Try
<ESC> e, and see what  it prints on the command  line. If you have  only
this file in VED, first get another file in, e.g. ved junk. To come back
to this file press  the number corresponding to  'buffers' (the name  of
this teach file).

Try using  <ESC>  e to  switch  from one  file  to another  by  pressing
different numbers. The last  file you were editing  is always No 1.  The
one you looked at before that is No 2. etc. That is, every time you  get
a file onto the screen it is brought to the front of the list.

If you end up with so many files that their names will not appear on the
command line, <ESC>  e will  create a temporary  file and  show you  the
names in that. Then, as before you can select your file by pressing  the
appropriate number. But you are unlikely to get that many files going at
once, unless you have been using VED for some time.

Before you  finish with  this file  you should  cycle through  all  your
'junk' files (if you created any, as suggested above) and do ENTER q  in
them, to stop them being  stored on the disk  when you log out,  wasting
disk space.


-- REVISION QUESTIONS --------------------------------------------------

You should  be keeping  a file  (called 'vednotes')  with a  summary  of
things you have learnt, or at least making notes using pencil and paper.
Add  what  you've  learnt  about  switching  files  to  your  notes.  In
particular note the answers to the following questions:

    What is a buffer?
    What does ESC x do? (See TEACH SWITCHWINDOW)
    What does ENTER q do?
    How does ENTER q treat a teach file differently from your own file?
    What options does ENTER q give you if you try to quit a file of your
        own after inserting or deleting some characters?
    What happens if you type 'y' after the quit command?
    If you are looking at one of your files, how can you get back to the
        last teach file you were looking at?
    If you are looking at a teach file, how can you get back to the last
        of your own files you were looking at?
    If you want to get back to  one of your files called TEST2, and  you
        are not sure that it was the  last one you were looking at,  how
        can you get back to it?
    If you want to get back to TEACH WINDOW and it wasn't the last teach
        file you were looking at, how can you get back to it?
    How can  you  find  out  which VED  buffers  are  currently  in  the
        temporary store?
    If you've made changes  to a file  and you want  them stored on  the
        disk, what command should you give?
    What does <ESC> e do?
    What number does <ESC> e give to the last file you were looking at?

    What is the difference between <ESC> w and <ENTER> w ?
        (See TEACH VED for <ENTER> w)


Suitable teach files to look at next if you have not already seen them:
TEACH VED, TEACH MOREVED, TEACH MARK, TEACH VEDPOP


CONTENTS OF THIS FILE
- (Use <ENTER> g to access required sections)

 -- QUITTING A FILE WITH ENTER q
 -- SWITCHING BETWEEN YOUR OWN AND TEACH FILES
 -- SWITCHING BETWEEN YOUR OWN FILES
 -- USING ESC e TO FIND OUT WHAT BUFFERS YOU HAVE
 -- REVISION QUESTIONS

--- C.all/teach/buffers ------------------------------------------------
--- Copyright University of Sussex 1987. All rights reserved. ----------