home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume1 / 8711 / uemacs-3.9-doc / 2 < prev    next >
Internet Message Format  |  1990-07-13  |  31KB

  1. Path: uunet!husc6!necntc!ncoast!allbery
  2. From: nwd@j.cc.purdue.edu (Daniel Lawrence)
  3. Newsgroups: comp.sources.misc
  4. Subject: MicroEmacs 3.9 Documentation (2 of 4)
  5. Message-ID: <5704@ncoast.UUCP>
  6. Date: 19 Nov 87 00:17:24 GMT
  7. Sender: allbery@ncoast.UUCP
  8. Lines: 714
  9. Approved: allbery@ncoast.UUCP
  10. X-Archive: comp.sources.misc/uemacs-3.9-doc/2
  11.  
  12. # This is a shar archive.
  13. # Remove everything above this line.
  14. # Run the file through sh, not csh.
  15. # (type `sh med.2')
  16. # If you do not see the message
  17. #    `med.2 completed!'
  18. # then the file was incomplete.
  19. echo extracting - emacs.tut
  20. sed 's/^X//' > emacs.tut << 'FRIDAY_NIGHT'
  21. XYou are looking at the MicroEMACS tutorial.  Comments on this document may
  22. Xbe referred to Daniel Lawrence.
  23. X
  24. XNOTE:  This tutorial attempts to help you "learn by doing".  The characters
  25. X       ">>" at the left margin of your screen indicate directions for you to
  26. X       try using a command.
  27. X
  28. XEMACS commands generally involve the CONTROL key (sometimes labelled CTRL
  29. Xor CTL) or the META key (generally labelled ESCAPE).  Rather than write out
  30. XCONTROL or META each time we want you to prefix a character, we'll use the
  31. Xfollowing abbreviations:
  32. X
  33. X   ^<chr>    Hold the CONTROL key while pressing the character <chr>.
  34. X             Thus, ^F would be:  hold the CONTROL key and press F.
  35. X
  36. X>>  Now type ^V (View Next Screen) to move to the next screen.
  37. X    Remember:  hold the CONTROL key and press V.
  38. X
  39. X   ESC-<chr>  Press the ESCAPE key and release it, then press the
  40. X              character <chr>.  Note:  The command will have the
  41. X              same meaning for upper or lower case characters (<chr>).
  42. X
  43. XIMPORTANT NOTE:  If you must exit at some point, type ^X^C.
  44. X
  45. XFor the time being, you'll be expected to type ^V whenever you finish reading
  46. Xthe current screen.
  47. X
  48. XNote that there is an overlap when going from screen to screen; this provides
  49. Xsome continuity when moving through the file.
  50. X
  51. XThe first thing that you need to know is how to move around from place to
  52. Xplace in the file.  You already know how to move forward a screen with ^V.
  53. XTo move back a screen, type ^Z.
  54. X
  55. X>>  Try typing ^Z and then ^V to move back and forth between screens a few
  56. X    times.
  57. X
  58. X
  59. XSUMMARY
  60. X-------
  61. X
  62. XThe following commands are useful for viewing screens:
  63. X
  64. X     ^V       Move forward one screen
  65. X     ^Z       Move back one screen
  66. X     ESC-^L   Clear screen and redisplay everything, putting the text
  67. X              near the cursor at the center of the screen.
  68. X
  69. X>>  Find the cursor and remember what text is near it.  Type an ESC-^L.
  70. X    Find the cursor again and see what text is near it now.
  71. X
  72. X
  73. XBASIC CURSOR CONTROL
  74. X--------------------
  75. X
  76. XGetting from screen to screen is useful, but how do you reposition yourself
  77. Xwithin a given screen to a specific place?  There are several ways you can
  78. Xdo this.  One way (not the best, but the most basic) is to use the commands
  79. Xprevious, backward, forward and next.  As you can imagine these commands
  80. X(which are given to EMACS as ^P, ^B, ^F, and ^N  respectively) move the
  81. Xcursor from where it currently is to a new place in the given direction.
  82. XHere, in a more graphical form, are the commands:
  83. X
  84. X                          Previous line, ^P
  85. X                                  :
  86. X                                  :
  87. X   Backward, ^B .... Current cursor position .... Forward, ^F
  88. X                                  :
  89. X                                  :
  90. X                          Next line, ^N
  91. X
  92. XYou'll probably find it easy to think of these by letter.  P for previous,
  93. XN for next, B for backward and F for forward.  These are the basic cursor
  94. Xpositioning commands and you'll be using them ALL the time so it would be
  95. Xof great benefit if you learn them now.
  96. X
  97. X>>  Do a few ^N's to bring the cursor down to this line.
  98. X
  99. X>>  Move into the line with ^F's and then up with several ^P's.  Note what
  100. X    ^P does when the cursor is in the middle of the line.
  101. X
  102. X>>  Try ^B at the beginning of a line.  Note what happened to the cursor.
  103. X    Do a few more ^B's.  Then do ^F's back to the end of the line and beyond.
  104. X
  105. XWhen you go off the top or bottom of the screen, the text beyond the edge is
  106. Xshifted onto the screen so that your instructions can be carried out while
  107. Xkeeping the cursor on the screen.
  108. X
  109. X>>  Move the cursor off the bottom of the screen with ^N's and see what
  110. X    happens.  Note the new position of the cursor.
  111. X
  112. XIf moving by characters is too slow, you can move by words.  ESC-F moves
  113. Xforward a word and ESC-B moves back a word.
  114. X
  115. X>>  Type a few ESC-F's and ESC-B's.  Intersperse them with ^F's and ^B's.
  116. X
  117. XNotice the parallel between ^F and ^B on the one hand, and ESC-F and ESC-B on
  118. Xthe other hand.  Very often META characters are used for operations related
  119. Xto English text whereas CONTROL characters operate on the basic textual units
  120. Xthat are independent of what you are editing (characters, lines, etc.).
  121. X
  122. XTwo other commands which are useful are ^A and ^E.  These commands move the
  123. Xcursor to the beginning (^A) and the end (^E) of the line.
  124. X
  125. X>>  Try a couple of ^A's, and then a couple of ^E's.  Note that the cursor
  126. X    does not move when either of these commands is repeated continuously.
  127. X
  128. XTwo other simple cursor motion commands are ESC-< (less than), which moves
  129. Xto the beginning of the file, and ESC-> (greater than), which moves to the
  130. Xend of the file.  If you need the shift key to type a "<", then you must
  131. Xalso use the shift key to type ESC-<.  Otherwise, you would be typing ESC-, .
  132. X
  133. XThe location of the cursor within the text is also called "point".  To
  134. Xparaphrase, the cursor shows on the screen where point is located in the
  135. Xtext.
  136. X
  137. XHere is a summary of simple moving operations, including the word and
  138. Xline moving commands:
  139. X
  140. X     ^F        Move forward a character
  141. X     ^B        Move back a character
  142. X
  143. X     ESC-F     Move forward a word
  144. X     ESC-B     Move back a word
  145. X
  146. X     ^N        Move to next line
  147. X     ^P        Move to previous line
  148. X
  149. X     ESC-N     Move to next paragraph
  150. X     ESC-P     Move to previous paragraph
  151. X
  152. X     ^A        Move to beginning of line
  153. X     ^E        Move to end of line
  154. X
  155. X     ESC-<     Go to beginning of file
  156. X     ESC->     Go to end of file
  157. X
  158. X>>  Try all of these commands now a few times for practice as these are
  159. X    the most often used commands.  Since the last two will take you away
  160. X    from this screen, use ^V's and ^Z's to return here.
  161. X
  162. XLike all other commands in EMACS, these commands can be given arguments
  163. Xwhich cause them to be executed repeatedly.  The way you give a command
  164. Xa repeat count is by pressing META (ESC) and then the number before you
  165. Xenter the command.  As a special case, typing ^U is equivalent to ESC-4.
  166. X
  167. XFor instance, ESC-8 ^F moves forward eight characters.
  168. X
  169. X>>  Try giving a suitable argument to ^N or ^P to come as close as you
  170. X    can to this line in one jump.
  171. X
  172. XThis also applies to the screen moving commands, ^V and ^Z.  When given
  173. Xan argument, they scroll the screen up or down by that many screens.
  174. X
  175. X>>  Try typing ESC-3 ^V now.
  176. X
  177. XIf you would like to scroll up, you can give an argument to ^Z.
  178. X
  179. X
  180. XABORTING COMMANDS
  181. X-----------------
  182. X
  183. XThe EMACS command used to abort any command which requests input is
  184. X^G.  For example, you can use ^G to discard a numeric argument or at
  185. Xthe beginning of a command that you don't want to finish.
  186. X
  187. X>>  Type ESC-100 to make a numeric argument of 100, then type ^G.
  188. X    Now type ^F.  How many characters does it move?  If you have
  189. X    typed an ESC by mistake, you can get rid of it with ^G^G.
  190. X
  191. X
  192. XERRORS
  193. X------
  194. XSometimes you may do something which EMACS doesn't allow.  If it is
  195. Xsomething simple, such as typing a CONTROL key sequence which is not
  196. Xassociated with any command, EMACS will just beep at you.  Otherwise,
  197. XEMACS will also display an informative error message at the bottom of
  198. Xthe screen.
  199. X
  200. XSome versions of EMACS do not have all the features described in this
  201. Xtutorial implemented yet.  If you come across such an unimplemented
  202. Xfeature, you may get an error message when you try to use it.  Just
  203. Xpress any cursor movement key and proceed to the next section of the
  204. Xtutorial.
  205. X
  206. X
  207. XNOTE:  Several of the exercises in the following sections allow you to use
  208. X       options which will make changes to this tutorial. Do no worry about
  209. X       these changes affecting the tutorial - this is only a copy of the
  210. X       master tutorial and you will not be instructed to save the changes
  211. X       made to it.
  212. X
  213. X
  214. XCURSOR KEYS
  215. X-----------
  216. X
  217. XThe cursor keypad, usually located on the right side of the keyboard,
  218. Xhas been bound to some of the more useful screen movement commands.
  219. XThe mappings are as follows:
  220. X
  221. X     Cursor-Right    ^F        Move forward a character
  222. X     Cursor-Left     ^B        Move back a character
  223. X
  224. X
  225. X     ^Cursor-Right   ESC-F     Move forward a word
  226. X     ^Cursor-Left    ESC-B     Move back a word
  227. X
  228. X
  229. X     Cursor-Down     ^N        Move to next line
  230. X     Cursor-Up       ^P        Move to previous line
  231. X
  232. X
  233. X     Pg-Dn           ^V        Move to next screen
  234. X     Pg-Up           ^Z        Move to previous screen
  235. X
  236. X
  237. X     Home            ESC-<     Go to beginning of file
  238. X     End             ESC->     Go to end of file
  239. X
  240. X
  241. X     Insert          ^C        Insert single space
  242. X     Delete          ^D        Delete current character
  243. X
  244. XA map of the keypad layout looks something like this:
  245. X
  246. X                   -------------------------------------------------
  247. X                   | 7             | 8             | 9             |
  248. X                   | Home          | ^             | Pg Up         |
  249. X                   |        ESC-<  | |         ^P  |           ^Z  |
  250. X                   -------------------------------------------------
  251. X                   | 4             | 5             | 6             |
  252. X                   | <--       ^B  |               | -->       ^F  |
  253. X                   -------------------------------------------------
  254. X                   | 1             | 2             | 3             |
  255. X                   | End           | |             | Pg Dn         |
  256. X                   |        ESC->  | v         ^N  |           ^V  |
  257. X       -------------------------------------------------------------
  258. X       | 0                           | .                           |
  259. X       | Insert                  ^C  | Delete                  ^D  |
  260. X       -------------------------------------------------------------
  261. X
  262. X>>  Practice using the cursor keypad.
  263. X
  264. X
  265. XMODE LINE
  266. X---------
  267. X
  268. XThe line above the function key display at the bottom of the screen
  269. Xis referred to as the "communication line".  This is where EMACS
  270. Xinteractively communicates with you.  Later you will see how EMACS
  271. Xprompts you for information on this line, such as to initiate a
  272. Xsearch.  EMACS can report things to you on this line as well.
  273. X
  274. X>>  Type ^X= and see what appears in the communication line. Don't worry
  275. X    about what all this information means - it is just an example of how
  276. X    EMACS lets you know more about the file you are editing.
  277. X
  278. XThe line immediately above the communication line is referred to as the
  279. X"mode line".  The mode line looks something like
  280. X
  281. X=* MicroEMACS 3.7 () == emacs.tut == File: emacs.tut ===========================
  282. X
  283. XThis is a very useful "information" line.
  284. X
  285. X  -  The asterisk (star) indicates that changes have been made to the file.
  286. X     Immediately after opening or saving a file, there is no star.
  287. X
  288. X  -  Any words inside the parentheses indicate the "modes" EMACS is
  289. X     currently in.  Modes will be discussed in the next section.
  290. X
  291. X  -  The string following the () is the buffername, i.e., the name EMACS
  292. X     gives to the buffer, and it is usually related to the filename.
  293. X
  294. X  -  The string following "File:" is the name of the file you are
  295. X     currently editing.
  296. X
  297. X>>  Look at the mode line and identify the items discussed above.
  298. X
  299. X
  300. XMODES
  301. X-----
  302. X
  303. XListed within the parentheses are the "modes" which are associated with
  304. Xthe current buffer.  Modes are a feature of EMACS which assist in the
  305. Xediting of different languages, i.e., C, and text.  Presently, there are
  306. Xno modes associated with this buffer.  This means EMACS will do exactly
  307. Xwhat you think it will when using it - no "bonuses".  You can find out
  308. Xmore about the current buffer and mode status by typing ^X^B.  Refer to
  309. Xthe EMACS manual for a further discussion of buffers and modes.
  310. X
  311. XAs you become more familiar with EMACS and the use of buffers, "mode"
  312. Xtakes on additional meaning.  When more than one buffer is in use, a
  313. Xmode is referred to as "local" or "global".  These terms indicate how a
  314. Xmode will affect the current buffer and other existing or to be added
  315. Xbuffers.
  316. X
  317. XA "local" mode is valid only within the scope of the current buffer.
  318. XOther existing buffers and buffers which will be added are not affected
  319. Xby local modes.
  320. X
  321. XThe commands to add and delete local modes are
  322. X
  323. X     ^XM       Add a local mode
  324. X     ^X^M      Delete a local mode
  325. X
  326. XEach of the above commands will prompt you for a mode.  To activate
  327. X(deactivate) a mode, type the name of a valid (active) mode (refer to
  328. XEMACS manual for a complete list of the valid modes) and follow it by
  329. Xpressing <Return>, the carriage-return key.
  330. X
  331. X>>  Type ^XM WRAP - note the change in the mode line.  Move the cursor
  332. X    to a blank line on this screen and begin typing the sequence "asdf ".
  333. X    Continue typing this sequence and note what happens when the right
  334. X    margin is encountered.
  335. X
  336. XThe previous exercise allowed you to enter text with the "WRAP" mode
  337. Xactive.  As you can see, "WRAP" instructs EMACS to break between words
  338. Xwhen a line gets too long.  However, in order for this mode to be
  339. Xeffective, spaces must be inserted between words.
  340. X
  341. XThe right margin is usually set at 72 characters but it can be changed.
  342. XTo change the margin type ESC nn ^XF where "nn" is the column number of
  343. Xthe new right-hand margin.
  344. X
  345. X>>  Type ESC 40 ^XF.  Then begin typing "asdf " and notice where the
  346. X    line now breaks.  To return to the default right-hand margin, type
  347. X    ESC 72 ^XF.
  348. X
  349. X>>  Type ^X^M WRAP to "turn off" the local mode "WRAP".
  350. X
  351. XA "global" mode affects only those buffers which will be ADDED after the
  352. X"add/delete global mode" command is executed - not the current or other
  353. Xexisting buffers.  Currently there is no global mode set.
  354. X
  355. XThe commands to add and delete global modes are
  356. X
  357. X     ESC-M     Add a global mode
  358. X     ESC-^M    Delete a global mode
  359. X
  360. XNote:  All modes can be local.  However, global modes allow you to
  361. X       activate those modes which usually apply to most of the buffers
  362. X       in use.
  363. X
  364. XAs with local modes, each of the above commands will prompt you for
  365. Xa mode.  To activate (deactivate) a mode, enter the name of a valid
  366. X(active) mode.
  367. X
  368. X>>  Type ESC-M OVER.  This mode tells EMACS to write over the text on
  369. X    the current line.  Is there any change in the mode line? Now move to
  370. X    the line of "asdf " you entered and start typing.  Note that nothing
  371. X    happens.  Remember that global modes affect only those modes which
  372. X    will be added - not those already existing.
  373. X
  374. X>>  Type ESC-^M OVER to "turn off" the global overwrite mode.
  375. X
  376. X
  377. XINSERTING AND DELETING
  378. X----------------------
  379. X
  380. XIf you want to type text, just start typing.  Characters which you
  381. Xcan see, such as A, 7, *, etc. are taken by EMACS as text and are
  382. Ximmediately inserted.  Type <Return> to insert a line separator,
  383. Xi.e., a single linefeed character.
  384. X
  385. XYou can delete the last character you typed by typing either <Delete>
  386. Xor ^H.  On some keyboards, there is a dedicated key for creating a ^H.
  387. XIf so, it is usually labelled as either "Backspace" or "<--".  <Delete>
  388. Xis a key on the keyboard, which may be labelled "Rubout" instead of
  389. X"Delete" on some terminals.  More generally, <Delete> deletes the
  390. Xcharacter immediately before the current cursor position.
  391. X
  392. X>>  Now type a few characters and then delete them by typing <Delete>
  393. X    a few times.
  394. X
  395. X>>  Now start typing text until you reach the right margin, then continue
  396. X    to type.  When a line of text gets too big for one line on the screen,
  397. X    the line of text is "continued" off the edge of the screen.  The dollar
  398. X    sign at the right margin indicates a line which has been continued.
  399. X    EMACS scrolls the line over so you can see what you are editing.  The
  400. X    "$" at the left or right edge of the screen indicates that the current
  401. X    line extends off in that direction.
  402. X
  403. XThis concept is easier to understand by doing rather than by reading about
  404. Xit so it is suggested that the following exercises be done.
  405. X
  406. X>>  The following line actually goes off the edge.  Try typing enough ESC-F's
  407. X    so that you move off the right hand end of this line.  This is a long line of text.  Note the "$" at each edge.  Keep typing ESC-F's and watch where EMACS decides to scroll the line.  Now, type ESC-B's until EMACS decides to scroll the line again.
  408. X
  409. X>>  Go to the line you entered which the text continued off the edge of
  410. X    the screen.  Use ^D's to delete the text until the text line fits on
  411. X    one screen line again.  The continuation "$" will go away.
  412. X
  413. X>>  Move the cursor to the beginning of a line and type <Delete>.  This
  414. X    deletes the line separator before the line and merges the line onto
  415. X    the previous line.  The resulting line may be too long to fit on the
  416. X    screen, in which case it has a continuation indicator.
  417. X
  418. X>>  Press <Return> to insert the separator again.
  419. X
  420. XInternally, EMACS will allow you to have lines of nearly any length, limited
  421. Xonly by the amount of memory available.  Externally, however, EMACS can only
  422. Xread or write lines, to or from a file, which are less than or equal to 255
  423. Xcharacters.
  424. X
  425. XRemember that most EMACS commands can be given a repeat count.  Note that
  426. Xthis includes characters which insert themselves.
  427. X
  428. X>>  Try that now -- type ESC-8 * and see what happens.
  429. X
  430. XIf you want to insert spaces in a line, type ^C.
  431. X
  432. X>>  Move to a line and move the cursor with ^F's; then insert spaces with ^C.
  433. X    Use ^D to remove the spaces.
  434. X
  435. XIf you want to create a blank line between two lines, move to the second
  436. Xof the two lines and type ^O.
  437. X
  438. X>>  Try moving to a line and typing ^O now.
  439. X
  440. XYou've now learned the most basic way of typing something in EMACS and
  441. Xcorrecting errors.  You can delete characters, words or lines as well.
  442. XHere is a summary of the delete operations:
  443. X
  444. X     <Delete>      Delete the character just before the cursor
  445. X     ^H            Delete the character just before the cursor
  446. X     ^D            Delete the character the cursor is under
  447. X
  448. X     ESC-<Delete>  Kill the word immediately before the cursor
  449. X     ESC-^H        Kill the word immediately before the cursor
  450. X     ESC-D         Kill the word from the cursor position
  451. X
  452. X     ^K            Kill from the cursor position to end of line
  453. X
  454. XNotice that <Delete> and ^D vs ESC-<Delete> and ESC-D extend the parallel
  455. Xstarted by ^F and ESC-F (well, <Delete> isn't really a control character,
  456. Xbut let's not worry about that).
  457. X
  458. XNow suppose you kill something, and then you decide that you want to get
  459. Xit back?  Well, whenever you kill something bigger than a character, EMACS
  460. Xsaves it for you.  To yank it back, use ^Y.  Note that you don't have to
  461. Xbe in the same place to do ^Y.  This is a good way to move text around.
  462. XAlso note the difference between "Killing" and "Deleting" - "Killed" text
  463. Xcan be yanked back, and "Deleted" text cannot.  Generally, the commands
  464. Xthat can destroy a lot of text save it, while the ones that attack only
  465. Xone character do not save it.
  466. X
  467. X>>  Type ^N a couple times to position the cursor at some line on this
  468. X    screen.  Now kill that line with ^K.
  469. X
  470. XNote that a single ^K kills the contents of the line, and a second ^K
  471. Xkills the line itself, and makes all the other lines move up.  If you
  472. Xgive ^K a repeat count, it kills that many lines AND their contents.
  473. X
  474. XThe text that has just disappeared is saved so that you can retrieve it.
  475. XTo retrieve the last killed text and put it where the cursor currently
  476. Xis, type ^Y.
  477. X
  478. X>>  Try it.  Type ^Y to yank the text back.
  479. X
  480. XThink of ^Y as if you were yanking something back that someone took away
  481. Xfrom you.  Notice that if you do several ^K's in a row the text that is
  482. Xkilled is all saved together so that one ^Y will yank all of the lines.
  483. X
  484. X>>  Try it.  Type ^K several times.
  485. X
  486. X>>  To retrieve that killed text:  Type ^Y.  Move the cursor down a few
  487. X    lines and type ^Y again.  You now know how to copy text.
  488. X
  489. XWhat do you do if you have some text you want to yank back, and then
  490. Xyou kill something else?  ^Y would yank the more recent kill.
  491. X
  492. X>>  Kill a line, move around, kill another line.  Then do ^Y to get back
  493. X    the second killed line.
  494. X
  495. X
  496. XSEARCHING
  497. X---------
  498. X
  499. XEMACS can do searches for strings (these are groups of contiguous
  500. Xcharacters or words) either forward through the file or backward
  501. Xthrough it.
  502. X
  503. X>>  Now type ^S to start a search.  Type the word "cursor", then ESC.
  504. X
  505. X>>  Type ^S ESC to find the next occurrence of "cursor".
  506. X
  507. XThe ^S starts a search that looks for any occurrence of the search
  508. Xstring AFTER the current cursor position.  But what if you want to
  509. Xsearch for something earlier in the text?  To do this one should
  510. Xtype ^R for Reverse search.  Everything that applies to ^S applies
  511. Xto ^R except that the direction of the search is reversed.
  512. X
  513. X
  514. XTEXT REPLACEMENT
  515. X----------------
  516. X
  517. X>>  Move the cursor to the blank line two lines below this one.
  518. X    Then type ESC-R changed ESC altered ESC .
  519. X
  520. X    Notice how this line has changed; you have replaced the word
  521. X    "changed" with "altered" wherever it occurs in the file after
  522. X    the cursor.  After all the substitutions have been made or
  523. X    the end of file has been reached, a message informing you of
  524. X    the number of substitutions which have been made appears in
  525. X    the communication line.
  526. X
  527. XThe more customary command for replacing strings is the interactive
  528. Xcommand query-replace-search (ESC-^R), which has several options.  In
  529. Xessence, it shows each occurrence of the first string and asks you if
  530. Xyou want to replace it or not.  Type a "?" when it asks to replace the
  531. Xstring to list the various options for query-replace-search.  For a
  532. Xmore detailed discussion of this command refer to the EMACS manual.
  533. X
  534. X
  535. XFILES
  536. X-----
  537. X
  538. XIn order to make the text changes permanent, you must save them to a file.
  539. XIf you do not save them, the changes will "disappear" when you leave EMACS.
  540. XAs you make changes, i.e., corrections, deletions, insertions, etc., they
  541. Xare actually written to a "scratch" copy of the file and the changes to
  542. Xthis file will not affect the "master" copy of the file until a file save
  543. Xis specified. This allows you to decide if changes made to the file should
  544. Xbe made permanent or discarded.
  545. X
  546. XRemember:  The file name appears on the mode line.
  547. X
  548. X=* MicroEMACS 3.7 () == emacs.tut == File: emacs.tut ===========================
  549. X                                     ---------------
  550. X
  551. XThe commands for finding and saving files are unlike the other commands
  552. Xyou have learned so far in that they consist of two characters - a ^X
  553. Xfollowed by another character which specifies the file command to be
  554. Xexecuted.
  555. X
  556. XTo find a file, type ^X^F.  EMACS will then prompt you from the
  557. Xcommunication line for the name of the file.  In response to the prompt,
  558. Xtype the file name followed by a <Return> to indicate the file name has
  559. Xbeen entered.  This command will tell EMACS to go find this file and
  560. Xload it.  Its contents will then be displayed on the screen and you will
  561. Xbe able to edit the file's contents.
  562. X
  563. XTo save any changes made to the file, type ^X^S.  This tells EMACS to
  564. Xcreate a new version of the file which includes the changes you have
  565. Xmade.  When the save is complete, the number of lines saved will be
  566. Xdisplayed in the communication line.
  567. X
  568. XIf you edit a file and at some point decide to quit (i.e., ^X^C) without
  569. Xsaving the changes, EMACS will remind you that changes have been made to
  570. Xthe file and ask you if you really want to quit.  Enter "N" to return to
  571. XEMACS or "Y" to exit EMACS without saving the changes.
  572. X
  573. XTo create a file, just edit it "as if" it already existed.  Then start
  574. Xtyping in the text.  When you ask to "save" the file, EMACS will really
  575. Xcreate the file with the text that you have entered.  From then on, you
  576. Xcan consider yourself to be editing an existing file.
  577. X
  578. XIt is not easy for you to test editing a file and continue with the
  579. Xtutorial.  But you can always come back into the tutorial by starting
  580. Xit over and skipping forward.  So, when you feel ready, you should
  581. Xtry editing a file named "FOO", putting some text in it, and saving
  582. Xit; then exit EMACS and look at the file to be sure that it worked.
  583. X
  584. X
  585. XEXTENDING THE COMMAND SET
  586. X-------------------------
  587. X
  588. XThere are many, many more EMACS commands than could possibly be put on all
  589. Xthe CONTROL and META characters.  EMACS gets around this with the X (eXtend)
  590. Xcommand.  There are two forms of this command:
  591. X
  592. X     ^X       Character eXtend.  Followed by one character.
  593. X     ESC-X    Named command eXtend.  Followed by a long name.
  594. X
  595. XThese are commands that are generally useful but used less than the commands
  596. Xyou have already learned about.  You have already seen two of them: the file
  597. Xcommands ^X^F to Find and ^X^S to Save.  Another example is the command to
  598. Xtell EMACS that you'd like to stop editing.  The command to do this is ^X^C.
  599. X
  600. XThere are many ^X commands.  Right now, the most helpful ones will be
  601. X
  602. X     ^X^F   Find file.
  603. X     ^X^S   Save file.
  604. X     ^X^C   Quit EMACS.  This does not save your files automatically;
  605. X              however, if your files have been modified, EMACS asks if
  606. X              you really want to quit.  The standard way to save and
  607. X              exit is ^X^S ^X^C.
  608. X
  609. XNamed eXtended commands are commands which are used even less frequently,
  610. Xor commands which are used only in certain modes.  These commands are
  611. Xusually called "functions".  An example is the function "apropos", which
  612. Xprompts for a keyword and then gives the names of all the functions that
  613. Xare apropos for that keyword.  When you type ESC-X, EMACS prompts you from
  614. Xthe communication line with ":" and you should type the name of the
  615. Xfunction you wish to call; in this case, "apropos".  Just type "apr<Space>"
  616. Xand EMACS will complete the name.  EMACS will ask you for a keyword or
  617. Xphrase and you type the string that you want information on.
  618. X
  619. X>>  Type ESC-X, followed by "apropos<Return>" or "apr<Space>".  Then
  620. X    type "file" followed by a <Return>.  Note: ESC-A is equivalent to
  621. X    the ECS-X "apropos" command.
  622. X
  623. X>>  To remove the "window" that was added, type ^X0 (zero).
  624. X
  625. X
  626. XFUNCTION KEYS
  627. X-------------
  628. X
  629. XBy now, you should be familiar with the format and meaning of some of
  630. Xthe more common CONTROL and META commands.  Because several of these
  631. Xcommands are used frequently, they have been bound to the function
  632. Xkeys, which are usually located on the left-hand side of the keyboard
  633. Xand labelled F1..F10.  By pressing the appropriate function key, one
  634. Xcan replace several keystrokes with a single keystroke, thus saving
  635. Xyou time as you become familiar with their use.
  636. X
  637. XThe highlighted portion at the top of the screen lists the commands
  638. Xwhich are associated with each function key.  Each function key supports
  639. Xtwo commands specified by fn or Fn where n = 1, 2,...10.  The default
  640. Xcommands are represented by fn and are defined on the left side of the
  641. Xscreen; these commands are executed by pressing the appropriate function
  642. Xkey.  The secondary commands are represented by Fn and are defined on
  643. Xthe right side of the screen; these commands are executed by pressing
  644. Xthe <Shift> key and the appropriate function key at the same time.
  645. X
  646. X>>  Press f1 would ESC.  Note the position of the cursor - "would"
  647. X    was located just as if ^S would ESC had been entered.  Enter
  648. X    ^S would ESC to see for yourself.
  649. X
  650. X>>  Press F1 (<Shift> f1).  Note the different appearance of the screen.
  651. X    You have toggled the function key list, i.e., "turned it off".  To
  652. X    "turn it on", press F1 again.
  653. X
  654. X>>  Try using some of the other function keys to become familiar with
  655. X    their use.  NOTE:  Do NOT use f9 with this file as it would save
  656. X    any changes you may have made while using the tutorial.
  657. X
  658. X
  659. XGETTING MORE HELP
  660. X-----------------
  661. X
  662. XIn this tutorial we have tried to supply just enough information to get
  663. Xyou started using EMACS.  There is so much available in EMACS that it
  664. Xwould be impossible to explain it all here.  However, you may want to
  665. Xlearn more about EMACS since it has numerous desirable features that you
  666. Xdon't know about yet.
  667. X
  668. XThe most basic HELP feature is the describe-key function which is
  669. Xavailable by typing ^X? and then a command character.  EMACS prints
  670. Xone line in the communication line to tell what function is bound
  671. Xto that key.
  672. X
  673. X>>  Type ^X?^P.  The message in the communication line should
  674. X    be something like "^P is bound to previous-line".
  675. X
  676. XNOTE:  Multi-character commands such as ^X^Z and ESC-V are also
  677. X       allowed after ^X? .
  678. X
  679. X###  The describe-command function does not work - December 1986  ###
  680. X###  Skip to the next section                                     ###
  681. X
  682. XThe describe-command function (ESC-?) will prompt for the name of a
  683. Xfunction and print out the section from the manual about that command.
  684. XWhen you are finished reading it, type a space or a ^G (quit) to bring
  685. Xyour text back on the screen.
  686. X
  687. XNow let's get more information about the previous-line command.
  688. X
  689. X>>  Type ESC-?^P.  When you are finished reading the output, type <Space>.
  690. X
  691. XThe "name of the function" is important for people who are customizing
  692. XEMACS.  It is what appears in the EMACS CHART as the documentation for
  693. Xthe command character.
  694. X
  695. X
  696. XCONCLUSION
  697. X----------
  698. X
  699. XRemember:  To EXIT use ^X^C.
  700. X
  701. XThis tutorial is meant to be understandable to all new users, so if
  702. Xyou found something unclear, don't sit and blame yourself - complain!
  703. X
  704. XYou'll probably find that if you use EMACS for a few days you won't be
  705. Xable to give it up.  Initially it may give you trouble.  But remember,
  706. Xthis is the case with any editor, especially one that can do many, many
  707. Xthings - and EMACS can do practically everything.
  708. X
  709. X
  710. XACKNOWLEDGEMENTS
  711. X----------------
  712. X
  713. XThis is a modified version of the "JOVE Tutorial" by Jonathan Payne
  714. X(19 January 86).  That document was in turn a modified version of
  715. Xthe tutorial "Teach-Emacs" from MIT as modified by Steve Zimmerman
  716. Xat CCA-UNIX (31 October 85).
  717. X
  718. XUpdate - February 1986 by Dana Hoggatt.
  719. X
  720. XUpdate - December 1986 by Kim Leburg.
  721. X
  722. XUpdate - November 1987 by Daniel Lawrence
  723. FRIDAY_NIGHT
  724. echo med.2 completed!
  725. # That's all folks!
  726.