[mod.sources] v08i032: The JOVE text editor, Part13/13

sources-request@mirror.UUCP (02/05/87)

Submitted by: seismo!rochester!jpayne (Jonathan Payne)
Mod.sources: Volume 8, Issue 32
Archive-name: jove/Part13

[  Now that you've got all the pieces, I'd like comments on the
   way the shell archives were put together into the series.
   Is this worthwhile, or not?  --r$  ]

#! /bin/sh
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
# If all goes well, you will see the message "End of archive 13 (of 13)."
# Contents:  doc/teach-jove
PATH=/bin:/usr/bin:/usr/ucb; export PATH
echo shar: extracting "'doc/teach-jove'" '(24421 characters)'
if test -f 'doc/teach-jove' ; then 
  echo shar: will not over-write existing file "'doc/teach-jove'"
else
sed 's/^X//' >doc/teach-jove <<'@//E*O*F doc/teach-jove//'
XYou are looking at the JOVE tutorial.  This was written by Richard Stallman
Xand modified by Doug Kingston and Jonathan Payne.  Comments on this document
Xshould be sent to payne@rochester. (12 February '86)
X
XJOVE commands generally involve the CONTROL key (sometimes labelled
XCTRL or CTL) or the META key (generally labelled ESCAPE).  Rather than
Xwrite out META or CONTROL each time we want you to prefix a character,
Xwe'll use the following abbreviations:
X
X C-<chr>  means hold the CONTROL key while typing the character <chr>
X	  Thus, C-F would be: hold the CONTROL key and type F.
X M-<chr>  means type the META (ESCAPE) key and release it, then type
X	  the character <chr>.  The <chr> can be upper or lower case
X	  and it will have the same meaning.
X
XImportant note: if you must exit at some point, type C-X C-C.
XThe characters ">>" at the left margin indicate directions for you to
Xtry using a command.  For instance:
X
X>>  Now type C-V (View next screen) to move to the next screen.
X	(go ahead, do it by depressing the control key and V together).
X	From now on, you'll be expected to do this whenever you finish
X	reading the screen.
X
XNote that there is an overlap when going from screen to screen; this
Xprovides some continuity when moving through the file.
X
XThe first thing that you need to know is how to move around from
Xplace to place in the file.  You already know how to move forward a
Xscreen, with C-V.  To move backwards a screen, type M-V (depress the
XMETA key and type V, or type <ESC>V if you don't have a META or EDIT
Xkey).
X
X>>  Try typing M-V and then C-V to move back and forth a few times.
X
X
XSUMMARY
X-------
X
XThe following commands are useful for viewing screenfuls:
X
X	C-V	Move forward one screenful
X	M-V	Move backward one screenful
X	C-L	Center the current line--clear screen and redisplay
X		everything if current line is already at center.
X	
X>> find the cursor and remember what text is near it.
X   Then type a C-L.
X   Find the cursor again and see what text is near it now.
X
X
XBASIC CURSOR CONTROL
X--------------------
X
XGetting from screenful to screenful is useful, but how do you
Xreposition yourself within a given screen to a specific place?  There
Xare several ways you can do this.  One way (not the best, but the most
Xbasic) is to use the commands previous, backward, forward and next.
XAs you can imagine these commands (which are given to JOVE as C-P,
XC-B, C-F, and C-N respectively) move the cursor from where it
Xcurrently is to a new place in the given direction.  Here, in a more
Xgraphical form are the commands:
X 
X			  Previous line, C-P
X				  :
X				  :
X   Backward, C-B .... Current cursor position .... Forward, C-F
X				  :
X				  :
X			  Next line, C-N
X
XYou'll probably find it easy to think of these by letter.  P for
Xprevious, N for next, B for backward and F for forward.  These are the
Xbasic cursor positioning commands and you'll be using them ALL the
Xtime so it would be of great benefit if you learn them now.
X
X>> Do a few C-N's to bring the cursor down to this line.
X
X>> Move into the line with C-F's and then up with several C-P's.  See
X   what C-P does when the cursor is in the middle of the line.
X
XLines are separated by a single Linefeed character, which is what Unix
Xcalls a Newline.
X
X>> Try to C-B at the beginning of a line.  Do a few more C-B's.
X   Then do C-F's back to the end of the line and beyond.
X
XWhen you go off the top or bottom of the screen, the text beyond the
Xedge is shifted onto the screen so that your instructions can be
Xcarried out while keeping the cursor on the screen.
X
X>> Try to move the cursor off the bottom of the screen with C-N and
X   see what happens.
X
XIf moving by characters is too slow, you can move by words.  M-F
X(Meta-F) moves forward a word and M-B moves back a word.
X
X>> Type a few M-F's and M-B's.  Intersperse them with C-F's and C-B's.
X
XNotice the parallel between C-F and C-B on the one hand, and M-F and
XM-B on the other hand.  Very often Meta characters are used for
Xoperations related to English text whereas Control characters operate
Xon the basic textual units that are independent of what you are
Xediting (characters, lines, etc).  There is a similar parallel between
Xlines and sentences: C-A and C-E move to the beginning or end of a
Xline, and M-A and M-E move to the beginning or end of a sentence.
X
X>> Try a couple of C-A's, and then a couple of C-E's.
X   Try a couple of M-A's, and then a couple of M-E's.
X
XSee how repeated C-A's do nothing, but repeated M-A's keep moving
Xfarther.  Do you think that this is right?
X
XTwo other simple cursor motion commands are M-< (Meta Less-than),
Xwhich moves to the beginning of the file, and M-> (Meta Greater-than),
Xwhich moves to the end of the file.  You probably don't need to try
Xthem, since finding this spot again will be boring.  If you need the
Xshift key to type a "<", then you must also use the shift key to type
XM-<.  Otherwise, you would be typing M-, .
X
XThe location of the cursor in the text is also called "point".  To
Xparaphrase, the cursor shows on the screen where point is located in
Xthe text.
X
XHere is a summary of simple moving operations including the word and
Xsentence moving commands:
X
X	C-F	Move forward a character
X	C-B	Move backward a character
X
X	M-F	Move forward a word
X	M-B	Move backward a word
X
X	C-N	Move to next line
X	C-P	Move to previous line
X
X	C-A	Move to beginning of line
X	C-E	Move to end of line
X
X	M-A	Move back to beginning of sentence
X	M-E	Move forward to end of sentence
X
X	M-<	Go to beginning of file
X	M->	Go to end of file
X
X>> Try all of these commands now a few times for practice.  Since the
X   last two will take you away from this screen, you can come back
X   here with the command C-X C-X (which will be explained later).
X   These are the most often used commands.
X
XLike all other commands in JOVE, these commands can be given arguments
Xwhich cause them to be executed repeatedly.  The way you give a
Xcommand a repeat count is by typing META and then the digits before
Xyou type the command.  (Remember META is ususally called ESCAPE)
X
XFor instance, META 8 C-F moves forward eight characters.
X	
X>> Try giving a suitable argument to C-N or C-P to come as close
X   as you can to this line in one jump.
X
XThe only apparent exception to this is the screen moving commands, C-V
Xand M-V.  When given an argument, they scroll the screen up or down by
Xthat many lines, rather than screenfuls.  This proves to be much more
Xuseful.
X
X>> Try typing M-8 C-V now.
X
XDid it scroll the screen up by 8 lines?  If you would like to scroll
Xit down you can give an argument to M-V.
X
X
XQUITTING FROM COMMANDS
X----------------------
X
XThe character in JOVE used to quit out of all commands which request
Xinput is C-G.  For example, you can use C-G to discard a numeric
Xargument or the beginning of a command that you don't want to finish.
X
X>> Type M-100 to make a numeric arg of 100, then type C-G.  Now type
X   C-F.  How many characters does it move?  If you have typed an <ESC>
X   by mistake, you can get rid of it with a C-G.
X
X
XERRORS
X------
X
XSometimes you may do something which JOVE doesn't allow.  If it is
Xsomething simple, such as typing a control key sequence which is not
Xassociated with any command, JOVE will just beep at you.  Otherwise,
XJOVE will also display an informative error message at the bottom of
Xthe screen.
X
XSome versions of JOVE do not have all the features described in this
Xtutorial implemented yet.  If you come across such an unimplemented
Xfeature, you may get an error message when you try to use it.  Just
Xproceed on to the next section of the tutorial.
X
X
XINSERTING AND DELETING
X----------------------
X
XIf you want to type text, just do it.  Characters which you can see,
Xsuch as A, 7, *, etc. are taken by JOVE as text and inserted
Ximmediately.  Type <Return> (the carriage-return key) to insert a line
Xseparator.
X
XYou can delete the last character you typed by typing <Delete>.
X<Delete> is a key on the keyboard, which may be labeled "Rubout"
Xinstead of "Delete" on some terminals.  More generally, <Delete>
Xdeletes the character immediately before the current cursor position.
X
X>> Do this now, type a few characters and then delete them by typing
X   <Delete> a few times.  Don't worry about this file being changed;
X   you won't affect the master tutorial.  This is just a copy of it.
X
X>> Now start typing text until you reach the right margin, and keep
X   typing.  When a line of text gets too big for one line on the
X   screen, the line of text is "continued" off the edge of the screen
X   The exclamation mark at the right margin indicates a line which has
X   been continued.  The line will slide over if you move off the edge
X   on either side.
X
X>> The following line actually goes off the edge.  Trying typing enough
X   C-F's that you move off the right hand end of this line.... This is a long line of text that the JOVE editor extends to the right.
X
X>> Use <Delete>s to delete the text until the line fits on one screen
X   line again.  The continuation "!" will go away.
X
X>> Move the cursor to the beginning of a line and type <Delete>.  This
X   deletes the line separator before the line and merges the line onto
X   the previous line.  The resulting line may be too long to fit, in
X   which case it has a continuation indication.
X
X>> Type <Return> to insert the separator again.
X
XRemember that most JOVE commands can be given a repeat count;  Note
Xthat this includes characters which insert themselves.
X
X>>  Try that now -- type META 8 * and see what happens.
X
XIf you want to create a blank line in between two lines, move to the
Xsecond of the two lines and type C-O.
X
X>>  Try moving to a line and typing C-O now.
X
XYou've now learned the most basic way of typing something in JOVE and
Xcorrecting errors.  You can delete by words or lines as well.  Here is
Xa summary of the delete operations:
X
X	<Delete>     delete the character just before the cursor
X	C-D   	     delete the next character after the cursor
X
X	M-<Delete>   kill the word immediately before the cursor
X	M-D	     kill the next word after the cursor
X
X	C-K	     kill from the cursor position to end of line
X	M-K	     kill to the end of the current sentence
X
XNotice that <Delete> and C-D vs M-<Delete> and M-D extend the parallel
Xstarted by C-F and M-F (well, <Delete> isn't really a control
Xcharacter, but let's not worry about that).  C-K and M-K are like C-E
Xand M-E, sort of, in that lines are opposite sentences.
X
XNow suppose you kill something, and then you decide that you want to
Xget it back?  Well, whenever you kill something bigger than a
Xcharacter, JOVE saves it for you.  To yank it back, use C-Y.  Note
Xthat you don't have to be in the same place to do C-Y; This is a good
Xway to move text around.  Also note that the difference between
X"Killing" and "Deleting" something is that "Killed" things can be
Xyanked back, and "Deleted" things cannot.  Generally, the commands
Xthat can destroy a lot of text save it, while the ones that attack
Xonly one character, or nothing but blank lines and spaces, do not save.
X
XFor instance, type C-N a couple times to postion the cursor at some
Xline on this screen.
X
X>> Do this now, move the cursor and kill that line with C-K.
X
XNote that a single C-K kills the contents of the line, and a second
XC-K kills the line itself, and make all the other lines move up.  If
Xyou give C-K a repeat count, it kills that many lines AND their
Xcontents.
X
XThe text that has just disappeared is saved so that you can retrieve
Xit.  To retrieve the last killed text and put it where the cursor
Xcurrently is, type C-Y.
X
X>> Try it; type C-Y to yank the text back.
X
XThink of C-Y as if you were yanking something back that someone took
Xaway from you.  Notice that if you do several C-K's in a row the text
Xthat is killed is all saved together so that one C-Y will yank all of
Xthe lines.
X
X>> Do this now, type C-K several times.
X
XNow to retrieve that killed text:
X
X>> Type C-Y.  Then move the cursor down a few lines and type C-Y
X   again.  You now see how to copy some text.
X
XWhat do you do if you have some text you want to yank back, and then
Xyou kill something else?  C-Y would yank the more recent kill.  But
Xthe previous text is not lost.  You can get back to it using the M-Y
Xcommand.  After you have done C-Y to get the most recent kill, typing
XM-Y replaces that yanked text with the previous kill.  Typing M-Y
Xagain and again brings in earlier and earlier kills.  When you have
Xreached the text you are looking for, you can just go away and leave
Xit there.  If you M-Y enough times, you come back to the starting
Xpoint (the most recent kill).
X
X>> Kill a line, move around, kill another line.  Then do C-Y to get
X   back the second killed line.  Then do M-Y and it will be replaced
X   by the first killed line.  Do more M-Y's and see what you get.
X   Keep doing them until the second kill line comes back, and then a
X   few more.  If you like, you can try giving M-Y positive and negative
X   arguments.
X
X
XFILES
X-----
X
XIn order to make the text you edit permanent, you must put it in a
Xfile.  Otherwise, it will go away when your invocation of JOVE goes
Xaway.  While you are editing a file in JOVE, your changes are actually
Xbeing made to a private "scratch" copy of the file.  However, the
Xchanges still don't become permanent until you "save" the file.  This
Xis so you can have control to avoid leaving a half-changed file around
Xwhen you don't want to.
X
XIf you look near the botton of the screen you will see a line that
Xlooks like this:
X    JOVE (Text) Buffer: teach-jove "teach-jove" *
X"teach-jove" is the name of the file you are editing.  This is the name
Xof your own temporary copy of the text of the JOVE tutorial; the file
Xyou are now editing.  Whatever file you edit, that file's name will
Xappear in that precise spot.
X
XThe commands for finding and saving files are unlike the other
Xcommands you have learned in that they consist of two characters.
XThey both start with the character Control-X.  There is a whole series
Xof commands that start with Control-X; many of them have to do with
Xfiles, buffers, and related things, and all of them consist of
XControl-X followed by some other character.  As with M- the character
Xinterpreted the same regardless of case.
X
XAnother thing about the command for finding a file is that you have to
Xsay what file name you want.  We say the command "reads an argument
Xfrom the terminal" (in this case, the argument is the name of the
Xfile).  After you type the command
X
X	C-X C-F   Find a file
X
XJOVE will ask you for the file name.  You should end the name with
Xthe Return key.  After this command, you will see the contents of the
Xfile in your JOVE.  You can edit the contents.  When you wish to make
Xthe changes permanent, issue the command
X
X	C-X C-S   Save the file
X
XWarning: on many systems JOVE will not be able to process the key C-S.
XIn place of C-S, you should type C-\.  It is possible to make C-S work
Xbut C-\ is guaranteed always to work in place of C-S.
X
XThe old version of the file will be replaced.  When the operation is
Xfinished, JOVE prints the name and number of lines and characters
Xsaved.
X
XIf you forget to save and then edit a different file, JOVE will remind
Xyou that you made changes that have not been saved and then ask you
Xwhether you really want to quit.  (If you don't save them, they will
Xbe thrown away.  That might be what you want!)  You should answer with
Xa "Y" to throw the changes away or "N" to abort quitting so you can
Xthen save the changes.
X
XTo make a new file, just edit it "as if" it already existed.  Then
Xstart typing in the text.  When you ask to "save" the file, JOVE will
Xreally create the file with the text that you have inserted.  From
Xthen on, you can consider yourself to be editing an already existing
Xfile.
X
XIt is not easy for you to try out editing a file and continue with the
Xtutorial.  But you can always come back into the tutorial by starting
Xit over and skipping forward.  So, when you feel ready, you should try
Xediting a file named "FOO", putting some text in it, and saving it;
Xthen exit from JOVE and look at the file to be sure that it worked.
X
X
XEXTENDING THE COMMAND SET
X-------------------------
X
XThere are many, many more JOVE commands than could possibly be put on
Xall the control and meta characters.  JOVE gets around this with the X
X(eXtend) command.  This comes in two flavors:
X
X	C-X	Character eXtend.  Followed by one character.
X	M-X	Named command eXtend.  Followed by a long name.
X
XThese are commands that are generally useful but used less than the
Xcommands you have already learned about.  You have already seen two of
Xthem: the file commands C-X C-F to Find and C-X C-S to Save.  Another
Xexample is the command to tell JOVE that you'd like to stop editing.
XThe command to do this is C-X C-C.
X
XThere are many C-X commands.  The ones you need immediately are:
X
X	C-X C-V		Visit file.
X	C-X C-S		Save file.
X	C-X C-C		Quit JOVE.  This does not save your files auto-
X			matically, though if your files have been modi-
X			fied, JOVE asks if you really want to quit.  The
X			standard way to save and exit is C-X C-S C-X C-C.
X
XNamed eXtended commands are commands which are used even less
Xfrequently, or commands which are used only in certain modes.  These
Xcommands are usually called "commands".  An example is the command
X"apropos", which prompts for a keyword and then gives the names of all
Xthe commands that apropos for that keyword.  When you type M-X, JOVE
Xprompts you at the bottom of the screen with ":" and you should type
Xthe name of the command you wish to call; in this case, "apropos".
XJust type "apr<Space>" and JOVE will complete the name.  JOVE will ask
Xyou for a keyword or phrase and you type the string that you want ask
Xabout.
X
X>> Try typing M-X, followed by "apropos" or "apr" and then Return.
X   Then try typing "file" followed by a Return.
X
X
XTEXT REPLACEMENT
X---- -----------
X
X>> Move the cursor to the blank line two lines below this one.
X   Then type M-r changed<Return>altered<Return>.
X
X   Notice how this line has changed: you've replaced the word
X   c-h-a-n-g-e-d with "altered" wherever it occurs after the cursor.
X
XThe more customary command for replacing strings is the interactive
Xcommand query-replace-search, which has several options.  In essence,
Xit shows each occurance of the first string and asks you if you want to
Xreplace it or not.  You can also choose to edit around the string, or
Xgo on and replace all occurances without asking further.  It is
Xdescribed in detail in the JOVE manual.
X
X
XMODE LINE
X---------
X
XIf JOVE sees that you are typing commands slowly it shows them to you
Xat the bottom of the screen in an area called the echo area.  The echo
Xarea contains the bottom line of the screen.  The line immediately above
Xthem is called the MODE LINE.  The mode line says something like
X
X   JOVE (Text)  Buffer: [buffername]  "filename" *
X
XThis is a very useful "information" line.
X
XThe buffername is the name JOVE gave to the buffer, and it is usually
Xrelated to the filename.  You already know what the filename means --
Xit is the file you have edited.
X
XThe star means that you have made changes to the text.  Right after
Xyou visit or save a file, there is no star.
X
XThe part of the mode line inside the parentheses is to tell you what
Xmodes you are in.  The default mode is Text which is what you are in
Xnow.  It is an example of a "major mode".  There are several major
Xmodes in JOVE for editing different languages and text, such as C
Xmode, Lisp mode, Text mode, etc.  At any time one and only one major
Xmode is active, and its two-letter code can always be found in the
Xmode line just where "Text" is now.  Each major mode makes a few
Xcommands behave differently.  For example, what JOVE considers as part
Xof a valid expression or an identifier differs from one major mode to
Xanother, since each programming language has a different idea of what
Xis a legal identifier.
X
XMajor modes are called major because there are also minor modes.  They
Xare called minor because they aren't alternatives to the major modes,
Xjust minor modifications of them.  Each minor mode can be turned on or
Xoff by itself, regardless of what major mode you are in, and
Xregardless of the other minor modes.  So you can use no minor modes,
Xor one minor mode, or any combination of several minor modes.
X
XOne minor mode which is very useful, especially for editing English
Xtext, is "Auto Fill" mode.  When this mode is on, JOVE breaks the line
Xin between words automatically whenever the line gets too long.  You
Xcan turn this mode on by doing M-X auto-fill-mode<Return>.  When the
Xmode is on, you can turn it off by doing M-X auto-fill-mode<Return>--
Xit toggles.
X
X>> Type "M-X auto-fill-mode<Return>" now.  Then insert a line with a
X   bunch of words over again until you see it divide into two lines.
X   You must put in spaces between them because Auto Fill breaks lines
X   only at spaces.  Notice that "Fill" (the code for Auto Fill) appears
X   in the mode line after "Text" to indicate that you are in Text Fill
X   mode.
X
XThe margin is usually set at 78 characters, but you can change it with
Xthe set command.  The margin is kept in a variable just like the mode
Xvalues.
X
X>> Type "M-X set right-margin 20", then type in some text and see
X   JOVE fill lines of 20 characters with it.  Then set the margin
X   back to 72 using M-X set again.
X
X
XSEARCHING
X---------
X
XJOVE can do searches for strings (these are groups of contiguous
Xcharacters or words) either forward through the file or backward
Xthrough it.  To search for the string means that you are trying to
Xfind that string somewhere in the file.  Remember to use C-\ where it
Xsays C-S.
X
X>> Now type C-S to start a search.  Type the word 'cursor', then
X   Return.
X
X>> Type C-S Return to find the next occurrence of "cursor".
X
XThe C-S starts a search that looks for any occurrence of the search
Xstring AFTER the current cursor position.  But what if you want to
Xsearch for something earlier in the text?  To do this one should type
XC-R for reverse search.  Everything that applies to C-S applies to C-R
Xexcept that the direction of the search is reversed.
X
X
XGETTING MORE HELP
X-----------------
X
XIn this tutorial we have tried to supply just enough information to
Xget you started using JOVE.  There is so much available in JOVE that
Xit would be impossible to explain it all here.  However, you may want
Xto learn more about JOVE since it has numerous desirable features that
Xyou don't know about yet.  JOVE has a some internal documentation.
X
XThe most basic HELP feature is the describe-key command which is
Xavailable by typing C-X ? and then a command character. JOVE prints
Xone line line on the bottom of the screen tell what command is bound to
Xthat key.  You can then get further information on that command
Xusing...
X
XThe describe-command command M-? will prompt for the name of a command
Xand print out the section from the manual about that command. When you
Xare finished reading it, type a Space or a C-G (quit) to bring your text
Xback on the screen.
X
X>> Type C-X ? Control-P.  The message at the bottom of the screen should
X   be something like "C-P is bound to previous-line".
X
XMulti-character commands such as C-X C-Z and <ESC>V are also allowed
Xafter C-X ?.
X
XNow lets get more information about the previous-line command.
X
X>> Type M-? previous-line.  When you are finished reading the
X   output, type a Space.
X
XThe "name of the command" is important for people who are customizing
XJOVE.  It is what appears in the JOVE CHART as the documentation for
Xthe command character.
X
XOne other form of help is the "apropos" command.  We have already tried
Xusing this command in an earlier part of this tutorial, but it should
Xbe mentioned again here.  Apropos prompts for a word or phrase and
Xlists all the commands that contain that string.  If you couldn't
Xremember the name of a certain command to read file, you could run the
Xapropos command with the keyword "file" and it would list all the
Xcommands that contain "file".  To run apropos you would type
X
X	M-X apr<Space>file<Return>
X
X
XCONCLUSION
X----------
X
XRemember, to exit use C-X C-C.
X
XThis tutorial is meant to be understandable to all new users, so if
Xyou found something unclear, don't sit and blame yourself - complain!
X
XYou'll probably find that if you use JOVE for a few days you won't
Xbe able to give it up.  Initially it may give you trouble.  But remember
Xthat this is the case with any editor, especially one that can do many,
Xmany things.  And JOVE can do practically everything.
@//E*O*F doc/teach-jove//
if test 24421 -ne "`wc -c <'doc/teach-jove'`"; then
    echo shar: error transmitting "'doc/teach-jove'" '(should have been 24421 characters)'
fi
fi # end of overwriting check
echo shar: "End of archive 13 (of 13)."
cp /dev/null ark13isdone
DONE=true
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13; do
    if test -f ark${I}isdone; then
        echo "You have run archive ${I}."
    else
        echo "You still need to run archive ${I}."
        DONE=false
    fi
done
case $DONE in
    true)
        echo "You have run all 13 archives."
        echo 'Now read the README and Makefile.'
        ;;
esac
##  End of shell archive.
exit 0