home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8707 / 37 < prev    next >
Encoding:
Internet Message Format  |  1990-07-13  |  54.2 KB

  1. From: jeff@kestrel.arpa (Jeff Kitson)
  2. Newsgroups: comp.sources.misc
  3. Subject: microemacs documentation in LaTeX (part 1 of 2)
  4. Message-ID: <2832@ncoast.UUCP>
  5. Date: 9 Jul 87 02:57:15 GMT
  6. Sender: allbery@ncoast.UUCP
  7. Lines: 1471
  8. Approved: allbery@ncoast.UUCP
  9. X-Archive: comp.sources.misc/8707/37
  10.  
  11. #!/bin/sh
  12. # to extract, remove the header and type "sh filename"
  13. if `test ! -s ./part2.tex`
  14. then
  15. echo "writting ./part2.tex"
  16. cat > ./part2.tex << '\Rogue\Monster\'
  17. \chapter{Files}
  18.  
  19. A file is simply a collection of related data.  In EMACS we are dealing
  20. with text files -- named collections of text residing on a disk (or some
  21. other storage medium).  You will recall that the major entities EMACS
  22. deals with are buffers.  Disk-based versions of files are only active in
  23. EMACS when you are reading into or writing out of buffers.  As we have
  24. already seen, buffers and physical files are linked by associated
  25. filenames.  For example, the buffer ``ch7.txt" which is associated with
  26. the physical disk file ``ch7.txt." You will notice that the file is
  27. usually specified by the drive name or (in the case of a hard drive) a
  28. path.  Thus you can specify full filenames in EMACS,
  29.  
  30. e.g. disk:$\backslash${}directories$\backslash${}filename.extension
  31.  
  32. If you do not specify a disk and directories, the default disk is used.
  33.  
  34. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  35. edits will be lost when you leave EMACS (although EMACS will prompt you
  36. when you are about to lose edits by exiting).  In addition, EMACS does
  37. not protect your disk-based files from overwriting when it saves files.
  38. Thus when you instruct EMACS to save a file to disk, it will create a
  39. file if the specified file doesn't exist, or it will overwrite the
  40. previously saved version of the file thus replacing it.  Your old
  41. version is gone forever.
  42.  
  43. If you are at all unsure about your edits, or if (for any reason) you
  44. wish to keep previous versions of a file, you can change the name of the
  45. associated file with the command {\bf{}\^{}X-N}.  When this file is saved
  46. to disk, EMACS will create a new physical file under the new name.  The
  47. earlier disk file will be preserved.
  48.  
  49. For example, let's load the file {\bf{}fang.txt} into EMACS.  Now, type
  50. {\bf{}\^{}X-N}.  The EMACS command line prompts ``name:".  Enter a new name
  51. for the file -- say {\bf{}new.txt} and press $<${}NL$>${}.  The file will be
  52. saved under the new filename, and your disk directory will show both
  53. {\bf{}fang.txt} and {\bf{}new.txt}.
  54.  
  55. An alternative method is to write the file directly to disk under a new
  56. filename.  Let's pull our ``publish.txt" file into EMACS.  To write this
  57. file under another filename, type {\bf{}\^{}X-\^{}W}.  EMACS will prompt
  58. you ``write file:".  Enter an alternate filename -- {\bf{}desktop.txt}.
  59. Your file will be saved as the physical file ``desktop.txt".
  60.  
  61. Note that in the examples above, although you have changed the names of
  62. the related files, the buffer names remain the same.  However, when you
  63. pull the physical file back into EMACS, you will find that the buffer
  64. name now relates to the filename.
  65.  
  66. For example -- You are working with a buffer ``fang.txt" with the related
  67. file ``fang.txt".  You change the name of the file to ``new.txt".  EMACS
  68. now shows you working with the buffer ``fang.txt" and the related file
  69. ``new.txt".  Now pull the file ``new.txt" into EMACS.  Notice that the
  70. buffer name has now changed to ``new.txt".
  71.  
  72. If for any reason a conflict of buffer names occurs,(if you have files
  73. of the same name on different drives for example) EMACS will prompt
  74. you ``use buffer:".  Enter an alternative buffer name if you need to.
  75.  
  76. For a list of file related commands (including some we`ve already
  77. seen), see the summary page.
  78. %\newpage
  79. \section{Chapter \thechapter{} Summary}
  80.  
  81. In Chapter \thechapter{} you learned some of the more advanced
  82. concepts of file naming and manipulation.  The relationship between
  83. files and buffers was discussed in some detail.
  84.  
  85. \begin{tabular}{llp{4in}}
  86. Key Binding & Keystroke & Effect \\ \hline
  87. Save-file & {\bf{}\^{}X-\^{}S} & Saves contents of current buffer with
  88. associated filename on default disk/directory (if not specified) \\
  89. Write-File & {\bf{}\^{}X-\^{}W} & Current buffer contents will be
  90. saved under specified name \\
  91. Change-File-name
  92.  & {\bf{}\^{}X-N} & The associated filename is changed
  93. (or associated if not previously
  94. specified) as specified \\
  95. Find-File & {\bf{}\^{}X-\^{}F} & Reads specified file into buffer and
  96. switches you to that buffer, or switches
  97. to buffer in which the file has previously
  98. been read \\
  99. Read-File & {\bf{}\^{}X-\^{}R} & Reads file into buffer thus overwriting
  100. buffer contents.  If file has already
  101. been read into another buffer, you will
  102. be switched to it \\
  103. View-File & {\bf{}\^{}X-\^{}V} & The same as read-file except the buffer
  104. is automatically put into VIEW mode thus
  105. preventing any changes from being made \\
  106. \end{tabular}
  107.  
  108. \chapter{Screen Formatting}
  109.  
  110. \section{Wrapping Text}
  111.  
  112. As we learned in the introduction, EMACS is not a word processor, but an
  113. editor.  Some simple formatting options are available however, although
  114. in most cases they will not affect the appearence of the finished text
  115. \index{wrapping text} when it is run through the formatter.  We have
  116. already encountered WRAP mode which wraps lines longer than a certain
  117. length (default is 72 characters).  You will recall that WRAP is enabled
  118. by entering {\bf{}\^{}X-M} and responding to the command line prompt with
  119. {\bf{}wrap}.
  120.  
  121. You can also set your own wrap margin with the command {\bf{}\^{}X-F}
  122. {\it{}set-fill-column} \index{set-fill-column}.  Notice EMACS responds
  123. ``[Fill column is 1]." Now try typing some text.  You'll notice some very
  124. strange things happening -- your text wraps at every word!! This effect
  125. occurs because the set wrap margin command must be preceeded by a
  126. numeric argument or EMACS sets it to the first column.  Thus any text
  127. you type that extends past the first column will wrap at the most
  128. convenient line break.
  129.  
  130. To reset the wrap column to 72 characters, press the
  131. {\bf{}$<${}META$>${}} key and enter 72.  EMACS will respond ``Arg:
  132. 72".  Now press {\bf\^{}X-F}.  EMACS will respond ``[Fill column is
  133. 72]".  Your text will again wrap at the margin you've been using up to
  134. this point.
  135.  
  136. \section{Reformatting Paragraphs}
  137.  
  138. After an intensive editing session, you may find that you have
  139. paragraphs containing lines of differing lengths.  Although this
  140. disparity will not affect the formatted text, aesthetic and technical
  141. concerns may make it desirable to have consistent paragraph blocks on
  142. the screen.  If you are in WRAP mode, you can reformat a paragraph with
  143. the command {\bf{}M-Q} {\it{}fill-paragraph} \index{fill-paragraph}.  This
  144. command `fills' the current paragraph reformatting it so all the lines
  145. are filled and wrap logically.  The process is complex, and (especially
  146. with longer paragraphs) may take a little time.
  147.  
  148. \section{Changing Case}
  149.  
  150. There may be occasions when you find it necessary to change the case of
  151. the text you've entered.  EMACS allows you to change the case of even
  152. large amounts of text with ease.  Let's try and convert a few of the
  153. office traditionalists to the joy of word processing.  Type in the
  154. following text:
  155.  
  156. \begin{verbatim}
  157.         Throw away your typewriter and learn to use a word processor.
  158.         Word processing is relatively easy to learn and will increase
  159.         your productivity enormously.  Enter the Computer Age and find
  160.         out just how much fun it can be!!
  161. \end{verbatim}
  162.  
  163. Let's give it a little more impact by capitalizing the first four
  164. words.  The first step is to define the region of text just as you
  165. would if you were doing an extensive deletion.  Set the mark at the
  166. beginning of the paragraph with {\bf{}M-$<${}space$>${}}
  167. {\it{}set-mark} and move the cursor to the space beyond ``typewriter."
  168. Now enter {\bf{}\^{}X-\^{}U} {\it{}case-region-upper}.  Your text
  169. should now look like this:
  170.  
  171. \begin{verbatim}
  172.         THROW AWAY YOUR TYPEWRITER and learn to use a word processor.
  173.         Word processing is relatively easy to learn and will increase
  174.         your productivity enormously.  Enter the Computer Age and find
  175.         out just how much fun it can be!!
  176. \end{verbatim}
  177.  
  178. If you want to change the text back to lower case, type {\bf{}\^{}X-\^{}L}
  179. {\it{}case-region-lower} \index{case-region-lower}.  You can also
  180. capitalize individual words.  To capitalize the word ``fun", position the
  181. cursor in front of the word and type {\bf{}M-U} {\it{}case-word-upper}
  182. \index{case-word-upper}.  The word is now capitalized.  To change it
  183. back to lower case, move the cursor back to the beginning of the word
  184. and type {\bf{}M-L} {\it{}case-word-lower} \index{case-word-lower}.
  185.  
  186. You may also capitalize individual letters in EMACS.  The command
  187. {\bf{}M-C} {\it{}case-word-capitalize} \index{case-word-capitalize}
  188. capitalizes the first letter after the point.  This command would
  189. normally be issued with the cursor positioned in front of the first
  190. letter of the word you wish to capitalize.  If you issue it in the
  191. middle of a word, you can end up with some strAnge looking text.
  192.  
  193. \section{Tabs}
  194.  
  195. Unless your formatter is instructed to take screen text literally (as
  196. MicroSCRIBE does in the `verbatim' environment for example), tabs in
  197. EMACS generally affect screen formatting only.
  198.  
  199. When EMACS is first started, it sets the default tab to every eighth
  200. column.  As long as you stay with default, every time you press the tab
  201. key a tab character, {\bf{}\^{}I} is inserted.  This character, like other
  202. control characters, is invisible -- but it makes a subtle and
  203. significant difference to your file and editing.
  204.  
  205. For example, in default mode, press the tab key and then type the word
  206. {\bf{}Test}.  ``Test" appears at the eighth column.  Move your cursor to the
  207. beginning of the word and delete the backward character.  The word
  208. doesn't move back just one character, but flushes to the left margin.
  209. The reason for this behavior is easily explained.  In tab default, EMACS
  210. inserts a `real' tab character when you press the tab key.  This
  211. character is inserted at the default position, but NO SPACES are
  212. inserted between the tab character and the margin (or previous tab
  213. character).  As you will recall, EMACS only recognizes characters (such
  214. as spaces or letters) and thus when the tab character is removed, the
  215. text beyond the tab is flushed back to the margin or previous tab mark.
  216.  
  217. This situation changes if you alter the default configuration.  The
  218. default value may be changed by entering a numeric argument before
  219. pressing the tab key.  As we saw earlier, pressing the {\bf{}META} key and
  220. entering a number allows you to specify how EMACS performs a given
  221. action.  In this case, let's specify an argument of 10 and hit the tab
  222. key.
  223.  
  224. Now hit the tab key again and type {\bf{}Test}.  Notice the word now
  225. appears at the tenth column.  Now move to the beginning of the word and
  226. delete the backward character.  ``Test" moves back by one character.
  227.  
  228. EMACS behaves differently in these circumstances because the {\bf{}\^{}I}
  229. \index{tab handling} {\it{}handle-tab} \index{handle-tab} function deals
  230. with tabbing in two distinct ways.  In default conditions, or if the
  231. numeric argument of zero is used, {\it{}handle-tab} inserts a true tab
  232. character.  If, however, a non-zero numeric argument is specified,
  233. {\it{}handle-tab} inserts the correct number of spaces needed to position
  234. the cursor at the next specified tab position.  It does NOT insert the
  235. single tab character and hence any editing functions should take account
  236. of the number of spaces between tabbed columns.
  237.  
  238. Many times you would like to take a line which has been created using
  239. the tab character and change it to use just spaces.  The command
  240. {\bf{}\^{}X-\^{}D} {\it{}detab-line} \index{detab-line} changes any
  241. tabs from the point to the end of the current line into the right
  242. number of spaces so the line does not change.  This is very usefull
  243. for times when the file must be printed or transfered to a machine
  244. which does not understand tabs.
  245.  
  246. Also, the inverse command, {\bf{}\^{}X-\^{}E} {\it{}entab-lines}
  247. \index{entab-lines} changes multiple spaces to tabs where possible.
  248. This is a good way to shrink the size of large documents, escpecially
  249. with data tables.  Both of these commands can take a numeric argument
  250. which will be interpeted as the number of lines to en/detab.
  251. %\newpage
  252. \section{Chapter \thechapter{} Summary}
  253.  
  254. In Chapter \thechapter{} introduced some of the formatting features of
  255. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  256. some detail.  The commands in the following table were covered in the
  257. chapter.
  258.  
  259. \begin{tabular}{llp{266pt}}
  260. Key Binding & Keystroke &     Effect \\ \hline
  261.  
  262. Add-Mode/WRAP & {\bf{}\^{}X-M}[WRAP] & Add wrap mode to current buffer \\
  263.  
  264. Delete-Mode/WRAP & {\bf{}\^{}X-\^{}M}[WRAP] & Remove wrap mode from
  265. current buffer \\
  266.  
  267. Set-Fill-Column & {\bf{}\^{}X-F}  & Set fill column to given numeric
  268. argument  \\
  269.  
  270. Fill-Paragraph & {\bf{}M-Q} & Logically reformats the current
  271. paragraph\\
  272.  
  273. Case-Word-Upper  & {\bf{}M-U} & Text from point to end of the
  274. current word is changed to uppercase\\
  275.  
  276. Case-Word-Lower  & {\bf{}M-L} & Text from point to end of the
  277. current word is changed to lowercase\\
  278.  
  279. Case-Word-Capitalize & {\bf{}M-C} & First word (or letter) after the
  280. point is capitalized\\
  281.  
  282. Case-Region-Upper & {\bf{}\^{}X-\^{}U} & The current region is uppercased\\
  283.  
  284. Case-Region-Lower & {\bf{}\^{}X-\^{}L} & The current region is lowercased\\
  285.  
  286. Handle-Tab & {\bf{}\^{}I} & Tab interval is set to the given
  287. numeric argument\\
  288.  
  289. Entab-Line & {\bf{}\^{}X-\^{}E} & Changes multiple spaces to tabs
  290. characters where possible\\
  291.  
  292. Detab-Line & {\bf{}\^{}X-\^{}D} & Changes tab characters to the
  293. apprpriate number of spaces\\
  294.  
  295. \end{tabular}
  296. \chapter{Keyboard Macros}
  297.  
  298. In many applications, it may be necessary to repeat a series of
  299. characters or commands frequently.  For example, a paper may require the
  300. frequent repetition of a complex formula or a long name.  You may also
  301. have a series of EMACS commands that you invoke frequently.  Keyboard
  302. macros offer a convenient method of recording and repeating these
  303. commands.
  304.  
  305. Imagine, for example, you are writing a scholarly paper on {\it{}Asplenium
  306. platyneuron}, the spleenwort fern.  Even the dedicated botanist would
  307. probably find it a task bordering on the agonizing to type
  308. {\it{}Asplenium platyneuron} frequently throughout the paper.  An
  309. alternative method is `record' the name in a keyboard macro.  Try it
  310. yourself.
  311.  
  312. The command {\bf{}\^{}X-(} {\it{}begin-macro} \index{begin-macro}
  313. starts recording the all the keystrokes and commands you input.  After
  314. you've typed it, enter {\bf{}Asplenium platyneuron}.  To stop
  315. recording, type {\bf{}\^{}X-)} {\it{}end-macro} \index{end-macro}.
  316. EMACS has stored all the keystrokes between the two commands.  To
  317. repeat the name you've stored, just enter {\bf{}\^{}X-E}
  318. {\it{}execute-macro} \index{execute-macro}, and the name ``Asplenium
  319. platyneuron" appears.  You can repeat this action as often as you
  320. want, and of course as with any EMACS command, you may preceed it with
  321. a numerical argument.
  322.  
  323. Because EMACS records keystrokes, you may freely intermix commands and
  324. text.  Unfortunately, you can only store one macro at a time.  Thus, if
  325. you begin to record another macro, the previously defined macro is
  326. lost. Be careful to ensure that you've finished with one macro before
  327. defining another.  If you have a series of commands that you would like
  328. to `record' for future use, use the macro or procedure facilities
  329. detailed in chapter 11.
  330. %\newpage
  331. \section{Chapter \thechapter{} Summary}
  332.  
  333. Chapter \thechapter{} covered keyboard macros.  You learned how to
  334. record keystrokes and how to repeat the stored sequence.
  335.  
  336. \begin{tabular}{llp{4in}}
  337. Key Binding & Keystroke & Effect \\ \hline
  338. Start-Macro & {\bf{}\^{}X-(} & Starts recording all keyboard input\\
  339.  
  340. End-Macro & {\bf{}\^{}X-)} & Stops recording keystrokes for macro\\
  341.  
  342. Execute-Macro & {\bf{}\^{}X-E} & Entire sequence of recorded
  343. keystrokes is replayed\\
  344.  
  345. \end{tabular}
  346. \chapter{MicroEMACS Macros}
  347.  
  348. Macros are programs that are used to customize the editor and to
  349. perform complicated editing tasks.  They may be stored in files or
  350. buffers and may be executed using an appropriate command, or bound to
  351. a particular keystroke.  Portions of the standard start-up file are
  352. implement via macros, as well as the example menu system.  The
  353. {\it{}execute-macro-$<${}n$>${}} \index{execute-macro-$<${}n$>${}}
  354. commands cause the macro, numbered from 1 to 40, to be executed.  The
  355. {\it{}execute-file} \index{execute-file} command allows you to execute
  356. a macro stored in a disk file, and the {\it{}execute-buffer}
  357. \index{execute-buffer} command allows you to execute a macro stored in
  358. a buffer.  Macros are stored for easy execution by executing files
  359. that contain the store-macro command.
  360.  
  361. There are many different aspects to the macro langage within
  362. MicroEMACS.  Editor commands are the various commands that manipulate
  363. text, buffers, windows, etc, within the editor.  Directives are commands
  364. which control what lines get executed within a macro.  Also there are
  365. various types of variables.  Environmental variables both control and
  366. report on different aspects of the editor.  User variables hold string
  367. values which may be changed and inspected.  Buffer variables allow text
  368. to be placed into variables.  Interactive variables allow the program to
  369. prompt the user for information.  Functions can be used to manipulate
  370. all these variables.
  371.  
  372. \section{Variables}
  373.  
  374. Variables in MicroEMACS can be used to return values within
  375. expressions, as repeat counts to editing commands, or as text to be
  376. inserted into buffers and messages.  The value of these variables is
  377. set using the {\it{}set} ({\bf{}\^{}X-A}) command.  For example, to
  378. set the current fill column to 64 characters, the following macro line
  379. would be used:
  380.  
  381. \begin{verbatim}
  382.         set $fillcol 64
  383. \end{verbatim}
  384.  
  385. or to have the contents of {\bf{}\%name} inserted at the point in the
  386. current buffer, the command to use would be:
  387.  
  388. \begin{verbatim}
  389.         insert-string %name
  390. \end{verbatim}
  391. %\newpage
  392. \subsection{Environmental Variables}
  393.  
  394. These variables are used to change different aspects of the way
  395. the editor works.  Also they will return the current settings if used as
  396. part of an expresion.  All environmental variable names begin with a
  397. dollar sign (\$) and are in lower case.
  398.  
  399. \begin{tabular}{lp{5in}}
  400. \$fillcol & Current fill column \\
  401.  
  402. \$pagelen & Number of screen lines used currently \\
  403.  
  404. \$curwidth & Number of columns used currently \\
  405.  
  406. \$curcol & Current column of point in current buffer \\
  407.  
  408. \$curline & Current line of point in current buffer \\
  409.  
  410. \$flicker & Flicker Flag set to TRUE if IBM CGA set to FALSE for most
  411. others \\
  412.  
  413. \$cbufname & Name of the current buffer \\
  414.  
  415. \$cfname & File name of the current buffer \\
  416.  
  417. \$sres & Current screen resolution (CGA, MONO or EGA on the IBM-PC driver.
  418. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040,
  419. NORMAL on all others) \\
  420.  
  421. \$debug & Flag to trigger macro debugging (try it... you'll like it!) \\
  422.  
  423. \$status & return status of the success of the last command
  424. (TRUE or FALSE) usually used with !force \\
  425.  
  426. \$palette & string used to control the palette register
  427. settings on graphics versions.  The usual form
  428. consists of groups of three octal digits
  429. setting the red, green, and blue levels. \\
  430.  
  431. \$asave & The number of inserted characters between
  432. automatic file-saves in ASAVE mode. \\
  433.  
  434. \$acount & The countdown of inserted characters until
  435. the next save-file. \\
  436.  
  437. \$lastkey & Last keyboard character typed \\
  438.  
  439. \$curchar & Character currently at the point \\
  440.  
  441. \$discmd & Flag to disable the echoing of messages
  442. on the command line \\
  443.  
  444. \$version & Contains the current MicroEMACS version number \\
  445.  
  446. \$progname & Always contains the string ``MicroEMACS" for
  447. standard MicroEMACS. Could be something else
  448. if used as part of someone else's program \\
  449.  
  450. \$seed & integer seed of the random number generator \\
  451.  
  452. \$disinp & Flag to disable the echoing of characters during command
  453. line input \\
  454.  
  455. \end{tabular}
  456.  
  457. Obviously, many more of these variables will be availible in
  458. future releases of MicroEMACS. (Yes, send a vote for your favorite new
  459. environmental variables today).
  460.  
  461. \subsection{User variables}
  462.  
  463. User variables allow you, the user, to store strings and
  464. manipulate them.  These strings can be pieces of text, numbers (in text
  465. form), or the logical values {\bf{}TRUE} and {\bf{}FALSE}.  These variables
  466. can be combined, tested, inserted into buffers, and otherwise used to
  467. control the way your macros execute.  At the moment, up to 100 user
  468. variables may be in use in one editing session.  All users variable
  469. names must begin with a percent sign (\%) and may contain any printing
  470. characters.  Only the first 10 characters are significant (ie
  471. differences beyond the tenth character are ignored).  Most operators
  472. will truncate strings to a length of 128 characters.
  473.  
  474. \subsection{Buffer Variables}
  475.  
  476. Buffer variables are special in that they can only be queried
  477. and cannot be set.  What buffer variables are is a way to take text from
  478. a buffer and place it in a variable. For example, if I have a buffer by
  479. the name of RIGEL2, and it contains the text:
  480.  
  481. \begin{verbatim}
  482.         Richmond
  483.         Lafayette
  484.         <*>Bloomington      (where <*> is the current point)
  485.         Indianapolis
  486.         Gary
  487.         =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  488. \end{verbatim}
  489.  
  490. and within a command I reference \#rigel2, like:
  491.  
  492. \begin{verbatim}
  493.         insert-string \#rigel2
  494. \end{verbatim}
  495.  
  496. MicroEMACS would start at the current point in the RIGEL2
  497. buffer and grab all the text up to the end of that line and pass that
  498. back.  Then it would advance the point to the beginning of the next line.
  499. Thus, after our last command executes, the string ``Bloomington" gets
  500. inserted into the current buffer, and the buffer RIGEL2 now looks like
  501. this:
  502.  
  503. \begin{verbatim}
  504.         Richmond
  505.         Lafayette
  506.         Bloomington
  507.         <*>Indianapolis     (where <*> is the current point)
  508.         Gary
  509.         =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  510. \end{verbatim}
  511.  
  512. as you have probably noticed, a buffer variable consists of the
  513. buffer name, preceded by a pound sign (\#).
  514.  
  515. \subsection{Interactive variables}
  516.  
  517. Interactive variables are actually a method to prompt the user
  518. for a string.  This is done by using an at sign (@) followed either with
  519. a quoted string, or a variable containing a string.  The string is the
  520. placed on the bottom line, and the editor waits for the user to type in
  521. a string.  Then the string typed in by the users is returned as the
  522. value of the interactive variable.  For example:
  523.  
  524. \begin{verbatim}
  525.         set %quest "What file? "
  526.         find-file @%quest
  527. \end{verbatim}
  528.  
  529. will ask the user for a file name, and then attempt to find it.
  530.  
  531. \section{Functions}
  532.  
  533. Functions can be used to manipulate variables in various ways.
  534. Functions can have one, two, or three arguments.  These arguments will
  535. always be placed after the function on the current command line.  For
  536. example, if we wanted to increase the current fill column by two, using
  537. emacs's set ({\bf{}\^{}X-A}) command, we would write:
  538.  
  539. \begin{verbatim}
  540.         set $fillcol &add $fillcol 2
  541.          \      \      \      \     \____second operand
  542.           \      \      \      \_________first operand
  543.            \      \      \_______________function to execute
  544.             \      \_____________________variable to set
  545.              \___________________________set (^X-A) command
  546. \end{verbatim}
  547.  
  548. Function names always begin with the ampresand (\&) character,
  549. and are only significant to the first three characters after the
  550. ampresand.  Functions will normal expect one of three types of
  551. arguments, and will automatically convert types when needed.
  552.  
  553. \begin{description}
  554.  
  555. \item[$<${}num$>${}] an ascii string of digits which is interpeted as
  556. a numeric value.  Any string which does not start with a digit or a
  557. minus sign (-) will be considered zero.
  558.  
  559. \item[$<${}str$>${}] An arbitrary string of characters.  At the
  560. moment, strings are limited to 128 characters in length.
  561.  
  562. \item[$<${}log$>${}] A logical value consisting of the string ``TRUE"
  563. or ``FALSE".  Numeric strings will also evaluate to ``FALSE" if they
  564. are equal to zero, and ``TRUE" if they are non-zero.  Arbitrary text
  565. strings will have the value of ``FALSE".
  566.  
  567. \end{description}
  568.  
  569. A list of the currently availible functions follows: (Once
  570. again, send in those votes on what kind of functions you would like to
  571. see added!) Functions are always used in lower case, the uppercase
  572. letters in the function table are the short form of the function (ie
  573. \&div for \÷).
  574.  
  575. \begin{tabular}{p{.8in}p{1.7in}p{250pt}}
  576. \multicolumn{3}{c}{Numeric Functions:  (returns $<${}num$>${})}\\ \hline
  577. \&ADD & $<${}num$>${} $<${}num$>${} & Add two numbers\\
  578.  
  579. \&SUB & $<${}num$>${} $<${}num$>${} & Subtract the second number from
  580. the first\\
  581.  
  582. \&TIMes & $<${}num$>${} $<${}num$>${} & Multiply two numbers\\
  583.  
  584. \&DIVide & $<${}num$>${} $<${}num$>${} & Divide the first number by
  585. the second giving an integer result\\
  586.  
  587. \&MOD & $<${}num$>${} $<${}num$>${} & Return the reminder of dividing the
  588. first number by the second\\
  589.  
  590. \&NEGate & $<${}neg$>${} & Multiply the arg by -1\\
  591.  
  592. \&LENgth & $<${}str$>${} & Returns length of string\\
  593.  
  594. \&ASCii & $<${}str$>${} & Return the ascii code of the first
  595. character in $<${}str$>${}\\
  596.  
  597. \&RND & $<${}num$>${} & Returns a random integer between 1 and
  598. $<${}num$>${}\\
  599.  
  600. \&ABS & $<${}num$>${} & Returns the absolute value of $<${}num$>${}\\
  601.  
  602. \end{tabular}
  603.  
  604. \begin{tabular}{p{.8in}p{1.7in}p{250pt}}
  605. \multicolumn{3}{c}{String manipulation functions:
  606. (returns $<${}str$>${})}\\ \hline
  607.  
  608. \&CAT & $<${}str$>${} $<${}str$>${} & Concatinate the two strings to
  609. form one\\
  610.  
  611. \&LEFt & $<${}str$>${} $<${}num$>${} & return the $<${}num$>${}
  612. leftmost characters from $<${}str$>${}\\
  613.  
  614. \&RIGht & $<${}str$>${} $<${}num$>${} & return the $<${}num$>${}
  615. rightmost characters from $<${}str$>${}\\
  616.  
  617. \&MID & $<${}str$>${} $<${}num1$>${} $<${}num2$>${} & Starting from
  618. $<${}num1$>${} position in $<${}str$>${}, return $<${}num2$>${}
  619. characters.\\
  620.  
  621. \&UPPer & $<${}str$>${} & Uppercase $<${}str$>${}\\
  622.  
  623. \&LOWer & $<${}str$>${} & lowercase $<${}str$>${}\\
  624.  
  625. \&CHR & $<${}num$>${} & return a string with the character
  626. represented by ascii code $<${}num$>${}\\
  627.  
  628. \>K & & return a string containing a single
  629. keystroke from the user\\
  630.  
  631. \end{tabular}
  632.  
  633. \begin{tabular}{p{.8in}p{1.7in}p{250pt}}
  634. \multicolumn{3}{c}{Logical Testing functions:(returns
  635. $<${}log$>${})}\\ \hline
  636.  
  637. \&NOT & $<${}log$>${} & Return the opposite logical value\\
  638.  
  639. \&AND & $<${}log1$>${} $<${}log2$>${} & Returns TRUE if BOTH logical
  640. arguments are TRUE\\
  641.  
  642. \&OR & $<${}log1$>${} $<${}log2$>${} & Returns TRUE if either argument
  643. is TRUE\\
  644.  
  645. \&EQUal & $<${}num$>${} $<${}num$>${} & If $<${}num$>${} and
  646. $<${}num$>${} are numerically equal, return TRUE\\
  647.  
  648. \&LESs & $<${}num1$>${} $<${}num2$>${} & If $<${}num1$>${} is less
  649. than $<${}num2$>${}, return TRUE.\\
  650.  
  651. \&GREater & $<${}num1$>${} $<${}num2$>${} & If $<${}num1$>${} is
  652. greater than, or equal to $<${}num2$>${}, return TRUE.\\
  653.  
  654. \&SEQual & $<${}str1$>${} $<${}str2$>${} & If the two strings are the
  655. same, return TRUE.\\
  656.  
  657. \&SLEss & $<${}str1$>${} $<${}str2$>${} & If $<${}str1$>${} is less
  658. alphabetically than $<${}str2$>${}, return TRUE.\\
  659.  
  660. \&SGReater & $<${}str1$>${} $<${}str2$>${} & If $<${}str1$>${} is
  661. alphabetically greater than or equal to $<${}str2$>${}, return TRUE.\\
  662.  
  663. \end{tabular}
  664.  
  665. \begin{tabular}{p{.8in}p{1.7in}p{250pt}}
  666. \multicolumn{3}{c}{Special Functions:}\\ \hline
  667.  
  668. \&INDirect & $<${}str$>${} & Evaluate $<${}str$>${} as a variable.\\
  669.  
  670. \end{tabular}
  671.  
  672. This last function deserves more explanation. The \&IND function
  673. evaluates its argument, takes the resulting string, and then uses it as
  674. a variable name.  For example, given the following code sequence:
  675.  
  676. \begin{verbatim}
  677.         ; set up reference table
  678.  
  679.         set %one   "elephant"
  680.         set %two   "giraffe"
  681.         set %three "donkey"
  682.  
  683.         set %index "two"
  684.         insert-string &ind %index
  685. \end{verbatim}
  686.  
  687. the string ``giraffe" would have been inserted at the point in
  688. the current buffer.  This indirection can be safely nested up to about
  689. 10 levels.
  690.  
  691. \section{Directives}
  692.  
  693. Directives are commands which only operate within an executing
  694. macro, ie they do not make sense as a single command. As such, they
  695. cannot be called up singly or bound to keystroke. Used within macros,
  696. they control what lines are executed and in what order.
  697.  
  698. Directives always start with the exclamation mark (!) character
  699. and must be the first thing placed on a line. Directives executed singly
  700. (via the execute-command-line command) interactively will be ignored.
  701.  
  702. \subsection{!ENDM Directive}
  703.  
  704. This directive is used to terminate a macro being stored. For
  705. example, if a file is being executed contains the text:
  706.  
  707. \begin{verbatim}
  708.         ; Read in a file in view mode, and make the window red
  709.  
  710.         26      store-macro
  711.                 find-file @"File to view: "
  712.                 add-mode "view"
  713.                 add-mode "red"
  714.         !endm
  715.  
  716.         write-message "[Consult macro has been loaded]"
  717. \end{verbatim}
  718.  
  719. only the lines between the store-macro command and the !ENDM
  720. directive are stored in macro 26.
  721.  
  722. \subsection{!FORCE Directive}
  723.  
  724. When MicroEMACS executes a macro, if any command fails, the
  725. macro is terminated at that point. If a line is preceeded by a !FORCE
  726. directive, execution continues whether the command succeeds or not. For
  727. example:
  728.  
  729. \begin{verbatim}
  730.         ; Merge the top two windows
  731.  
  732.         save-window           ;remember what window we are at
  733.         1 next-window         ;go to the top window
  734.         delete-window         ;merge it with the second window
  735.         !force restore-window ;This will continue irregardless
  736.         add-mode "red"
  737. \end{verbatim}
  738.  
  739. \subsection{!IF, !ELSE, and !ENDIF Directives}
  740.  
  741. This directive allows statements only to be executed if a
  742. condition specified in the directive is met.  Every line following the
  743. !IF directive, until the first !ELSE or !ENDIF directive, is only
  744. executed if the expresion following the !IF directive evaluates to a
  745. TRUE value.  For example, the following macro segment creates the
  746. portion of a text file automatically.  (yes believe me, this will be
  747. easier to understand then that last explanation....)
  748.  
  749. \begin{verbatim}
  750.         !if &sequal %curplace "timespace vortex"
  751.                 insert-string "First, rematerialize~n"
  752.         !endif
  753.         !if &sequal %planet "earth"        ;If we have landed on earth...
  754.                 !if &sequal %time "late 20th century"  ;and we are then
  755.                         write-message "Contact U.N.I.T."
  756.                 !else
  757.                         insert-string "Investigate the situation....~n"
  758.                         insert-string "(SAY 'stay here Sara')~n"
  759.                 !endif
  760.         !else
  761.                 set %conditions @"Atmosphere conditions outside? "
  762.                 !if &sequal %conditions "safe"
  763.                         insert-string &cat "Go outside......" "~n"
  764.                         insert-string "lock the door~n"
  765.                 !else
  766.                         insert-string "Dematerialize..try somewhen else"
  767.                         newline
  768.                 !endif
  769.         !endif
  770. \end{verbatim}
  771.  
  772. \subsection{!GOTO Directive}
  773.  
  774. Flow can be controlled within a MicroEMACS macro using the !GOTO
  775. directive. It takes as an argument a label. A label consists of a line
  776. starting with an asterick (*) and then an alphanumeric label.  Only
  777. labels in the currently executing macro can be jumped to, and trying to
  778. jump to a non-existing label terminates execution of a macro.  For
  779. example..
  780.  
  781. \begin{verbatim}
  782.         ;Create a block of DATA statements for a BASIC program
  783.  
  784.                 insert-string "1000 DATA "
  785.                 set %linenum 1000
  786.  
  787.         *nxtin
  788.                 update-screen                ;make sure we see the changes
  789.                 set %data @"Next number: "
  790.                 !if &equal %data 0
  791.                         !goto finish
  792.                 !endif
  793.  
  794.                 !if &greater $curcol 60
  795.                         2 delete-previous-character
  796.                         newline
  797.                         set %linenum &add %linenum 10
  798.                         insert-string &cat %linenum " DATA "
  799.                 !endif
  800.  
  801.                 insert-string &cat %data ", "
  802.                 !goto nxtin
  803.  
  804.         *finish
  805.  
  806.                 2 delete-previous-character
  807.                 newline
  808. \end{verbatim}
  809.  
  810. \subsection{!RETURN Directive}
  811.  
  812. The !RETURN Directive causes the current macro to exit, either
  813. returning to the caller (if any) or to interactive mode.  For example:
  814.  
  815. \begin{verbatim}
  816.         ;Check the monitor type and set %mtyp
  817.  
  818.         !if &sres "CGA"
  819.                 set %mtyp 1
  820.                 !return
  821.         !else
  822.                 set %mtyp 2
  823.         !endif
  824.  
  825.         insert-string "You are on a MONOCHROME machine!~n"
  826. \end{verbatim}
  827. \appendix
  828. \chapter{MicroEMACS commands}
  829.  
  830. Below is a complete list of the commands in EMACS, the keys
  831. normally used to do the command, and what the command does.  Remember,
  832. on some computers there may also be additional ways of using a command
  833. (cursor keys and special function keys for example).
  834.  
  835. \begin{tabular}{llp{300pt}}
  836. Command & Binding & Meaning\\ \hline
  837. abort-command &  \^{}G & This allows the user to abort out of any
  838. command that is waiting for input\\
  839.  
  840. add-mode &  \^{}X-M & Add a mode to the current buffer\\
  841.  
  842. add-global-mode  &  M-M & Add a global mode for all new buffers\\
  843.  
  844. apropos  &  M-A & List out commands whose name contains
  845. the string specified\\
  846.  
  847. backward-character &  \^{}B & Move one character to the left\\
  848.  
  849. begin-macro &  \^{}X-( & Begin recording a keyboard macro\\
  850.  
  851. beginning-of-file &  M-$<${} & Move to the beginning of the file in
  852. the current buffer\\
  853.  
  854. beginning-of-line &  \^{}A & Move to the beginning of the current line\\
  855.  
  856. bind-to-key &  M-K & Bind a key to a function\\
  857.  
  858. buffer-position  &  \^{}X-= & List the position of the cursor in the
  859. current window on the command line\\
  860.  
  861. case-region-lower &  \^{}X-\^{}L & Make a marked region all lower case\\
  862.  
  863. case-region-upper &  \^{}X-\^{}U & Make a marked region all upper case\\
  864.  
  865. case-word-capitalize &  M-C & Capitalize the following word\\
  866.  
  867. case-word-lower  &  M-L & Lower case the following word\\
  868.  
  869. case-word-upper  &  M-U & Upper case the following word\\
  870.  
  871. change-file-name &  \^{}X-N & Change the name of the file in the
  872.  current buffer\\
  873.  
  874. change-screen-size &  M-\^{}S & Chnage the number of lines of the screen
  875. currently being used\\
  876.  
  877. change-screen-width &  M-\^{}T & Change the number of columns of the
  878. screen currently being used\\
  879. \end{tabular}
  880.  
  881. \begin{tabular}{llp{287pt}}
  882. Command & Binding & Meaning\\ \hline
  883. clear-and-redraw &  \^{}L & Clear the physical screen and redraw it\\
  884.  
  885. clear-message-line & (none) & Clear the command line\\
  886.  
  887. copy-region &  M-W & Copy the currently marked region into
  888. the kill buffer\\
  889.  
  890. count-words &  M-\^{}C & Count how many words, lines and
  891. characters are in the current marked region\\
  892.  
  893. ctlx-prefix &  \^{}X & Change the key used as the \^{}X prefix\\
  894.  
  895. delete-blank-lines & \^{}X-\^{}O & Delete all blank lines around the
  896. cursor\\
  897.  
  898. delete-buffer &  \^{}X-K & Delete a buffer which is not being
  899. currently displayed in a window\\
  900.  
  901. delete-mode &  \^{}X-\^{}M & Turn off a mode in the current buffer\\
  902.  
  903. delete-global-mode &  M-\^{}M & Turn off a global mode\\
  904.  
  905. delete-next-character &  \^{}D & Delete the character following the cursor\\
  906.  
  907. delete-next-word &  M-D & Delete the word following the cursor\\
  908.  
  909. delete-other-windows &  \^{}X-1 & Make the current window cover the entire
  910. screen\\
  911.  
  912. delete-previous-character & \^{}H & Delete the character to the left of the
  913. cursor\\
  914.  
  915. delete-previous-word & M-\^{}H & Delete the word to the left of the
  916. cursor\\
  917.  
  918. delete-window &  \^{}X-0 & Remove the current window from the screen\\
  919.  
  920. describe-bindings & (none) & Make a list of all legal commands\\
  921.  
  922. describe-key &  \^{}X-? & Describe what command is bound to a
  923. keystroke sequence\\
  924.  
  925. detab-line &  \^{}X-\^{}D & Change all tabs in a line to the
  926. equivilant spaces\\
  927.  
  928. end-macro &  \^{}X-) & stop recording a keyboard macro\\
  929.  
  930. end-of-file &  M-$>${} & Move cursor to the end of the current buffer\\
  931.  
  932. end-of-line &  \^{}E & Move to the end of the current line\\
  933.  
  934. entab-line &  \^{}X-\^{}E & Change multiple spaces to tabs where
  935. possible\\
  936.  
  937. exchange-point-and-mark & \^{}X-\^{}X & Move cursor to the last marked spot,
  938. make the original position be marked\\
  939.  
  940. execute-buffer & (none) & Execute a buffer as a macro\\
  941.  
  942. execute-command-line & (none) & Execute a line typed on the command
  943. line as a macro command\\
  944.  
  945. execute-file &  FNB & Execute a file as a macro\\
  946.  
  947. execute-macro &  \^{}X-E & Execute the keyboard macro (play back
  948. the recorded keystrokes)\\
  949.  
  950. execute-macro-$<${}n$>${} & (none) & Execute numbered macro
  951. $<${}N$>${} where $<${}N$>${} is an integer from 1 to 40\\
  952.  
  953. execute-named-command &  M-X & Execute a command by name\\
  954.  
  955. execute-procedure &  M-\^{}E & Execute a procedure by name\\
  956.  
  957. exit-emacs &  \^{}X-\^{}C & Exit EMACS. If there are unwritten,
  958. changed buffers EMACS will ask to confirm\\
  959.  
  960. fill-paragraph &  M-Q & Fill the current paragraph\\
  961.  
  962. filter-buffer &  \^{}X-\# & Filter the current buffer through an
  963. external filter\\
  964.  
  965. find-file &  \^{}X-\^{}F & Find a file to edit in the current window\\
  966.  
  967. forward-character &  \^{}F & Move cursor one character to the right\\
  968.  
  969. goto-line &  M-G & Goto a numbered line\\
  970.  
  971. goto-matching-fence &  M-\^{}F & Goto the matching fence\\
  972.  
  973. grow-window &  \^{}X-\^{} & Make the current window larger\\
  974. \end{tabular}
  975.  
  976. \begin{tabular}{llp{283pt}}
  977. Command & Binding & Meaning\\ \hline
  978. handle-tab &  \^{}I & Insert a tab or set tab stops\\
  979.  
  980. hunt-forward &  FN= & Hunt for the next match of the last
  981. search string\\
  982.  
  983. hunt-backward &  FN$>${} & Hunt for the last match of the last
  984. search string\\
  985.  
  986. help &  M-? & Read EMACS.HLP into a buffer and display it\\
  987.  
  988. i-shell  &  \^{}X-C & Shell up to a new command processor\\
  989.  
  990. incremental-search &  \^{}X-S & Search for a string, incrementally\\
  991.  
  992. insert-file &  \^{}X-\^{}I & insert a file at the cursor in the
  993. current file\\
  994.  
  995. insert-space &  \^{}C & Insert a space to the right of the cursor\\
  996.  
  997. insert-string & (none) & Insert a string at the cursor\\
  998.  
  999. kill-paragraph &  M-\^{}W & Delete the current paragraph\\
  1000.  
  1001. kill-region &  \^{}W & Delete the current marked region, moving
  1002. it to the kill buffer\\
  1003.  
  1004. kill-to-end-of-line &  \^{}K & Delete the rest of the current line\\
  1005.  
  1006. list-buffers &  \^{}X-\^{}B & List all existing buffers\\
  1007.  
  1008. meta-prefix &  $<${}ESC$>${} & Key used to preceed all META commands\\
  1009.  
  1010. move-window-down & \^{}X-\^{}N & Move all the lines in the current
  1011. window down\\
  1012.  
  1013. move-window-up & \^{}X-\^{}P & Move all the lines in the current
  1014. window up\\
  1015.  
  1016. name-buffer &  M-\^{}N & Change the name of the current buffer\\
  1017.  
  1018. newline  &  \^{}M & Insert a $<${}NL$>${} at the cursor\\
  1019.  
  1020. newline-and-indent &  \^{}J & Insert a $<${}NL$>${} at the cursor and indent
  1021. the new line the same as the preceeding line\\
  1022.  
  1023. next-buffer &  \^{}X-X & Bring the next buffer in the list into
  1024. the current window\\
  1025.  
  1026. next-line &  \^{}N & Move the cursor down one line\\
  1027.  
  1028. next-page &  \^{}V & Move the cursor down one page\\
  1029.  
  1030. next-paragraph &  M-N & Move cursor to the next paragraph\\
  1031.  
  1032. next-window &  \^{}X-O & Move cursor to the next window\\
  1033.  
  1034. next-word &  M-F & Move coursor to the beginning of the
  1035. next word\\
  1036.  
  1037. open-line &  \^{}O & Open a line at the cursor\\
  1038.  
  1039. pipe-command &  \^{}X-@ & Execute an external command and place
  1040. its output in a buffer\\
  1041.  
  1042. previous-line &  \^{}P & Move cursor up one line\\
  1043.  
  1044. previous-page &  \^{}Z & Move cursor up one page\\
  1045.  
  1046. previous-paragraph &  M-P & Move back one paragraph\\
  1047.  
  1048. previous-window  &  \^{}X-P & Move the cursor to the last window\\
  1049.  
  1050. previous-word &  M-B & Move the cursor to the beginning of the
  1051. word to the left of the cursor\\
  1052.  
  1053. query-replace-string &  M-\^{}R & Reaplace all of one string with another
  1054. string, interactivly quering the user\\
  1055.  
  1056. quick-exit &  M-Z & Exit EMACS, writing out all changed buffers\\
  1057.  
  1058. quote-character  &  \^{}Q & Insert the next character literally\\
  1059.  
  1060. read-file &  \^{}X-\^{}R & Read a file into the current buffer\\
  1061.  
  1062. redraw-display &  M-\^{}L & Redraw the display, centering the
  1063. current line\\
  1064.  
  1065. resize-window &  \^{}X-W & Change the number of lines in the
  1066. current window\\
  1067.  
  1068. restore-window & (none) & Move cursor to the last saved window\\
  1069.  
  1070. replace-string &  M-R & Replace all occurences of one string
  1071. with another string from the cursor
  1072. to the end of the buffer\\
  1073.  
  1074. reverse-incremental-search & \^{}X-R & Search backwards, incrementally\\
  1075. \end{tabular}
  1076.  
  1077. \begin{tabular}{llp{300pt}}
  1078. Command & Binding & Meaning\\ \hline
  1079. run &  M-\^{}E & Execute a named procedure\\
  1080.  
  1081. save-file &  \^{}X-\^{}S & Save the current buffer if it is changed\\
  1082.  
  1083. save-window & (none) & Remember current window (to restore later)\\
  1084.  
  1085. scroll-next-up &  M-\^{}Z & Scroll the next window up\\
  1086.  
  1087. scroll-next-down &  M-\^{}V & Scroll the next window down\\
  1088.  
  1089. search-forward &  \^{}S & Search for a string\\
  1090.  
  1091. search-reverse &  \^{}R & Search backwards for a string\\
  1092.  
  1093. select-buffer &  \^{}X-B & Select a buffer to display in the
  1094. current window\\
  1095.  
  1096. set &  \^{}X-A & Set a variable to a value\\
  1097.  
  1098. set-encryption-key &  M-E & Set the encryption key of the current buffer\\
  1099.  
  1100. set-fill-column  &  \^{}X-F & Set the current fill column\\
  1101.  
  1102. set-mark & & Set the mark\\
  1103.  
  1104. shell-command &  \^{}X-! & Execute an external command\\
  1105.  
  1106. shrink-window &  \^{}X-\^{}Z & Make the current window smaller\\
  1107.  
  1108. split-current-window &  \^{}X-2 & Split the current window in two\\
  1109.  
  1110. store-macro & (none) & Store the following macro lines to a
  1111. numbered macro\\
  1112.  
  1113. store-procedure & (none) & Store the following macro lines to a
  1114. named procedure\\
  1115.  
  1116. transpose-characters &  \^{}T & Transpose the character at the cursor
  1117. with the character to the left\\
  1118.  
  1119. trim-line &  \^{}X-\^{}T & Trim any trailing whitespace from line\\
  1120.  
  1121. unbind-key &  M-\^{}K & Unbind a key from a function\\
  1122.  
  1123. universal-argument &  \^{}U & Execute the following command 4 times\\
  1124.  
  1125. unmark-buffer &  M-~ & Unmark the current buffer (so it is
  1126. no longer changed)\\
  1127.  
  1128. update-screen & (none) & Force a screen update during macro execution\\
  1129.  
  1130. view-file &  \^{}X-\^{}V & Find a file,and put it in view mode\\
  1131.  
  1132. wrap-word &  M-FNW & Wrap the current word, this is an
  1133. internal function\\
  1134.  
  1135. write-file &  \^{}X-\^{}W & Write the current buffer under a new
  1136. file name\\
  1137.  
  1138. write-message & (none) & Display a string on the command line\\
  1139.  
  1140. yank &  \^{}Y & yank the kill buffer into the current
  1141. buffer at the cursor\\
  1142. \end{tabular}
  1143. \chapter{MicroEMACS Bindings}
  1144.  
  1145. Below is a complete list of the key bindings used in MicroEMACS.
  1146. This can be used as a wall chart reference for MicroEMACS commands.
  1147.  
  1148. \begin{verbatim}
  1149.            [Default Key Bindings for MicroEmacs 3.8i]
  1150.  
  1151.  ^A   Move to start of line           ESC A   Apropos (list some commands)
  1152.  ^B   Move backward by characters     ESC B   Backup by words
  1153.  ^C   Insert space                    ESC C   Initial capitalize word
  1154.  ^D   Forward delete                  ESC D   Delete forward word
  1155.  ^E   Goto end of line                ESC E   Reset Encryption Key
  1156.  ^F   Move forward by characters      ESC F   Advance by words
  1157.  ^G   Abort out of things             ESC G   Go to a line
  1158.  ^H   Backward delete
  1159.  ^I   Insert tab/Set tab stops
  1160.  ^J   Insert CR-LF, then indent
  1161.  ^K   Kill forward                    ESC K   Bind Key to function
  1162.  ^L   Refresh the screen              ESC L   Lower case word
  1163.  ^M   Insert CR-LF                    ESC M   Add global mode
  1164.  ^N   Move forward by lines           ESC N   Goto End paragraph
  1165.  ^O   Open up a blank line
  1166.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  1167.  ^Q   Insert literal                  ESC Q   Fill current paragraph
  1168.  ^R   Search backwards                ESC R   Search and replace
  1169.  ^S   Search forward
  1170.  ^T   Transpose characters
  1171.  ^U   Repeat command four times       ESC U   Upper case word
  1172.  ^V   Move forward by pages           ESC V   Move backward by pages
  1173.  ^W   Kill region                     ESC W   Copy region to kill buffer
  1174.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  1175.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  1176.  
  1177.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  1178.  ESC ^F   Goto matching fence         ESC !   Reposition window
  1179.  ESC ^H   Delete backward word        ESC <   Move to start of buffer
  1180.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  1181.  ESC ^L   Reposition window           ESC .   Set mark
  1182.  ESC ^M   Delete global mode          ESC space    Set mark
  1183.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  1184.  ESC ^R   Search & replace w/query        rubout   Backward delete
  1185.  ESC ^S   Change screen rows
  1186.  ESC ^T   Change screen columns
  1187.  ESC ^V   Scroll next window down
  1188.  ESC ^W   Delete Paragraph
  1189.  ESC ^Z   Scroll next window up
  1190.  
  1191.  ^X ?   Describe a key             ^X !   Run 1 command in a subjob
  1192.  ^X =   Show the cursor position   ^X @   Pipe DOS command to buffer
  1193.  ^X ^   Enlarge display window     ^X #   Filter buffer thru DOS filter
  1194.  ^X 0   Delete current window      ^X (   Begin macro
  1195.  ^X 1   Delete other windows       ^X )   End macro
  1196.  ^X 2   Split current window
  1197.                                    ^X A   Set variable value
  1198.  ^X ^B   Display buffer list       ^X B   Switch a window to a buffer
  1199.  ^X ^C   Exit MicroEMACS           ^X C   Start a new command processer
  1200.                                    ^X D   Suspend MicroEMACS (BSD4.2 only)
  1201.                                    ^X E   Execute macro
  1202.  ^X ^F   Find file                 ^X F   Set fill column
  1203.  ^X ^I   Insert file
  1204.                                    ^X K   Delete buffer
  1205.  ^X ^L   Lower case region
  1206.  ^X ^M   Delete Mode               ^X M   Add a mode
  1207.  ^X ^N   Move window down          ^X N   Rename current filename
  1208.  ^X ^O   Delete blank lines        ^X O   Move to the next window
  1209.  ^X ^P   Move window up            ^X P   Move to the previous window
  1210.  ^X ^R   Get a file from disk      ^X R   Incremental reverse search
  1211.  ^X ^S   Save current file         ^X S   Incremental forward search
  1212.  ^X ^U   Upper case region
  1213.  ^X ^V   View file
  1214.  ^X ^W   Write a file to disk      ^X W   resize Window
  1215.  ^X ^X   Swap "." and mark         ^X X   Use next buffer
  1216.  ^X ^Z   Shrink window             ^X Z   Enlarge display window
  1217.  
  1218. Only under PCDOS:
  1219.  <ALT>-S Hunt forward        SHIFT <F1> - <F10>
  1220.  <ALT>-R Hunt backward           Execute macroes 1 - 10
  1221.  
  1222.                            Usable Modes
  1223. WRAP     Lines going past right margin "wrap" to a new line
  1224. VIEW     Read-Only mode where no modifications are allowed
  1225. CMODE    Change behavior of some commands to work with C better
  1226. EXACT    Exact case matching on search strings
  1227. OVER     Overwrite typed characters instead of inserting them
  1228. CRYPT    Current buffer will be encrypted on write, decrypted on read
  1229. MAGIC    Use regular expresion matching in searches
  1230. ASAVE    Save the file every 256 inserted characters
  1231.  
  1232. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK  Sets forground color
  1233. white/cyan/magenta/yellow/blue/red/green/black  Sets background color
  1234. \end{verbatim}
  1235. %\newpage
  1236. \chapter{Supported machines}
  1237.  
  1238. The following table lists all the hardware/compilers for which I
  1239. currently support MicroEMACS.  This is not exclusive of all machines
  1240. which MicroEMACS will run on, but I have either run it myself, or had a
  1241. first hand report of it running.
  1242.  
  1243. \begin{tabular}{lllp{137pt}}
  1244. Hardware &OS&Compiler &Comments\\ \hline
  1245.  
  1246. VAX 780&UNIX V5&native\\
  1247.  
  1248. &UNIX V7&native\\
  1249.  
  1250. &BSD 4.2&native &job control supported\\
  1251.  
  1252. &*VMS&native &only some terminals supported\\
  1253.  
  1254. NCR Tower &UNIX V5&native\\
  1255.  
  1256. Fortune 32:16 &UNIX V7&native\\
  1257.  
  1258. IBM-PC&MSDOS &LATTICE2.15 &Large CODE/Large DATA\\
  1259.  
  1260. & 2.0 \& 3.2 &AZTEC 3.4e   &Small CODE/Large DATA\\
  1261.  
  1262. &  &*MSC 4.0 \\
  1263.  
  1264. &&*MWC 86\\
  1265.  
  1266. HP150&MSDOS&Lattice 2.15 &Function key labels\\
  1267.  
  1268. &&&for the touch screen\\
  1269.  
  1270. HP110&MSDOS&Lattice 2.15\\
  1271.  
  1272. &&Aztec 3.4e\\
  1273.  
  1274. *Data General 10 & MSDOS&Lattice 2.15\\
  1275.  
  1276. *Texas Instruments Professional & MSDOS& Lattice 2.15\\
  1277.  
  1278. Amiga&Intuition & Lattice 3.03 & no mouse or menus yet\\
  1279.  
  1280. & &*Aztec 3\\
  1281.  
  1282. ST520&TOS&Lattice 3.10& no menus yet, no shell commands\\ %
  1283. \multicolumn{4}{c}{Systems to be supported (ie some code is already
  1284. written:)}\\
  1285.  
  1286. Macintosh& Finder 5.0& Aztec\\
  1287.  
  1288. \end{tabular}
  1289.  
  1290. *means that I do not own or have access to the listed compiler and/or
  1291.  machine and must rely upon others to help support it.
  1292. \chapter{Machine Dependent Notes}
  1293.  
  1294. This appendix lists some notes specific to individual
  1295. implementations of MicroEMACS. Every attempt has been made to allow
  1296. EMACS to be identical on all machines, but we have also tried to take
  1297. advantage of function keys, cursor keys, mice, and special screen modes
  1298. where possible.
  1299.  
  1300. \section{IBM-PC/XT/AT and its clones}
  1301.  
  1302. The IBM-PC family of computers is supported with a variety of
  1303. different display adapters.  EMACS will attempt to discover what adapter
  1304. is connected and use the proper driver for it.  Below is a list of the
  1305. currently supported video adapters:
  1306.  
  1307. \begin{tabular}{llp{236pt}}
  1308. Adapter & \$sres & Original mode used\\ \hline
  1309. Monochrome Graphics Adapter & MONO & MONO\\
  1310. Color Graphics Adapter & CGA & CGA\\
  1311. Enhanced graphics Adapter & EGA & CGA\\
  1312. \end{tabular}
  1313.  
  1314. EMACS also takes advatage of various function keys and the keys
  1315. on the keypad on an IBM-PC.  The function keys are initially not bound
  1316. to any particular functions (except by the emacs.rc startup file), but
  1317. the keypad keys do default to the following:
  1318.  
  1319. \begin{tabular}{ll}
  1320. Keypad key & Function\\ \hline
  1321. Home & beginning-of-file\\
  1322. CSRS UP & previous-line\\
  1323. Pg Up & previous-page\\
  1324. CSRS LEFT & backward-character\\
  1325. CSRS RIGHT & forward-character\\
  1326. End & end-of-file\\
  1327. CSRS DOWN & next-line\\
  1328. Pg Dn & Next-page\\
  1329. \end{tabular}
  1330.  
  1331. All these special keys are indicated in EMACS macroes by use of
  1332. the {\bf{}FN} prefix.  Below is a list of many of the keys and the codes
  1333. used to specify them.  Also the codes may be gotten by using the
  1334. describe-key (\^{}X-?) command on the suspect key.
  1335.  
  1336. \newpage
  1337. \begin{verbatim}
  1338.                         IBM PC function keys in MicroEmacs
  1339.  
  1340.         function        Function        ^function       Alt-function
  1341.  f1)      FN;             FNT             FN^             FNh
  1342.  f2)      FN<             FNU             FN_             FNi
  1343.  f3)      FN=             FNV             FN`             FNj
  1344.  f4)      FN>             FNW             FNa             FNk
  1345.  f5)      FN?             FNX             FNb             FNl
  1346.  f6)      FN@             FNY             FNc             FNm
  1347.  f7)      FNA             FNZ             FNd             FNn
  1348.  f8)      FNB             FN[             FNe             FNo
  1349.  f9)      FNC             FN\             FNf             FNp
  1350. f10)      FND             FN]             FNg             FNq
  1351.  
  1352. home)     FNG                             FNw
  1353. CuUp)     FNH
  1354. PgUp)     FNI                             FN (Alt 132)
  1355. CuLf)     FNK                             FNs
  1356.  5  )
  1357. CuRt)     FNM                             FNt
  1358.  End)     FNO                             FNu
  1359. CuDn)     FNP
  1360. PgDn)     FNQ                             FNv
  1361.  Ins)     FNR
  1362.  Del)     FNS
  1363. \end{verbatim}
  1364. %\newpage
  1365. \section{Atari 520/1040ST}
  1366.  
  1367. The ATARI ST family of computers have a dual personality.  They
  1368. may use either a monochrome or a color screen.  EMACS supports two
  1369. screen resolutions on each monitor.
  1370.  
  1371. \begin{tabular}{lllll}
  1372. Monitor & \$sres & size & \#color & \$palette format\\ \hline\\
  1373. Color & LOW & 40x25 & 16 & 000111222333444555666777\\
  1374.  & MEDIUM & 80x25 & 4 & 000111222333\\
  1375. Mono & HIGH & 80x25 & 2 & 000\\
  1376.  & DENSE & 80x40 & 2 & 000\\
  1377. \end{tabular}
  1378.  
  1379. The \$palette environment variable can be used to change what
  1380. color is associated with each color name.  With a color monitor, each
  1381. group of three digits indicates an octal number specifying the RED,
  1382. GREEN and BLUE levels of that color.  Each color digit can vary from 0
  1383. to 7.  For example, the initial setting of \$palette in LOW resolution is:
  1384.  
  1385. \begin{verbatim}
  1386.         000700070770007707077777
  1387.  
  1388.         which broken up is:
  1389.  
  1390.         000 700 070 770 007 707 077 777
  1391.  
  1392.         which means:
  1393.  
  1394.         000     Black
  1395.         700     Red
  1396.         070     Green
  1397.         770     Yellow
  1398.         007     Blue
  1399.         707     Magenta
  1400.         077     Cyan
  1401.         777     White
  1402. \end{verbatim}
  1403.  
  1404. {\it{}Note: DENSE mode is not yet supported in 3.8i.  It will be
  1405. soon}
  1406.  
  1407. Also the mouse generates FN prefix codes when moved, or when one
  1408. of the two buttons is pressed.  Initially the movement of the mouse is
  1409. bound to movement of the cursor, and the left mouse button generates a
  1410. set-mark (M-space) command.  The cursor keys and the function keys are
  1411. bound similarly to to IBM-PC.
  1412. %\newpage
  1413. \section{Amiga 1000}
  1414.  
  1415. The Commodore AMIGA 1000 version of MicroEMACS does not have
  1416. extensive support of the mouse or of pull down menus as of yet.  It does
  1417. however come up in a window, and it is possible to re-size it to run in
  1418. different sized windows.  The {\bf{}M-\^{}S} {\it{}change-screen-size}
  1419. \index{change-screen-size} takes its numeric argument as the new number
  1420. of lines for EMACS to use.  The {\bf{}M-\^{}T} {\it{}change-screen-width}
  1421. \index{change-screen-width} command allows you to change the number of
  1422. columns EMACS will use.  The defaults for these are 23 lines and 77
  1423. characters across for a full screen window.
  1424.  
  1425. {\bf Note about Compiling MicroEMACS:}
  1426. If you are compiling the sources on the AMIGA to produce an
  1427. executable image, and you are using the Lattice compiler, be sure to
  1428. give the CLI command `STACK 40000' before compiling to make sure the
  1429. compiler has sufficient stack space to successfully complete
  1430. compiliation.
  1431.  
  1432. %\newpage
  1433. \section{UNIX V5, V7, and BSD4.[23]}
  1434.  
  1435. MicroEMACS under UNIX utilizes the {\bf{}TERMCAP} \index{termcap}
  1436. library to provide machine independent screen functions.  Make sure that
  1437. termcap is availible and properly set on your account before attempting
  1438. to use MicroEMACS.
  1439.  
  1440. Under systems which support job control, you can use the
  1441. {\bf{}\^{}X-D} {\it{}suspend-emacs} \index{suspend-emacs} command to
  1442. place EMACS into the background.  This carries a much smaller overhead
  1443. than bringing up a new shell under EMACS.  EMACS will properly redraw
  1444. the screen when you bring it back to the forground.
  1445.  
  1446. With the addition of some very machine/operating system specific
  1447. code, EMACS can prevent two or more people from modifying the same file
  1448. at the same time.  \index{file locking} The upper level of a set of
  1449. functions to provide file locking exist in the source file {\bf{}LOCK.C}.
  1450. It requires two machine specific functions written and linked into EMACS
  1451. for it to operate properly.
  1452.  
  1453. \newpage
  1454. \begin{verbatim}
  1455.         char *dolock(fname)
  1456.  
  1457.         char *fname;
  1458.  
  1459.         dolock() locks a file, preventing others from modifying it. If
  1460.         it succeeds, it returns NULL, otherwise it returns a pointer to
  1461.         a string in the form "LOCK ERROR: explination".
  1462.  
  1463.         char *undolock(fname)
  1464.  
  1465.         char *fname;
  1466.  
  1467.         undolock() unlocks a file, allowing others to modifying it. If
  1468.         it succeeds, it returns NULL, otherwise it returns a pointer to
  1469.         a string in the form "LOCK ERROR: explination".
  1470. \end{verbatim}
  1471. \Rogue\Monster\
  1472. else
  1473.   echo "will not over write ./part2.tex"
  1474. fi
  1475. if [ `wc -c ./part2.tex | awk '{printf $1}'` -ne 54785 ]
  1476. then
  1477. echo `wc -c ./part2.tex | awk '{print "Got " $1 ", Expected " 54785}'`
  1478. fi
  1479. echo "Finished archive 1 of 2"
  1480. exit
  1481.