home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 March / PCWELT_3_2006.ISO / base / 05_common.mo / usr / lib / jove / teach-jove < prev    next >
Encoding:
Text File  |  2003-03-04  |  38.6 KB  |  915 lines

  1.               J O V E   T U T O R I A L
  2.  
  3. Welcome to JOVE - an advanced, easy-to-use, user-friendly environment
  4. for editing text, programs or anything else you may like to type.
  5.  
  6. JOVE is designed to be run from a "dumb terminal", so it does not use
  7. the capabilities and conventions of windowing systems (multiple
  8. windows, mice, multiple fonts and so on).  JOVE can be run on such a
  9. system using a "terminal emulator" or "command window".
  10.  
  11. JOVE commands generally involve the CONTROL key (sometimes labelled
  12. CTRL or CTL) or the META key (generally labelled ESCAPE).  Rather than
  13. write out META or CONTROL each time we want you to prefix a character,
  14. we'll use the following abbreviations:
  15.  
  16.  ^<chr>  means hold the CONTROL key while typing the character <chr>
  17.       Thus, ^F would be: hold the CONTROL key and type F.
  18.  M-<chr>  means type the META (ESCAPE) key and release it, then type
  19.       the character <chr>.  The <chr> can be upper or lower case
  20.       and it will have the same meaning.
  21.  
  22. Important note: if you must exit at some point, type ^X ^C.
  23. The characters ">>" at the left margin indicate directions for you to
  24. try using a command.  For instance:
  25.  
  26. >>  Now type ^V (View next screen) to move to the next screen.
  27.     (go ahead, do it by depressing the control key and V together).
  28.     From now on, you'll be expected to do this whenever you finish
  29.     reading the screen.
  30.  
  31. Note that there is an overlap when going from screen to screen; this
  32. provides some continuity when moving through the file.
  33.  
  34. The first thing that you need to know is how to move around from
  35. place to place in the file.  You already know how to move forward a
  36. screen, with ^V.  To move backwards a screen, type M-V (depress the
  37. META key and type V, or type <ESC>V if you don't have a META or EDIT
  38. key).
  39.  
  40. >>  Try typing M-V and then ^V to move back and forth a few times.
  41.  
  42.  
  43. SUMMARY
  44. -------
  45.  
  46. The following commands are useful for viewing screenfuls:
  47.  
  48.     ^V    Move forward one screenful
  49.     M-V    Move backward one screenful
  50.     ^L    Center the current line--clear screen and redisplay
  51.         everything if current line is already at center.
  52.  
  53. >> find the cursor and remember what text is near it.
  54.    Then type a ^L.
  55.    Find the cursor again and see what text is near it now.
  56.  
  57.  
  58. BASIC CURSOR CONTROL
  59. --------------------
  60.  
  61. Getting from screenful to screenful is useful, but how do you
  62. reposition yourself within a given screen to a specific place?  There
  63. are several ways you can do this.  One way (not the best, but the most
  64. basic) is to use the commands previous, backward, forward and next.
  65. As you can imagine these commands (which are given to JOVE as ^P,
  66. ^B, ^F, and ^N respectively) move the cursor from where it
  67. currently is to a new place in the given direction.  Here, in a more
  68. graphical form are the commands:
  69.  
  70.               Previous line, ^P
  71.                   :
  72.                   :
  73.    Backward, ^B .... Current cursor position .... Forward, ^F
  74.                   :
  75.                   :
  76.               Next line, ^N
  77.  
  78. You'll probably find it easy to think of these by letter.  P for
  79. previous, N for next, B for backward and F for forward.  These are the
  80. basic cursor positioning commands and you'll be using them ALL the
  81. time so it would be of great benefit if you learn them now.
  82.  
  83. >> Do a few ^N's to bring the cursor down to this line.
  84.  
  85. >> Move into the line with ^F's and then up with several ^P's.  See
  86.    what ^P does when the cursor is in the middle of the line.
  87.  
  88. Lines are separated by a single Linefeed character, which is what Unix
  89. calls a Newline.
  90.  
  91. >> Try to ^B at the beginning of a line.  Do a few more ^B's.
  92.    Then do ^F's back to the end of the line and beyond.
  93.  
  94. When you go off the top or bottom of the screen, the text beyond the
  95. edge is shifted onto the screen so that your instructions can be
  96. carried out while keeping the cursor on the screen.
  97.  
  98. >> Try to move the cursor off the bottom of the screen with ^N and
  99.    see what happens.
  100.  
  101. If moving by characters is too slow, you can move by words.  M-F
  102. (Meta-F) moves forward a word and M-B moves back a word.
  103.  
  104. >> Type a few M-F's and M-B's.  Intersperse them with ^F's and ^B's.
  105.  
  106. Notice the parallel between ^F and ^B on the one hand, and M-F and
  107. M-B on the other hand.  Very often Meta characters are used for
  108. operations related to English text whereas Control characters operate
  109. on the basic textual units that are independent of what you are
  110. editing (characters, lines, etc).  There is a similar parallel between
  111. lines and sentences: ^A and ^E move to the beginning or end of a
  112. line, and M-A and M-E move to the beginning or end of a sentence.
  113.  
  114. >> Try a couple of ^A's, and then a couple of ^E's.
  115.    Try a couple of M-A's, and then a couple of M-E's.
  116.  
  117. See how repeated ^A's do nothing, but repeated M-A's keep moving
  118. farther.  Do you think that this is right?
  119.  
  120. Two other simple cursor motion commands are M-< (Meta Less-than),
  121. which moves to the beginning of the file, and M-> (Meta Greater-than),
  122. which moves to the end of the file.  You probably don't need to try
  123. them, since finding this spot again will be boring.  If you need the
  124. shift key to type a "<", then you must also use the shift key to type
  125. M-<.  Otherwise, you would be typing M-, .
  126.  
  127. The location of the cursor in the text is also called "point".  To
  128. paraphrase, the cursor shows on the screen where point is located in
  129. the text.
  130.  
  131. Here is a summary of simple moving operations including the word and
  132. sentence moving commands:
  133.  
  134.     ^F    Move forward a character
  135.     ^B    Move backward a character
  136.  
  137.     M-F    Move forward a word
  138.     M-B    Move backward a word
  139.  
  140.     ^N    Move to next line
  141.     ^P    Move to previous line
  142.  
  143.     ^A    Move to beginning of line
  144.     ^E    Move to end of line
  145.  
  146.     M-A    Move back to beginning of sentence
  147.     M-E    Move forward to end of sentence
  148.  
  149.     M-<    Go to beginning of file
  150.     M->    Go to end of file
  151.  
  152. >> Try all of these commands now a few times for practice.  Since the
  153.    last two will take you away from this screen, you can come back
  154.    here with the command ^X ^X (which will be explained later).
  155.    These are the most often used commands.
  156.  
  157. Like all other commands in JOVE, these commands can be given arguments
  158. which cause them to be executed repeatedly.  The way you give a
  159. command a repeat count is by typing META and then the digits before
  160. you type the command.  (Remember META is ususally called ESCAPE)
  161.  
  162. For instance, META 8 ^F moves forward eight characters.
  163.  
  164. >> Try giving a suitable argument to ^N or ^P to come as close
  165.    as you can to this line in one jump.
  166.  
  167. The only apparent exception to this is the screen moving commands, ^V
  168. and M-V.  When given an argument, they scroll the screen up or down by
  169. that many lines, rather than screenfuls.  This proves to be much more
  170. useful.
  171.  
  172. >> Try typing M-8 ^V now.
  173.  
  174. Did it scroll the screen up by 8 lines?  If you would like to scroll
  175. it down you can give an argument to M-V.
  176.  
  177.  
  178.  
  179. THE UNIVERSAL ARGUMENT
  180. ----------------------
  181.    Almost every command in JOVE takes a so-called Universal Argument.
  182. This argument, although it is interpreted differently in some cases,
  183. usually means REPEAT.  One important exception to this is with the screen
  184. moving commands.  In this case, the number refers to the number of LINES
  185. to scroll, not the number of screens.
  186.  
  187.    The way you give a command a universal argument is by typing ESC and
  188. then the number.  For example, ESC 10 ^F would move you forward ten
  189. characters.
  190.  
  191. >>> Try giving a suitable argument to ^N or ^P to come as close as you
  192.     can to this line in one jump.  Then try giving the same command,
  193.     except make the number negative.
  194.  
  195.   Another count-giving command is ^U.  This command, when you first type
  196. it, gives you an argument of 4 (four).  If you type ^U ^U, you will get
  197. an argument of 16.  Each time ^U is typed, the argument is multiplied by
  198. four.
  199.  
  200. >>> Try typing ESC 8 ^V now.
  201.  
  202. THE GOTO COMMAND
  203. ----------------
  204.    Now that we've learned about the universal argument, we can introduce
  205. another cursor positioning command, the command to move to a specific
  206. line.  This command is given by giving a line number via ESC, and then
  207. typing M-G.
  208.  
  209. >>> Try using the M-< and M-> commands to move to the beginning and the
  210.     end of the file.  Then come back here using the M-G command (this is
  211.     line 206, so you'd type ESC 206 M-G.)
  212.  
  213. QUITTING FROM COMMANDS
  214. ----------------------
  215.  
  216. The character in JOVE used to quit out of all commands which request
  217. input is ^G.  For example, you can use ^G to discard a numeric
  218. argument or the beginning of a command that you don't want to finish.
  219.  
  220. >> Type M-100 to make a numeric arg of 100, then type ^G.  Now type
  221.    ^F.  How many characters does it move?  If you have typed an <ESC>
  222.    by mistake, you can get rid of it with a ^G.
  223.  
  224.  
  225. ERRORS
  226. ------
  227.  
  228. Sometimes you may do something which JOVE doesn't allow.  If it is
  229. something simple, such as typing a control key sequence which is not
  230. associated with any command, JOVE will just beep at you.  Otherwise,
  231. JOVE will also display an informative error message at the bottom of
  232. the screen.
  233.  
  234. Some versions of JOVE do not have all the features described in this
  235. tutorial implemented yet.  If you come across such an unimplemented
  236. feature, you may get an error message when you try to use it.  Just
  237. proceed on to the next section of the tutorial.
  238.  
  239.  
  240. INSERTING AND DELETING
  241. ----------------------
  242.  
  243. If you want to type text, just do it.  Characters which you can see,
  244. such as A, 7, *, etc. are taken by JOVE as text and inserted
  245. immediately.  Type <Return> (the carriage-return key) to insert a line
  246. separator.
  247.  
  248. You can delete the last character you typed by typing <Delete>.
  249. <Delete> is a key on the keyboard, which may be labeled "Rubout"
  250. instead of "Delete" on some terminals.  More generally, <Delete>
  251. deletes the character immediately before the current cursor position.
  252.  
  253. >> Do this now, type a few characters and then delete them by typing
  254.    <Delete> a few times.  Don't worry about this file being changed;
  255.    you won't affect the master tutorial.  This is just a copy of it.
  256.  
  257. >> Now start typing text until you reach the right margin, and keep
  258.    typing.  When a line of text gets too big for one line on the
  259.    screen, the line of text is "continued" off the edge of the screen
  260.    The exclamation mark at the right margin indicates a line which has
  261.    been continued.  The line will slide over if you move off the edge
  262.    on either side.
  263.  
  264. >> The following line actually goes off the edge.  Trying typing enough
  265.    ^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.
  266.  
  267. >> Use <Delete>s to delete the text until the line fits on one screen
  268.    line again.  The continuation "!" will go away.
  269.  
  270. >> Move the cursor to the beginning of a line and type <Delete>.  This
  271.    deletes the line separator before the line and merges the line onto
  272.    the previous line.  The resulting line may be too long to fit, in
  273.    which case it has a continuation indication.
  274.  
  275. >> Type <Return> to insert the separator again.
  276.  
  277. Remember that most JOVE commands can be given a repeat count; Note
  278. that this includes characters which insert themselves.
  279.  
  280. >>  Try that now -- type META 8 * and see what happens.
  281.  
  282. If you want to create a blank line in between two lines, move to the
  283. second of the two lines and type ^O.
  284.  
  285. >>  Try moving to a line and typing ^O now.
  286.  
  287. You've now learned the most basic way of typing something in JOVE and
  288. correcting errors.  You can delete by words or lines as well.  Here is
  289. a summary of the delete operations:
  290.  
  291.     <Delete>     delete the character just before the cursor
  292.     ^D         delete the next character after the cursor
  293.  
  294.     M-<Delete>   kill the word immediately before the cursor
  295.     M-D         kill the next word after the cursor
  296.  
  297.     ^K         kill from the cursor position to end of line
  298.     M-K         kill to the end of the current sentence
  299.  
  300. Notice that <Delete> and ^D vs M-<Delete> and M-D extend the parallel
  301. started by ^F and M-F (well, <Delete> isn't really a control
  302. character, but let's not worry about that).  ^K and M-K are like ^E
  303. and M-E, sort of, in that lines are opposite sentences.
  304.  
  305. Now suppose you kill something, and then you decide that you want to
  306. get it back?  Well, whenever you kill something bigger than a
  307. character, JOVE saves it for you.  To yank it back, use ^Y.  Note
  308. that you don't have to be in the same place to do ^Y; This is a good
  309. way to move text around.  Also note that the difference between
  310. "Killing" and "Deleting" something is that "Killed" things can be
  311. yanked back, and "Deleted" things cannot.  Generally, the commands
  312. that can destroy a lot of text save it, while the ones that attack
  313. only one character, or nothing but blank lines and spaces, do not save.
  314.  
  315. For instance, type ^N a couple times to postion the cursor at some
  316. line on this screen.
  317.  
  318. >> Do this now, move the cursor and kill that line with ^K.
  319.  
  320. Note that a single ^K kills the contents of the line, and a second
  321. ^K kills the line itself, and make all the other lines move up.  If
  322. you give ^K a repeat count, it kills that many lines AND their
  323. contents.
  324.  
  325. The text that has just disappeared is saved so that you can retrieve
  326. it.  To retrieve the last killed text and put it where the cursor
  327. currently is, type ^Y.
  328.  
  329. >> Try it; type ^Y to yank the text back.
  330.  
  331. Think of ^Y as if you were yanking something back that someone took
  332. away from you.  Notice that if you do several ^K's in a row the text
  333. that is killed is all saved together so that one ^Y will yank all of
  334. the lines.
  335.  
  336. >> Do this now, type ^K several times.
  337.  
  338. Now to retrieve that killed text:
  339.  
  340. >> Type ^Y.  Then move the cursor down a few lines and type ^Y
  341.    again.  You now see how to copy some text.
  342.  
  343. What do you do if you have some text you want to yank back, and then
  344. you kill something else?  ^Y would yank the more recent kill.  But
  345. the previous text is not lost.  You can get back to it using the M-Y
  346. command.  After you have done ^Y to get the most recent kill, typing
  347. M-Y replaces that yanked text with the previous kill.  Typing M-Y
  348. again and again brings in earlier and earlier kills.  When you have
  349. reached the text you are looking for, you can just go away and leave
  350. it there.  If you M-Y enough times, you come back to the starting
  351. point (the most recent kill).
  352.  
  353. >> Kill a line, move around, kill another line.  Then do ^Y to get
  354.    back the second killed line.  Then do M-Y and it will be replaced
  355.    by the first killed line.  Do more M-Y's and see what you get.
  356.    Keep doing them until the second kill line comes back, and then a
  357.    few more.  If you like, you can try giving M-Y positive and negative
  358.    arguments.
  359.  
  360.  
  361. FILES
  362. -----
  363.  
  364. In order to make the text you edit permanent, you must put it in a
  365. file.  Otherwise, it will go away when your invocation of JOVE goes
  366. away.  While you are editing a file in JOVE, your changes are actually
  367. being made to a private "scratch" copy of the file.  However, the
  368. changes still don't become permanent until you "save" the file.  This
  369. is so you can have control to avoid leaving a half-changed file around
  370. when you don't want to.
  371.  
  372. If you look near the botton of the screen you will see a line that
  373. looks like this:
  374.     JOVE (Text) Buffer: teach-jove "teach-jove" *
  375. "teach-jove" is the name of the file you are editing.  This is the name
  376. of your own temporary copy of the text of the JOVE tutorial; the file
  377. you are now editing.  Whatever file you edit, that file's name will
  378. appear in that precise spot.
  379.  
  380. The commands for finding and saving files are unlike the other
  381. commands you have learned in that they consist of two characters.
  382. They both start with the character Control-X.  There is a whole series
  383. of commands that start with Control-X; many of them have to do with
  384. files, buffers, and related things, and all of them consist of
  385. Control-X followed by some other character.  As with M- the character
  386. interpreted the same regardless of case.
  387.  
  388. Another thing about the command for finding a file is that you have to
  389. say what file name you want.  We say the command "reads an argument
  390. from the terminal" (in this case, the argument is the name of the
  391. file).  After you type the command
  392.  
  393.     ^X ^F   Find a file
  394.  
  395. JOVE will ask you for the file name.  You should end the name with
  396. the Return key.  After this command, you will see the contents of the
  397. file in your JOVE.  You can edit the contents.  When you wish to make
  398. the changes permanent, issue the command
  399.  
  400.     ^X ^S   Save the file
  401.  
  402. Warning: on many systems JOVE will not be able to process the key ^S.
  403. In place of ^S, you should type ^\.  It is possible to make ^S work
  404. but ^\ is guaranteed always to work in place of ^S.
  405.  
  406. The old version of the file will be replaced.  When the operation is
  407. finished, JOVE prints the name and number of lines and characters
  408. saved.
  409.  
  410. If you forget to save and then edit a different file, JOVE will remind
  411. you that you made changes that have not been saved and then ask you
  412. whether you really want to quit.  (If you don't save them, they will
  413. be thrown away.  That might be what you want!)  You should answer with
  414. a "Y" to throw the changes away or "N" to abort quitting so you can
  415. then save the changes.
  416.  
  417. To make a new file, just edit it "as if" it already existed.  Then
  418. start typing in the text.  When you ask to "save" the file, JOVE will
  419. really create the file with the text that you have inserted.  From
  420. then on, you can consider yourself to be editing an already existing
  421. file.
  422.  
  423. It is not easy for you to try out editing a file and continue with the
  424. tutorial.  But you can always come back into the tutorial by starting
  425. it over and skipping forward.  So, when you feel ready, you should try
  426. editing a file named "FOO", putting some text in it, and saving it;
  427. then exit from JOVE and look at the file to be sure that it worked.
  428.  
  429. CONCLUSION OF PART ONE
  430. ----------------------
  431.    This is the end of the first part of this tutorial.  You now know
  432. enough to edit a file with JOVE, and save your work.  The second part of
  433. this tutorial, which starts with the next section, discusses searching,
  434. replacing, word processing, and other modes of JOVE.  You may wish to
  435. stop here and practice for awhile before you continue.
  436.  
  437.  
  438. EXTENDING THE COMMAND SET
  439. -------------------------
  440.  
  441. There are many, many more JOVE commands than could possibly be put on
  442. all the control and meta characters.  JOVE gets around this with the X
  443. (eXtend) command.  This comes in two flavors:
  444.  
  445.     ^X    Character eXtend.  Followed by one character.
  446.     M-X    Named command eXtend.  Followed by a long name.
  447.  
  448. These are commands that are generally useful but used less than the
  449. commands you have already learned about.  You have already seen two of
  450. them: the file commands ^X ^F to Find and ^X ^S to Save.  Another
  451. example is the command to tell JOVE that you'd like to stop editing.
  452. The command to do this is ^X ^C.
  453.  
  454. There are many ^X commands.  The ones you need immediately are:
  455.  
  456.     ^X ^V        Visit file.
  457.     ^X ^S        Save file.
  458.     ^X ^C        Quit JOVE.  This does not save your files auto-
  459.             matically, though if your files have been modi-
  460.             fied, JOVE asks if you really want to quit.  The
  461.             standard way to save and exit is ^X ^S ^X ^C.
  462.  
  463. Named eXtended commands are commands which are used even less
  464. frequently, or commands which are used only in certain modes.  These
  465. commands are usually called "commands".  An example is the command
  466. "apropos", which prompts for a keyword and then gives the names of all
  467. the commands that apropos for that keyword.  When you type M-X, JOVE
  468. prompts you at the bottom of the screen with ":" and you should type
  469. the name of the command you wish to call; in this case, "apropos".
  470. Just type "apr<Space>" and JOVE will complete the name.  JOVE will ask
  471. you for a keyword or phrase and you type the string that you want ask
  472. about.
  473.  
  474. >> Try typing M-X, followed by "apropos" or "apr" and then Return.
  475.    Then try typing "file" followed by a Return.
  476.  
  477.  
  478. MODE LINE
  479. ---------
  480.  
  481. If JOVE sees that you are typing commands slowly it shows them to you
  482. at the bottom of the screen in an area called the echo area.  The echo
  483. area contains the bottom line of the screen.  The line immediately above
  484. them is called the MODE LINE.  The mode line says something like
  485.  
  486.    JOVE (Text)  Buffer: [buffername]  "filename" *
  487.  
  488. This is a very useful "information" line.
  489.  
  490. The buffername is the name JOVE gave to the buffer, and it is usually
  491. related to the filename.  You already know what the filename means --
  492. it is the file you have edited.
  493.  
  494. The star means that you have made changes to the text.  Right after
  495. you visit or save a file, there is no star.
  496.  
  497. The part of the mode line inside the parentheses is to tell you what
  498. modes you are in.  The default mode is Text which is what you are in
  499. now.  It is an example of a "major mode".  There are several major
  500. modes in JOVE for editing different languages and text, such as C
  501. mode, Lisp mode, Text mode, etc.  At any time one and only one major
  502. mode is active, and its two-letter code can always be found in the
  503. mode line just where "Text" is now.  Each major mode makes a few
  504. commands behave differently.  For example, what JOVE considers as part
  505. of a valid expression or an identifier differs from one major mode to
  506. another, since each programming language has a different idea of what
  507. is a legal identifier.
  508.  
  509. Major modes are called major because there are also minor modes.  They
  510. are called minor because they aren't alternatives to the major modes,
  511. just minor modifications of them.  Each minor mode can be turned on or
  512. off by itself, regardless of what major mode you are in, and
  513. regardless of the other minor modes.  So you can use no minor modes,
  514. or one minor mode, or any combination of several minor modes.
  515.  
  516. One minor mode which is very useful, especially for editing English
  517. text, is "Auto Fill" mode.  When this mode is on, JOVE breaks the line
  518. in between words automatically whenever the line gets too long.  You
  519. can turn this mode on by doing M-X auto-fill-mode<Return>.  When the
  520. mode is on, you can turn it off by doing M-X auto-fill-mode<Return>--
  521. it toggles.
  522.  
  523. >> Type "M-X auto-fill-mode<Return>" now.  Then insert a line with a
  524.    bunch of words over again until you see it divide into two lines.
  525.    You must put in spaces between them because Auto Fill breaks lines
  526.    only at spaces.  Notice that "Fill" (the code for Auto Fill) appears
  527.    in the mode line after "Text" to indicate that you are in Text Fill
  528.    mode.
  529.  
  530. The margin is usually set at 78 characters, but you can change it with
  531. the set command.  The margin is kept in a variable just like the mode
  532. values.
  533.  
  534. >> Type "M-X set right-margin 20", then type in some text and see
  535.    JOVE fill lines of 20 characters with it.  Then set the margin
  536.    back to 72 using M-X set again.
  537.  
  538.  
  539. SEARCHING
  540. ---------
  541.  
  542. JOVE can do searches for strings (these are groups of contiguous
  543. characters or words) either forward through the file or backward
  544. through it.  To search for the string means that you are trying to
  545. find that string somewhere in the file.  Remember to use ^\ where it
  546. says ^S.
  547.  
  548. >> Now type ^S to start a search.  Type the word 'cursor', then
  549.    Return.
  550.  
  551. >> Type ^S Return to find the next occurrence of "cursor".
  552.  
  553. The ^S starts a search that looks for any occurrence of the search
  554. string AFTER the current cursor position.  But what if you want to
  555. search for something earlier in the text?  To do this one should type
  556. ^R for reverse search.  Everything that applies to ^S applies to ^R
  557. except that the direction of the search is reversed.
  558.  
  559.  
  560. REPLACING TEXT
  561. --------------
  562.  
  563. >> Move the cursor to the blank line two lines below this one.
  564.    Then type M-r changed<Return>altered<Return>.
  565.  
  566.    Notice how this line has changed: you've replaced the word
  567.    c-h-a-n-g-e-d with "altered" wherever it occurs after the cursor.
  568.  
  569. The more customary command for replacing strings is the interactive
  570. command query-replace-search, which has several options.  In essence,
  571. it shows each occurrence of the first string and asks you if you want to
  572. replace it or not.  You can also choose to edit around the string, or
  573. go on and replace all occurrences without asking further.
  574.  
  575.    This is invoked with M-Q..  When you start up a Query Replace, it
  576. will prompt you with "From" and "To", for what you want to change, and
  577. what you want to change it to.  JOVE will then move to the first
  578. occurence of the "From", and wait for a character.  You can type:
  579.  
  580.     <SPACE>        Do the replacement, and move to next occurrence
  581.             of the "From" string.
  582.     <DEL>        Skip the current "From" string and move to the
  583.             next one.
  584.     RETURN        Exit the Query Replace now.
  585.     r        Recursive Edit
  586.     p        Replace all further occurences of the "From"
  587.             string,    without asking.
  588.  
  589. Recursive edit makes it possible to temporarily supend the Q-R-S, let the
  590. user go off and do something, and then return to the search after the he
  591. is done.  The command exit-jove (^X ^C) returns from the recursive-edit.
  592.  
  593. GETTING MORE HELP
  594. -----------------
  595.  
  596. In this tutorial we have tried to supply just enough information to
  597. get you started using JOVE.  There is so much available in JOVE that
  598. it would be impossible to explain it all here.  However, you may want
  599. to learn more about JOVE since it has numerous desirable features that
  600. you don't know about yet.  JOVE has a some internal documentation.
  601.  
  602. The most basic HELP feature is the describe-key command which is
  603. available by typing ^X ? and then a command character.  JOVE prints
  604. one line line on the bottom of the screen tell what command is bound to
  605. that key.  You can then get further information on that command
  606. using...
  607.  
  608. The describe-command command M-? will prompt for the name of a command
  609. and print out the section from the manual about that command.  When you
  610. are finished reading it, type a Space or a ^G (quit) to bring your text
  611. back on the screen.
  612.  
  613. >> Type ^X ? Control-P.  The message at the bottom of the screen should
  614.    be something like "^P is bound to previous-line".
  615.  
  616. Multi-character commands such as ^X ^C and <ESC>V are also allowed
  617. after ^X ?.
  618.  
  619. Now lets get more information about the previous-line command.
  620.  
  621. >> Type M-? previous-line.  When you are finished reading the
  622.    output, type a Space.
  623.  
  624. The "name of the command" is important for people who are customizing
  625. JOVE.  It is what appears in the JOVE CHART as the documentation for
  626. the command character.
  627.  
  628. One other form of help is the "apropos" command.  We have already tried
  629. using this command in an earlier part of this tutorial, but it should
  630. be mentioned again here.  Apropos prompts for a word or phrase and
  631. lists all the commands that contain that string.  If you couldn't
  632. remember the name of a certain command to read file, you could run the
  633. apropos command with the keyword "file" and it would list all the
  634. commands that contain "file".  To run apropos you would type
  635.  
  636.     M-X apr<Space>file<Return>
  637.  
  638. Finally, the full JOVE manual is included in the distribution.  It is
  639. in NROFF/TROFF form and can be formatted into a form readable on the
  640. terminal or line-printer with the command:
  641.  
  642.     cd /local/src/jove
  643.     make doc/jove.man
  644.  
  645. To get a typeset copy, use the make target troff-man.  You will have to
  646. adjust the makefile for your local facilities for TROFF output.
  647.  
  648. Besides, someone around you must have a printed version which you can borrow!
  649. There's also an old copy in the Berkeley Unix 4.3 manuals - in the User
  650. Supplementary Documents manual (the one with the green spine).  There is also
  651. a chart of JOVE commands, sorted by function, which is handy as a quick
  652. reference.  Ask your local Jove guru for a copy.
  653.  
  654. CONCLUSION OF PART TWO
  655. ----------------------
  656.    This concludes section two of the JOVE tutorial.  The rest of this
  657. tutorial describes some of the very advanced features of JOVE, such as
  658. editing more than one file at once, writing your own macros, windows, and
  659. initialization files.  Unless you're already somewhat familiar with
  660. JOVE, you should probably wait a little while before starting the third
  661. section.
  662.  
  663. MARKS AND REGIONS
  664. -----------------
  665.  
  666.    In general, a command which processes an arbitrary part of the buffer
  667. must know where to start and where to stop.  In JOVE, such commands
  668. usually operate on the text between point (where the cursor is now) and
  669. "the mark".  This range of text is called "the region".  To specify a
  670. region, you set point to one end of it and mark at the other.  It doesn't
  671. matter which one is set first chronologically, or which one comes earlier
  672. in the text.  Here are some commands for setting the mark:
  673.  
  674.         ^@         Set the mark where point is.
  675.         ^<SPACE>   The same.
  676.         ^X ^X      Interchange mark and point.
  677.  
  678.    The most common way to set the mark is with the ^@ command or the
  679. ^<SPACE> command.  They set the mark where point is.  Then you can move
  680. point away, leaving the mark behind.
  681.  
  682.    Since terminals have only one cursor, there is no way for JOVE to
  683. show you where the mark is located.  You have to remember.  The usual
  684. solution to this problem is to set the mark and then use it soon, before
  685. you forget where it is.  But you can see where the mark is with the
  686. command ^X ^X which puts the mark where point was and point where the
  687. mark was.  The extent of the region is unchanged, but the cursor and
  688. point are now at the previous location of the mark.
  689.  
  690.    There are many, many commands which use regions (the area between the
  691. point and the mark), which we have not mentioned here.  They can be found
  692. in the Jove Quick Reference Card.
  693.  
  694. BUFFERS
  695. -------
  696.    When editing a file, JOVE reads the file into a buffer.  This is
  697. where the modifcations are done, and when you save the file with ^X ^S,
  698. the buffer is actually written out to the file.  JOVE permits you to
  699. have up to 100 buffers, so, in essence, you can edit up to 100 files at
  700. the same time.
  701.  
  702.    If you want to list the buffers you have, use the ^X ^B command.
  703. This will display a list of the buffers, their numbers and names, and
  704. whether or not they've been modified.
  705.  
  706. >>> Do this now, type ^X ^B.  When you're done looking, type a <SPACE>.
  707.  
  708.    You probably noticed you have three buffers, named "Main", "*minibuf*",
  709. and "teach-jove".  The "Main" buffer is always created by JOVE; you may
  710. use it if you wish.  "*minibuf*" is a special reserved buffer which is
  711. described in the JOVE manual.  "teach-jove" holds a working copy of the
  712. file of the same name.
  713.  
  714.    If you were editing more than one file, you would have even more
  715. buffers.  There are two ways to edit more than one file.  The first is to
  716. call JOVE with more than one file on the command line.  For example, the
  717. shell command
  718.  
  719.                   jove a b c
  720.  
  721. would start JOVE with three buffers (named a, b, and c), each one
  722. containing one file.  The other way is to use the ^X ^F command (called
  723. Find File).  This command prompts you for a filename, and then reads that
  724. file into a new buffer, and puts you into the new buffer.
  725.  
  726.    To change buffers, use the ^X B command.  JOVE will prompt you for a
  727. buffer name, and print a name in parentheses.  If you just hit a carriage
  728. return without typing a buffer name, you will go to the buffer named in
  729. parentheses.  Another way to change buffers is to give ^X B a NUMBER.
  730. This goes to the buffer NUMBER, rather than using the buffer name.
  731.  
  732. >>> Get a piece of paper, and write down the following commands.  Then
  733.     run them, to get a feel for playing with buffers.  BE SURE TO WRITE
  734.     THEM DOWN! We don't want to get you lost!
  735.  
  736.             ^X ^B
  737.             <SPACE>
  738.             ^X ^F        (type "/etc/motd" to the prompt)
  739.             ^X ^B
  740.             <SPACE>
  741.             ^X B
  742.             <RETURN>
  743.  
  744.    Well, wasn't that fun?  Now you know how to get another file into
  745. another buffer, and then "bounce" back and forth.  A nice feature about
  746. editing more than one file is that you can transfer text from one file to
  747. the other.  Just kill it in one file, change buffers, and then put it
  748. back with ^Y.
  749.  
  750. WINDOWS
  751. -------
  752.    What you see on your screen is a "window" into the buffer you are
  753. editing.  JOVE allows you to have more than one window on your screen, and
  754. you can therefore look into two, or more buffers at once.  You can also look at
  755. different parts of the same file.  The command ^X 2 splits your screen into
  756. two windows, both looking into the same buffer.  The command ^X 4 f will
  757. display a specified file in the other window, ^X 4 b will display a specified
  758. buffer in the other window, ^X n moves to the next window on the screen,
  759. while ^X p moves to the previous window.
  760.  
  761. >>> Try the command ^X 2, which splits the screen into two windows, and
  762.     displays the same buffer in both.  You'll notice that you are in the new
  763.     window.  Try some commmands in this window, like ^V, or M-V, to move
  764.     around in the file.  Observe that the other window doesn't change its
  765.     position relative to the buffer.  This gives you a way of looking at two
  766.     parts of the same file.
  767.  
  768. >>> Now try to type some text, or change something.  You will see the changes
  769.     affecting the text in the other window as well.  That is because both
  770.     windows are displaying the same buffer, and therefor the same text.  Changes
  771.     in the contents of the buffer have to affect both windows.
  772.  
  773. >>> Let's now try to edit another file in this window.  Give the command
  774.     ^X ^F and type the name of file as "/etc/motd".  You now have two files
  775.     on your screen at the same time.
  776.  
  777. >>> Type the command M-^V (Meta followed by ^V) and watch the other window
  778.     page downward.  This is very convenient when doing a variety of tasks, like
  779.     correcting errors in a file - edit the file, with the list of errors in
  780.     the other window!
  781.  
  782. >>> Finally, let's get back to the main window (with this document) by typing
  783.     ^X p (or ^X n, since there are only two windows).  Expand this window
  784.     to fill the entire screen by typing ^X 1.
  785.  
  786. Enjoyable, wasn't it! There are other commands for shrinking and growing
  787. windows, but one of the most useful when editing text like this is the command
  788. which invokes JOVE's interactive spelling checker.  It's called spell-buffer.
  789. It runs the UNIX spell(1) command on the buffer, and puts the errors in
  790. another buffer in another window, and allows you to edit the list to remove
  791. the words you know are not errors.  Then, type ^X ^C, which usually gets you
  792. out of JOVE but in this case only gets you out of the spell-edit mode.  You can
  793. now go through the remaining spelling errors word-by-word, and you can correct
  794. them.  The commands for this are ^X ^N (for next error) and ^X ^P (for
  795. previous error.)
  796.  
  797. >>> Try the spell-buffer command now, by going M-X spel <space> and watch.
  798. Delete a few errors, then type ^X ^C, and do a few ^X ^N's to find some
  799. errors in this document.  We've left a few! (deliberately, of course!!!)
  800.  
  801.  
  802. MACROS
  803. ------
  804.    A "keyboard macro" is a command defined by the user to abbreviate a
  805. sequence of other commands.  If you discover that you are about to type
  806. ^N ^D forty times, you can define a keyboard macro to do ^N ^D and
  807. call it with a repeat count of forty.  The commands which deal with
  808. keyboard macros are:
  809.  
  810.         ^X (       Start defining a keyboard macro.
  811.         ^X )       End the definition of a keyboard macro.
  812.         ^X E       Execute the most recent keyboard macro.
  813.  
  814.    You define a keyboard macro while executing the commands which are the
  815. definition.  Put differently, as you are defining a keyboard macro, the
  816. definition is being executed for the first time.  This way, you can see
  817. what the effects of your commands are, so that you don't have to figure
  818. them out in your head.  When you are finished, the keyboard macro is
  819. defined and also has been, in effect, executed once.  You can then do the
  820. whole thing over again by invoking the macro.
  821.  
  822.    To start defining a keyboard macro, type the ^X ( command.  From then
  823. on, your commands continue to be executed, but also become part of the
  824. definition of the macro.  "Def" appears in the mode line to remind you of
  825. what is going on.  When you are finished, the ^X ) command terminates
  826. the definition (without becoming part of it!).
  827.  
  828.    The macro thus defined can be invoked again with the ^X E command
  829. which may be given a repeat count as a numeric argument to execute the
  830. macro many times.  ^X ) can also be given a repeat count as an argument,
  831. in which case it repeats the macro that many times right after defining
  832. it, but defining the macro counts as the first repetition (since it is
  833. executed as you define it).  So, giving ^X ) an argument of 2 executes
  834. the macro immediately one additional time.
  835.  
  836.    If you want to perform an operation on each line, then either you
  837. should start by positioning point on the line above the first one to be
  838. processed and then begin the macro definition with a ^N, or you should
  839. start on the proper line and end with a ^N.  Either way, repeating the
  840. macro will operate on successive lines.
  841.  
  842. >>> Place the cursor at the top of the screen and then enter the commands
  843.     below.  Note that after the first command, "Def" appears in the mode
  844.     line.
  845.  
  846.             ^X (
  847.             ^A
  848.             *****
  849.             M-F
  850.             M-F
  851.             M-F
  852.             -----
  853.             ^N
  854.             ^X )
  855.  
  856. >>> Notice that as you typed those commands in, they were executed.  Now
  857.     move the cursor down a couple of lines, but keep it near the top of
  858.     the screen.  Type the command ^U ^X E.  This will execute your
  859.     macro 4 times.
  860.  
  861.    Although not described here, it is possible to both name your macros,
  862. and to save and restore them from files.  See the documentation for this.
  863.  
  864. INITIALIZATION FILES
  865. --------------------
  866.    You can initialize JOVE just the way you like it by putting a file
  867. named ".joverc" in your home directory.  To see what this file should
  868. look like, look at the one in the directory /usr/src/local/jove/doc.  The
  869. file system.rc is one such file, the other example is example.rc.  It
  870. should be noted that the commands in this file contain control
  871. characters, which may make it hard to read.  Use the "cat -v" command
  872. for this.
  873.  
  874.    To insert control characters into a file with JOVE, you should use
  875. the ^Q command.  Type ^Q <X> where <X> is the control character.  Note that
  876. ^Q will not work on some terminals, because it, like ^S, is used for
  877. suspending and restoring the output to the terminal.  In that case, use
  878. the command M-X quo <space> <X>.
  879.  
  880. INTERACTIVE SHELLS
  881. ------------------
  882.  
  883.    One of JOVE's very powerful features is the ability to start up shells
  884. within the editor, and then use shell commands within the screen editing
  885. environment.  To execute a command again, just cursor-up to it, change it if
  886. you want with all the normal editing keys, and hit RETURN once to bring it
  887. down to your present command line, and again to execute it.  We'll bow out
  888. here suggesting you consult the manual for hard details, or type M-X shell
  889. <space> if you are the adventurous type!
  890.  
  891. CONCLUSION
  892. ----------
  893.  
  894. Remember, to exit use ^X ^C.
  895.  
  896. This tutorial is meant to be understandable to all new users, so if
  897. you found something unclear, don't sit and blame yourself - complain to
  898. one of the people listed at the end of this document!
  899.  
  900. You'll probably find that if you use JOVE for a few days you won't
  901. be able to give it up.  Initially it may give you trouble.  But remember
  902. that this is the case with any editor, especially one that can do many,
  903. many things.  And JOVE can do practically everything.
  904.  
  905.    Hopefully you have enjoyed this tutorial, and, more importantly, I
  906. hope you've learned something.  If you use JOVE for about a week, and be
  907. patient, you will find that it is more convenient and friendly to use
  908. than any other editor you've used.  I know.  I did.
  909.  
  910. ---------------------------------------------------------------------------
  911. This tutorial was originally written by Richard Stallman for EMACS and
  912. modified by Doug Kingston and Jonathan Payne for JOVE. The section on windows
  913. was added by Mark Moraes.  Comments on this document should be sent to
  914. jovehacks@cs.toronto.edu.
  915.