home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311DOC.ZIP / EMACS.MSS next >
Text File  |  1991-10-30  |  182KB  |  4,461 lines

  1. @style(spacing 1 lines, margins .7 inches, indent 8 chars, font Times10)
  2. @Define(goodstuff, fill n, font Helvetica10)
  3. @Define(col3, columns 3, fill n)
  4. @style(indent 8 chars, spacing 1 lines, BindingMargin .5 inches)
  5. @pagefooting()
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.         @big(@b[MicroEMACS])
  19.  
  20.         Full Screen Text Editor
  21.         Reference Manual
  22.  
  23.         Version 3.11
  24.         October 29, 1991
  25.  
  26.         (C)Copyright 1988, 1989, 1990, 1991 by Daniel M. Lawrence
  27.         Reference Manual (C)opyright 1988, 1989, 1990, 1991
  28.             by Brian Straight and Daniel M. Lawrence
  29.         All Rights Reserved
  30.  
  31.         @i[(C)Copyright 1988, 1989, 1990, 1991 by Daniel M. Lawrence
  32.         MicroEMACS 3.11 can be copied and distributed freely for any
  33.         non-commercial purposes. Commercial users may use MicroEMACS
  34.         3.11 inhouse. Shareware distributors may redistribute
  35.         MicroEMACS 3.11 for media costs only. MicroEMACS 3.11 can only
  36.         be incorporated into commercial software or resold with the
  37.         permission of the current author.]
  38. @newpage
  39. @flushleft(@big[Introduction])
  40.  
  41.     MicroEMACS is a tool for creating and changing documents,
  42. programs, and other text files. It is both relatively easy for the
  43. novice to use, but also very powerful in the hands of an expert.
  44. MicroEMACS can be extensively customized for the needs of the individual
  45. user.
  46.  
  47.     MicroEMACS allows several files to be edited at the same time.
  48. The screen can be split into different windows and screens, and text may
  49. be moved freely from one window on any screen to the next. Depending on
  50. the type of file being edited, MicroEMACS can change how it behaves to
  51. make editing simple.  Editing standard text files, program files and
  52. word processing documents are all possible at the same time.
  53.  
  54.     There are extensive capabilities to make word processing and
  55. editing easier. These include commands for string searching and
  56. replacing, paragraph reformatting and deleting, automatic word wrapping,
  57. word move and deletes, easy case controlling, and automatic word counts.
  58.  
  59.     For complex and repetitive editing tasks editing macroes can be
  60. written. These macroes allow the user a great degree of flexibility in
  61. determining how MicroEMACS behaves. Also, any and all the commands can
  62. be used by any keystroke by changing, or rebinding, what commands
  63. various keys invoke.
  64.  
  65.     Special features are also available to perform a diverse set of
  66. operations such as file encryption, automatic backup file generation,
  67. entabbing and detabbing lines, executing operating system commands and
  68. filtering of text through other programs (like SORT to allow sorting
  69. text).
  70.  
  71. @flushleft(@big[History])
  72.  
  73.     EMACS was originally a text editor written by Richard Stallman
  74. at MIT in the early 1970s for Digital Equipment computers. Various
  75. versions, rewrites and clones have made an appearance since.
  76.  
  77.     This version of MicroEMACS is derived from code written by Dave
  78. G. Conroy in 1985. Later modifications were performed by Steve Wilhite
  79. and George Jones. In December of 1985 Daniel Lawrence picked up the then
  80. current source (version 2.0) and made extensive modifications and
  81. additions to it over the course of the next six years. Updates and
  82. support for the current version are still available. Commercial support
  83. and usage and resale licences are also available. The current program
  84. author can be contacted by writing to:
  85.  
  86. @begin(verbatim)
  87.     USMAIL: Daniel Lawrence
  88.         617 New York St
  89.         Lafayette, IN 47901
  90.  
  91.     UUCP:    pur-ee!mdbs!dan
  92.     ARPA:    mdbs!dan@@ee.ecn.purdue.edu
  93.  
  94.     Support is provided through:
  95.  
  96.     The Programmer's Room
  97.     Opus 201/10
  98.     300/1200/2400 and 9600 (Hayes V series only)
  99.     (317) 742-5533    no parity  8 databits  no stop bits
  100. @end(verbatim)
  101. @newpage
  102. @flushleft(@big[Credits])
  103.  
  104.     Many people have been involved in creating this software and we
  105. wish to credit some of them here. Dave Conroy, of course, wrote the very
  106. first version of MicroEMACS, and it is a credit to his clean coding that
  107. so much work was able to be done to expand it. John Gamble is
  108. responsible for writing the MAGIC mode search routines, and for
  109. maintaining all the search code. Jeff Lomicka wrote the appendix on DEC
  110. VMS and has supplied a lot of code to support VMS and the ATARI 1040ST
  111. versions. Curtis Smith wrote the original VMS code and help support the
  112. Commodore AMIGA. Also Lance Jones has done a lot of work on the AMIGA
  113. code. Professor Suresh Konda at Carnegie Mellon University has put a lot
  114. of effort into writing complex macros and finding all the bugs in the
  115. macro language before anyone else does.
  116.  
  117.     A special thanks to Dana Hoggatt who has provided an almost
  118. daily sounnding board for ideas, algorithyms and code. He is responcible
  119. for the encryption code directly and has prodded me into adding many
  120. features with simple but poignant questions (Dan? How do we move the
  121. upper left corner of the screen? . . . which forced me to write the text
  122. windowing system).
  123.  
  124.     As to people sending source code and text translations over
  125. computer networks like USENET and ARPA net, there are simply more than
  126. can be listed here. [The comments in the edit history in the history.c
  127. file mention each and the piece they contributed]. All these people
  128. should be thanked for the hard work they have put into MicroEMACS.
  129.  
  130. @closing(Daniel M. Lawrence)
  131. @newpage
  132. @string(ChapterTitle="")
  133. @set(page = 0)
  134. @pageheading(odd, left "@title[Chapter]", right "MicroEMACS Reference Manual")
  135. @pageheading(even, left "MicroEMACS Reference Manual", right "@title[Chapter]")
  136. @pagefooting(odd, left="@value(page)")
  137. @pagefooting(even, right="@value(page)")
  138. @chapter(Basic Concepts)
  139.  
  140.     The current version of MicroEMACS is 3.11 (Third major
  141. re-write, eleventh public release), and for the rest of this document, we
  142. shall simply refer to this version as "EMACS". Any modifications for
  143. later versions will be in the file README on the MicroEMACS distribution
  144. disk.
  145.  
  146. @section(Keys and the Keyboard)
  147.  
  148.     Many times throughout this manual we will be talking about
  149. @index(special keys) commands and the keys on the keyboard needed to use
  150. them. There are a number of "special" keys which can be used and are
  151. listed here:
  152.  
  153. @begin(description)
  154. <NL>@\NewLine which is also called RETURN, ENTER, or <NL>, this key is
  155. used to @index(newline) end different commands. 
  156.  
  157. ^@\The control key can be used before any alphabetic character and some
  158. symbols. For example, ^C means to hold down the <CONTROL> key and type
  159. @index(control key) the C key at the same time. 
  160.  
  161. ^X@\The CONTROL-X key is used at the beginning of many different
  162. @index(control-x) commands. 
  163.  
  164. META or M-@\This is a special EMACS key used to begin many commands.
  165. @index(meta key)This key is pressed and then released before
  166. typing the next character. On most systems, this is the <ESC> key, but
  167. it can be changed. (consult appendix E to learn what key is used for
  168. META on your computer).
  169. @end(description)
  170.  
  171. Whenever a command is described, the manual will list the actual
  172. keystrokes needed to execute it in @b(boldface) using the above
  173. conventions, and also the name of the command in @i(italics).
  174. @section(Getting Started)
  175.  
  176.     In order to use EMACS, you must call it up from your system or
  177. computer's command prompt. On UNIX and MSDOS machines, just type "emacs"
  178. from the command prompt and follow it with the <RETURN> or <ENTER> key
  179. (we will refer to this key as <NL> for "new-line" for the remainder of
  180. this manual). On the Macintosh, the Amiga, the ATARI ST, and under OS/2
  181. and other icon based operating systems, double click on the uEMACS icon.
  182. Shortly after this, a screen similar to the one below should appear.
  183.  
  184. @section(Parts and Pieces)
  185.  
  186.     The screen is divided into a number of areas or @b<windows>. On
  187. some systems the top window contains a function list of unshifted and
  188. @index(windows) shifted function keys. We will discuss these keys later. 
  189. @index(mode line) Below them is an EMACS @b<mode line> which, as we will
  190. see, informs you of the present mode of operation of the editor--for
  191. example "(WRAP)" if you set EMACS to wrap at the end of each line. 
  192. @index(text window) Under the mode line is the @b<text window> where text
  193. appears and is manipulated. Since each window has its own mode line,
  194. below the text window is it's mode line. The last line of the screen is
  195. the @b(command line) where EMACS takes commands and reports on what it
  196. is doing. 
  197.  
  198. @begin(verbatim)
  199. ===============================================================================
  200. f1 search-> f2 <-search |    MicroEMACS:  Text Editor
  201. f3 hunt->   f4 <-hunt    | 
  202. f5 fkeys    f6 help    |  Available function key Pages include:
  203. f7 nxt wind f8 pg[    ] |    WORD  BOX    EMACS  PASCAL  C  cObal  Lisp
  204. f9 save     f10 exit    |  [use the f8 key to load Pages]
  205. ===============================================================================
  206.    MicroEMACS 3.11 ()     Function Keys
  207. ===============================================================================
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. ===============================================================================
  220. ---- MicroEMACS 3.11 () -- Main ----------------------------------------------
  221. ===============================================================================
  222.         Fig 1:    EMACS screen on an IBM-PC
  223. @end(verbatim)
  224.  
  225. @section(Entering Text)
  226.  
  227. Entering text in EMACS is simple. Type the following sentence fragment:
  228.  
  229. @quotation<Fang Rock lighthouse, center of a series of mysterious and>
  230.  
  231. @flushleft(The text is displayed at the top of the text window. Now type:)
  232.  
  233. @quotation<terrifying events at the turn of the century>
  234.  
  235. Notice that some of your text has dissapeared off the left side of the
  236. screen. Don't panic--your text is safe!!! You've just discovered that
  237. EMACS doesn't "wrap" text to the next line like most word processors
  238. unless you hit <NL>. But since EMACS is used for both word processing,
  239. and text editing, it has a bit of a dual personality. You can change
  240. @index(modes) the way it works by setting various @b(modes). In this
  241. case, you need to set @b(WRAP) mode, using the @i(add-mode)
  242. @index(add-mode) command, by typing @b(^XM). The command line at the
  243. base of the screen will prompt you for the mode you wish to add. Type
  244. @b<wrap> followed by the <NL> key and any text you now enter will be
  245. wrapped. However, the command doesn't wrap text already entered. To
  246. get rid of the long line, press and hold down the <BACKSPACE> key until
  247. the line is gone. Now type in the words you deleted, watch how EMACS
  248. goes down to the next line at the right time. @i{(In some versions of
  249. EMACS, @b<WRAP> is a default mode in which case you don't have to worry
  250. about the instructions relating to adding this mode.)}
  251.  
  252. Now let's type a longer insert. Hit <NL> a couple of times to tab
  253. down from the text you just entered. Now type the following paragraphs. 
  254. Press <NL> twice to indicate a paragraph break. 
  255.  
  256. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  257. terrifying events at the turn of the century, is built on a rocky island
  258. a few miles of the Channel coast. So small is the island that wherever
  259. you stand its rocks are wet with sea spray. 
  260.  
  261. The lighthouse tower is in the center of the island. A steep flight of
  262. steps leads to the heavy door in its base. Winding stairs lead up to
  263. the crew room.>
  264.  
  265. @section<Basic cursor movement>
  266.  
  267. Now let's practice moving around in this text. To move the cursor back
  268. to the word "Winding," enter @b<M-B> @i(previous-word)
  269. @index(previous-word). This command moves the cursor backwards by one
  270. word at a time. Note you have to press the key combination every time
  271. the cursor steps back by one word. Continuously pressing META and
  272. toggling B produces an error message. To move forward to the word
  273. "stairs" enter @b<M-F> @i(next-word)@index(next-word), which moves the
  274. cursor forward by one word at a time. 
  275.  
  276. Notice that EMACS commands are usually mnemonic--F for forward, B for
  277. backward, for example.
  278.  
  279. To move the cursor up one line, enter @b<^P> @i(previous-line)
  280. @index(previous-line), down one line @b<^N> @i(next-line)
  281. @index(next-line). Practice this movement by moving the cursor to the
  282. word "terrifying" in the second line. 
  283.  
  284. The cursor may also be moved forward or backward in smaller increments. 
  285. To move forward by one character, enter @b<^F> @i(forward-character)
  286. @index(forward-character), to move backward, @b<^B>
  287. @i(backward-character) @index(backward-character). EMACS also allows
  288. you to specify a number which is normally used to tell a command to
  289. execute many times. To repeat most commands, press META and then the
  290. number before you enter the command. Thus, the command META 5 ^F
  291. (@b<M-5^F>) will move the cursor forward by five characters. Try moving
  292. around in the text by using these commands. For extra practice, see how
  293. close you can come to the word "small" in the first paragraph by giving
  294. an argument to the commands listed here. 
  295.  
  296. Two other simple cursor commands that are useful to help us move around
  297. in the text are @b<M-N> @i(next-paragraph) @index(next-paragraph) which
  298. moves the cursor to the second paragraph, and @b<M-P>
  299. @i(previous-paragraph) @index(previous-paragraph) which moves it back
  300. to the previous paragraph. The cursor may also be moved rapidly from
  301. one end of the line to the other. Move the cursor to the word "few" in
  302. the second line. Press @b<^A> @i(beginning-of-line)
  303. @index(beginning-of-line). Notice the cursor moves to the word
  304. "events" at the beginning of the line. Pressing @b<^E> @i(end-of-line)
  305. @index(end-of-line) moves the cursor to the end of the line. 
  306.  
  307. Finally, the cursor may be moved from any point in the file to the end
  308. or beginning of the file. Entering @b{M->} @i(end-of-file)
  309. @index(end-of-file) moves the cursor to the end of the buffer, @b{M-<}
  310. @i(beginning-of-file) @index(beginning-of-file) to the first character
  311. of the file. 
  312.  
  313. @i(On the IBM-PC, the ATARI ST and many other machines, the cursor keys
  314. @index(cursor keys) can also be used to move the cursor.)
  315.  
  316. Practice moving the cursor in the text until you are comfortable with
  317. the commands we've explored in this chapter.
  318.  
  319. @section(Saving your text)
  320.  
  321. When you've finished practicing cursor movement, save your file. Your
  322. @index(buffer) file currently resides in a @b<BUFFER>. The buffer is a
  323. temporary storage area for your text, and is lost when the computer is
  324. turned off. You can save the buffer to a file by entering @b<^X^S>
  325. @i(save-file) @index(save-file). Notice that EMACS informs you that
  326. your file has no name and will not let you save it.
  327.  
  328. To save your buffer to a file with a different name than it's current
  329. one (which is empty), press @b<^X^W> @i(write-file) @index(write-file). 
  330. EMACS will prompt you for the filename you wish to write. Enter the
  331. name @b<fang.txt> and press return. On a micro, the drive light will
  332. come on, and EMACS will inform you it is writing the file. When it
  333. finishes, it will inform you of the number of lines it has written to
  334. the disk. 
  335.  
  336. Congratulations!! You've just saved your first EMACS file!
  337. @newpage
  338. @heading(Chapter @value(chapter) Summary)
  339.  
  340.     In chapter @value(chapter), you learned how to enter text, how
  341. to use wrap mode, how to move the cursor, and to save a buffer. The
  342. following is a table of the commands covered in this chapter and their
  343. corresponding key bindings:
  344.  
  345. @begin{verbatim}
  346. @u(Key Binding        Keystroke    Effect)
  347.  
  348. abort-command        @b<^G>        aborts current command
  349.  
  350. add-mode        @b<^XM>     allows addition of EMACS
  351.                     mode such as @b(WRAP)
  352.  
  353. backward-character    @b<^B>        moves cursor left one character
  354.  
  355. beginning-of-file    @b{M-<}     moves cursor to beginning of file
  356.  
  357. beginning-of-line    @b<^A>        moves cursor to beginning of line
  358.  
  359. end-of-file        @b{M->}     moves cursor to end of file
  360.  
  361. end-of-line        @b<^E>        moves cursor to end of line
  362.  
  363. forward-character    @b<^F>        moves cursor right one character
  364.  
  365. next-line        @b<^N>        moves cursor to next line
  366.  
  367. next-paragraph        @b<M-N>     moves cursor to next paragraph
  368.  
  369. next-word        @b<M-F>     moves cursor forward one word
  370.  
  371. previous-line        @b<^P>        moves cursor backward by one line
  372.  
  373. previous-paragraph    @b<M-P>     moves cursor to previous paragraph
  374.  
  375. previous-word        @b<M-B>     moves cursor backward by one word
  376.  
  377. save-file        @b<^X^S>    saves current buffer to a file
  378.  
  379. write-file        @b<^X^W>    save current buffer under a new name
  380. @end(verbatim)
  381. @newpage
  382. @chapter(Basic Editing--Simple Insertions and Deletions)
  383.  
  384. @section<A Word About Windows, Buffers, Screens, and Modes>
  385.  
  386. In the first chapter, you learned how to create and save a file in
  387. EMACS. Let's do some more editing on this file. Call up emacs by
  388. typing in the following command.
  389.  
  390. @b<emacs fang.txt>
  391.  
  392. @i(On icon oriented systems, double click on the uEMACS icon, usually a
  393. file dialog box of some sort will appear. Choose @b(FANG.TXT) from the
  394. appropriate folder.)
  395.  
  396. Shortly after you invoke EMACS, the text should appear on the screen
  397. ready for you to edit. The text you are looking at currently resides in
  398. a @b<buffer>. A buffer is a temporary area of computer memory which is
  399. @index(buffer) the primary unit internal to EMACS -- this is the place
  400. where EMACS goes to work. The mode line at the bottom of the screen
  401. lists the buffer name, @b<FANG.TXT> and the name of the file with which
  402. this buffer is associated, @b<FANG.TXT>
  403.  
  404. The computer talks to you through the use of its @b(screen). This
  405. @index(screen) screen usually has an area of 24 lines each of 80
  406. characters across. You can use EMACS to subdivide the screen into
  407. several separate work areas, or @b(windows), each of which can be
  408. @index(window) 'looking into' different files or sections of text. Using
  409. windows, you can work on several related texts at one time, copying and
  410. moving blocks of text between windows with ease. To keep track of what
  411. you are editing, each window is identified by a @b(mode line) on the
  412. @index(mode line) @index(buffer) last line of the window which lists the
  413. name of the @b(buffer) which it is looking into, the file from which the
  414. text was read, and how the text is being edited. 
  415.  
  416. An EMACS @b<mode> tells EMACS how to deal with user input. As we have
  417. already seen, the mode 'WRAP' controls how EMACS deals with long lines
  418. (lines with over 79 characters) while the user is typing them in. The
  419. 'VIEW' mode, allows you to read a file without modifying it. Modes are
  420. associated with buffers and not with files; hence, a mode needs to be
  421. explicitly set or removed every time you edit a file. A new file read
  422. into a buffer with a previously specified mode will be edited under this
  423. mode. If you use specific modes frequently, EMACS allows you to set
  424. the modes which are used by all new buffers, called @b<global> modes. 
  425.  
  426. @section<Insertions>
  427.  
  428. Your previously-saved text should look like this:
  429.  
  430. @quotation<Fang Rock lighthouse, center of a series of mysterious and
  431. terrifying events at the turn of the century, is built on a rocky island
  432. a few miles of the Channel coast. So small is the island that wherever
  433. you stand its rocks are wet with sea spray. 
  434.  
  435. The lighthouse tower is in the center of the island. A steep flight of
  436. steps leads to the heavy door in its base. Winding stairs lead up to
  437. the crew room.>
  438.  
  439. Let's assume you want to add a sentence in the second paragraph after
  440. the word "base."  Move the cursor until it is on the "W" of "Winding".
  441. Now type the following:
  442.  
  443. @quotation<This gives entry to the lower floor where the big steam
  444. generator throbs steadily away, providing power for the electric
  445. lantern.>
  446.  
  447. If the line fails to wrap and you end up with a '$' sign in the right
  448. margin, just enter @b{M-Q} @i(fill-paragraph) @index(fill-paragraph) to
  449. reformat the paragraph. This new command attempts to fill out a
  450. paragraph. Long lines are divided up, and words are shuffled around to
  451. make the paragraph look nicer. 
  452.  
  453. Notice that all visible EMACS characters are self-inserting -- all you
  454. had to do was type the characters to insert and the existing text made
  455. space for it. With a few exceptions discussed later, all non-printing
  456. characters (such as control or escape sequences) are commands. To
  457. insert spaces, simply use the space bar. Now move to the first line of
  458. the file and type @b{^O} @i(open-line) @index(open-line) (Oh, not zero). 
  459. You've just learned how to insert a blank line in your text. 
  460.  
  461. @section<Deletions>
  462.  
  463. EMACS offers a number of deletion options. For example, move the cursor
  464. until it's under the period at the end of the insertion you just did. 
  465. Press the backspace key. Notice the "n" on "lantern" disappeared. The
  466. backspace implemented on EMACS is called a @b<destructive> backspace--it
  467. removes text immediately before the current cursor position from the
  468. buffer. Now type @b<^H> @i(delete-previous-character)
  469. @index(delete-previous-character). Notice that the cursor moves back
  470. and obliterates the "r"--either command will backspace the cursor. 
  471.  
  472. Type in the two letters you erased to restore your text and move the
  473. cursor to the beginning of the buffer @b{M->} @i(beginning-of-file)
  474. @index(beginning-of-file). Move the cursor down one line to the
  475. beginning of the first paragraph. 
  476.  
  477. To delete the forward character, type @b{^D} @i(delete-next-character)
  478. @index(delete-next-character). The "F" of "Fang" disappears. Continue
  479. to type @b{^D} until the whole word is erased EMACS also permits the
  480. deletion of larger elements of text. Move the cursor to the word
  481. "center" in the first line of text. Pressing @b{M-<backspace>}
  482. @i(delete-previous-word) @index(delete-previous-word) kills the word
  483. immediately before the cursor. @b{M-^H} has the same effect. 
  484.  
  485. Notice that the commands are very similar to the control commands you
  486. used to delete individual letters. As a general rule in EMACS, control
  487. sequences affect small areas of text, META sequences larger areas. The
  488. word forward of the cursor position can therefore be deleted by typing
  489. @b{M-D} @i(delete-next-word) @index(delete-next-word). Now let's take
  490. out the remainder of the first line by typing @b{^K}
  491. @i(kill-to-end-of-line) @index(kill-to-end-of-line). You now have a
  492. blank line at the top of your screen. Typing @b{^K} again or @b{^X^O}
  493. @i(delete-blank-lines) @index(delete-blank-lines) deletes the blank line
  494. and flushes the second line to the top of the text. Now exit EMACS by
  495. typing @b{^X^C} @i(exit-emacs) @index(exit-emacs). Notice EMACS
  496. reminds you that you have not saved your buffer. Ignore the warning and
  497. exit. This way you can exit EMACS without saving any of the changes you
  498. just made. 
  499. @newpage
  500. @heading(Chapter @value(chapter) Summary)
  501.  
  502. In Chapter @value(chapter), you learned about the basic 'building
  503. blocks' of an EMACS text file--buffers, windows, and files. 
  504.  
  505. @begin{verbatim}
  506. @u(Key binding        Keystroke    Effect)
  507. delete-previous-character
  508.             @b{^H}        deletes character immediately before
  509.                     the current cursor position
  510.  
  511. delete-next-character    @b{^D}        deletes character immediately after     
  512.                     current cursor position
  513.  
  514. delete-previous-word    @b{M-^H}    deletes word immediately before
  515.                     current cursor position
  516.  
  517. delete-next-word    @b{M-D}     deletes word immediately after
  518.                     current cursor position
  519.  
  520. kill-to-end-of-line    @b<^K>        deletes from current cursor
  521.                     position to end of line
  522.  
  523. insert-space        @b<^C>        inserts a space to right of cursor
  524.  
  525. open-line        @b{^O}        inserts blank line
  526.  
  527. delete-blank-lines    @b{^X^O}    removes blank line
  528.  
  529. exit-emacs        @b{^X^C}    exits emacs
  530. @end(verbatim)
  531. @chapter(Using Regions)
  532.  
  533. @section(Defining and Deleting a Region)
  534.  
  535. At this point its time to familiarize ourselves with two more EMACS
  536. terms--the @b<point> and the @b<mark>. The point is located directly
  537. @index(point) @index(mark) behind the current cursor position. The mark
  538. (as we shall see shortly) is user defined. These two elements together
  539. are called the current @b(region) and limit the @b<region> of text on
  540. which EMACS performs many of its editing functions. 
  541.  
  542. Let's begin by entering some new text. Don't forget to add @b(wrap)
  543. mode if its not set on this buffer. Start EMACS and open a file called
  544. @b{PUBLISH.TXT}. Type in the following text:
  545.  
  546. @quotation{One of the largest growth areas in personal computing is
  547. electronic publishing. There are packages available for practically
  548. every machine from elegantly simple programs for the humble Commodore 64
  549. to sophisticated professional packages for PC and Macintosh computers. 
  550.  
  551. Electronic publishing is as revolutionary in its way as the Gutenburg
  552. press. Whereas the printing press allowed the mass production and
  553. distribution of the written word, electronic publishing puts the means
  554. of production in the hands of nearly every individual. From the class
  555. magazine to the corporate report, electronic publishing is changing the
  556. way we produce and disseminate information. 
  557.  
  558. Personal publishing greatly increases the utility of practically every
  559. computer. Thousands of people who joined the computer revolution of
  560. this decade only to hide their machines unused in closets have
  561. discovered a new use for them as dedicated publishing workstations.}
  562.  
  563. Now let's do some editing. The last paragraph seems a little out of
  564. place. To see what the document looks like without it we can cut it
  565. from the text by moving the cursor to the beginning of the paragraph. 
  566. Enter @b(M-<space>) @i(set-mark) @index(set-mark). EMACS will respond
  567. with "[Mark set]". Now move the cursor to the end of the paragraph. 
  568. You have just defined a region of text. To remove this text from the
  569. screen, type @b<^W> @i(kill-region) @index(kill-region). The paragraph
  570. disappears from the screen. 
  571.  
  572. On further consideration, however, perhaps the paragraph we cut wasn't
  573. so bad after all. The problem may have been one of placement. If we
  574. could tack it on to the end of the first paragraph it might work quite
  575. well to support and strengthen the argument. Move the cursor to the end
  576. of the first paragraph and enter @b<^Y> @i(yank) @index(yank). Your
  577. text should now look like this:
  578.  
  579. @quotation{One of the largest growth areas in personal computing is
  580. electronic publishing. There are packages available for practically
  581. every machine from elegantly simple programs for the humble Commodore 64
  582. to sophisticated professional packages for PC and Macintosh computers. 
  583. Personal publishing greatly increases the utility of practically every
  584. computer. Thousands of people who joined the computer revolution of
  585. this decade only to hide their machines unused in closets have
  586. discovered a new use for them as dedicated publishing workstations. 
  587.  
  588. Electronic publishing is as revolutionary in its way as the Gutenburg
  589. press. Whereas the printing press allowed the mass production and
  590. distribution of the written word, electronic publishing puts the means
  591. of production in the hands of nearly every individual. From the class
  592. magazine to the corporate report, electronic publishing is changing the
  593. way we produce and disseminate information.}
  594.  
  595. @section(Yanking a Region)
  596.  
  597. The text you cut initially didn't simply just disappear, it was cut into
  598. a buffer that retains the 'killed' text appropriately called the @b<kill
  599. buffer>. @b<^Y> "yanks" the text back from this buffer into the current
  600. buffer. If you have a long line (indicated, remember, by the "$"
  601. sign), simply hit @b{M-Q} to reformat the paragraph. 
  602.  
  603. There are other uses to which the kill buffer can be put. Using the
  604. @index(kill buffer) method we've already learned, define the last
  605. paragraph as a region. Now type @b<M-W> @i(copy-region)
  606. @index(copy-region). Nothing seems to have happened; the cursor stays
  607. blinking at the point. But things have changed, even though you may not
  608. be able to see any alteration. 
  609.  
  610. To see what has happened to the contents of the kill buffer, move the
  611. cursor down a couple of lines and "yank" the contents of the kill buffer
  612. back with @b<^Y>. Notice the last paragraph is now repeated. The
  613. region you defined is "tacked on" to the end of your file because
  614. @b<M-W> @b<copies> a region to the kill buffer while leaving the
  615. original text in your working buffer. Some caution is needed however,
  616. because the contents of the kill buffer are updated when you delete any
  617. regions, lines or words. If you are moving large quantities of text,
  618. complete the operation before you do any more deletions or you could
  619. find that the text you want to move has been replaced by the most recent
  620. deletion. Remember--a buffer is a temporary area of computer memory
  621. that is lost when the machine is powered down or switched off. In order
  622. to make your changes permanent, they must be saved to a file before you
  623. leave EMACS. Let's delete the section of text we just added and save
  624. the file to disk. 
  625.  
  626. @heading(Chapter @value(chapter) Summary)
  627.  
  628. In Chapter @value(chapter), you learned how to achieve longer insertions
  629. and deletions. The EMACS terms @b<point> and @b<mark> were introduced
  630. and you learned how to manipulate text with the kill buffer. 
  631.  
  632. @begin{verbatim}
  633. @begin(group)
  634. @u(Key Binding    Keystroke    Effect)
  635.  
  636. set-mark    @b{M-<space>}    Marks the beginning of a region
  637.  
  638. delete-region    @b{^W}        Deletes region between point and mark and
  639.                 places it in KILL buffer
  640.  
  641. copy-region    @b{M-W}     Copies text between point and mark into
  642.                 KILL buffer
  643.  
  644. yank-text    @b{^Y}        Inserts a copy of the KILL buffer into
  645.                 current buffer at point
  646. @end(group)
  647. @end(verbatim)
  648. @chapter(Search and Replace)
  649.  
  650. @section<Forward Search>
  651.  
  652. Load EMACS and bring in the file you just saved. Your file should look
  653. like the one below.
  654.  
  655. @quotation{One of the largest growth areas in personal computing is electronic
  656. publishing. There are packages available for practically every machine
  657. from elegantly simple programs for the humble Commodore 64 to
  658. sophisticated professional packages for PC and Macintosh computers. 
  659. Personal publishing greatly increases the utility of practically every
  660. computer. Thousands of people who joined the computer revolution of
  661. this decade only to hide their machines unused in closets have
  662. discovered a new use for them as dedicated publishing workstations. 
  663.  
  664. Electronic publishing is as revolutionary in its way as the Gutenburg
  665. press. Whereas the printing press allowed the mass production and
  666. distribution of the written word, electronic publishing puts the means
  667. of production in the hands of nearly every individual. From the class
  668. magazine to the corporate report, electronic publishing is changing the
  669. way we produce and disseminate information.}
  670.  
  671. Let's use EMACS to search for the word "revolutionary" in the second
  672. paragraph. Because EMACS searches from the current cursor position
  673. toward the end of buffers, and we intend to search forward, move the
  674. cursor to the beginning of the text. Enter @b<^S> @i(search-forward)
  675. @index(search-forward). Note that the command line now reads
  676.  
  677. "Search [] <META>:" 
  678.  
  679. EMACS is prompting you to enter the @b<search string> -- the text you
  680. want to find. Enter the word @b<revolutionary> and hit the @b<META>
  681. key. The cursor moves to the end of the word "revolutionary."
  682.  
  683. Notice that you must enter the <META> key to start the search. If you
  684. @index(<NL>) simply press <NL> the command line responds with "<NL>". 
  685. Although this may seem infuriating to users who are used to pressing the
  686. return key to execute any command, EMACS' use of <META> to begin
  687. searches allows it to pinpoint text with great accuracy. After every
  688. line wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
  689. If you need to search for a word at the end of a line, you can specify
  690. this word uniquely in EMACS. 
  691.  
  692. In our sample text for example, the word "and" occurs a number of times,
  693. but only once at the end of a line. To search for this particular
  694. occurrence of the word, move the cursor to the beginning of the buffer
  695. and type @b(^S). Notice that EMACS stores the last specified
  696. @index(default string) search string as the @b<default> string. If you
  697. press @b{<META>} now, EMACS will search for the default string, in this
  698. case, "revolutionary."
  699.  
  700. To change this string so we can search for our specified "and" simply
  701. enter the word @b{and} followed by @b{<NL>}. The command
  702. line now shows:
  703.  
  704. "search [and<NL>]<META>:"
  705.  
  706. Press @b{<META>} and the cursor moves to "and" at the end of the second
  707. last line.
  708.  
  709. @section<Exact Searches>
  710.  
  711. If the mode EXACT is active in the current buffer, EMACS searches on a case
  712. sensitive basis. Thus, for example you could search for @b{Publishing}
  713. as distinct from @b{publishing}. 
  714.  
  715.  
  716. @section<Backward Search>
  717.  
  718. Backward searching is very similar to forward searching except that it
  719. is implemented in the reverse direction. To implement a reverse search,
  720. type @b{^R} @i(search-reverse) @index(search-reverse). Because EMACS
  721. makes no distinction between forward and backward stored search strings,
  722. the last search item you entered appears as the default string. Try
  723. searching back for any word that lies between the cursor and the
  724. beginning of the buffer. Notice that when the item is found, the point
  725. moves to the beginning of the found string (i.e., the cursor appears
  726. under the first letter of the search item). 
  727.  
  728. Practice searching for other words in your text.
  729.  
  730. @section<Searching and Replacing>
  731.  
  732. Searching and replacing is a powerful and quick way of making changes to
  733. your text. Our sample text is about electronic publishing, but the
  734. correct term is 'desktop' publishing. To make the necessary changes we
  735. need to replace all occurrences of the word "electronic" with "desktop."
  736. First, move the cursor to the top of the current buffer with the @b(M-<)
  737. command. Then type @b[M-R] @i(replace-string) @index(replace-string). 
  738. The command line responds:
  739.  
  740. "Replace []<META>:"
  741.  
  742. where the square brackets enclose the default string. Type the word
  743. @b<electronic> and hit @b{<META>}. The command line responds:
  744.  
  745. "with []<META>"
  746.  
  747. type @b{desktop<META>}. EMACS replaces all instances of the original
  748. word with your revision. Of course, you will have to capitalize the
  749. first letter of "desktop" where it occurs at the beginning of a
  750. sentence.
  751.  
  752. You have just completed an @b<unconditional replace>. In this
  753. operation, EMACS replaces every instance of the found string with the
  754. replacement string. 
  755.      
  756. @section<Query-Replace>
  757.  
  758. You may also replace text on a case by case basis. The @b{M-^R}
  759. @i(query-replace-string) @index(query-replace-string) command causes
  760. EMACS to pause at each instance of the found string. 
  761.  
  762. For example, assume we want to replace some instances of the word
  763. "desktop" with the word "personal." Go back to the beginning of the
  764. current buffer and enter the @b(M-^R) @i(query-replace)
  765. @index(query-replace) command. The procedure is very similar to that
  766. which you followed in the unconditional search/replace option. When the
  767. search begins however, you will notice that EMACS pauses at each
  768. instance of "publishing" and asks whether you wish to replace it with
  769. the replacement string. You have a number of options available for
  770. response:
  771.  
  772. @begin(verbatim)
  773. @u(    Response    Effect)
  774.     Y(es)    Make the current replacement and skip to the next
  775.         occurrence of the search string
  776.  
  777.     N(o)    Do not make this replacement but continue
  778.  
  779.     !    Do the rest of the replacements with no more queries
  780.  
  781.     U(ndo)    Undo just the last replacement and query for it
  782.         again (This can only go back ONE time)
  783.  
  784.     ^G    Abort the replacement command (This action does not
  785.         undo previously-authorized replacements
  786.  
  787.     . Same effect as ^G, but cursor returns to the point at
  788.         which the replacement command was given
  789.  
  790.     ?    This lists help for the query replacement command
  791. @end(verbatim)
  792.  
  793. Practice searching and searching and replacing until you feel
  794. comfortable with the commands and their effects.
  795. @begin(group)
  796. @heading(Chapter @value(chapter) Summary)
  797.  
  798. In this chapter, you learned how to search for specified strings of text
  799. in EMACS. The chapter also dealt with searching for and replacing
  800. elements within a buffer. 
  801.  
  802. @begin(verbatim)
  803. @u(Key Binding        Keystroke             Effect)
  804.  
  805. search-forward        @b{^S}    Searches from point to end of buffer.
  806.                 Point is moved from current location to
  807.                 the end of the found string
  808.  
  809. search-backward     @b{^R}    Searches from point to beginning of buffer. 
  810.                 Point is moved from current location to
  811.                 beginning of found string
  812.  
  813. replace         @b{M-R} Replace ALL occurrences of search string with 
  814.                 specified (null) string from point to the
  815.                 end of the current buffer
  816.  
  817. query-replace           @b{M-^R} As above, but pause at each found string
  818.                 and query for action
  819. @end(verbatim)
  820. @end(group)
  821. @chapter(Windows)
  822.  
  823. @section<Creating Windows>@index{Windows, Creating}
  824.  
  825. We have already met windows in an earlier chapter. In this chapter, we
  826. will explore one of EMACS' more powerful features -- text manipulation
  827. through multiple windowing. Windows offer you a powerful and easy way
  828. to edit text. By manipulating a number of windows and buffers on the
  829. screen simultaneously, you can perform complete edits and revisions on
  830. the computer screen while having your draft text or original data
  831. available for reference in another window. 
  832.  
  833. You will recall that windows are areas of buffer text that you can see
  834. @index(windows) on the screen. Because EMACS can support several screen
  835. windows simultaneously you can use them to look into different places in
  836. the same buffer. You can also use them to look at text in different
  837. buffers. In effect, you can edit several files at the same time. 
  838.  
  839. Let's invoke EMACS and pull back our file on desktop publishing by
  840. typing
  841.  
  842. @quotation<emacs publish.txt>
  843.  
  844. When the text appears, type the @b{^X2} @i(split-current-window)
  845. @index{split-current-window} command. The window splits into two
  846. windows. The window where the cursor resides is called the @b<current>
  847. window -- in this case the bottom window. Notice that each window has
  848. a text area and a mode line. The @b(command line) @index{command line}
  849. is however, common to all windows on the screen. 
  850.  
  851. The two windows on your screen are virtually mirror images of each other
  852. because the new window is opened into the same buffer as the one you are
  853. in when you issue the @i{open-window command} @index{open-window}. All
  854. commands issued to EMACS are executed on the current buffer in the
  855. current window. 
  856.  
  857. To move the cursor to the upper window (i.e., to make that window the
  858. current window, type @b{^XP} @i(previous-window) @index{previous-window}. 
  859. Notice the cursor
  860. moves to the upper or @b<previous> window. Entering @b{^XO}
  861. @i(next-window) moves to the @b{next} window. Practice moving between
  862. windows. You will notice that you can also move into the Function Key
  863. menu by entering these commands. 
  864.  
  865. Now move to the upper window. Let's open a new file. On the EMACS disk
  866. is a tutorial file. Let's call it into the upper window by typing:
  867.  
  868. @quotation<^X^F>
  869.  
  870. and press return.
  871.  
  872. Enter the filename @b<emacs.tut>.
  873.  
  874. In a short time, the tutorial file will appear in the window. We now have
  875. two windows on the screen, each looking into different buffers. We have
  876. just used the @b(^X^F) @i(find-file) @index{find-file}
  877. command to find a file and bring
  878. it into our current window.
  879.  
  880. You can scroll any window up and down with the cursor keys, or with the
  881. commands we've learned so far. However, because the area of visible
  882. text in each window is relatively small, you can scroll the current
  883. window a line at a time. 
  884.  
  885. Type @b{^X^N} @i(move-window-down)@index{move-window-down}
  886.  
  887. The current window scrolls down by one line -- the top line of text
  888. scrolls out of view, and the bottom line moves towards the top of the
  889. screen. You can imagine, if you like, the whole window slowly moving
  890. down to the end of the buffer in increments of one line. The command
  891. @b{^X^P} @i(move-window-up)@index{move-window-up} 
  892. scrolls the window in the opposite
  893. direction. 
  894.  
  895. As we have seen, EMACS editing commands are executed in the current
  896. window, but the program does support a useful feature that allows you
  897. to scroll the @b<next> window.  @b<M-^Z> @i(scroll-next-up)
  898. @index{scroll-next-up} scrolls the next window up, @b{M-^V}
  899. @i(scroll-next-down)@index{scroll-next-down}  scrolls it downward. 
  900. From the tutorial window, practice scrolling the window with the
  901. desktop publishing text in it up and down. 
  902.  
  903. When you're finished, exit EMACS without saving any changes in your
  904. files. 
  905.  
  906.  
  907. Experiment with splitting the windows on your screen. Open windows
  908. into different buffers and experiment with any other files you may
  909. have. Try editing the text in each window, but don't forget to save
  910. any changes you want to keep -- you still have to save each buffer
  911. separately.
  912.  
  913. @section(Deleting Windows)@index{Windows, Deleting}
  914. Windows allow you to perform complex editing tasks with ease. However,
  915. they become an inconvenience when your screen is cluttered with open
  916. windows you have finished using. The simplest solution is to delete
  917. unneeded windows. The command @b{^X0} @i{delete-window}
  918. will delete the window you are currently working in and move you to the
  919. next window.
  920.  
  921. If you have a number of windows open, you can delete all but the current
  922. window by entering @b{^X1} @i{delete-other-windows}.
  923.  
  924. @section(Resizing Windows)@index{Windows, Resizing} 
  925.  
  926. During complex editing tasks, you will probably find it convenient to
  927. have a number of windows on the screen simultaneously. However this
  928. situation may present inconveniences because the more windows you have
  929. on the screen the smaller they are; in some cases, a window may show
  930. only a couple of lines of text. To increase the flexibility and utility
  931. of the window environment, EMACS allows you to resize the window you are
  932. working in (called, as you will recall, the @b<current> window) to a
  933. convenient size for easier editing, and then shrink it when you no
  934. longer need it to be so large. 
  935.  
  936. Let's try an example. Load in any EMACS text file and split the current
  937. window into two. Now type @b{^X^(Shift-6)},
  938. @i{grow-window}@index{grow-window}. Your current window should be
  939. the lower one on the screen. Notice that it increases in size upwards
  940. by one line. If you are in the upper window, it increases in size in a
  941. downward direction. The command @b{^X^Z},
  942. @i{shrink-window}@index{shrink-window} correspondingly decreases window
  943. size by one line at a time. 
  944.  
  945. EMACS also allows you to resize a window more precisely by entering a
  946. numeric argument specifying the size of the window in lines. To resize
  947. the window this way, press the META key and enter a numeric argument
  948. (remember to keep it smaller than the number of lines on your screen
  949. display) then press @b{^XW} @i{resize-window}@index{resize-window}. 
  950. The current window will be enlarged or shrunk to the number of lines
  951. specified in the numeric argument. For example entering:
  952.  
  953. @quotation{@b[M-8 ^XW]}will resize the current window to 8 lines.
  954.  
  955. @section(Repositioning within a Window)
  956.  
  957. The cursor may be centered within a window by entering @b{M-! or M-^L}
  958. @i{redraw-display} @index{redraw-display}. This command is especially
  959. useful in allowing you to quickly locate the cursor if you are moving
  960. frequently from window to window. You can also use this command to move
  961. the line containing the cursor to any position within the current
  962. window. This is done by using a numeric argument before the command.
  963. Type @b(M-<n> M-^L) where <n> is the number of the line within the
  964. window that you wish the current line to be displayed.
  965.  
  966. The @b{^L} @i{clear-and-redraw} @index{clear-and-redraw} command is
  967. useful for 'cleaning up' a 'messy' screen that can result of using EMACS
  968. on a mainframe system and being interrupted by a system message. 
  969. @newpage
  970. @u<Chapter @value(chapter) summary>
  971.  
  972. In Chapter @value(chapter) you learned how to manipulate windows and the
  973. editing flexibility they offer. 
  974.  
  975. @begin(verbatim)
  976. @u(Key Binding    Keystroke    Effect)
  977.  
  978. open-window    @b{^X2}        Splits current window into two windows if
  979.                 space available
  980.  
  981. close-windows    @b{^X1}     Closes all windows except current window
  982.  
  983. next-window    @b{^XO}[oh]    Moves point into next (i.e. downward) window
  984.  
  985. previous-window @b{^XP}     Moves point to previous (i.e. upward) window
  986.  
  987. move-window-down @b{^X^N}    Scrolls current window down one line
  988.  
  989. move-window-up    @b{^X^P}    Scrolls current window up one line
  990.  
  991. redraw-display    @b{M !} or    Window is moved so line with point
  992.         @b{M ^L}    (with cursor) is at center of window
  993.  
  994. grow-window    @b{M-X ^}    Current window is enlarged by one
  995.                 line and nearest window is shrunk by 
  996.                 one line
  997.  
  998. shrink-window    @b{^X^Z}    Current window is shrunk by one line
  999.                 and nearest window is enlarged by one line
  1000.  
  1001. clear-and-redraw @b{^L}     Screen is blanked and redrawn. Keeps
  1002.                 screen updates in sync with your commands
  1003.  
  1004. scroll-next-up    @b{M-^Z}    Scrolls next window up by one line
  1005.  
  1006. scroll-next-down @b{M-^V}    Scrolls next window down by one line
  1007.  
  1008. delete-window    @b{^X0}     Deletes current window
  1009.  
  1010. delete-other-windows @b{^X1}    Deletes all but current window
  1011.  
  1012. resize-window    @b{^X^W}    Resizes window to a given numeric argument
  1013. @end(verbatim)
  1014. @chapter(Using a Mouse)
  1015.  
  1016.     On computers equipped with a mouse@index(mouse), the mouse can
  1017. usually be used to make editing easier. If your computer has a mouse,
  1018. let's try using it. Start MicroEMACS by typing:
  1019.  
  1020.     emacs publish.txt
  1021.  
  1022.     This brings EMACS up and allows it to edit the file from the
  1023. last chapter. If the function key window is visible on the screen,
  1024. press the F5 key to cause it to disappear. Now use the @b(^X2)
  1025. @i(split-current-window) command to split the screen into two windows. 
  1026. Next use the @b(^X^F) @i(find-file) command to read in the @b(fang.txt)
  1027. file. Now your screen should have two windows looking into two
  1028. different files.
  1029.  
  1030.     Grab the mouse and move it around. On the screen an arrow, or
  1031. block of color appears. This is called the mouse cursor @index(mouse
  1032. cursor) and can be positioned on any character on the screen. On some
  1033. computers, positioning the mouse cursor in the extreme upper right or
  1034. left corner may bring down menus which allow you to access that
  1035. computers utilities, sometimes called @b(Desk Accessories) @index(desk
  1036. accessories).
  1037.  
  1038. @section(Moving around with the mouse)
  1039.  
  1040.     Using the mouse button (or the left button if the mouse has more
  1041. than one), position the mouse over some character in the current window. 
  1042. Click the mouse button once. The @b(point) will move to where the mouse
  1043. cursor is. If you place the mouse cursor past the end of a line, the
  1044. point will move to the end of that line.
  1045.  
  1046.     Move the mouse cursor into the other window and click on one of
  1047. the characters there. MicroEMACS will automatically make this window
  1048. the current window (notice that the mode line changes) and position the
  1049. point to the mouse cursor. This makes it very easy to use the mouse to
  1050. switch to a different window quickly.
  1051.  
  1052. @section(Dragging around)
  1053.  
  1054.     Besides just using the mouse to move around on the screen, you
  1055. can use the same button to move text. Move the mouse cursor to a
  1056. character in one of the windows, and click down... but don't let the
  1057. button up yet!    The point will move to where the mouse cursor is. Now
  1058. move the mouse cursor up or down on the screen, and release the button.
  1059. The point will again move to where the mouse cursor is, but this time
  1060. it will bring the text under it along for the ride. This is called
  1061. @b(dragging)@index(dragging), and is how you can make the text appear
  1062. just where you want it to. If you try to drag text out of the current
  1063. window, EMACS will ignore your attempt and leave the point where you
  1064. first clicked down. @index(vertical scrolling)
  1065.  
  1066.     Now, click down on a word in one of the windows, and drag it
  1067. directly to the left. Release the button and watch as the entire
  1068. window slides, or @b(scrolls) @index(horizontal scrolling) to the left. 
  1069. The missing text has not been deleted, it is simply not visible, off the
  1070. left hand side of the screen. Notice the mode line has changed and now
  1071. looks like:
  1072.  
  1073. @flushleft(==== MicroEMACS 3.11 [<12] () == fang.txt == File: fang.txt =========)
  1074.  
  1075.     The number insided the brackets [] shows that the screen is now
  1076. scrolled 12 characters from the left margin.
  1077.  
  1078.     Now grab the same text again, and drag it to the right, pulling
  1079. the rest of the text back into the current window. The [<] field will
  1080. disappear, meaning that the window is no longer scrolled to the left. 
  1081. This feature is very useful for looking at wide charts and tables. 
  1082. Remember, MicroEMACS will only scroll the text in the current window
  1083. sideways if you drag it straight to the side, otherwise it will drag
  1084. the text vertically.
  1085.  
  1086.     Now, place the mouse cursor over a character on the upper mode
  1087. line, click down, move the mouse cursor up or down a few lines and let
  1088. go of the button. The mode line moves to where you dragged it, 
  1089. changing the size of the windows above and below it. If you try to
  1090. make a window with less than one line, EMACS will not let you. Dragging
  1091. the mode lines can make it very fast and easy for you to rearrange the
  1092. windows as you would like.
  1093.  
  1094.     If you have a number of different windows visible on the screen,
  1095. positioning the mouse over the mode line of one window and clicking the
  1096. right mouse button will cause that window to be deleted.
  1097.  
  1098. @section(Cut and Paste)
  1099.  
  1100.     If your mouse has two buttons, then you can use the right
  1101. button to do some other things as well. Earlier, we learned how to
  1102. define a @b(region)@index(region) by using the @b(M-<space>)
  1103. @i(set-mark) command. Now, position the mouse over at the beginning of
  1104. a region you would like to copy. Next click and hold down the right
  1105. mouse button. Notice that the point jumps to the mouse cursor and
  1106. EMACS reports "[Mark Set]". Holding the button down move the mouse to
  1107. the end of the text you wish to copy and release the mouse button. 
  1108. Emacs reports "[Region Copied]" to let you know it has copied the
  1109. region into the KILL buffer. This has done the same job as the @b(M-W)
  1110. @i(copy-region) command.
  1111.  
  1112.     If you now click the right mouse button,
  1113. without moving the mouse, the region you defined dissapear, being
  1114. @b(cut)@index(cut) from the current buffer. This works just like the
  1115. @b(^W) @i(kill-region) command.
  1116.  
  1117.     If you move the mouse away from where you cut the text, and
  1118. click the right mouse button down and up without moving the mouse, the
  1119. text in the KILL buffer gets inserted, or pasted@index(paste) into the
  1120. current buffer at the point.
  1121.  
  1122. @section(Screens)
  1123.  
  1124.     MicroEMACS can use more than one screen@index(screen) at once.
  1125. Each screen is a collection of @i(windows) along with a mode line. These
  1126. screens usually fill the terminal or computer screen on text based
  1127. systems, but can also be held in different @b(windows) on graphically
  1128. based systems like MicroSoft Windows, OS/2, the Macintosh Finder and
  1129. X-Windows. Don't be confused by the two different uses of the term
  1130. "window". Inside EMACS style editors, a @i(window) lets you view part of
  1131. a buffer. Under graphical operating systems, a @b(window) holds a
  1132. "virtual terminal", allowing you to manipulate more than one job,
  1133. editing session or program at once. Within MicroEMACS, these operating
  1134. system @b(window)s are called screens. All these screens are displayed
  1135. on your current desktop@index(desktop).
  1136.  
  1137. @section(Resizing a Screen)
  1138.  
  1139.     You can change the size of a screen. Move the mouse to the last
  1140. position of the command line. Press the left mouse button down. Holding
  1141. it, move the mouse to the place you want the new lower right corner.
  1142. Release the mouse. The desktop redraws, with your newly resized screen.
  1143. MicroEMACS will ignore size changes that can not be done, like
  1144. attempting to pull the lower left corner above the upper right corner of
  1145. the current screen.
  1146.  
  1147. @section(Moving a Screen)
  1148.  
  1149.     To change where on the desktop a screen is placed, move the
  1150. mouse to the upper right corner of the screen, press the left mouse
  1151. button down, move the mouse and release it where you want the screen
  1152. displayed. Again, MicroEMACS will ignore placements that can not be
  1153. done.
  1154.  
  1155. @section(Creating a Screen)
  1156.  
  1157.     Creating a new screen is just like moving a screen, but using
  1158. the right button. Move to the upper right of an existing screen, press
  1159. the right mouse button down, and move the mouse, releasing the button
  1160. where the new screen should appear. A new screen will have a single
  1161. @b(window), containing the contents of the current window in the copied
  1162. screen, and will have that @b(window)'s colors. The new screen will have
  1163. the copied screen's size.
  1164.  
  1165. @section(Switching to a Screen)
  1166.  
  1167.     This is simple. Any mouse command can be done in any screen by
  1168. placing the mouse on a visible part of the screen and clicking. The last
  1169. screen the mouse is used on comes to front and is the current screen.
  1170. Also, the @b(A-C) @i(cycle-screens)@index(cycle-screens) command brings
  1171. the rearmost screen to front.
  1172.  
  1173. @section(Deleting a Screen)
  1174.  
  1175.     Place the mouse on the command line of the screen you want to
  1176. delete. Click the right mouse button, the screen will disapear. If you
  1177. delete the only remaining screen on the desktop, MicroEMACS will exit.
  1178. @newpage
  1179. @heading(Chapter @value(chapter) Summary)
  1180.  
  1181. In Chapter @value(chapter), you learned how to use the mouse to move the
  1182. point, switch windows, drag text, and resize windows. You also learned
  1183. how to use the right mouse button in order to copy and delete regions
  1184. and yank them back at other places. And lastly, you learned how to
  1185. control multiple screens with the mouse.
  1186.  
  1187. @begin{verbatim}
  1188. @begin(group)
  1189. @u(Action    Mouse Directions)
  1190.  
  1191. Move Cursor    position mouse cursor over desired location
  1192.         click down and up with left button
  1193.  
  1194. Drag Text    position mouse cursor over desired text
  1195.         click left button down
  1196.         move to new screen location for text
  1197.         release mouse button
  1198.  
  1199. Resize Windows    position mouse cursor over mode line to move
  1200.         click left button down
  1201.         move to new location for mode line
  1202.         release mouse button
  1203.  
  1204. Delete Window    position mouse cursor over mode line of window to delete
  1205.         click right mouse button
  1206.  
  1207. Activate Screen    Move mouse over existing screen
  1208.         click left button down and up
  1209.  
  1210. Resize Screen    position mouse cursor over last character on message line
  1211.         click left button down
  1212.         move to new lower right corner of screen
  1213.         release mouse button
  1214.  
  1215. Copy Region    position mouse at beginning of region
  1216.         click right button down
  1217.         move to end of region
  1218.         release mouse button
  1219.  
  1220. Cut Region    position mouse at beginning of region
  1221.         click right button down
  1222.         move to end of region
  1223.         release mouse button
  1224.         click right button down and up
  1225.  
  1226. Paste Region    position mouse at place to paste
  1227.         click right button down and up
  1228.  
  1229. Create Screen    position mouse at upper left corner of existing screen
  1230.         click right button down
  1231.         move to position of new screen
  1232.         release mouse button
  1233.  
  1234. Resize Screen    position mouse at lower right corner of screen
  1235.         click left button down
  1236.         move to new lower left corner
  1237.         release mouse button
  1238.  
  1239. Move Screen    position mouse at upper right corner of screen
  1240.         click left button down
  1241.         move to new screen position
  1242.         release mouse button
  1243.  
  1244. Delete Screen    position to command line of existing screen
  1245.         click right button down
  1246.         release mouse button
  1247. @end(group)
  1248. @end(verbatim)
  1249. @chapter(Buffers)
  1250.  
  1251. @index(buffer)We have already learned a number of things about buffers.
  1252. As you will recall, they are the major internal entities in EMACS --
  1253. the place where editing commands are executed. They are characterized
  1254. by their @b<names>, their @b<modes>, and by the file with which they
  1255. are associated. Each buffer also "remembers" its @b(mark) and
  1256. @b(point). This convenient feature allows you to go to other buffers
  1257. and return to the original location in the "current" buffer. 
  1258.  
  1259. Advanced users of EMACS frequently have a number of buffers in the
  1260. computer's memory simultaneously. In the last chapter, for example, you
  1261. opened at least two buffers -- one into the text you were editing, and
  1262. the other into the EMACS on-line tutorial. If you deal with complex
  1263. text files -- say, sectioned chapters of a book, you may have five or
  1264. six buffers in the computer's memory. You could select different
  1265. buffers by simply calling up the file with @b{^X^F} @i(find-file)
  1266. @index(find-file), and let EMACS open or reopen the buffer. However,
  1267. EMACS offers fast and sophisticated buffering techniques that you will
  1268. find easy to master and much more convenient to use. 
  1269.  
  1270. Let's begin by opening three buffers. You can open any three you
  1271. choose, for example call the following files into memory: @b(fang.txt),
  1272. @b(publish.txt), and @b(emacs.tut) in the order listed here. When
  1273. you've finished this process, you'll be looking at a screen showing the
  1274. EMACS tutorial. Let's assume that you want to move to the fang.txt
  1275. buffer. Enter:
  1276.  
  1277. @b{^XX} @i(next-buffer) @index(next-buffer)
  1278.  
  1279. This command moves you to the @u<next> buffer. Because EMACS cycles
  1280. through the buffer list, which is alphabetized, you will now be in the
  1281. @b(fang.txt) buffer. Using @b(^XX) again places you in the
  1282. @b(publish.txt) buffer. @i(If you are on a machine that supports
  1283. function keys, using @b[^XX] again places you in the @b(Function Keys)
  1284. buffer). Using @b(^XX) one last time cycles you back to the beginning
  1285. of the list.
  1286.  
  1287. If you have a large number of buffers to deal with, this cycling process
  1288. may be slow and inconvenient. The command @b{^XB} @i(select-buffer)
  1289. @index(select-buffer) allows you to specify the buffer you wish to be
  1290. switched to. When the command is entered, EMACS prompts, "Use buffer:". 
  1291. Simply enter the buffer name (NOT the file name), and that buffer will
  1292. then become the current buffer. If you type in part of the file name
  1293. and press the space bar, EMACS will attempt to complete the name from
  1294. the list of current buffers. If it succeeds, it will print the rest of
  1295. the name and you can hit <NL> to switch to that buffer. If EMACS beeps
  1296. the bell, there is no such buffer, and you may continue editing the name
  1297. on the command line.
  1298.  
  1299. Multiple buffer manipulation and editing is a complex activity, and you
  1300. will probably find it very inconvenient to re-save each buffer as you
  1301. modify it. The command @b{^X^B} @i(list-buffers) @index(list-buffers)
  1302. creates a new window that gives details about all the buffers currently
  1303. known to EMACS. Buffers that have been modified are identified by the
  1304. "buffer changed" indicator (an asterisk in the second column). You can
  1305. thus quickly and easily identify buffers that need to be saved to files
  1306. before you exit EMACS. The buffer window also provides other
  1307. information -- buffer specific modes, buffer size, and buffer name are
  1308. also listed. To close this window, simply type the close-windows
  1309. command, @b{^X1}. 
  1310.  
  1311. To delete any buffer, type @b{^XK} @i(delete-buffer)
  1312. @index(delete-buffer). EMACS prompts you "Kill buffer:". Enter the
  1313. buffer name you want to delete. As this is destructive command, EMACS
  1314. will ask for confirmation if the buffer was changed and not saved. 
  1315. Answer Y(es) or N(o). As usual @b{^G} cancels the command. 
  1316.  
  1317. @newpage
  1318. @heading(Chapter @value(chapter) Summary)
  1319.  
  1320. In Chapter @value(chapter) you learned how to manipulate buffers. 
  1321.  
  1322. @begin{verbatim}
  1323. @u(Key Binding        Keystroke               Effect)
  1324. next-buffer        @b(^X^X)    Switch to the next buffer in the
  1325.                     buffer list
  1326.  
  1327. select-buffer        @b(^XB)     Switch to a particular buffer
  1328.  
  1329. list-buffers        @b(^X^B)    List all buffers
  1330.  
  1331. delete-buffer        @b(^XK)     Delete a particular buffer if it
  1332.                     is off-screen
  1333. @end(verbatim)
  1334. @chapter(Modes)
  1335.  
  1336.     EMACS allows you to change the way it works in order to
  1337. customized it to the style of editing you are using. It does this by
  1338. providing a number of different @b(modes) @index(modes). These modes
  1339. can effect either a single buffer, or any new buffer that is created. 
  1340. To add a mode to the current buffer, type @b(^XM) @i(add-mode)
  1341. @index(add-mode). EMACS will then prompt you for the name of a mode to
  1342. add. When you type in a legal mode name, and type a <NL>, EMACS will
  1343. add the mode name to the list of current mode names in the mode line of
  1344. the current buffer. 
  1345.  
  1346.     To remove an existing mode, typing the @b(^X^M) @i(delete-mode)
  1347. @index(delete-mode) will cause EMACS to prompt you for the name of a
  1348. mode to delete from the current buffer. This will remove that mode from
  1349. the mode list on the current mode line.
  1350.  
  1351.     Global modes are the modes which are inherited by any new
  1352. buffers which are created. For example, if you wish to always do string
  1353. searching with character case being significant, you would want global
  1354. mode EXACT to be set so that any new files read in inherent the EXACT
  1355. mode. Global modes are set with the @b(M-M) @i(add-global-mode)
  1356. @index(add-global-mode) command, and unset with the @b(M-^M)
  1357. @i(delete-global-mode) @index(delete-global-mode) command. Also, the
  1358. current global modes are displayed in the first line of a
  1359. @b(^X^B) @i(list-buffers) @index(list-buffers) command.
  1360.  
  1361.     On machines which are capable of displaying colors,
  1362. @index(color) the mode commands can also set the background and
  1363. foreground character colors. Using @i(add-mode) or @i(delete-mode) with
  1364. a lowercase color will set the background color in the current window. 
  1365. An uppercase color will set the foreground color in the current window. 
  1366. Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
  1367. red, green, and black. If the computer you are running on does not have
  1368. eight colors, EMACS will attempt to make some intelligent guess at what
  1369. color to use when you ask for one which is not there. 
  1370.  
  1371. @section(ASAVE mode)@index(ASAVE mode)
  1372.  
  1373.     Automatic Save mode tells EMACS to automatically write out the
  1374. current buffer to its associated file on a regular basis. Normally this
  1375. will be every 256 characters typed into the file. The environment
  1376. variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
  1377. value used to reset $ACOUNT after a save occurs. 
  1378.  
  1379. @section(CMODE mode)@index(CMODE mode)
  1380.  
  1381.     CMODE is useful to C programmers. When CMODE is active, EMACS
  1382. will try to assist the user in a number of ways. This mode is set
  1383. automatically with files that have a .c or .h extension. 
  1384.  
  1385.     The <NL> key will normally attempt to return the user to the
  1386. next line at the same level of indentation as the last non blank line,
  1387. unless the current line ends with a open brace ({) in which case the
  1388. new line will be further indented by one tab position.
  1389.  
  1390.     A close brace (}) will search for the corresponding open brace
  1391. and line up with it.
  1392.  
  1393.     A pound sign (#) with only leading white space will delete all
  1394. the white space preceding itself. This will always bring preprocessor
  1395. directives flush to the left margin.
  1396.  
  1397.     Whenever any close fence is typed, IE )]>}, if the matching open
  1398. fence is on screen in the current window, the cursor will briefly flash
  1399. to it, and then back. This makes balancing expressions, and matching
  1400. blocks much easier.
  1401.  
  1402. @section(CRYPT mode)@index(CRYPT mode)
  1403.  
  1404.     When a buffer is in CRYPT mode, @index(encryption) it is
  1405. encrypted whenever it is written to a file, and decrypted when it is
  1406. read from the file. The encryption key can be specified on the command
  1407. line with the -k switch, or with the @b(M-E) @i(set-encryption-key)
  1408. @index(set-encryption-key) command. If you attempt to read or write a
  1409. buffer in crypt mode and now key has not been set, EMACS will execute
  1410. @i(set-encryption-key) automatically, prompting you for the needed key. 
  1411. Whenever EMACS prompts you for a key, it will not echo the key to your
  1412. screen as you type it (IE make SURE you get it right when you set it
  1413. originally).
  1414.  
  1415.     The encryption algorithm used changes all characters into normal
  1416. printing characters, thus the resulting file is suitable for sending via
  1417. electronic mail. All version of MicroEMACS should be able decrypt the
  1418. resulting file regardless of what machine encrypted it. Also available
  1419. with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
  1420. the files produced by CRYPT mode in EMACS.
  1421.  
  1422. @section(EXACT mode)@index(EXACT mode)
  1423.  
  1424.     All string searches and replacements will take upper/lower case
  1425. into account. Normally the case of a string during a search or replace
  1426. is not taken into account.
  1427.  
  1428. @section(MAGIC mode)@index(MAGIC mode)
  1429.  
  1430.      In the MAGIC mode certain characters gain special meanings when
  1431. used in a search pattern. Collectively they are know as @index(regular
  1432. expressions) regular expressions, and a limited number of them are
  1433. supported in MicroEmacs. They grant greater flexibility when using the
  1434. search command. They have no affect on the incremental search
  1435. command. 
  1436.  
  1437.      The symbols that have special meaning in MAGIC mode are
  1438. ^, $, ., &, ?, *, +, [ (and ], used with it), and \.
  1439.  
  1440.      The characters ^ and $ fix the search pattern to the beginning and
  1441. end of line, respectively. The ^ character must appear at the beginning
  1442. of the search string, and the $ must appear at the end, otherwise they
  1443. loose their meaning and are treated just like any other character. For
  1444. example, in MAGIC mode, searching for the pattern "t$" would put the
  1445. cursor at the end of any line that ended with the letter 't'. Note that
  1446. this is different than searching for "t<NL>", that is, 't' followed by a
  1447. newline character. The character $ (and ^, for that matter) matches a
  1448. position, not a character, so the cursor remains at the end of the line. 
  1449. But a newline is a character that must be matched like any other
  1450. character, which means that the cursor is placed just after it - on the
  1451. beginning of the next line. 
  1452.  
  1453.      The character . has a very simple meaning -- it matches any single
  1454. character, except the newline. Thus a search for "bad.er" could match
  1455. "badger", "badder" (slang), or up to the 'r' of "bad error". 
  1456.  
  1457.      The character [ indicates the beginning of a character class. It
  1458. is similar to the 'any' character ., but you get to choose which
  1459. characters you want to match. The character class is ended with the
  1460. character ]. So, while a search for "ba.e" will match "bane", "bade",
  1461. "bale", "bate", et cetera, you can limit it to matching "babe" and
  1462. "bake" by searching for "ba[bk]e". Only one of the characters inside
  1463. the [ and ] will match a character. If in fact you want to match any
  1464. character except those in the character class, you can put a ^ as the
  1465. first character. It must be the first character of the class, or else
  1466. it has no special meaning. So, a search for [^aeiou] will match any
  1467. character except a vowel, but a search for [aeiou^] will match any vowel
  1468. or a ^.
  1469.  
  1470. If you have many characters in order, that you want to put in the
  1471. character class, you may use a dash (-) as a range character. So, [a-z]
  1472. will match any letter (or any lower case letter if EXACT mode is on),
  1473. and [0-9a-f] will match any digit or any letter 'a' through 'f', which
  1474. happen to be the characters for hexadecimal numbers. If the dash is at
  1475. the beginning or end of a character class, it is taken to be just a
  1476. dash. 
  1477.  
  1478.      The ? character indicates that the preceding character is optional.
  1479. The character may or may not appear in the matched string. For example,
  1480. a search for "bea?st" would match both "beast" and "best". If there is
  1481. no preceding charcter for ? to modify, it is treated as a normal
  1482. question mark character.
  1483.  
  1484.      The * character is known as closure, and means that zero or more
  1485. of the preceding character will match. If there is no preceding character,
  1486.  * has no special meaning and is treated as a normal asterisk. The
  1487. closure symbol will also have no special meaning if it is preceded by
  1488. the beginning of line symbol ^, since it represents a position, not a
  1489. character. 
  1490.  
  1491.      The notion of zero or more characters is important. If, for
  1492. example, your cursor was on the line
  1493.  
  1494. @quotation(This line is missing two vowels.)
  1495.  
  1496. and a search was made for "a*", the cursor would not move, because it is
  1497. guaranteed to match no letter 'a' , which satisfies the search
  1498. conditions. If you wanted to search for one or more of the letter 'a',
  1499. you could search for "aa*", which would match the letter a, then zero or
  1500. more of them. A better way, however, is to use the + character.
  1501.  
  1502.      The + character behaves in every respect like the * character, with
  1503. the exception that its minimum match range is one, not zero. Thus the
  1504. pattern "a+" is identical to "aa*".
  1505.  
  1506.      Under older versions of MicroEMACS, the closure symbols would not
  1507. operate on newlines. The current versions no longer have this restriction.
  1508.  
  1509.      The \ is the escape character. With the exception of groups, which
  1510. are explained below, the \ is used at those times when you want to be in
  1511. MAGIC mode, but also want a regular expression character to be just a
  1512. character. It turns off the special meaning of the character. So a
  1513. search for "it\." will search for a line with "it.", and not "it"
  1514. followed by any other character. Or, a search for "TEST\*+" would match
  1515. the word TEST followed by one or more asterisks. The escape character
  1516. will also let you put ^, -, or ] inside a character class with no
  1517. special side effects.
  1518.  
  1519.      The character pair \( represent the start of a group in a search
  1520. string. A group is ended by the character pair \). All characters
  1521. matched within the \( and \) are part of a numbered group, and may be
  1522. referenced with the &GROUP function, or with a \ followed by the group
  1523. number in the replacement string of @i(replace-string)
  1524. @index(replace-string) or the
  1525. @i(query-replace-string) @index(query-replace-string) commands. For
  1526. example, a search for "INDEX\([0-9]+\)", to be replaced by "getind(\1)"
  1527. would change
  1528.  
  1529. @quotation(indptr := INDEX42) to @quotation(indptr := getind(42)).
  1530.  
  1531.      There may be up to nine groups. Groups may be nested.
  1532.  
  1533.      The character & (ampersand) is a replacement character, and
  1534. represents all the characters which were matched by the search string. 
  1535. When used in the @b[M-R] @i(replace-string) @index(replace-string) or
  1536. the @b[M-^R]
  1537. @i(query-replace-string) @index(query-replace-string) commands, the &
  1538. will be substituted for the search string. 
  1539.  
  1540. @section(OVER mode)@index(OVER mode)
  1541.  
  1542.     OVER mode stands for overwrite mode. When in this mode, when
  1543. characters are typed, instead of simply inserting them into the file,
  1544. EMACS will attempt to overwrite an existing character past the point. 
  1545. This is very useful for adjusting tables and diagrams. 
  1546.  
  1547. @section(WRAP mode)@index(WRAP mode)
  1548.  
  1549.     Wrap mode is used when typing in continuous text. Whenever the
  1550. cursor is past the currently set fill column @index(fill column) (72 by
  1551. default) and the user types a space or a <NL>, the last word of the line
  1552. is brought down to the beginning of the next line. Using this, one just
  1553. types a continuous stream of words and EMACS automatically inserts <NL>s
  1554. at appropriate places.
  1555.  
  1556. @center(NOTE to programmers:)
  1557.  
  1558. @quotation{The EMACS variable $wraphook contains the name of the
  1559. function which executes when EMACS detects it is time to wrap. This is
  1560. set to the function @i(wrap-word) @index(wrap-word) by default, but can
  1561. be changed to activate different functions and macros at wrap time.}
  1562.  
  1563. @section(VIEW mode)@index(VIEW mode)
  1564.  
  1565.     VIEW mode disables all commands which can change the current
  1566. buffer. EMACS will display an error message and ring the bell every
  1567. time you attempt to change a buffer in VIEW mode.
  1568. @newpage
  1569. @heading(Chapter @value(chapter) Summary)
  1570.  
  1571. In Chapter @value(chapter) you learned about modes and their effects.
  1572.  
  1573. @begin{verbatim}
  1574. @u(Key Binding        Keystroke               Effect)
  1575. add-mode        @b(^XM)     Add a mode to the current buffer
  1576.  
  1577. delete-mode        @b(^X^M)    Delete a mode from the current buffer
  1578.  
  1579. add-global-mode     @b(M-M)     Add a global mode to the
  1580.                     current buffer
  1581.  
  1582. delete-global-mode    @b(M-^M)    Delete a global mode from the
  1583.                     current buffer
  1584. @end(verbatim)
  1585. @chapter(Files)
  1586.  
  1587. A file is simply a collection of related data. In EMACS we are dealing
  1588. with text files -- named collections of text residing on a disk (or some
  1589. other storage medium). You will recall that the major entities EMACS
  1590. deals with are buffers. Disk-based versions of files are only active in
  1591. EMACS when you are reading into or writing out of buffers. As we have
  1592. already seen, buffers and physical files are linked by associated
  1593. file names. For example, the buffer "ch7.txt" which is associated with
  1594. the physical disk file "ch7.txt." You will notice that the file is
  1595. usually specified by the drive name or (in the case of a hard drive) a
  1596. path. Thus you can specify full file names in EMACS,
  1597.  
  1598. e.g. disk:\directories\filename.extension
  1599.  
  1600. If you do not specify a disk and directories, the default disk and the
  1601. current directory is used.
  1602.  
  1603. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  1604. edits will be lost when you leave EMACS (although EMACS will prompt you
  1605. when you are about to lose edits by exiting). In addition, EMACS does
  1606. not protect your disk-based files from overwriting when it saves files. 
  1607. Thus when you instruct EMACS to save a file to disk, it will create a
  1608. file if the specified file doesn't exist, or it will overwrite the
  1609. previously saved version of the file thus replacing it. Your old
  1610. version is gone forever. 
  1611.  
  1612. If you are at all unsure about your edits, or if (for any reason) you
  1613. wish to keep previous versions of a file, you can change the name of
  1614. the associated file with the command @b{^XN}
  1615. @i(change-file-name)@index(change-file-name). When this file is saved
  1616. to disk, EMACS will create a new physical file under the new name. The
  1617. earlier disk file will be preserved.
  1618.  
  1619. For example, let's load the file @b{fang.txt} into EMACS. Now, type
  1620. @b{^XN}. The EMACS command line prompts "Name:". Enter a new name
  1621. for the file -- say @b(new.txt) and press <NL>. The file will be
  1622. saved under the new filename, and your disk directory will show both
  1623. @b(fang.txt) and @b(new.txt).
  1624.  
  1625. An alternative method is to write the file directly to disk under a new
  1626. filename. Let's pull our "publish.txt" file into EMACS. To write this
  1627. file under another filename, type @b{^X^W}
  1628. @i(write-file)@index(writefile). EMACS will prompt you "write file:". 
  1629. Enter an alternate filename -- @b{desktop.txt}. Your file will be
  1630. saved as the physical file "desktop.txt".
  1631.  
  1632. Note that in the examples above, although you have changed the names of
  1633. the related files, the buffer names remain the same. However, when you
  1634. pull the physical file back into EMACS, you will find that the buffer
  1635. name now relates to the filename.
  1636.  
  1637. For example -- You are working with a buffer "fang.txt" with the related
  1638. file "fang.txt". You change the name of the file to "new.txt". EMACS
  1639. now shows you working with the buffer "fang.txt" and the related file
  1640. "new.txt". Now pull the file "new.txt" into EMACS. Notice that the
  1641. buffer name has now changed to "new.txt". 
  1642.  
  1643. If for any reason a conflict of buffer names occurs,(if you have files
  1644. of the same name on different drives for example) EMACS will prompt
  1645. you "use buffer:". Enter an alternative buffer name if you need to. 
  1646.  
  1647. For a list of file related commands (including some we`ve already
  1648. seen), see the summary page.
  1649. @newpage
  1650. @heading(Chapter @value(chapter) Summary)
  1651.  
  1652. In Chapter @value(chapter) you learned some of the more advanced
  1653. concepts of file naming and manipulation. The relationship between
  1654. files and buffers was discussed in some detail. 
  1655.  
  1656. @begin(verbatim)
  1657. @u(Key Binding    Keystroke    Effect)
  1658.  
  1659. save-file    @b{^X^S}    Saves contents of current buffer with
  1660.                 associated filename on default disk/
  1661.                 directory (if not specified)
  1662.  
  1663. write-file    @b{^X^W}    Current buffer contents will be
  1664.                 saved under specified name 
  1665.  
  1666. change-file-name
  1667.         @b{^XN}     The associated filename is changed
  1668.                 (or associated if not previously
  1669.                 specified) as specified
  1670.  
  1671. find-file    @b{^X^F}    Reads specified file into buffer and 
  1672.                 switches you to that buffer, or switches
  1673.                 to buffer in which the file has previously
  1674.                 been read
  1675.  
  1676. read-file    @b{^X^R}    Reads file into buffer thus overwriting
  1677.                 buffer contents. If file has already
  1678.                 been read into another buffer, you will
  1679.                 be switched to it
  1680.  
  1681. view-file    @b{^X^V}    The same as read-file except the buffer
  1682.                 is automatically put into VIEW mode thus 
  1683.                 preventing any changes from being made
  1684. @end{verbatim}
  1685. @chapter(Screen Formatting)
  1686.  
  1687. @section<Wrapping Text>
  1688.  
  1689. As we learned in the introduction, EMACS is not a word processor, but an
  1690. editor. Some simple formatting options are available however, although
  1691. in most cases they will not affect the appearance of the finished text
  1692. @index(wrapping text) when it is run through the formatter. We have
  1693. already encountered WRAP mode which wraps lines longer than a certain
  1694. length (default is 75 characters). You will recall that WRAP is enabled
  1695. by entering @b{^XM} and responding to the command line prompt with
  1696. @b{wrap}. 
  1697.  
  1698. You can also set your own wrap margin with the command @b{^XF}
  1699. @i(set-fill-column) @index(set-fill-column). Notice EMACS responds
  1700. "[Fill column is 1]." Now try typing some text. You'll notice some very
  1701. strange things happening -- your text wraps at every word!! This effect
  1702. occurs because the set wrap margin command must be preceded by a
  1703. numeric argument or EMACS sets it to the first column. Thus any text
  1704. you type that extends past the first column will wrap at the most
  1705. convenient line break. 
  1706.  
  1707. To reset the wrap column to 72 characters, press the @b{<META>} key and
  1708. enter 72. EMACS will respond "Arg: 72". Now press @b<^XF>. EMACS
  1709. will respond "[Fill column is 72]". Your text will again wrap at the
  1710. margin you've been using up to this point.
  1711.  
  1712. @section<Reformatting Paragraphs>
  1713.  
  1714. After an intensive editing session, you may find that you have
  1715. paragraphs containing lines of differing lengths. Although this
  1716. disparity will not affect the formatted text, aesthetic and technical
  1717. concerns may make it desirable to have consistent paragraph blocks on
  1718. the screen. If you are in WRAP mode, you can reformat a paragraph with
  1719. the command @b{M-Q} @i(fill-paragraph) @index(fill-paragraph). This
  1720. command 'fills' the current paragraph reformatting it so all the lines
  1721. are filled and wrap logically.
  1722.  
  1723. @section<Changing Case>
  1724.  
  1725. There may be occasions when you find it necessary to change the case of
  1726. the text you've entered. EMACS allows you to change the case of even
  1727. large amounts of text with ease. Let's try and convert a few of the
  1728. office traditionalists to the joy of word processing. Type in the
  1729. following text:
  1730.  
  1731. @quotation{Throw away your typewriter and learn to use a word processor. 
  1732. Word processing is relatively easy to learn and will increase your
  1733. productivity enormously. Enter the Computer Age and find out just how
  1734. much fun it can be!!}
  1735.  
  1736. Let's give it a little more impact by capitalizing the first four words. 
  1737. The first step is to define the region of text just as you would if you
  1738. were doing an extensive deletion. Set the mark at the beginning of the
  1739. paragraph with @b{M-<space>} @i(set-mark) and move the cursor to the
  1740. space beyond "typewriter." Now enter @b{^X^U} @i(case-region-upper). 
  1741. Your text should now look like this:
  1742.  
  1743. @quotation{THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
  1744. Word processing is relatively easy to learn and will increase your
  1745. productivity enormously. Enter the Computer Age and find out just how
  1746. much fun it can be!!}
  1747.  
  1748. If you want to change the text back to lower case, type @b{^X^L}
  1749. @i(case-region-lower) @index(case-region-lower). You can also
  1750. capitalize individual words. To capitalize the word "fun", position the
  1751. cursor in front of the word and type @b{M-U} @i(case-word-upper)
  1752. @index(case-word-upper). The word is now capitalized. To change it
  1753. ck to lower case, move the cursor back to the beginning of the word
  1754. and type @b{M-L} @i(case-word-lower) @index(case-word-lower). 
  1755.  
  1756. You may also capitalize individual letters in EMACS. The command
  1757. @b{M-C} @i(case-word-capitalize) @index(case-word-capitalize)
  1758. capitalizes the first letter after the point. This command would
  1759. normally be issued with the cursor positioned in front of the first
  1760. letter of the word you wish to capitalize. If you issue it in the
  1761. middle of a word, you can end up with some strAnge looking text. 
  1762.  
  1763. @section<Tabs>
  1764.  
  1765. Unless your formatter is instructed to take screen text literally (as
  1766. MicroSCRIBE does in the 'verbatim' environment for example), tabs in
  1767. EMACS generally affect screen formatting only. 
  1768.  
  1769. When EMACS is first started, it sets the default tab to every eighth
  1770. column. As long as you stay with default, every time you press the tab
  1771. key a tab character, @b(^I) is inserted. This character, like other
  1772. control characters, is invisible -- but it makes a subtle and
  1773. significant difference to your file and editing. 
  1774.  
  1775. For example, in default mode, press the tab key and then type the word
  1776. @b{Test}. "Test" appears at the eighth column. Move your cursor to the
  1777. beginning of the word and delete the backward character. The word
  1778. doesn't move back just one character, but flushes to the left margin. 
  1779. The reason for this behavior is easily explained. In tab default, EMACS
  1780. inserts a 'real' tab character when you press the tab key. This
  1781. character is inserted at the default position, but NO SPACES are
  1782. inserted between the tab character and the margin (or previous tab
  1783. character). As you will recall, EMACS only recognizes characters (such
  1784. as spaces or letters) and thus when the tab character is removed, the
  1785. text beyond the tab is flushed back to the margin or previous tab mark.
  1786.  
  1787. This situation changes if you alter the default configuration. The
  1788. default value may be changed by entering a numeric argument before
  1789. pressing the tab key. As we saw earlier, pressing the @b{META} key and
  1790. entering a number allows you to specify how EMACS performs a given
  1791. action. In this case, let's specify an argument of 10 and hit the tab
  1792. key. 
  1793.  
  1794. Now hit the tab key again and type @b{Test}. Notice the word now
  1795. appears at the tenth column. Now move to the beginning of the word and
  1796. delete the backward character. "Test" moves back by one character. 
  1797.  
  1798. EMACS behaves differently in these circumstances because the @b(^I)
  1799. @index(tab handling) @i(handle-tab) @index(handle-tab) function deals
  1800. with tabbing in two distinct ways. In default conditions, or if the
  1801. numeric argument of zero is used, @i(handle-tab) inserts a true tab
  1802. character. If, however, a non-zero numeric argument is specified,
  1803. @i(handle-tab) inserts the correct number of spaces needed to position
  1804. the cursor at the next specified tab position. It does NOT insert the
  1805. single tab character and hence any editing functions should take account
  1806. of the number of spaces between tabbed columns.
  1807.  
  1808. The distance which a true tab character moves the cursor can be
  1809. modified by changing the value of the $hardtab environment variable. 
  1810. Initially set to 8, this will determine how far each tab stop is placed
  1811. from the previous one. (Use the ^XA @i(set)@index(set) command to set
  1812. the value of an environment variable).
  1813.  
  1814. Many times you would like to take text which has been created using
  1815. the tab character and change it to use just spaces. The command
  1816. @b(^X^D) @i(detab-region) @index(detab-region) changes any tabs 
  1817. in the currently selected region into the right number of spaces so
  1818. the text does not change. This is very useful for times when the file
  1819. must be printed or transferred to a machine which does not understand
  1820. tabs. 
  1821.  
  1822. Also, the inverse command, @b(^X^E) @i(entab-region)
  1823. @index(entab-region) changes multiple spaces to tabs where possible. 
  1824. This is a good way to shrink the size of large documents, especially
  1825. with data tables. Both of these commands can take a numeric argument
  1826. which will be interpreted as the number of lines to en/detab. 
  1827.  
  1828. Another function, related to those above is provided for by the @b(^X^T)
  1829. @i(trim-region)@index(trim-region) when invoked will delete any trailing
  1830. white space in the selected region. A preceding numeric argument will do
  1831. this for that number of lines.
  1832. @newpage
  1833. @heading(Chapter @value(chapter) Summary)
  1834.  
  1835. In Chapter @value(chapter) introduced some of the formatting features of
  1836. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  1837. some detail. The commands in the following table were covered in the
  1838. chapter. 
  1839.  
  1840. @begin{verbatim}
  1841.  
  1842. @u(Key Binding        Keystroke            Effect)
  1843. add-mode/WRAP        @b{^XM}[WRAP]    Add wrap mode to current buffer
  1844.  
  1845. delete-mode/WRAP    @b{^X^M}[WRAP]    Remove wrap mode from current buffer
  1846.  
  1847. set-fill-column     @b{^XF}     Set fill column to given numeric
  1848.                     argument  
  1849.  
  1850. fill-paragraph        @b{M-Q}     Logically reformats the current
  1851.                     paragraph
  1852.  
  1853. case-word-upper     @b{M-U}     Text from point to end of the
  1854.                     current word is changed to uppercase
  1855.  
  1856. case-word-lower     @b{M-L}     Text from point to end of the 
  1857.                     current word is changed to lowercase
  1858.  
  1859. case-word-capitalize    @b{M-C}     First word (or letter) after the
  1860.                     point is capitalized
  1861.  
  1862. case-region-upper    @b{^X^U}    The current region is uppercased
  1863.  
  1864. case-region-lower    @b{^X^L}    The current region is lowercased
  1865.  
  1866. handle-tab        @b{^I}        Tab interval is set to the given
  1867.                     numeric argument
  1868.  
  1869. entab-region        @b(^X^E)    Changes multiple spaces to tabs
  1870.                     characters where possible
  1871.  
  1872. detab-region        @b(^X^D)    Changes tab characters to the
  1873.                     appropriate number of spaces
  1874.  
  1875. trim-region        @b(^X^T)    Trims white space from the end
  1876.                     of the lines in the current region
  1877. @end{verbatim}
  1878. @chapter(Access to the Outside World)
  1879.  
  1880.     EMACS has the ability to interface to other programs and the
  1881. environment of the computer outside of itself. It does this through a
  1882. series of commands that allow it to talk to the computer's @b(command
  1883. processor) @index(command processor) or @b(shell) @index(shell). Just
  1884. what this is varies between different computers. Under MSDOS or PCDOS
  1885. this is the @b(command.com) @index(command.com) command processor. 
  1886. Under UNIX it is the @b(csh) @index(cshell) shell. On the Atari ST is
  1887. can be the Mark Williams @b(MSH) or the Beckmeyer shell. In each case,
  1888. it is the part of the computer's operating system that is responsible
  1889. for determining what programs are executed, and when. 
  1890.  
  1891.     The @b(^X!) @i(shell-command) @index(shell-command) command
  1892. prompts the user for a command line to send out to the shell to execute.
  1893. This can be very useful for doing file listings and changing the
  1894. current directory or folder. EMACS gives control to the shell, which
  1895. executed the command, and then types @b([END]) and waits for the user to
  1896. type a character before redrawing the screen and resuming editing. If
  1897. the @i(shell-command) command is used from within the macro language,
  1898. there is no pause.
  1899.  
  1900.     @b(^X@@) @i(pipe-command) @index(pipe-command) command allows
  1901. EMACS to execute a shell command, and if the particular computer allows
  1902. it, send the results into a buffer which is automatically displayed on
  1903. the screen. The resulting buffer, called "command" can be manipulated
  1904. just like any other editing buffer. Text can be copied out of it or
  1905. rearranged as needed. This buffer is originally created in @b(VIEW) mode,
  1906. so remember to @b(^X^Mview<NL>) in order to change it.
  1907.  
  1908.     Many computers provide tools which will allow you to @b(filter)
  1909. @index(filter) text, making some modifications to it along the way. A
  1910. very common tool is the @b(SORT) program which accepts a file, sorts
  1911. it, and prints the result out. The EMACS command, @b(^X#)
  1912. @i(filter-buffer)@index(filter-buffer) sends the current buffer through
  1913. such a filter. Therefore, if you wished to sort the current buffer on
  1914. a system which supplied a sort filter, you would type @b(^X#sort<NL>). 
  1915. You can also create your own filters by writing programs and utilities
  1916. which read text from the keyboard and display the results. EMACS will
  1917. use any of these which would normally be available from the current
  1918. shell.
  1919.  
  1920.     If you would like to execute another program directly, without
  1921. the overhead of an intervening shell, you can use the @b(^X$)
  1922. @i(execute-program) @index(execute-program) command. It will prompt you
  1923. for an external program and its arguments and attempt to execute it. 
  1924. Like when EMACS looks for command files, EMACS will look first in the
  1925. HOME directory, then down the execute PATH, and finally in the current
  1926. directory for the named program. On some systems, it will automatically
  1927. tack the proper extension on the file name to indicate it is a program.
  1928. On some systems that don't support this function, @b(^X$) will be
  1929. equivalent to @b(^X!) @i(shell-command).
  1930.  
  1931.     Sometimes, you would like to get back to the shell and execute
  1932. other commands, without losing the current contents of EMACS. The
  1933. @b(^XC) @i(i-shell) @index(i-shell) command shells out of EMACS,
  1934. leaving EMACS in the computer and executing another command shell. Most
  1935. systems would allow you to return to EMACS with the "exit" command. 
  1936.  
  1937.     @i(On some systems, mainly advanced versions of UNIX, you can
  1938. direct EMACS to "go into the background" with the @b(^XD) suspend-emacs
  1939. @index(suspend-emacs) command. This places EMACS in the background
  1940. returning you to the original command shell. EMACS can then be returned
  1941. to at any time with the "fg" foreground command.)
  1942. @newpage
  1943. @heading(Chapter @value(chapter) Summary)
  1944.  
  1945. In Chapter @value(chapter) introduced different ways to access the
  1946. computers shell or command processor from within EMACS. The commands
  1947. in the following table were covered in the chapter. 
  1948.  
  1949. @begin{verbatim}
  1950.  
  1951. @u(Key Binding        Keystroke            Effect)
  1952. execute-program     @b(^X$)     Execute an external program
  1953.                     directly
  1954.  
  1955. filter-command        @b(^X#)     Send the current buffer through
  1956.                     a shell filter
  1957.  
  1958. i-shell         @b(^XC)     Escape to a new shell
  1959.  
  1960. pipe-command        @b(^X@@)    Send the results of an external
  1961.                     shell command to a buffer
  1962.  
  1963. shell-command        @b(^X!)     Execute one shell command
  1964.  
  1965. suspend-emacs        @b(^XD)     Place EMACS in the background
  1966.                     (some UNIX systems only)
  1967. @end{verbatim}
  1968. @chapter(Keyboard Macros)
  1969.  
  1970.     In many applications, you may need to repeat a series of
  1971. characters or commands frequently. For example, a paper may require the
  1972. frequent repetition of a complex formula or a long name. You may also
  1973. have a series of EMACS commands that you invoke frequently. Keyboard
  1974. macros offer a convenient method of recording and repeating these
  1975. commands. 
  1976.  
  1977.     Imagine, for example, you are writing a scholarly paper on
  1978. @i{Asplenium platyneuron}, the spleenwort fern. Even the dedicated
  1979. botanist would probably find it a task bordering on the agonizing to
  1980. type @i{Asplenium platyneuron} frequently throughout the paper. An
  1981. alternative method is 'record' the name in a keyboard macro. Try it
  1982. yourself.
  1983.  
  1984.     The command @b{^X(} @i(begin-macro) @index(begin-macro) starts
  1985. recording the all the keystrokes and commands you input. After you've
  1986. typed it, enter @b{Asplenium platyneuron}. To stop recording, type
  1987. @b{^X)} @i(end-macro) @index(end-macro). EMACS has stored all the
  1988. keystrokes between the two commands. To repeat the name you've stored,
  1989. just enter @b{^XE} @i(execute-macro) @index(execute-macro), and the
  1990. name "Asplenium platyneuron" appears. You can repeat this action as
  1991. often as you want, and of course as with any EMACS command, you may
  1992. precede it with a numerical argument to repeat it many times.
  1993.  
  1994.     Because EMACS records keystrokes, you may freely intermix
  1995. commands and text. Unfortunately, you can only store one macro at a
  1996. time. Thus, if you begin to record another macro, the previously defined
  1997. macro is lost. Be careful to ensure that you've finished with one macro
  1998. before defining another. If you have a series of commands that you would
  1999. like to 'record' for future use, use the procedure facilities detailed
  2000. in chapter @ref(macros).
  2001. @newpage
  2002. @heading(Chapter @value(chapter) Summary)
  2003.  
  2004. Chapter @value(chapter) covered keyboard macros. You learned how to
  2005. record keystrokes and how to repeat the stored sequence. 
  2006.  
  2007. @begin{verbatim}
  2008. @u(Key Binding        Keystroke        Effect)
  2009.  
  2010. start-macro        @b{^X(}     Starts recording all keyboard input
  2011.  
  2012. end-macro        @b{^X)}     Stops recording keystrokes for macro
  2013.  
  2014. execute-macro        @b{^XE}     Entire sequence of recorded
  2015.                     keystrokes is replayed
  2016. @end{verbatim}
  2017. @chapter(MicroEMACS Procedures)
  2018. @tag(macros)
  2019.     Procedures, or macros, are programs that are used to customize
  2020. the editor and to perform complicated editing tasks. They may be stored
  2021. in files or buffers and may be executed using an appropriate command, or
  2022. bound to a particular keystroke. Portions of the standard start-up file
  2023. are implemented via procedures, as well as the built in help system. The
  2024. @b(M-^E) @i(run) @index(run) command causes named procedures to be executed.
  2025. The @i(execute-file) @index(execute-file) command allows you to execute
  2026. a procedure stored in a disk file, and the @i(execute-buffer)
  2027. @index(execute-buffer) command allows you to execute a procedure stored
  2028. in a buffer. Procedures are stored for easy execution by executing files
  2029. that contain the store-procedure command. 
  2030.  
  2031.     In a command file, the @i(store-procedure)
  2032. @index(store-procedure) command takes a string argument which is the
  2033. name of a procedure to store. These procedures than can be executed with
  2034. the @b(M-^E) @i(run) @index(run) command. Also, giving the name of a
  2035. stored procedure within another procedure will executed that named
  2036. procedure as if it had been called up with the @i(run) command.
  2037.  
  2038.     Some fairly length examples of MicroEMACS procedures can be seen
  2039. by examining the standard files that come with EMACS. The @b(emacs.rc)
  2040. @index(emacs.rc) file (called @b[.emacsrc]@index[.emacsrc]) under UNIX)
  2041. is the MicroEMACS command file which is executed when EMACS is normally
  2042. run. It contains a number of different stored procedures along with the
  2043. lines to setup and display the Function key window @index(function key
  2044. window) and to call up other procedures and command files using function
  2045. keys.
  2046.  
  2047.     There are many different aspects to the language within
  2048. MicroEMACS. Editor commands are the various commands that manipulate
  2049. text, buffers, windows, et cetera, within the editor. Directives are
  2050. commands which control what lines get executed within a macro. Also
  2051. there are various types of variables. Environmental variables both
  2052. control and report on different aspects of the editor. User variables
  2053. hold string values which may be changed and inspected. Buffer variables
  2054. allow text to be placed into variables. Interactive variable allow the
  2055. program to prompt the user for information. Functions can be used to
  2056. manipulate all these variables. 
  2057.  
  2058. @section(Constants)
  2059.  
  2060.     All constants and variable contents in EMACS are stored as
  2061. strings of characters. Numbers are stored digit by digit as characters.
  2062. This allows EMACS to be "typeless", not having different variables types
  2063. be legal in different contexts. This has the disadvantage of forcing the
  2064. user to be more careful about the context of the statements variables
  2065. are placed in, but in turn gives them more flexibility in where they
  2066. can place variables. Needless to say, this also allows EMACS's expression
  2067. evaluator to be both concise and quick.
  2068.  
  2069.     Wherever statements need to have arguments, it is legal to place
  2070. constants. A constant is a double quote character, followed by a string
  2071. of characters, and terminated by another double quote character. To
  2072. represent various special characters within a constant, the tilde (~)
  2073. character is used. The character following the tilde is interpreted
  2074. according to the following table:
  2075.  
  2076. @begin(verbatim)
  2077. @u(Sequence    Result)
  2078. ~n            EMACS newline character (breaks lines)
  2079. ~r        ^M    carriage return
  2080. ~l        ^J    linefeed
  2081. ~~        ~    tilde
  2082. ~b        ^H    backspace
  2083. ~f        ^L    formfeed
  2084. ~t        ^I    tab
  2085. ~"        "    quote
  2086. @end(verbatim)
  2087.  
  2088.     Any character not in the table which follows a tilde will be
  2089. passed unmodified. This action is similar to the @b(^Q)
  2090. @i(quote-character) command available from the keyboard. 
  2091.  
  2092.     EMACS may use different characters for line terminators on
  2093. different computers. The ~n combination will always get the proper line
  2094. terminating sequence for the current system.
  2095.  
  2096.     The double quotes around constants are not needed if the
  2097. constant contains no internal white space and it also does not happen to
  2098. meet the rules for any other EMACS commands, directives, variables, or
  2099. functions. This is reasonable useful for numeric constants.
  2100.  
  2101. @section(Variables)
  2102.  
  2103.     Variables in MicroEMACS procedures can be used to return values
  2104. within expressions, as repeat counts to editing commands, or as text to
  2105. be inserted into buffers and messages. The value of these variables is
  2106. set using the set @b(^XA) command. For example, to set the current fill
  2107. column to 64 characters, the following macro line would be used:
  2108.  
  2109.     set $fillcol 64
  2110.  
  2111.     or to have the contents of @b(%name) inserted at the point in the
  2112. current buffer, the command to use would be:
  2113.  
  2114.     insert-string %name
  2115.  
  2116. @subsection(Environmental Variables)
  2117.  
  2118.     "What good is a quote if you can't change it?"
  2119.  
  2120.     These variables are used to change different aspects of the way
  2121. the editor works. Also they will return the current settings if used as
  2122. part of an expression. All environmental variable names begin with a
  2123. dollar sign ($) and are in lower case.
  2124.  
  2125. @begin(description)
  2126. $acount@\The countdown of inserted characters until the next save-file.
  2127.  
  2128. $asave@\The number of inserted characters between automatic file-saves
  2129. in ASAVE mode.
  2130.  
  2131. $bufhook@\The function named in this variable is run when a buffer is
  2132. entered. It can be used to implement modes which are specific to a
  2133. paricular file or file type.
  2134.  
  2135. $cbflags@\Current buffer attribute flags (See appendix G for details).
  2136.  
  2137. $cbufname@\Name of the current buffer.
  2138.  
  2139. $cfname@\File name of the current buffer.
  2140.  
  2141. $cmdhook@\Name of function to run before accepting a command. This is
  2142. by default set to @i(nop).
  2143.  
  2144. $cmode@\Integer containing the mode of the current buffer. (See Appendix F
  2145. for values).
  2146.  
  2147. $curchar@\Ascii value of the character currently at the point.
  2148.  
  2149. $curcol@\Current column of point in current buffer.
  2150.  
  2151. $curline@\Current line of point in current buffer.
  2152.  
  2153. $curwidth@\Number of columns used currently.
  2154.  
  2155. $curwind@\Current window number.
  2156.  
  2157. $cwline@\Current display line in current window.
  2158.  
  2159. $debug@\Flag to trigger macro debugging.
  2160.  
  2161. $deskcolor@\Color to use for current desktop, default to BLACK.
  2162.  
  2163. $diagflag@\If set to TRUE, diagonal dragging of text and mode lines is
  2164. enabled. If FALSE, text and modelines can only be dragged horizontally
  2165. or vertically at one time.
  2166.  
  2167. $discmd@\Controls the echoing of command prompts. Default is TRUE.
  2168.  
  2169. $disinp@\Controls the echoing of input at the command prompts. Default
  2170. is TRUE.
  2171.  
  2172. $disphigh@\If set to TRUE, high-bit characters (single byte characters
  2173. that are greater than 127 in value) will be displayed in a
  2174. pseudo-control format. The characters "^!" will lead off the sequence,
  2175. followed by the character stripped of its high bit. Default is FALSE.
  2176.  
  2177. $exbhook@\This variable holds the name of a function or macro which is
  2178. run whenever you are switching out of a buffer.
  2179.  
  2180. $fcol@\The current line position being displayed in the first column of
  2181. the current window.
  2182.  
  2183. $fillcol@\Current fill column.
  2184.  
  2185. $flicker@\Flicker Flag set to TRUE if IBM CGA set to FALSE for most
  2186. others.
  2187.  
  2188. $fmtlead@\lists all formatter command leadin characters. Lines beginning
  2189. with these characters will be considered the beginning of paragraphs.
  2190.  
  2191. $gflags@\Global flags controlling some EMACS internal functions (See
  2192. appendix G for details).
  2193.  
  2194. $gmode@\Global mode flags. (See Appendix F for values).
  2195.  
  2196. $hardtab@\Number of spaces between hard tab stops. Normally 8, this can
  2197. be used to change indentation only within the editor.@index(tabs)
  2198.  
  2199. $hjump@\The number in here tells EMACS how many columns to scroll the
  2200. screen horizontally when a horizontal scroll is required.
  2201.  
  2202. $hscroll@\This flag determines if EMACS will scroll the entire current
  2203. window horizontally, or just the current line. The default value, TRUE,
  2204. results in the entire current window being shifted left and right when
  2205. the cursor goes off the edge of the screen.
  2206.  
  2207. $kill@\This contains the first 127 characters currently in the kill
  2208. buffer and can be used to set the contents of the kill buffer.
  2209.  
  2210. $language@\[READ ONLY]Contains the name of the language which the
  2211. current EMACS's message will display. (Currently EMACS is available in
  2212. English, French, Spanish, Latin, Portuguese, Dutch, German, and Pig Latin).
  2213.  
  2214. $lastkey@\[READ ONLY]Last keyboard character typed.
  2215.  
  2216. $lastmesg@\[READ ONLY]Contains the text of the last message which
  2217. emacs wrote on the command line.
  2218.  
  2219. $line@\The current line in the current buffer can be retrieved and
  2220. set with this environment variable.
  2221.  
  2222. $lterm@\Character(s) to write as a line terminator when writing a file
  2223. to disk. Default is null, which causes a '\n' character to be written.
  2224. Not all operating systems support this.
  2225.  
  2226. $lwidth@\[READ ONLY]Returns the number of characters in the current line.
  2227.  
  2228. $match@\[READ ONLY]Last string matched in a search.
  2229.  
  2230. $modeflag@\Determines if mode lines are currently displayed.
  2231.  
  2232. $msflag@\If TRUE, the mouse (if present) is active. If FALSE, no mouse
  2233. cursor is displayed, and no mouse actions are taken.@index(mouse)
  2234.  
  2235. $numwind@\The number of windows displayed.
  2236.  
  2237. $oldcrypt@\Use the old method of encryption (which had a bug in it). 
  2238. Default is FALSE.
  2239.  
  2240. $orgrow@\Desktop row position of current screen.
  2241.  
  2242. $orgcol@\Desktop column position of current screen.
  2243.  
  2244. $pagelen@\Number of screen lines used currently.
  2245.  
  2246. $palette@\string used to control the palette register settings on
  2247. graphics versions. The usually form consists of groups of three octal
  2248. digits setting the red, green, and blue levels.@index(color pallette)
  2249.  
  2250. $paralead@\Lists all paragraph start characters.
  2251.  
  2252. $pending@\[READ ONLY]Flag to determine if there are user keystrokes
  2253. waiting to be processed.
  2254.  
  2255. $popflag@\Use pop-up windows. Default is TRUE.
  2256.  
  2257. $progname@\[READ ONLY]Always contains the string "MicroEMACS" for
  2258. standard MicroEMACS. Could be something else if EMACS is incorporated
  2259. as part of someone else's program.
  2260.  
  2261. $ram@\ The amount of remaining memory if MicroEMACS was compiled with
  2262. RAMSIZE set. A debugging tool.
  2263.  
  2264. $readhook@\This variable holds the name of a function to execute
  2265. whenever a file is read into EMACS. Normally, using the standard
  2266. @b(emacs.rc) file, this is bound to a function which places EMACS into
  2267. CMODE if the extension of the file read is .c or .h.
  2268.  
  2269. $region@\Contains the string of the current region. It will truncate at
  2270. the stringsize limit, 255.
  2271.  
  2272. $replace@\Current default replace string.
  2273.  
  2274. $rval@\This contains the return value from the last subprocess which was
  2275. invoked from EMACS.
  2276.  
  2277. $scrname@\The current screen name.
  2278.  
  2279. $search@\Current default search string.
  2280.  
  2281. $searchpnt@\Set the placement of the of the cursor on a successful
  2282. search match. $searchpnt = 0 (the default), causes the cursor to be
  2283. placed at the end of the matched text on forward searches, and at the
  2284. beginning of the text on reverse searches. $searchpnt = 1 causes the
  2285. cursor to be placed at the the beginning of the matched text regardless
  2286. of the search direction, while $searchpnt = 2 causes the cursor to be
  2287. placed at the end.
  2288.  
  2289. $seed@\Integer seed of the random number generator.
  2290.  
  2291. $softtab@\Number of spaces inserted by EMACS when the handle-tab command
  2292. (which is normally bound to the TAB key) is invoked.@index(tabs)
  2293.  
  2294. $sres@\Current screen resolution (CGA, MONO, EGA or VGA on the IBM-PC
  2295. driver. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on most
  2296. others).@index(screen resolution)
  2297.  
  2298. $ssave@\If TRUE, when EMACS is asked to save the current file, it
  2299. writes all files out to a temporary file, deletes the original, and
  2300. then renames the temporary to the old file name. The default value of
  2301. this is TRUE.
  2302.  
  2303. $sscroll@\Changes EMACS, when set to TRUE, to smoothly scroll windows
  2304. (one line at a time) when cursoring off the ends of the current
  2305. window.
  2306.  
  2307. $status@\[READ ONLY]Status of the success of the last command (TRUE or
  2308. FALSE). This is usually used with !force to check on the success of a
  2309. search, or a file operation. 
  2310.  
  2311. $sterm@\This is the character used to terminate search string inputs.
  2312. The default for this is the last key bound to @i(meta-prefix).
  2313.  
  2314. $target@\Current target for line moves (setting this fool's EMACS into
  2315. believing the last command was a line move).
  2316.  
  2317. $time@\[READ ONLY]Contains a string corresponding to the current date
  2318. and time. Usually this is in a form similar to "Mon May 09 10:10:58 1988".
  2319. Not all operating systems will support this.
  2320.  
  2321. $tpause@\Controls the length of the pause to display a matched fence
  2322. when the current buffer is in CMODE and a close fence has been typed.
  2323.  
  2324. $version@\[READ ONLY]Contains the current MicroEMACS version number.
  2325.  
  2326. $wchars@\When set, MicroEMACS uses the characters listed in it to
  2327. determine if it is in a word or not. If it is not set (the default),
  2328. the characters it uses are the upper and lower case letters, and the
  2329. underscore.
  2330.  
  2331. $wline@\Number of display lines in current window.
  2332.  
  2333. $wraphook@\This variable contains the name of an EMACS function which is
  2334. executed when a buffer is in WRAP mode and it is time to wrap. By
  2335. default this is bound to @i(wrap-word).
  2336.  
  2337. $writehook@\This variable contains the name of an EMACS function or
  2338. macro which is invoked whenever EMACS attempts to write a file out to
  2339. disk. This is executed before the file is written, allowing you to
  2340. process a file on the way out.
  2341.  
  2342. $xpos@\The column the mouse was at the last mouse button press.
  2343.  
  2344. $yankflag@\Controls the placement of the cursor after a yank command or
  2345. an insert. When $yankflag is FALSE (the default), the cursor is placed
  2346. at the end of the yanked or inserted text. When it is TRUE, the cursor
  2347. remains at the start of the text.
  2348.  
  2349. $ypos@\The line which the mouse was on during the last mouse button press.
  2350. @end(description)
  2351.  
  2352. @subsection(User variables)
  2353.  
  2354.     User variables allow you to store strings and manipulate them.
  2355. These strings can be pieces of text, numbers (in text form), or the
  2356. logical values @b(TRUE) and @b(FALSE). These variables can be combined,
  2357. tested, inserted into buffers, and otherwise used to control the way
  2358. your macros execute. At the moment, up to 512 user variables may be in
  2359. use in one editing session. All users variable names must begin with a
  2360. percent sign (%) and may contain any printing characters. Only the first
  2361. 10 characters are significant (IE differences beyond the tenth character
  2362. are ignored). Most operators will truncate strings to a length of 128
  2363. characters. 
  2364.  
  2365. @subsection(Buffer Variables)
  2366.  
  2367.     Buffer variables are special in that they can only be queried
  2368. and cannot be set. What buffer variables are is a way to take text from
  2369. a buffer and place it in a variable. For example, if I have a buffer by
  2370. the name of RIGEL2, and it contains the text:
  2371.  
  2372. @begin(verbatim)
  2373. @begin(group)
  2374.     Richmond
  2375.     Lafayette
  2376.     <*>Bloomington        (where <*> is the current point)
  2377.     Indianapolis
  2378.     Gary
  2379.     =* MicroEMACS 3.11 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2380. @end(group)
  2381. @end(verbatim)
  2382.  
  2383.     and within a command I reference #rigel2, like:
  2384.  
  2385.     insert-string #rigel2
  2386.  
  2387.     MicroEMACS would start at the current point in the RIGEL2
  2388. buffer and grab all the text up to the end of that line and pass that
  2389. back. Then it would advance the point to the beginning of the next line.
  2390. Thus, after our last command executes, the string "Bloomington" gets
  2391. inserted into the current buffer, and the buffer RIGEL2 now looks like
  2392. this:
  2393.  
  2394. @begin(verbatim)
  2395. @begin(group)
  2396.     Richmond
  2397.     Lafayette
  2398.     Bloomington
  2399.     <*>Indianapolis     (where <*> is the current point)
  2400.     Gary
  2401.     =* MicroEMACS 3.11 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2402. @end(group)
  2403. @end(verbatim)
  2404.  
  2405.     as you have probably noticed, a buffer variable consists of the
  2406. buffer name, preceded by a pound sign (#).
  2407.  
  2408. @subsection(Interactive variables)
  2409.  
  2410.     Interactive variables are actually a method to prompt the user
  2411. for a string. This is done by using an at sign (@@) followed either with
  2412. a quoted string, or a variable containing a string. The string is the
  2413. placed on the bottom line, and the editor waits for the user to type in
  2414. a string. Then the string typed in by the users is returned as the
  2415. value of the interactive variable. For example:
  2416.  
  2417. @begin(verbatim)
  2418.     set %quest "What file? "
  2419.     find-file @@%quest
  2420. @end(verbatim)
  2421.  
  2422.     will ask the user for a file name, and then attempt to find it.
  2423. Note also that complex expressions can be built up with these
  2424. operators, such as:
  2425.  
  2426. @verbatim(set %default "file1"
  2427. @@&cat &cat "File to decode[" %default "]: ")
  2428.  
  2429.     which prompts the user with the string:
  2430.  
  2431.     File to decode[file1]:
  2432.  
  2433. @section(Functions)
  2434.  
  2435.     Functions can be used to act on variables in various ways. 
  2436. Functions can have one, two, or three arguments. These arguments will
  2437. always be placed after the function on the current command line. For
  2438. example, if we wanted to increase the current fill column by two, using
  2439. emacs's set (^XA) command, we would write:
  2440.  
  2441. @begin(group)
  2442. @begin(verbatim)
  2443.     set $fillcol &add $fillcol 2
  2444.      \    \      \      \     \____second operand
  2445.       \     \    \      \_________first operand
  2446.        \      \     \_______________function to execute
  2447.         \       \_____________________variable to set
  2448.          \___________________________set (^XA) command
  2449. @end(verbatim)
  2450. @end(group)
  2451.  
  2452.     Function names always begin with the ampersand (&) character,
  2453. and are only significant to the first three characters after the
  2454. ampersand. Functions will normal expect one of three types of
  2455. arguments, and will automatically convert types when needed. Different
  2456. argument types include:
  2457.  
  2458. @begin(description)
  2459. <num>@\an ascii string of digits which is interpreted as a numeric value. 
  2460. Any string which does not start with a digit or a minus sign (-) will be
  2461. considered zero. 
  2462.  
  2463. <str>@\An arbitrary string of characters. At the moment, strings are
  2464. limited to 128 characters in length. 
  2465.  
  2466. <log>@\A logical value consisting of the string "TRUE" or "FALSE". 
  2467. Numeric strings will also evaluate to "FALSE" if they are equal to zero,
  2468. and "TRUE" if they are non-zero. Arbitrary text strings will have the
  2469. value of "FALSE". 
  2470. @end(description)
  2471.  
  2472.     A list of the currently available functions follows. Functions
  2473. are always used in lower case, the uppercase letters in the function
  2474. table are the short form of the function (IE &div for ÷).
  2475.  
  2476. @begin(verbatim)
  2477. Numeric Functions:    (returns <num>)
  2478.  
  2479. &ADD        <num> <num>    Add two numbers
  2480. &SUB        <num> <num>    Subtract the second number from the first
  2481. &TIMes        <num> <num>    Multiply two numbers
  2482. &DIVide     <num> <num>    Divide the first number by the second
  2483.                 giving an integer result
  2484. &MOD        <num> <num>    Return the reminder of dividing the
  2485.                 first number by the second
  2486. &NEGate     <neg>        Multiply the arg by -1
  2487. &LENgth     <str>        Returns length of string
  2488. &SINdex     <str1> <str2>    Finds the position of <str2> within
  2489.                 <str1>. Returns zero if not found.
  2490. &ASCii        <str>        Return the ascii code of the first
  2491.                 character in <str>
  2492. &RND        <num>        Returns a random integer between 1 and <num>
  2493. &ABS        <num>        Returns the absolute value of <num>
  2494. &BANd        <num> <num>    Bitwise AND function
  2495. &BOR        <num> <num>    Bitwise OR function
  2496. &BXOr        <num> <num>    Bitwise XOR function
  2497. &BNOt        <num>        Bitwise NOT function
  2498.  
  2499. String manipulation functions:    (returns <str>)
  2500.  
  2501. &CAT        <str> <str>    Concatenate the two strings to form one
  2502. &LEFt        <str> <num>    return the <num> leftmost characters
  2503.                 from <str>
  2504. &RIGht        <str> <num>    return the <num> rightmost characters
  2505.                 from <str>
  2506. &MID        <str> <num1> <num2>
  2507.                 Starting from <num1> position in <str>,
  2508.                 return <num2> characters.
  2509. &UPPer        <str>        Uppercase <str>
  2510. &LOWer        <str>        Lowercase <str>
  2511. &CHR        <num>        return a string with the character
  2512.                 represented by ascii code <num>
  2513. >C                returns a string of characters
  2514.                 containing a EMACS command input from
  2515.                 the user
  2516. >K                return a string containing a single
  2517.                 keystroke from the user
  2518. &ENV        <str>        If the operating system is capable, this
  2519.                 returns the environment string associated
  2520.                 with <str>
  2521. &BIND        <str>        return the function name bound to the
  2522.                 keystroke <str>
  2523. &XLATE        <str1> <str2> <str3>
  2524. &FINd        <str>        Find the named file <str> along the
  2525.                 path and return its full file specification
  2526.                 or an empty string if none exists
  2527. &TRIM        <str>        Trim the trailing whitespace from a string
  2528.  
  2529. Logical Testing functions:    (returns <log>)
  2530.  
  2531. &NOT        <log>        Return the opposite logical value
  2532. &AND        <log1> <log2>    Returns TRUE if BOTH logical arguments
  2533.                 are TRUE
  2534. &OR        <log1> <log2>    Returns TRUE if either argument
  2535.                 is TRUE
  2536. &EQUal        <num> <num>    If <num> and <num> are numerically
  2537.                 equal, return TRUE
  2538. &LESs        <num1> <num2>    If <num1> is less than <num2>, return
  2539.                 TRUE.
  2540. &GREater    <num1> <num2>    If <num1> is greater than, or equal to
  2541.                 <num2>, return TRUE.
  2542. &SEQual     <str1> <str2>    If the two strings are the same, return
  2543.                 TRUE.
  2544. &SLEss        <str1> <str2>    If <str1> is less alphabetically than
  2545.                 <str2>, return TRUE.
  2546. &SGReater    <str1> <str2>    If <str1> is alphabetically greater than
  2547.                 or equal to <str2>, return TRUE.
  2548. &EXIst        <str>        Does the named file <str> exist?
  2549.  
  2550. &ISNum        <num>        Is the given argument a legitimate number?
  2551.  
  2552. Special Functions:
  2553.  
  2554. &GROup        <num>        Return group <num> as set by a MAGIC
  2555.                 mode search.
  2556.  
  2557. &SUPper        <str1> <str2>    Translate the first char in <str1> to
  2558.                 the first char in <str2> when uppercasing.
  2559.  
  2560. &SLOwer        <str1> <str2>    Translate the first char in <str1> to
  2561.                 the first char in <str2> when lowercasing.
  2562.  
  2563. &INDirect    <str>        Evaluate <str> as a variable.
  2564. @end(verbatim)
  2565.  
  2566.     This last function deserves more explanation. The &IND function
  2567. evaluates its argument, takes the resulting string, and then uses it as
  2568. a variable name. For example, given the following code sequence:
  2569.  
  2570. @begin(verbatim)
  2571.     ; set up reference table
  2572.  
  2573.     set %one    "elephant"
  2574.     set %two    "giraffe"
  2575.     set %three    "donkey"
  2576.  
  2577.     set %index "two"
  2578.     insert-string &ind %index
  2579. @end(verbatim)
  2580.  
  2581.     the string "giraffe" would have been inserted at the point in
  2582. the current buffer. This indirection can be safely nested up to about
  2583. 10 levels.
  2584.  
  2585. @section(Directives)
  2586.  
  2587.     Directives are commands which only operate within an executing
  2588. procedure, IE they do not make sense as a single command. As such, they
  2589. cannot be called up singly or bound to keystroke. Used within command
  2590. files, they control what lines are executed and in what order.
  2591.  
  2592.     Directives always start with the exclamation mark (!) character
  2593. and must be the first non-wite space placed on a line. Directives
  2594. executed interactively (via the execute-command-line command) will be
  2595. ignored. 
  2596.  
  2597. @subsection(!ENDM Directive)
  2598.  
  2599.     This directive is used to terminate a procedure or macro being
  2600. stored. For example, if a file is being executed contains the text:
  2601.  
  2602. @begin(verbatim)
  2603.     ;    Read in a file in view mode, and make the window red
  2604.  
  2605.     store-procedure get-red-viewed-file
  2606.         find-file @@"File to view: "
  2607.         add-mode "view"
  2608.         add-mode "red"
  2609.     !endm
  2610.  
  2611.     print "[Consult procedure has been loaded]"
  2612. @end(verbatim)
  2613.  
  2614.     only the lines between the store-macro command and the !ENDM
  2615. directive are stored in procedure get-red-viewd-file. Both named
  2616. procedures and numbered macroes (via the @i(store-macro) command) should
  2617. be terminated with this directive.
  2618.  
  2619. @subsection(!FORCE Directive)
  2620.  
  2621.     When MicroEMACS executes a procedure, if any command fails, the
  2622. procedure is terminated at that point. If a line is preceded by a !FORCE
  2623. directive, execution continues whether the command succeeds or not. For
  2624. example:
  2625.  
  2626. @begin(verbatim)
  2627.     ;    Merge the top two windows
  2628.  
  2629.     save-window        ;remember what window we are at
  2630.     1 next-window        ;go to the top window
  2631.     delete-window        ;merge it with the second window
  2632.     !force restore-window    ;This will continue regardless
  2633.     add-mode "red"
  2634. @end(verbatim)
  2635.     Often this is used together with the $status environment
  2636. variable to test if a command succeeded. For example:
  2637. @begin(verbatim)
  2638.     set %seekstring @"String to Find: "
  2639.     !force search-forward %seekstring
  2640.     !if &seq $status TRUE
  2641.         print "Your string is Found"
  2642.     !else
  2643.         print "No such STRING!"
  2644.     !endif
  2645. @end(verbatim)
  2646.  
  2647. @subsection(!IF, !ELSE, and !ENDIF Directives)
  2648.  
  2649.     This directive allows statements only to be executed if a
  2650. condition specified in the directive is met. Every line following the
  2651. !IF directive, until the first !ELSE or !ENDIF directive, is only
  2652. executed if the expression following the !IF directive evaluates to a
  2653. TRUE value. For example, the following commands creates the portion of a
  2654. text file automatically. (yes believe me, this will be easier to
  2655. understand then that last explanation....)
  2656.  
  2657. @begin(verbatim)
  2658.     !if &sequal %curplace "timespace vortex"
  2659.         insert-string "First, rematerialize~n"
  2660.     !endif
  2661.     !if &sequal %planet "earth"    ;If we have landed on earth...
  2662.         !if &sequal %time "late 20th century"  ;and we are then
  2663.             write-message "Contact U.N.I.T."
  2664.         !else
  2665.             insert-string "Investigate the situation....~n"
  2666.             insert-string "(SAY 'stay here Sara')~n"
  2667.         !endif
  2668.     !else
  2669.         set %conditions @@"Atmosphere conditions outside? "
  2670.         !if &sequal %conditions "safe"
  2671.             insert-string &cat "Go outside......" "~n"
  2672.             insert-string "lock the door~n"
  2673.         !else
  2674.             insert-string "Dematerialize..try somewhen else"
  2675.             newline
  2676.         !endif
  2677.     !endif
  2678. @end(verbatim)
  2679.  
  2680. @subsection(!GOTO Directive)
  2681.  
  2682.     Flow can be controlled within a MicroEMACS procedure using the
  2683. !GOTO directive. It takes as an argument a label. A label consists of a
  2684. line starting with an asterisk (*) and then an alphanumeric label. Only
  2685. labels in the currently executing procedure can be jumped to, and trying
  2686. to jump to a non-existing label terminates execution of a procedure. For
  2687. example:
  2688.  
  2689. @begin(verbatim)
  2690.     ;Create a block of DATA statements for a BASIC program
  2691.  
  2692.         insert-string "1000 DATA "
  2693.         set %linenum 1000
  2694.  
  2695.     *nxtin
  2696.         update-screen        ;make sure we see the changes
  2697.         set %data @@"Next number: "
  2698.         !if &equal %data 0
  2699.             !goto finish
  2700.         !endif
  2701.  
  2702.         !if &greater $curcol 60
  2703.             2 delete-previous-character
  2704.             newline
  2705.             set %linenum &add %linenum 10
  2706.             insert-string &cat %linenum " DATA "
  2707.         !endif
  2708.  
  2709.         insert-string &cat %data ", "
  2710.         !goto nxtin
  2711.  
  2712.     *finish
  2713.  
  2714.         2 delete-previous-character
  2715.         newline
  2716. @end(verbatim)
  2717.  
  2718. @subsection(!WHILE and !ENDWHILE Directives)
  2719.  
  2720.     This directive allows you to set up repetitive tasks easily and
  2721. efficiently. If a group of statements need to be executed while a
  2722. certain condition is true, enclose them with a while loop. For example,
  2723.  
  2724. @begin(verbatim)
  2725.     !while &less $curcol 70
  2726.         insert-string &cat &cat "[" #stuff "]"
  2727.     !endwhile
  2728. @end(verbatim)
  2729.  
  2730.     places items from buffer "item" in the current line until the
  2731. cursor is at or past column 70. While loops may be nested and can
  2732. contain and be the targets of !GOTOs with no ill effects. Using a while
  2733. loop to enclose a repeated task will run much faster than the
  2734. corresponding construct using !IFs.
  2735.  
  2736. @subsection(!BREAK Directive)
  2737.  
  2738.     This lets you abort out of the most executing currently inner
  2739. while loop, regardless of the condition. It is often used to abort
  2740. processing for error conditions. For example:
  2741.  
  2742. @begin(verbatim)
  2743. ;    Read in files and substitute "begining" with "beginning"
  2744.  
  2745.     set %filename #list
  2746.     !while ¬ &seq %filename "<end>"
  2747. !force        find-file %filename
  2748.         !if &seq $status FALSE
  2749.             write-message "[File read error]"
  2750.             !break
  2751.         !endif
  2752.         beginning-of-file
  2753.         replace-string "begining" "beginning"
  2754.         save-file
  2755.         set %filename #list
  2756.     !endwhile
  2757. @end(verbatim)
  2758.  
  2759.     This while loop will process files until the list is exhausted
  2760. or there is an error while reading a file.
  2761.  
  2762. @subsection(!RETURN Directive)
  2763.  
  2764.     The !RETURN Directive causes the current procedure to exit,
  2765. either returning to the caller (if any) or to interactive mode. For
  2766. example:
  2767.  
  2768. @begin(verbatim)
  2769.     ;    Check the monitor type and set %mtyp
  2770.  
  2771.     !if &sres "CGA"
  2772.         set %mtyp 1
  2773.         !return
  2774.     !else
  2775.         set %mtyp 2
  2776.     !endif
  2777.  
  2778.     insert-string "You are on a MONOCHROME machine!~n"
  2779. @end(verbatim)
  2780. @chapter(Debugging MicroEMACS Procedures)
  2781.  
  2782.     @index(debugging)@index($debug)When developing new procedures,
  2783. it is very convenient to be able to trace their execution to discover
  2784. errors. The $debug environment variable enables procedure debugging.
  2785. While this variable is TRUE, emacs will stop at each line it intends to
  2786. execute and allow you to view it, and issue a number of different
  2787. commands to help determine how the procedure is executing.
  2788.  
  2789.     For example, we will step through the procedure which toggles
  2790. the function key window off. The first thing to do, is to set $debug,
  2791. using the @b(^XA) @i(set) command. Type ^XA and emacs will prompt you on
  2792. the command line with "Variable to set: ". Type in "$debug" and press
  2793. the enter key. Emacs will then ask "Value: ". Type in "TRUE" (in capital
  2794. letters) and press the enter key.
  2795.  
  2796.     While macro debugging is enabled (as it is now) emacs will
  2797. report each time a variable is assigned a value, by displaying the
  2798. variable and its value on the command line. Right now,
  2799.  
  2800. @flushleft{((($debug <- TRUE)))}
  2801.  
  2802.     appears on the command line to tell you that $debug now has been
  2803. assigned the value of TRUE. Press the space bar to continue.
  2804.  
  2805.     Now, lets try to debug a macro. Press function key 5 which
  2806. normally toggles the function key window. The first thing that appears
  2807. is:
  2808.  
  2809. @flushleft{<<<[Macro 01]:!if %rcfkeys>>>}
  2810.  
  2811.     At this point, emacs is waiting for a command. It is prepared
  2812. to see if the user variable %rcfkeys is TRUE, and execute some lines if
  2813. they are. Suppose we want to see the value of this variable, type the
  2814. letter "e" to evaluate an expression. Emacs will prompt with "EXP: ". 
  2815. Type "%rcfkeys" followed by the enter key. Emacs should then respond
  2816. with "TRUE" to indicate that the function key window is currently on
  2817. screen.
  2818.  
  2819.     Press the space bar to allow the !if directive to execute. 
  2820. Emacs will decide that it is TRUE, and then display the next command to
  2821. execute.
  2822.  
  2823. @flushleft{<<<[Macro 01]:!goto rcfoff>>>}
  2824.  
  2825.     Notice emacs tells us what procedure we are currently executing
  2826. (in this case, the macro bound to execute-macro-1). Press the space bar
  2827. again to execute the !goto directive.
  2828.  
  2829. @flushleft{<<<[Macro 01]:save-window>>>}
  2830.  
  2831.     Emacs is saving the position of the current window so that it
  2832. can attempt to return to it after it has brought up the function key window.
  2833.  
  2834. [...THIS CHAPTER IS NOT FINISHED...]
  2835. @chapter(Key Bindings, What they are and why)
  2836.  
  2837.     One of the features which makes MicroEMACS very adaptable is its
  2838. ability to use different keystrokes to execute different commands. The
  2839. process of changing the particular command a key invokes is called
  2840. @i(rebinding)@index(rebinding). This allows us to make the editor
  2841. look like other popular editors and programs.
  2842.  
  2843.     Each command in MicroEMACS has a name which is used for binding
  2844. purposes. For example, the command to move the cursor down one page is
  2845. called @i(next-line) and is normally bound to the ^N key. If you
  2846. decided that you also wanted to use the ^D key to move the cursor down
  2847. one line, you would use the M-K @i(bind-to-key)@index(bind-to-key)
  2848. command. EMACS would respond with ": bind-to-key " on the command line
  2849. and allow you to type in a command name. Then type in the name of the
  2850. command  you want to change, in this case @i(next-line),
  2851. followed by the <NL> key. EMACS will then wait for you to type in the
  2852. keys you want to activate the named function. Type a single ^D. From
  2853. now on, typing ^D will cause EMACS to move down one line, rather than
  2854. its original function of deleting characters.
  2855.  
  2856.     To find out the name of a command, consult the list of
  2857. valid EMACS commands in Appendix B. Also, you can use the ^X?
  2858. @i(describe-key)@index(describe-key) command to look up the name of a
  2859. command. Type ^X? and then the key to use that command, and EMACS will
  2860. show you the name of the command.
  2861.  
  2862.     After you have experimented with changing your key bindings, you
  2863. may decide that you want to change some bindings permanently. To have
  2864. EMACS rebind keys to your pleasure each time you start EMACS, you can
  2865. add statements to the end of your startup file (@b(emacs.rc) or
  2866. @b(.emacsrc) depending on the system). For example,
  2867.  
  2868. bind-to-key next-line ^D
  2869.  
  2870.     Notice, that control D character in the startup file is
  2871. represented visibly as an uparrow key followed by a capital D. To know
  2872. how to represent any keys you want to bind, use the @i(describe-key)
  2873. command on the key, and use the sequence that is displayed.
  2874.  
  2875. bind-to-key split-current-window FN1
  2876.  
  2877.     This example would make function key 1 activate the command
  2878. that splits the current window in two. 
  2879.  
  2880.     EMACS will let you define a large number of keys, but will report 
  2881. "Binding table FULL!" when it runs out of space to bind keys. Normally 
  2882. EMACS will allow up to 512 key bindings (including approx. 300 originally 
  2883. bound keys).
  2884.  
  2885.     If you want to get a current listing of all the commands and
  2886. the keys bound to them, use the @i(describe-bindings)
  2887. @index(describe-bindings) command. Notice, that this command is not
  2888. bound to any keys!
  2889.  
  2890. @appendix(MicroEMACS Command Line Switches and Startup Files)
  2891.  
  2892. @index(startup files)
  2893.     When EMACS first executes, it always searches for a file,
  2894. called @b(.emacsrc) @i(under most UNIX systems) or @b(emacs.rc) @i(on
  2895. most other systems) @index(emacs.rc) @index(.emacsrc) which it will
  2896. execute as EMACS macros before it reads in the named source files. This
  2897. file normally contains EMACS macroes to bind the function keys to
  2898. useful functions and load various useful macros. The contents of this
  2899. file will probably vary from system to system and can be modified by the
  2900. user as desired.
  2901.  
  2902.     When searching for this file, EMACS looks for it in this order. 
  2903. First, it attempts to find a definition for "@b(HOME)" in the
  2904. environment. It will look in that directory first. Then it searches
  2905. all the directories listed in the "@b(PATH)" environment variable. Then
  2906. it looks through a list of predefined standard directories which vary
  2907. from system to system. Finally, failing all of these, it looks in the
  2908. current directory. This is also the same method EMACS uses to look up
  2909. any files to execute, and to find it's help file @b(EMACS.HLP). 
  2910. @index(PATH environment variable) @index(HOME environment variable)
  2911. @index(Help File)
  2912.  
  2913. @index(switches)
  2914.     On computers that call up EMACS via a command line process, such
  2915. as MSDOS and UNIX, there are different things that can be added to the
  2916. command line to control the way EMACS operates. These can be switches,
  2917. which are a dash ('-') followed by a letter, and possible other
  2918. parameters, or a startup file specifier, which is an at sign '@@'
  2919. followed by a file name.
  2920.  
  2921. @begin(description)
  2922. @@<file>@\This causes the named file to be executed instead of the
  2923. standard emacs.rc file before emacs reads in any other files. More than
  2924. one of these can be placed on the command line, and they will be
  2925. executed in the order that they appear. 
  2926.  
  2927. -C@\The following source files on the command line can be changed (as
  2928. opposed to being in VIEW mode). This is mainly used to cancel the
  2929. effects of the -v switch used previously in the same command line.
  2930.  
  2931. -E@\This flag causes emacs to automatically run the startup file
  2932. "error.cmd" instead of emacs.rc. This is used by various C compilers for
  2933. error processing (for example, Mark Williams C). @index(error parsing)
  2934.  
  2935. -G<num>@\Upon entering EMACS, position the cursor at the <num> line of
  2936. the first file.
  2937.  
  2938. -I<var> <value>@\Initialize an EMACS variable with <value>. This can be
  2939. useful to force EMACS to start in a particular mode. (For example,
  2940. invoke EMACS with "emacs -i$sres VGA foo.bar" to edit file foo.bar
  2941. in VGA 50 line mode on an IBM-PC).
  2942.  
  2943. -K<key>@\This key tells emacs to place the source files in CRYPT
  2944. @index(CRYPT mode) mode and read it in using <key> as the encryption
  2945. key. If no key is listed immediately after the -K switch, EMACS will
  2946. prompt for a key, and not echo it as it is typed. 
  2947.  
  2948. -R@\This places EMACS in "restricted mode"@index(restricted mode)
  2949. @index(BBS) where any commands allowing the user to read or write any
  2950. files other than the ones listed on the command line are disabled. Also
  2951. all commands allowing the user access to the operating system are
  2952. disabled. This makes EMACS very useful as a "safe" environment for use
  2953. within other applications and especially used as a remote editor for a
  2954. BBS or electronic bulletin board system.
  2955.  
  2956. -S<string>@\After EMACS is started, it automatically searches for
  2957. <string> in the first source file.
  2958.  
  2959. -V@\This tells EMACS that all the following sources files on the command
  2960. line should be in VIEW mode to prevent any changes being made to them.
  2961. @end(description)
  2962. @appendix(Command Completion)
  2963.  
  2964.     Some versions of MicroEMACS will allow you to abbrieviate buffer
  2965. names, command names and file names as you enter them. To use this,
  2966. type in the first few characters of the name you wish, and then hit
  2967. either the space bar, the META key or the TAB key. MicroEMACS will then
  2968. attempt to look at the list of all the availible names and if there is
  2969. only one which will fit, it will choose that name. If there are several
  2970. names that quailify, as many characters as are common to ALL of them
  2971. will be entered. If there are no possible matches, the bell will ring
  2972. to indicate MicroEMACS can not complete the command.
  2973.  
  2974.     For example, if you have several files in your current directory
  2975. with the following names:
  2976.  
  2977. @begin(verbatim)
  2978.     prog1.c
  2979.     prog1.obj
  2980.     prog1.exe
  2981.     prog1.doc
  2982.     program.one
  2983.     project.one
  2984.     test.c
  2985.     tes
  2986. @end(verbatim)
  2987.  
  2988.     and you enter the @b(^X^F) @i(find-file) command, if you type
  2989. 'p' and then hit the space bar, EMACS will respond by typing the 'r'
  2990. that is common to all the above file names begining with 'p'. If you
  2991. then type 'ogr' and hit the tab key, EMACS will respond with 'am.one'
  2992. and automatically hit the enter key for you.
  2993.  
  2994.     If you were to instead type an 'a' and hit the space bar, EMACS
  2995. will beep, informing you that there is no possible match.
  2996.  
  2997.     If you type a 'te' and hit the space bar, EMACS will then type
  2998. the following 's', but it will not automatically enter it because it is
  2999. possible you mean to get to the test.c file.
  3000.  
  3001.     Buffer name, and command name completion is available in all
  3002. versions of MicroEMACS. File name completion is available on UNIX
  3003. BSD4.3, the Atari ST, the AMIGA and under MSDOS.
  3004. @appendix(MicroEMACS Commands)
  3005.  
  3006.     Below is a complete list of the commands in EMACS, the keys
  3007. normally used to do the command, and what the command does. Remember,
  3008. on some computers there may also be additional ways of using a command
  3009. (cursor keys and special function keys for example). 
  3010.  
  3011. @begin(verbatim)
  3012. @u(Command            Binding     Meaning)
  3013. abort-command         ^G    This allows the user to abort out of any
  3014.                 command that is waiting for input
  3015.  
  3016. add-mode         ^XM    Add a mode to the current buffer
  3017.  
  3018. add-global-mode      M-M    Add a global mode for all new buffers
  3019.  
  3020. append-file         ^X^A    Write a buffer to the end of a file
  3021.  
  3022. apropos          M-A    List out commands whose name contains
  3023.                 the string specified
  3024.  
  3025. backward-character     ^B    Move one character to the left
  3026.  
  3027. begin-macro         ^X(    Begin recording a keyboard macro
  3028.  
  3029. beginning-of-file     M-<    Move to the beginning of the file in
  3030.                 the current buffer
  3031.  
  3032. beginning-of-line     ^A    Move to the beginning of the current line
  3033.  
  3034. bind-to-key         M-K    Bind a key to a function
  3035.  
  3036. buffer-position      ^X=    List the position of the cursor in the
  3037.                 current window on the command line
  3038.  
  3039. case-region-lower     ^X^L    Make a marked region all lower case
  3040.  
  3041. case-region-upper     ^X^U    Make a marked region all upper case
  3042.  
  3043. case-word-capitalize     M-C    Capitalize the following word
  3044.  
  3045. case-word-lower      M-L    Lower case the following word
  3046.  
  3047. case-word-upper      M-U    Upper case the following word
  3048.  
  3049. change-file-name     ^XN    Change the name of the file in the
  3050.                 current buffer
  3051.  
  3052. change-screen-size    (none)    Change the number of lines of the screen
  3053.                 currently being used
  3054.  
  3055. change-screen-width    (none)    Change the number of columns of the
  3056.                 screen currently being used
  3057.  
  3058. clear-and-redraw     ^L    Clear the physical screen and redraw it
  3059.  
  3060. clear-message-line    (none)    Clear the command line
  3061.  
  3062. copy-region         M-W    Copy the currently marked region into
  3063.                 the kill buffer
  3064.  
  3065. count-words         M-^C    Count how many words, lines and
  3066.                 characters are in the current marked region
  3067.  
  3068. ctlx-prefix         ^X    Change the key used as the ^X prefix
  3069.  
  3070. cycle-screens         A-C    Bring the rearmost screen to front
  3071.  
  3072. delete-blank-lines     ^X^O    Delete all blank lines around the cursor
  3073.  
  3074. delete-buffer         ^XK    Delete a buffer which is not being
  3075.                 currently displayed in a window
  3076.  
  3077. delete-mode         ^X^M    Turn off a mode in the current buffer
  3078.  
  3079. delete-global-mode     M-^M    Turn off a global mode
  3080.  
  3081. delete-next-character     ^D    Delete the character following the cursor
  3082.  
  3083. delete-next-word     M-D    Delete the word following the cursor
  3084.  
  3085. delete-other-windows     ^X1    Make the current window cover the entire
  3086.                 screen
  3087.  
  3088. delete-previous-character^H    Delete the character to the left of the
  3089.                 cursor
  3090.  
  3091. delete-previous-word     M-^H    Delete the word to the left of the cursor
  3092.  
  3093. delete-screen         A-D    Delete a screen
  3094.  
  3095. delete-window         ^X0    Remove the current window from the screen
  3096.  
  3097. describe-bindings    (none)    Make a list of all legal commands
  3098.  
  3099. describe-functions    (none)    Make a list of all legal functions
  3100.  
  3101. describe-variables    (none)    Make a list of all environment
  3102.                 and user variables
  3103.  
  3104. describe-key         ^X?    Describe what command is bound to a
  3105.                 keystroke sequence
  3106.  
  3107. detab-region         ^X^D    Change all tabs in a region to the
  3108.                 equivalent spaces
  3109.  
  3110. display         ^XG    Prompts the user for a variable and
  3111.                 displays its current value
  3112.  
  3113. dump-variables         none    Places into a buffer the current values
  3114.                 of all environment and user variables
  3115.  
  3116. end-macro         ^X)    stop recording a keyboard macro
  3117.  
  3118. end-of-file         M->    Move cursor to the end of the current buffer
  3119.  
  3120. end-of-line         ^E    Move to the end of the current line
  3121.  
  3122. end-of-word        (none)    Move the point just past the end of
  3123.                 the current word
  3124.  
  3125. entab-region         ^X^E    Change multiple spaces to tabs where
  3126.                 possible
  3127.  
  3128. exchange-point-and-mark  ^X^X    Move cursor to the last marked spot,
  3129.                 make the original position be marked
  3130.  
  3131. execute-buffer        (none)    Execute a buffer as a macro
  3132.  
  3133. execute-command-line    (none)    Execute a line typed on the command
  3134.                 line as a macro command
  3135.  
  3136. execute-file        (none)    Execute a file as a macro
  3137.  
  3138. execute-macro         ^XE    Execute the keyboard macro (play back
  3139.                 the recorded keystrokes)
  3140. execute-macro-<n>    (none)    Execute numbered macro <N> where <N> is
  3141.                 an integer from 1 to 40
  3142.  
  3143. execute-named-command     M-X    Execute a command by name
  3144.  
  3145. execute-procedure     M-^E    Execute a procedure by name
  3146.  
  3147. execute-program     ^X$    Execute a program directly (not through
  3148.                 an intervening shell)
  3149.  
  3150. exit-emacs         ^X^C    Exit EMACS. If there are unwritten,
  3151.                 changed buffers EMACS will ask to confirm
  3152.  
  3153. fill-paragraph         M-Q    Fill the current paragraph
  3154.  
  3155. filter-buffer         ^X#    Filter the current buffer through an
  3156.                 external filter
  3157.  
  3158. find-file         ^X^F    Find a file to edit in the current window
  3159.  
  3160. find-screen         A-F    Bring the named screen to front,
  3161.                 creating it if needed
  3162.  
  3163. forward-character     ^F    Move cursor one character to the right
  3164.  
  3165. goto-line         M-G    Goto a numbered line
  3166.  
  3167. goto-mark         M-^G    Goto a numbered mark
  3168.  
  3169. goto-matching-fence     M-^F    Goto the matching fence
  3170.  
  3171. grow-window         ^X^    Make the current window larger
  3172.  
  3173. handle-tab         ^I    Insert a tab or set tab stops
  3174.  
  3175. hunt-forward         A-S    Hunt for the next match of the last
  3176.                 search string
  3177.  
  3178. hunt-backward         A-R    Hunt for the last match of the last
  3179.                 search string
  3180.  
  3181. help             M-?    Read EMACS.HLP into a buffer and display it
  3182.  
  3183. i-shell          ^XC    Shell up to a new command processor
  3184.  
  3185. incremental-search     ^XS    Search for a string, incrementally
  3186.  
  3187. indent-region         M-(    Indent the current region one tab
  3188.  
  3189. insert-file         ^X^I    insert a file at the cursor in the
  3190.                 current file
  3191.  
  3192. insert-space         ^C    Insert a space to the right of the cursor
  3193.  
  3194. insert-string        (none)    Insert a string at the cursor
  3195.  
  3196. kill-paragraph         M-^W    Delete the current paragraph
  3197.  
  3198. kill-region         ^W    Delete the current marked region, moving
  3199.                 it to the kill buffer
  3200.  
  3201. kill-to-end-of-line     ^K    Delete the rest of the current line
  3202.  
  3203. label-function-key    (none)    Set the text on a function key label
  3204.                 (HP150 only)
  3205.  
  3206. list-buffers         ^X^B    List all existing buffers
  3207.  
  3208. list-screens         A-B    List all existing screens
  3209.  
  3210. macro-to-key         M-^K    Bind a key to a macro
  3211.  
  3212. meta-prefix         <ESC>    Key used to precede all META commands
  3213.  
  3214. mouse-move-down      MSa
  3215.  
  3216. mouse-move-up         MSb
  3217.  
  3218. mouse-resize-screen     MS1
  3219.  
  3220. mouse-region-down     MSe
  3221.  
  3222. mouse-region-up      MSf
  3223.  
  3224. move-window-down     ^X^N    Move all the lines in the current window down
  3225.  
  3226. move-window-up         ^X^P    Move all the lines in the current window up
  3227.  
  3228. name-buffer         M-^N    Change the name of the current buffer
  3229.  
  3230. narrow-to-region     ^X<    hides all text not in the current region
  3231.  
  3232. newline          ^M    Insert a <NL> at the cursor
  3233.  
  3234. newline-and-indent     ^J    Insert a <NL> at the cursor and indent
  3235.                 the new line the same as the preceding line
  3236.  
  3237. next-buffer         ^XX    Bring the next buffer in the list into
  3238.                 the current window
  3239.  
  3240. next-line         ^N    Move the cursor down one line
  3241.  
  3242. next-page         ^V    Move the cursor down one page
  3243.  
  3244. next-paragraph         M-N    Move cursor to the next paragraph
  3245.  
  3246. next-window         ^XO    Move cursor to the next window
  3247.  
  3248. next-word         M-F    Move cursor to the beginning of the
  3249.                 next word
  3250.  
  3251. nop            (none)    Does nothing
  3252.  
  3253. open-line         ^O    Open a line at the cursor
  3254.  
  3255. overwrite-string    (none)    Overwrite a string at the cursor
  3256.  
  3257. pipe-command         ^X@@    Execute an external command and place
  3258.                 its output in a buffer
  3259.  
  3260. pop-buffer        (none)    Display a buffer temporarily, paging
  3261.  
  3262. previous-line         ^P    Move cursor up one line
  3263.  
  3264. previous-page         ^Z    Move cursor up one page
  3265.  
  3266. previous-paragraph     M-P    Move back one paragraph
  3267.  
  3268. previous-window      ^XP    Move the cursor to the last window
  3269.  
  3270. previous-word         M-B    Move the cursor to the beginning of the
  3271.                 word to the left of the cursor
  3272.  
  3273. print            (none)    Display a string on the command line
  3274.                 (a synonim to write-message)
  3275.  
  3276. query-replace-string     M-^R    Replace all of one string with another
  3277.                 string, interactively querying the user
  3278.  
  3279. quick-exit         M-Z    Exit EMACS, writing out all changed buffers
  3280.  
  3281. quote-character      ^Q    Insert the next character literally
  3282.  
  3283. read-file         ^X^R    Read a file into the current buffer
  3284.  
  3285. redraw-display         M-^L    Redraw the display, centering the
  3286.                 current line
  3287.  
  3288. remove-mark        (none)    Remove a numbered mark
  3289.  
  3290. resize-window         ^XW    Change the number of lines in the
  3291.                 current window
  3292.  
  3293. restore-window        (none)    Move cursor to the last saved window
  3294.  
  3295. replace-string         M-R    Replace all occurrences of one string
  3296.                 with another string from the cursor
  3297.                 to the end of the buffer
  3298.  
  3299. reverse-incremental-search^XR    Search backwards, incrementally
  3300.  
  3301. run             M-^E    Execute a named procedure
  3302.  
  3303. save-file         ^X^S    Save the current buffer if it is changed
  3304.  
  3305. save-window        (none)    Remember current window (to restore later)
  3306.  
  3307. scroll-next-up         M-^Z    Scroll the next window up
  3308.  
  3309. scroll-next-down     M-^V    Scroll the next window down
  3310.  
  3311. search-forward         ^S    Search for a string
  3312.  
  3313. search-reverse         ^R    Search backwards for a string
  3314.  
  3315. select-buffer         ^XB    Select a buffer to display in the
  3316.                 current window
  3317.  
  3318. set             ^XA    Set a variable to a value
  3319.  
  3320. set-encryption-key     M-E    Set the encryption key of the current buffer
  3321.  
  3322. set-fill-column      ^XF    Set the current fill column
  3323.  
  3324. set-mark            Set the mark
  3325.  
  3326. shell-command         ^X!    Causes an external shell to execute
  3327.                 a command
  3328.  
  3329. show-files        (none)    Pop up a list of files from the
  3330.                 specified directory
  3331.  
  3332. shrink-window         ^X^Z    Make the current window smaller
  3333.  
  3334. source            (none)    Execute a file as a macro
  3335.  
  3336. split-current-window     ^X2    Split the current window in two
  3337.  
  3338. store-macro        (none)    Store the following macro lines to a
  3339.                 numbered macro
  3340.  
  3341. store-procedure     (none)    Store the following macro lines to a
  3342.                 named procedure
  3343.  
  3344. transpose-characters     ^T    Transpose the character at the cursor
  3345.                 with the character to the left
  3346.  
  3347. trim-region         ^X^T    Trim any trailing white space from a region
  3348.  
  3349. unbind-key         M-^K    Unbind a key from a function
  3350.  
  3351. undent-region         M-)    Remove a leading indent from a region
  3352.  
  3353. universal-argument     ^U    Execute the following command 4 times
  3354.  
  3355. unmark-buffer         M-~    Unmark the current buffer (so it is
  3356.                 no longer changed)
  3357.  
  3358. update-screen        (none)    Force a screen update during macro execution
  3359.  
  3360. view-file         ^X^V    Find a file,and put it in view mode
  3361.  
  3362. widen-from-region     ^X>    restores hidden text (see narrow-to-region)
  3363.  
  3364. wrap-word        (none)    Wrap the current word, this is an
  3365.                 internal function
  3366.         
  3367. write-file         ^X^W    Write the current buffer under a new
  3368.                 file name
  3369.  
  3370. write-message        (none)    Display a string on the command line
  3371.  
  3372. yank             ^Y    yank the kill buffer into the current
  3373.                 buffer at the cursor
  3374. @end(verbatim)
  3375. @appendix(MicroEMACS Bindings)
  3376.  
  3377.     Below is a complete list of the key bindings used in MicroEMACS.
  3378. This can be used as a wall chart reference for MicroEMACS commands.
  3379.  
  3380. @begin(verbatim)
  3381. @center(@b[Default Key Bindings for MicroEmacs 3.11])
  3382.  
  3383.  ^A   Move to start of line          ESC A   Apropos (list some commands)
  3384.  ^B   Move backward by characters     ESC B   Backup by words
  3385.  ^C   Insert space              ESC C   Initial capitalize word
  3386.  ^D   Forward delete              ESC D   Delete forward word
  3387.  ^E   Goto end of line              ESC E   Reset Encryption Key
  3388.  ^F   Move forward by characters      ESC F   Advance by words
  3389.  ^G   Abort out of things          ESC G   Go to a line
  3390.  ^H   Backward delete              
  3391.  ^I   Insert tab/Set tab stops
  3392.  ^J   Insert <NL>, then indent            
  3393.  ^K   Kill forward              ESC K   Bind Key to function
  3394.  ^L   Refresh the screen          ESC L   Lower case word
  3395.  ^M   Insert <NL>              ESC M   Add global mode
  3396.  ^N   Move forward by lines          ESC N   Goto End paragraph
  3397.  ^O   Open up a blank line          
  3398.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  3399.  ^Q   Insert literal              ESC Q   Fill current paragraph
  3400.  ^R   Search backwards              ESC R   Search and replace
  3401.  ^S   Search forward              ESC S   Suspend (BSD only)
  3402.  ^T   Transpose characters               
  3403.  ^U   Repeat command four times       ESC U   Upper case word
  3404.  ^V   Move forward by pages          ESC V   Move backward by pages
  3405.  ^W   Kill region              ESC W   Copy region to kill buffer
  3406.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  3407.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  3408.  
  3409.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  3410.  ESC ^E   Execute named procedure
  3411.  ESC ^F   Goto matching fence          ESC !   Reposition window
  3412.  ESC ^H   Delete backward word          ESC <   Move to start of buffer
  3413.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  3414.  ESC ^L   Reposition window          ESC .  Set mark
  3415.  ESC ^M   Delete global mode          ESC space    Set mark
  3416.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  3417.  ESC ^R   Search & replace w/query      rubout   Backward delete
  3418.  ESC ^S   Source command file
  3419.  ESC ^V   Scroll next window down
  3420.  ESC ^W   Delete Paragraph
  3421.  ESC ^X   Execute command line
  3422.  ESC ^Z   Scroll next window up
  3423.  
  3424.  ^X <    Narrow-to-region       ^X ?   Describe a key
  3425.  ^X >    Widen-from-region       ^X !   Run 1 command in a shell
  3426.  ^X =    Show the cursor position   ^X @@   Pipe shell command to buffer
  3427.  ^X ^    Enlarge display window       ^X #   Filter buffer thru shell filter
  3428.  ^X 0    Delete current window       ^X $   Execute an external program
  3429.  ^X 1    Delete other windows       ^X (   Begin macro
  3430.  ^X 2    Split current window       ^X )   End macro
  3431.                    ^X A   Set variable value
  3432.  ^X ^B     Display buffer list       ^X B   Switch a window to a buffer
  3433.  ^X ^C     Exit MicroEMACS       ^X C   Start a new command processor
  3434.  ^X ^D     Detab line           ^X D   Suspend MicroEMACS (BSD4.2 only)
  3435.  ^X ^E     Entab line           ^X E   Execute macro
  3436.  ^X ^F     Find file           ^X F   Set fill column
  3437.  ^X ^I     Insert file
  3438.                    ^X K   Delete buffer
  3439.  ^X ^L     Lower case region
  3440.  ^X ^M     Delete Mode           ^X M   Add a mode
  3441.  ^X ^N     Move window down       ^X N   Rename current filename
  3442.  ^X ^O     Delete blank lines       ^X O   Move to the next window
  3443.  ^X ^P     Move window up        ^X P   Move to the previous window
  3444.  ^X ^R     Get a file from disk       ^X R   Incremental reverse search
  3445.  ^X ^S     Save current file       ^X S   Incremental forward search
  3446.  ^X ^T     Trim line           (Incremental search
  3447.  ^X ^U     Upper case region          not always available)
  3448.  ^X ^V     View file
  3449.  ^X ^W     Write a file to disk       ^X W   resize Window
  3450.  ^X ^X     Swap "." and mark       ^X X   Use next buffer
  3451.  ^X ^Z     Shrink window           ^X Z   Enlarge display window
  3452.  
  3453. @u(Usable Modes)
  3454. WRAP     Lines going past right margin "wrap" to a new line
  3455. VIEW     Read-Only mode where no modifications are allowed
  3456. CMODE     Change behavior of some commands to work better with C
  3457. EXACT     Exact case matching on search strings
  3458. OVER     Overwrite typed characters instead of inserting them
  3459. CRYPT     Current buffer will be encrypted on write, decrypted on read
  3460. MAGIC     Use regular expression matching in searches
  3461. ASAVE     Save the file every 256 inserted characters
  3462.  
  3463. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK    Sets foreground color
  3464. white/cyan/magenta/yellow/blue/red/green/black    Sets background color
  3465. @end(verbatim)
  3466. @newpage
  3467. @appendix(Numeric Arguments)
  3468. @newpage
  3469. @appendix(Numeric Arguments to Commands)
  3470. @index(numeric arguments)
  3471.  
  3472.     In general, preceding a MicroEMACS command with a numeric argument
  3473. @b(n) causes the command to be executed @b(n) times.  However, there
  3474. are a great many commands for which this has no effect, simply because
  3475. it would make no sense for the command to be executed more than once. 
  3476. There are also commands that take advantage of the numeric arguments to
  3477. alter their behavior subtly or unsubtly.  The following is a list of
  3478. these commands.  Commands that are not affected at all by numeric
  3479. arguments are listed afterwards.
  3480.  
  3481. @begin(description)
  3482. backward-character@\A negative argument invokes @i(forward-character).
  3483.  
  3484. change-screen-size@\With no arguments, the number of rows defaults to
  3485. the largest.  Otherwise, set the screen size to @b(n).
  3486.  
  3487. change-screen-width@\With no arguments, the number of columns defaults to
  3488. the largest.  Otherwise, set the screen width to @b(n).
  3489.  
  3490. clear-and-redraw@\With an argument, centers the window around the
  3491. current cursor position.
  3492.  
  3493. delete-next-character@\A negative argument invokes
  3494. @i(delete-previous-character).
  3495.  
  3496. delete-next-word@\With an argument of 0, will not delete the whitespace
  3497. trailing the deleted word. A negative argument will cause nothing to
  3498. happen.
  3499.  
  3500. delete-previous-character@\A negative argument invokes
  3501. @i(delete-next-character).
  3502.  
  3503. delete-previous-word@\An negative or zero argument will cause nothing to
  3504. happen.
  3505.  
  3506. detab-region@\Without an argument, @i(detab-region) changes hard tabs to
  3507. spaces in the lines between the mark and the cursor.  With an argument
  3508. @b(n), the commands detab @b(n) lines - forward if @b(n) is positive,
  3509. backwards if not.
  3510.  
  3511. end-of-word@\A negative argument invokes @i(next-word).
  3512.  
  3513. entab-region@\Without an argument, @i(entab-region) changes spaces to
  3514. hard tabs in the lines between the mark and the cursor.  With an
  3515. argument @b(n), the commands entab @b(n) lines - forward if @b(n) is
  3516. positive, backwards if not.
  3517.  
  3518. exchange-point-and-mark@\Swap the current cursor position and mark
  3519. number @b(n).  Without an argument, @b(n) defaults to 0.
  3520.  
  3521. exit-emacs@\Providing a numeric argument @b(n) causes two things to
  3522. happen.  First, no checking for modified buffers will occur.  Second,
  3523. MicroEMACS exits with a status of @b(n).
  3524.  
  3525. forward-character@\A negative argument invokes @i(backward-character).
  3526.  
  3527. goto-line@\An argument @b(n) will be taken as the line number to go to. 
  3528. Without an argument, you will be asked for a line number.  In either
  3529. case, the line number must be 1 or greater.
  3530.  
  3531. goto-mark@\Go to mark number @b(n).  Without an argument, @b(n)
  3532. defaults to 0.
  3533.  
  3534. grow-window@\A negative argument invokes @i(shrink-window).  An argument
  3535. of 0 causes no action.
  3536.  
  3537. handle-tab@\Without an argument, @i(handle-tab) deals with the tab
  3538. character, whether it should be a single "hard" tab, or expanded as
  3539. spaces.  With an argument @b(n), $softtab is set to @b(n).
  3540.  
  3541. hunt-backward@\The command will hunt @b(n) times.  The command will
  3542. report failure if it cannot find its pattern the @b(nth) time, even if
  3543. has found an occurrence of the pattern before number @b(n).  A negative
  3544. argument invokes @i(hunt-forward).
  3545.  
  3546. hunt-forward@\The command will hunt @b(n) times.  The command will
  3547. report failure if it cannot find its pattern the @b(nth) time, even if
  3548. has found an occurrence of the pattern before number @b(n).  A negative
  3549. argument invokes @i(hunt-backward).
  3550.  
  3551. kill-to-end-of-line@\With no argument @b(n), the command deletes all
  3552. characters to the end of the line.  If it is already at the end of the
  3553. line, it will delete the newline.  With a positive @b(n) as an
  3554. argument, the command will delete @b(n) complete lines, newline
  3555. character and all, starting from the cursor.  With @b(n) equal to zero,
  3556. the command deletes all text from the cursor to the beginning of the
  3557. line, but will not delete past the newline character.  A negative @b(n)
  3558. is illegal.
  3559.  
  3560. list-buffers@\With a numeric argument, INVISIBLE buffers are also
  3561. listed.
  3562.  
  3563. move-window-down@\With a negative argument, invokes @i(move-window-up).
  3564.  
  3565. move-window-up@\With a negative argument, invokes @i(move-window-down).
  3566.  
  3567. next-buffer@\With an argument @b(n), the @b(nth) buffer after the
  3568. current one is selected, and read in if necessary.  Any buffers in
  3569. between the current buffer and the target buffer that have not yet been
  3570. read in are read.
  3571.  
  3572. next-line@\A negative argument invokes @i(previous-line).
  3573.  
  3574. next-page@\Without an argument, the window is scrolled forward by a
  3575. full page. With an argument @b(n), the window is scrolled forwards by
  3576. @b(n) lines.  Negative arguments invoke @i(previous-page).
  3577.  
  3578. next-paragraph@\A negative argument invokes @i(previous-paragraph).
  3579.  
  3580. next-window@\With a positive argument @b(n), the @b(nth) window from
  3581. the top becomes the working window.  With a negative argument, the
  3582. @b(nth) window from the bottom becomes the working window.
  3583.  
  3584. next-word@\A negative argument invokes @i(next-word).
  3585.  
  3586. previous-line@\A negative argument invokes @i(next-line).
  3587.  
  3588. previous-page@\Without an argument, the window is scrolled backward by a
  3589. full page. With an argument @b(n), the window is scrolled backwards by
  3590. @b(n) lines.  Negative arguments invoke @i(next-page).
  3591.  
  3592. previous-paragraph@\A negative argument invokes @i(next-paragraph).
  3593.  
  3594. previous-window@\With a positive argument @b(n), the @b(nth) window from
  3595. the bottom becomes the working window.  With a negative argument, the
  3596. @b(nth) window from the top becomes the working window.
  3597.  
  3598. previous-word@\A negative argument invokes @i(next-word).
  3599.  
  3600. query-replace-string@\With a numeric argument, @b(n) occurrences of the
  3601. search string may be replaced, depending upon the user's response.  The
  3602. count is based on the number of occurrences found, not the number of
  3603. positive responses from the user.
  3604.  
  3605. quick-exit@\Saves all modifed buffers, and exits with a status of @b(n).
  3606.  
  3607. redraw-display@\With no argument, or when @b(n) is 0, the window
  3608. is adjusted so that the cursor is in the center.  When @b(n) is
  3609. positive, the window is adjusted so that the cursor is on the @b(nth)
  3610. line of the screen.  When @b(n) is negative, the window is adjusted so
  3611. that the cursor is on the last line of the window, regardless of the
  3612. magnitude of @b(n).
  3613.  
  3614. remove-mark@\Remove mark number @b(n).  Without an argument, @b(n)
  3615. defaults to 0. 
  3616.  
  3617. replace-string@\Will replace @b(n) occurrences of the search string with
  3618. the replacement string.  Otherwise, with no argument, all occurrences
  3619. from the cursor position to the end of file are replaced.
  3620.  
  3621. resize-window@\Requires an argument which must be positive.
  3622.  
  3623. scroll-next-down@\Behavior is same as with @i(next-page).
  3624.  
  3625. scroll-next-up@\Behavior is same as with @i(previous-page).
  3626.  
  3627. search-forward@\The command will search @b(n) times.  The command will
  3628. report failure if it cannot find its pattern the @b(nth) time, even if
  3629. has found an occurrence of the pattern before number @b(n).  A negative
  3630. argument invokes @i(search-reverse).
  3631.  
  3632. search-reverse@\The command will search @b(n) times.  The command will
  3633. report failure if it cannot find its pattern the @b(nth) time, even if
  3634. has found an occurrence of the pattern before number @b(n).  A negative
  3635. argument invokes @i(search-forward).
  3636.  
  3637. select-buffer@\Without an argument, the buffer is simply displayed in
  3638. the window.  With an argument, the buffer is not only displayed, but
  3639. also given the attribute INVISIBLE.
  3640.  
  3641. set@\If using the @i(set) command interactively, preceding the command with
  3642. a numeric argument then makes it unecessary for the command to ask for
  3643. the variable's value (it will still ask for the variable's name).  If
  3644. used in a command line, then the command
  3645.  
  3646. @begin(verbatim)
  3647.     set <variable name> <number>
  3648. @end(verbatim)
  3649.  
  3650. is identical to
  3651.  
  3652. @begin(verbatim)
  3653.     <number> set <variable name>
  3654. @end(verbatim)
  3655.  
  3656. set-fill-column@\With an argument, the fill column is set to @b(n).  The
  3657. default argument is 1.
  3658.  
  3659. set-mark@\Set mark number @b(n).  Without an argument, @b(n) defaults to
  3660. 0. 
  3661.  
  3662. shrink-window@\A negative argument invokes @i(shrink-window).  An argument
  3663. of 0 causes no action.
  3664.  
  3665. split-current-window@\With @b(n) = 1, the new upper window becomes the
  3666. current window.  Any other numeric argument makes the new lower
  3667. window the current window.  With no argument, the current window becomes
  3668. the new upper or lower window depending upon whether the cursor was in
  3669. the upper or lower half of the old window.
  3670.  
  3671. store-macro@\Since macroes are numbered, a numeric argument must be
  3672. provided. These numbered macroes are being phased out in preference for
  3673. named macros.
  3674.  
  3675. store-procedure@\If the command is provided a numeric argument, it will
  3676. assume that @i(store-macro) is actually being called.
  3677.  
  3678. trim-region@\Without an argument, @i(trim-region) removes spaces and
  3679. tabs from the end of the lines between the mark and the cursor. With an
  3680. argument @b(n), the commands trim @b(n) lines - forward if @b(n) is
  3681. positive, backwards if not.
  3682. @end(description)
  3683. @appendixsection(Commands unaffected by numeric arguments.)
  3684. @begin(col3)
  3685. abort-command
  3686. add-global-mode
  3687. add-mode
  3688. append-file
  3689. apropos
  3690. back-from-tag-word
  3691. begin-macro
  3692. beginning-of-file
  3693. beginning-of-line
  3694. bind-to-key
  3695. buffer-position
  3696. case-region-lower
  3697. case-region-upper
  3698. change-file-name
  3699. clear-message-line
  3700. copy-region
  3701. count-words
  3702. cycle-screens
  3703. delete-blank-lines
  3704. delete-buffer
  3705. delete-global-mode
  3706. delete-mode
  3707. delete-other-windows
  3708. delete-screen
  3709. delete-window
  3710. describe-bindings
  3711. describe-functions
  3712. describe-key
  3713. describe-variables
  3714. display
  3715. end-macro
  3716. end-of-file
  3717. end-of-line
  3718. execute-command-line
  3719. execute-program
  3720. fill-paragraph
  3721. filter-buffer
  3722. find-file
  3723. find-screen
  3724. goto-matching-fence
  3725. help
  3726. i-shell
  3727. incremental-search
  3728. insert-file
  3729. kill-region
  3730. macro-to-key
  3731. mouse-move-down
  3732. mouse-move-up
  3733. mouse-region-down
  3734. mouse-region-up
  3735. mouse-resize-screen
  3736. name-buffer
  3737. narrow-to-region
  3738. nop
  3739. pipe-command
  3740. pop-buffer
  3741. print
  3742. re-tag-word
  3743. read-file
  3744. restore-window
  3745. reverse-incremental-search
  3746. save-file
  3747. save-window
  3748. set-encryption-key
  3749. shell-command
  3750. suspend-emacs
  3751. tag-word
  3752. transpose-characters
  3753. unbind-key
  3754. unmark-buffer
  3755. update-screen
  3756. view-file
  3757. widen-from-region
  3758. wrap-word
  3759. write-file
  3760. write-message
  3761. @end(col3)
  3762. @newpage
  3763. @appendix(Supported machines)
  3764.  
  3765.     The following table lists all the hardware/compilers for which I
  3766. currently support MicroEMACS. This is not exclusive of all machines
  3767. which MicroEMACS will run on, but I have either run it myself, or had a
  3768. first hand report of it running.
  3769.  
  3770. @begin(verbatim)
  3771. @u(Hardware    OS        Compiler    Comments)
  3772. VAX 780     UNIX V5     native
  3773.         UNIX V7     native
  3774.         BSD 4.2     native        job control supported
  3775.         VMS        native        SMG & ANSI support
  3776.  
  3777. SUN        SUNOS 3 & 4    native
  3778.                 gcc
  3779.  
  3780. NCR Tower    UNIX V5     native
  3781.  
  3782. IBM-RT PC    BSD 4.3     native
  3783.         AIX        native
  3784.  
  3785. HP9000        UNIX V5     native
  3786.  
  3787. Fortune 32:16    UNIX V7     native
  3788.  
  3789. IBM-PC        MSDOS        LATTICE 3    Large CODE/Large DATA
  3790.          2.0 & 3.2    AZTEC 3.4e    Large CODE/Large DATA
  3791.                 TURBO C 2.0    LARGE memory model
  3792.                 MSC 6.0
  3793.                 *MWC 86
  3794.         SCO XENIX    native
  3795.  
  3796. HP150        MSDOS        Lattice 2.15    Function key labels
  3797.                 Turbo C 2.0        for the touch screen
  3798.  
  3799. HP110        MSDOS        Lattice 2.15
  3800.                 Aztec 3.4e
  3801.                 Turbo C 2.0
  3802.  
  3803. *Data General 10
  3804.         MSDOS        Lattice 2.1  Texas Instruments Professional
  3805.         MSDOS        Lattice 2.15
  3806.  
  3807. Amiga        Intuition    Lattice 3.03
  3808.                 Aztec 3.6
  3809.  
  3810. ST520        TOS        Mark Williams C Spawns under MSH
  3811.                 Lattice 3.1    (no shell commands)
  3812.  
  3813. Fujitsu FMR    MSDOS        MSC 6.0
  3814.    series
  3815.  
  3816. NEC 9800    MSDOS        Turbo 2.0    Function key support
  3817.    series            MSC 6.0
  3818.  
  3819. HP3000 series    MPE        native
  3820.  
  3821. @u[Systems to be supported (IE some code is already written:)]
  3822. Macintosh    System 7    Lightspeed C
  3823.  
  3824. *means that I do not own or have access to the listed compiler and/or
  3825.  machine and must rely upon others to help support it. 
  3826. @end(verbatim)
  3827. @newpage
  3828. @appendix(Function Keys)
  3829.  
  3830.     All environments now support a set of machine independant
  3831. bindings for function keys. Below is a list of these bindings (not all
  3832. of these are supported on all systems).
  3833.  
  3834. @begin(verbatim)
  3835.             Function keys in MicroEmacs
  3836.  
  3837.     function    Function    ^function    Alt-function
  3838.  f1)      FN1         S-FN1          FN^1          A-FN1
  3839.  f2)      FN2         S-FN2          FN^2          A-FN2
  3840.  f3)      FN3         S-FN3          FN^3          A-FN3
  3841.  f4)      FN4         S-FN4          FN^4          A-FN4
  3842.  f5)      FN5         S-FN5          FN^5          A-FN5
  3843.  f6)      FN6         S-FN6          FN^6          A-FN6
  3844.  f7)      FN7         S-FN7          FN^7          A-FN7
  3845.  f8)      FN8         S-FN8          FN^8          A-FN8
  3846.  f9)      FN9         S-FN9          FN^9          A-FN9
  3847. f10)      FN0         S-FN0          FN^0          A-FN0
  3848.  
  3849. home)      FN<                  FN^<
  3850. CsUp)      FNP                  FN^P
  3851. PgUp)      FNZ                  FN^Z
  3852. CsLf)      FNB                  FN^B
  3853.  5  )
  3854. CsRt)      FNF                  FN^F
  3855.  End)      FN>                  FN^>
  3856. CsDn)      FNN                  FN^N
  3857. PgDn)      FNV                  FN^V
  3858.  Ins)      FNC                  FN^C
  3859.  Del)      FND                  FN^D
  3860. @end(verbatim)
  3861. @newpage
  3862. @appendix(Machine Dependent Notes)
  3863.  
  3864.     This appendix lists some notes specific to individual
  3865. implementations of MicroEMACS. Every attempt has been made to allow
  3866. EMACS to be identical on all machines, but we have also tried to take
  3867. advantage of function keys, cursor keys, mice, and special screen modes
  3868. where possible.
  3869.  
  3870. @appendixsection(IBM-PC/XT/AT and its clones)
  3871.  
  3872.     The IBM-PC family of computers is supported with a variety of
  3873. different display adapters. EMACS will attempt to discover what adapter
  3874. is connected and use the proper driver for it. Below is a list of the
  3875. currently supported video adapters:
  3876.  
  3877. @begin(verbatim)
  3878. @u(Adapter            $sres        Original mode used)
  3879. Monochrome Graphics Adapter    MONO        MONO
  3880. Color Graphics Adapter        CGA        CGA
  3881.                 CGA40        CGA40
  3882. Enhanced Graphics Adapter    EGA        CGA
  3883. Video Graphics Adapter        VGA        CGA
  3884.                 VGA12
  3885. @end(verbatim)
  3886.  
  3887.     If a driver for a Microsoft compatable mouse is installed on the
  3888. system, EMACS will use the mouse in text mode and allow the user all the
  3889. standard mouse functions. The mouse cursor will appear to be a block of
  3890. color in the color opposite of it's background.
  3891.  
  3892.     EMACS also takes advantage of various function keys and the keys
  3893. on the keypad on an IBM-PC. The function keys are initially not bound
  3894. to any particular functions (except by the emacs.rc startup file), but
  3895. the keypad keys do default to the following:
  3896.  
  3897. @begin(verbatim)
  3898. @u(Keypad key    Function)
  3899. Home        beginning-of-file
  3900. CSRS UP     previous-line
  3901. Pg Up        previous-page
  3902. CSRS LEFT    backward-character
  3903. CSRS RIGHT    forward-character
  3904. End        end-of-file
  3905. CSRS DOWN    next-line
  3906. Pg Dn        Next-page
  3907. @end(verbatim)
  3908.  
  3909.     All these special keys are indicated in EMACS macroes by use of
  3910. the @b(FN) prefix. Below is a list of many of the keys and the codes
  3911. used to specify them. Also the codes may be gotten by using the
  3912. describe-key (^X ?) command on the suspect key.
  3913.  
  3914. @flushleft(@b[Compiling under TURBO C])
  3915.  
  3916.     To compile MicroEMACS under TURBO C, set the TURBO integrated
  3917. environment with the following options:
  3918.  
  3919.     Memory model        LARGE
  3920.     Floating point        NONE
  3921.     Default char type    UNSIGNED
  3922.     Data alignment        BYTE
  3923.     Merge duplicate strings ON
  3924.     Standard stack frame    off
  3925.     Test stack overflow    off
  3926.  
  3927.     Optimize for            SIZE
  3928.     Use register optimization    ON
  3929.     Register optimization        ON
  3930.     Jump optimization        ON
  3931.  
  3932.     Initialize segments    OFF
  3933.     Stack warnings        OFF
  3934.  
  3935.     Names: Code names
  3936.         Segment name    *
  3937. @newpage
  3938. @appendixsection(HP 150)
  3939.  
  3940.     This machine from Hewlett Packard is very unusual for an MSDOS
  3941. machine. It has a touch screen and is very function key oriented. An
  3942. additional command, @i(label-function-key)@index(label-function-key)
  3943. allows you to place labels on the on screen function key labels. A
  3944. numeric argument indicates which function key to label (one through
  3945. eight) and then the program prompts for a 16 character label, which will
  3946. be used as two lines of eight characters. To label function key three
  3947. with "save file" from a macro, you would use:
  3948.  
  3949. @verbatim(3 label-function-key "save    file")
  3950.  
  3951.     Notice the 4 spaces after "save". This forces "file" to begin on
  3952. the second line of the label.
  3953. @newpage
  3954. @appendixsection(Atari 520/1040ST)
  3955.  
  3956.     The ATARI ST family of computers have a dual personality. They
  3957. may use either a monochrome or a color screen. EMACS supports two
  3958. screen resolutions on each monitor. 
  3959.  
  3960. @center(@b[NOTE])
  3961.  
  3962. @quotation(When you set MicroEMACS up on your system, please remember to
  3963. install it on the desktop as a GEM application. If you have EMACS set
  3964. as a TOS application, the mouse will not function properly, and EMACS
  3965. will alert you to this problem by beeping the bell.)
  3966.  
  3967. @begin(verbatim)
  3968. @u(Monitor $sres size #color $palette format)
  3969. Color    LOW    40x25    16    000111222333444555666777
  3970.     MEDIUM    80x25    4    000111222333
  3971. Mono    HIGH    80x25    2    000
  3972.     DENSE    80x50    2    000
  3973. @end(verbatim)
  3974.  
  3975.     The $palette environment variable can be used to change what
  3976. color is associated with each color name. With a color monitor, each
  3977. group of three digits indicates an octal number specifying the RED,
  3978. GREEN and BLUE levels of that color. Each color digit can vary from 0
  3979. to 7. For example, the initial setting of $palette in LOW resolution is:
  3980.  
  3981. @begin(verbatim)
  3982.     000700070770007707077777
  3983.  
  3984.     which broken up is:
  3985.  
  3986.     000 700 070 770 007 707 077 777
  3987.  
  3988.     which means:
  3989.  
  3990.     000    Black
  3991.     700    Red
  3992.     070    Green
  3993.     770    Yellow
  3994.     007    Blue
  3995.     707    Magenta
  3996.     077    Cyan
  3997.     777    White
  3998. @end(verbatim)
  3999.  
  4000.     Also the mouse buttons are bound to mouse functions as
  4001. described in the chapter about mice. The cursor keys and the function
  4002. keys are bound similarly to IBM-PC.
  4003.  
  4004.     Files generated by EMACS on the ATARI ST have a single return
  4005. character at the end of each line, unlike the desktop files which want
  4006. to have two returns. This makes it display files strangely from GEM's
  4007. [SHOW] option, but makes the files port to other computers much nicer.
  4008. When compiling MicroEMACS, the ADDCR symbol in @b(estruct.h) will cause
  4009. emacs to generate line ending sequences compatible with GEM.
  4010.  
  4011.     Currently, when operating under the Mark Williams MSH program,
  4012. EMACS can shell out and perform external commands. This capability will
  4013. be added later for the Beckmeyer shell and under GEMDOS.
  4014. @newpage
  4015. @appendixsection(Amiga 1000)
  4016.  
  4017.     The Commodore AMIGA 1000 version of MicroEMACS does fully
  4018. support the mouse, window resizing and the close gadget. It runs in
  4019. medium resolution, using the colors defined for the workbench. 
  4020.  
  4021. @center(Note about Compiling MicroEMACS)
  4022.  
  4023. @begin(quotation)
  4024.     If you are compiling the sources on the AMIGA to produce an
  4025. executable image, and you are using the Lattice compiler, be sure to
  4026. give the CLI command 'STACK 40000' before compiling to make sure the
  4027. compiler has sufficient stack space to successfully complete
  4028. compilation.
  4029. @end(quotation)
  4030. @newpage
  4031. @appendixsection(UNIX V5, V7, and BSD4.[23])
  4032.  
  4033.     MicroEMACS under UNIX utilizes the @b(TERMCAP) @index(termcap)
  4034. library to provide machine independent screen functions. Make sure that
  4035. termcap is available and properly set on your account before attempting
  4036. to use MicroEMACS. 
  4037.  
  4038.     Under systems which support job control, you can use the
  4039. @b(^XD) @i(suspend-emacs) @index(suspend-emacs) command to place EMACS
  4040. into the background. This carries a much smaller overhead than bringing
  4041. up a new shell under EMACS. EMACS will properly redraw the screen when
  4042. you bring it back to the foreground.
  4043.  
  4044.     If the symbol VT100 has been set to 1 in the @i(estruct.h)
  4045. options file, EMACS will recognize the key sequence <ESC>[ as the lead
  4046. in sequence for the FN function key prefix.
  4047.  
  4048.     With the addition of some very machine/operating system specific
  4049. code, EMACS can prevent two or more people from modifying the same file
  4050. at the same time. @index(file locking) The upper level of a set of
  4051. functions to provide file locking exist in the source file @b(LOCK.C). 
  4052. It requires two machine specific functions written and linked into EMACS
  4053. for it to operate properly. 
  4054.  
  4055. @begin(verbatim)
  4056.     char *dolock(fname)
  4057.  
  4058.     char *fname;
  4059.  
  4060.     dolock() locks a file, preventing others from modifying it. If
  4061.     it succeeds, it returns NULL, otherwise it returns a pointer to
  4062.     a string in the form "LOCK ERROR: explanation".
  4063.  
  4064.     char *undolock(fname)
  4065.  
  4066.     char *fname;
  4067.  
  4068.     undolock() unlocks a file, allowing others to modifying it. If
  4069.     it succeeds, it returns NULL, otherwise it returns a pointer to
  4070.     a string in the form "LOCK ERROR: explanation".
  4071. @end(verbatim)
  4072. @newpage
  4073. @appendixsection(DEC VMS operating system)
  4074.  
  4075. @flushleft(@b[TERMINALS])
  4076.  
  4077.     Depending upon the options set in ESTRUCT.H, MicroEMACS uses
  4078. either the capabilities of VMS SMG, working with any terminal that is
  4079. defined in SMGTERMS.TXT or TERMTABLE.TXT (see your SMG manual for more
  4080. information), or the ANSI escape sequences. Full keyboard support, with
  4081. function keys and everything, is provided for VT100 and VT200 series
  4082. compatible terminals. Mouse support is provided under the ANSI version
  4083. only at this time. Mouse support is provided for the VSII
  4084. workstation's VT220 terminal emulator, and other terminal emulators
  4085. that use the same escape sequences for mouse control. (There is some
  4086. partial support for the BBN BitGraph mouse sequences in the sources,
  4087. but this is not yet complete). Terminals may have up to 100 lines and
  4088. 160 columns. 
  4089.  
  4090.     The maximum terminal size is 256 columns and 72 row. If you
  4091. run MicroEMACS on a terminal that is larger than this, MicroEMACS will
  4092. reduce it to these limits while you are editing.
  4093.  
  4094. @flushleft(@b[Flow control])
  4095.     Some terminals will require the use of XON/XOFF flow control
  4096. when used with MicroEMACS. When XON/XOFF flow control is used, you
  4097. will not be able to use functions bound to ^S or ^Q, and should use
  4098. bind-to-key to put these functions on other keys. MicroEMACS does not
  4099. change the flow control characteristics of your terminal line while it
  4100. is running. If your terminal requires flow control, you should:
  4101.  
  4102.     $ SET TERM/HOSTSYNC/TTSYNC
  4103.  
  4104.     before entering MicroEMACS. If you are on a VSII emulated
  4105. workstation terminal, are using the SSU multi-session protocol (VT330
  4106. and VT340 with SSU enabled), or are certain that your terminal does not
  4107. require XON/XOFF flow control, you should
  4108.  
  4109.     $ SET TERM /HOSTSYNC/NOTTSYNC
  4110.  
  4111.     This will allow you to use ^S and ^Q for MicroEMACS commands.
  4112. Note that if you are using a VSII with VWS V3.2 or later, you must
  4113. leave the /HOSTSYNC enabled in order for the cross/session cut and
  4114. paste capability to work properly.
  4115.  
  4116.  
  4117. @flushleft(@b[KEYBOARD])
  4118.  
  4119.     The VMS version understands the LK201 functions of VT200
  4120. series, vt300 series, and compatible terminals and terminal emulators,
  4121. and allows you to bind to them as function keys. In addition, the
  4122. VT100 numeric keypad, in application mode, is available as function
  4123. keys. MicroEMACS will only put the keypad into application mode for
  4124. you if the KEYPAD option is set in ESTRUCT.H. In this situation,
  4125. MicroEmacs will detect your kepad's state, and restore it to that state
  4126. upon exiting. If MicroEMACS has not been compiled with this option,
  4127. you may still put the keypad into application mode by issuing the
  4128. command "SET TERM /APPLICATION" before entering MicroEMACS. 
  4129.  
  4130. @begin(verbatim)
  4131. @u(VT200 keys)
  4132.  
  4133. Note that F1 through F5 are local function keys on DEC terminals.
  4134.  
  4135. F6         = FN6    FIND = FNS
  4136. FN7        = FN7    INSERT = FNC
  4137. F8         = FN8    REMOVE = FND
  4138. F9         = FN9    SELECT = FN@@
  4139. F10        = FN0    PREV = FNZ
  4140. F11        = S-FN1    NEXT = FNV
  4141. F12        = S-FN2    Arrow Up = FNP
  4142. F13        = S-FN3    Arrow Down = FNN
  4143. F14        = S-FN4    Arrow Right = FNF
  4144. HELP (F15) = S-FN5    Arrow Left = FNB
  4145. DO (F16)   = S-FN6
  4146. F17        = S-FN7
  4147. F18        = S-FN8
  4148. F19        = S-FN9
  4149. F20        = S-FN0
  4150.  
  4151. @u(VT100 and VT200 numeric keypad in application mode)
  4152.  
  4153. PF1 = FN^1    PF2 = FN^2    PF3 = FN^3    PF4   = FN^4
  4154. 7   = A-7    8   = A-8    9   = A-9    -     = A--
  4155. 4   = A-4    5   = A-5    6   = A-6    ,     = A-,
  4156. 1   = A-1    2   = A-2    3   = A-3    ENTER = A-E
  4157. 0   = A-0    .  = A-.
  4158. @end(verbatim)
  4159.  
  4160. @center(@b[WARNING])
  4161.  
  4162. @begin(quotation)
  4163.     The VMS version contains code for interpreting function keys
  4164. that are sent as Ansi sequences that begin with the ESC character. 
  4165. Because of this, MicroEMACS cannot process an incoming ESC until it
  4166. knows what character follows it. This can cause problems with
  4167. terminating search and replace strings. If you use ESC as the
  4168. meta-prefix character (which is the default) you must type one
  4169. additional keystroke following ESC before emacs will recognize that you
  4170. have edited the search command prompt, and are continuing. (The
  4171. additional character is processed normally be MicroEMACS, it is NOT
  4172. discarded.)
  4173.  
  4174.     MicroEMACS must wait long enough for the network delay
  4175. that might be involved between seeing the ESC and seeing the
  4176. characters that follow it. If holding down one of the arrow keys causes
  4177. characters to drop into your file, then you may want to alter the delay
  4178. yourself. The logical variable MICROEMACS$SHORTWAIT may be set to vary
  4179. that delay. The default delay is 400ms (4 tenths of a second). The
  4180. equivalent value in MICROEMACS$SHORTWAIT is 4000000.
  4181. @end(quotation)
  4182.  
  4183. @flushleft(@b[Special case for BBN BItGraph])
  4184.  
  4185.     If you are using the BBN BitGraph, execute the following commands
  4186. before entering MicroEMACS, and you will get mouse support:
  4187.  
  4188. @begin(verbatim)
  4189.     $ esc[0,8] = 27
  4190.     $ microemacs$mouse_enable == esc+":5;6;L"+esc+":0;63;;;;;;;;;9;16;c"
  4191.     $ microemacs$mouse_disable == esc+":5;1;L"+esc+":0;0c"
  4192.     $ exit
  4193. @end(verbatim)
  4194.  
  4195.     Do NOT do this for any other terminals.
  4196.  
  4197. @flushleft(@b[Search List for EMACS.RC])
  4198.  
  4199.     VMS MicroEMACS will first search logical name MICROEMACS$LIB:,
  4200. then SYS$LOGIN:, then the current directory, and finally
  4201. "sys$sysdevice:[vmstools]" when looking for startup files or help files.
  4202.  
  4203.     Please use MICROEMACS$LIB:, and allow the secondary search of
  4204. [vmstools] to become archaic. If desired, MICROEMACS$LIB may be
  4205. defined to be a VMS search list that first searches a user directory,
  4206. and then a system directory. 
  4207.  
  4208.     Generally, you should create a private directory where you keep
  4209. all your .CMD files, and in your LOGIN.COM $DEFINE a logical name to
  4210. point to this area.
  4211.  
  4212.     In addition to whatever commands you have in your EMACS.RC file,
  4213. one command you should certainly include is "set $ssave FALSE". The
  4214. "safe save" mechanism, which writes a buffer to a temporary file,
  4215. deletes the old version of a file, and then moves the temporary file to
  4216. its permanent name, works wonderfully on most systems, but makes no
  4217. sense on VMS, which maintains older versions of a file.
  4218.  
  4219. @flushleft(@b[Using MicroEMACS as a subprocess])
  4220.     MicroEmacs can now be kept in a subprocess. You can arrange to
  4221. start emacs only once in a job, and to re-attach to it each time you
  4222. want to use it. This is optional. To use this feature, install
  4223. MicroEMACS in the following way:
  4224.  
  4225. @begin(verbatim)
  4226. 1. MicroEMACS contains two images. ME.EXE is a small program for
  4227.     starting and stopping the Emacs subprocess. The source for ME.
  4228.     is in ME.C, and should not be linked into MESHR.EXE. MESHR.EXE
  4229.     is the actual MicroEMACS image. The name "MESHR" is required for
  4230.     MAIL/NOTES support, see next section for details.
  4231.  
  4232. 2. Make sure that the SYS$SHARE search list includes MESHR.EXE. If you
  4233.    don't have the privilages to move MESHR.EXE into SYS$SHARE, you
  4234.    can $ DEFINE the MESHR logical name to be the full name and location of
  4235.    the MESHR.EXE program. For example, you could store all of these
  4236.    programs in the MICROEMACS$LIB: search list, and say:
  4237.  
  4238.         $ DEFINE MESHR microemacs$lib:meshr.exe
  4239.  
  4240. 3. Put ME.EXE in MICROEMACS$LIB and the following line in your LOGIN.COM:
  4241.  
  4242.         $ me :== $microemacs$lib:me
  4243.  
  4244. 4. Put a line in your EMACS.RC that will
  4245.  
  4246.         bind-to-key suspend-emacs ^C  ; use your usual exit-emacs key
  4247. @end(verbatim)
  4248.  
  4249.     Now, use the "$ ME" command to invoke microemacs. Subseqeuent
  4250. invocations in the same job will re-use the existing subprocess. You
  4251. can use the full capabilty of the microemacs command line in the first
  4252. and in all subsequent invocations of ME.
  4253.  
  4254.     WARNING:
  4255.  
  4256.     MicroEMACS will ALWAYS read in new copies of any files you
  4257. specify on the command line, even if you are already editing it. If
  4258. you edit a file a second time with the same MicroEMACS, you will get a
  4259. NEW buffer with ANOTHER copy of the file. The old buffer is still
  4260. there also. It is easy, in this situation, to accidently edit in a
  4261. WRONG BUFFER, and if you write out an obsolete buffer, you will loose
  4262. earlier edits!
  4263.  
  4264.     This is considered a bug and may be fixed in a later version of
  4265. MicroEMACS. To avoid this situation, do not specify a file on the
  4266. command line if MicroEMACS already has that file in a buffer. Use the
  4267. "find-file" MicroEMACS command instead.
  4268.  
  4269.  
  4270.     @b(Using MICROEMACS with MAIL and NOTES:)
  4271.  
  4272.     With VMS V5 and later versions, the MAIL interface to
  4273. Microemacs is much simplified. With VMS V5, the MESHR.EXE image does
  4274. NOT have to be installed as a known image to be used as a callable
  4275. editor from MAIL. Therefore, to use MicroEMACS as your VMS MAIL
  4276. editor, simply add the following lines to your LOGIN.COM:
  4277.  
  4278. @begin(verbatim)
  4279.         $ DEFINE MAIL$EDIT CALLABLE_ME
  4280.         $ MAIL :== MAIL/EDIT
  4281. @end(verbatim)
  4282.  
  4283.     and make sure that the SYS$SHARE search list includes
  4284. MESHR.EXE. If you don't have privs or permission to move MESHR.EXE
  4285. into SYS$SHARE, you can $ DEFINE the MESHR logical name to be the full
  4286. name and location of the MESHR.EXE program. For example, you could
  4287. store all of these programs in the MICROEMACS$LIB: search list, and
  4288. say:
  4289.  
  4290.         $ DEFINE MESHR microemacs$lib:meshr.exe
  4291.  
  4292.     Note that this is the same location as is required for using kept
  4293. MicroEMACS.
  4294.  
  4295.     To abort sending a message, exit MicroEMACS without writing out
  4296. the mail message file.
  4297.  
  4298.     To use MicroEMACS as your VAX NOTES editor, issue the following
  4299. command to VAX NOTES:
  4300.  
  4301.         NOTES> SET PROFILE/EDIT=(ME,CALL)
  4302.  
  4303.     Note, if you are still in the dark ages of VMS V4, you will
  4304. have to either install MESHR as a known image, or following the
  4305. original "Second way" instructions given in the existing appendix F.6
  4306. of the older MicroEMACS manual (previous to version 3.10).
  4307.  
  4308. @flushleft(@b[Second way, as described in older versions])
  4309.  
  4310.     In the event that you cannot get your system manager to INSTALL
  4311. MicroEMACS as known image, you can use the following technique:
  4312.  
  4313. @begin(verbatim)
  4314. 1. In MICROEMACS$LIB:MEMAIL.COM, put the following command file:
  4315.  
  4316. $! Use on VAX/VMS as MAIL$EDIT for using MicroEMACS as mail editor.
  4317. $ if "''P1'" .NES. "_NL:" then if "''P1'" .NES. "" then copy 'P1' 'P2'
  4318. $ define/user sys$input sys$output
  4319. $ me 'P2'
  4320. $ exit
  4321.  
  4322. This file may have come with your MicroEMACS kit.
  4323.  
  4324. 2. In your LOGIN.COM, put the following lines:
  4325.  
  4326. $    me :== $MICROEMACS$LIB:MESHR.EXE ! Assumes meshr.exe is there
  4327. $    define mail$edit microemacs$lib:me_edit.com
  4328.  
  4329. 3. In NOTES, give the command
  4330.  
  4331. NOTES> SET PROFILE/EDIT=(@@MicroEMACS$lib:me_edit.com,SPAWN)
  4332.  
  4333. @flushleft(@b[Building MicroEMACS for VMS])
  4334.  
  4335. The configuration options are set in file estruct.h:
  4336.  
  4337. - Under the category of "Machine/OS definitions", set VMS to "1" and all
  4338. others to "0". 
  4339.  
  4340. - Under "Compiler definitions", set all selections to "0". Selecting
  4341. VMS implies that you are using VAXC.
  4342.  
  4343. - Under "Special keyboard definitions", be sure "VT100" is set to "0". 
  4344. This option is not required for the VMS version, it is for other
  4345. systems using ANSI terminal support. VMS in combination with SMG or
  4346. ANSI already handles the special characteristics of Ansi keyboards.
  4347.  
  4348. - Under "Terminal Output definitions", set either ANSI or SMG to "1"
  4349. and all others to "0". As stated previously, only ANSI supports the
  4350. mouse at this time.
  4351.  
  4352. - Under "Configuration options", you may select as you wish, with the
  4353. following notes:
  4354.  
  4355.     - COLOR    support does not exist for VMS, even when using
  4356.         color workstations.
  4357.     - MOUSE    support should be enabled if you have any VSII
  4358.         workstations. Only supported under the ANSI driver.
  4359.     - KEYPAD    support recognises whether your keypad is already
  4360.         in application mode or not, and puts your keypad
  4361.         in its correct state on exit.
  4362.     - XNONOFF    automatically allows you to use control-S or
  4363.         control-Q in MicroEMACS, by disabling the TTSYNC
  4364.         characteristic. This option should not be set if
  4365.         MicroEMACS might be used on DecStations or VT100s.
  4366.         It also should not be used with slow terminals or
  4367.         terminal emulators connected to fast terminal lines.
  4368.     - RMSIO    support should absolutely be used. This option
  4369.         allows the writing and reading of files in VMS's
  4370.         variable-length format, as opposed to STREAM-LF,
  4371.         and cuts down on file writing and reading time by
  4372.         approximately two thirds.
  4373.     - OPTMEM    support may be used on VMS versions 5.0 and higher.
  4374.         It substitutes the C library's memory allocation
  4375.         calls for the native VAX calls, and gives a speed
  4376.         improvement.
  4377. @end(verbatim)
  4378.  
  4379.     If you have MMS, you can use the supplied DESCRIP.MMS to build
  4380. MicroEMACS. Otherwise, the command file MEMAKE.COM has been provided.
  4381. These files assume that you are using SMG as your terminal driver. If
  4382. you are using ANSI, then you must replace SMG with ANSI in the command
  4383. and opt files. If you do not have MMS or are missing MEMAKE.COM,
  4384. simply compile each module with "CC", and link with the command:
  4385.  
  4386.     $ LINK MESHR/OPTION/SHARE
  4387.  
  4388.     Note that the executable filename must end in "SHR" in order
  4389. for MicroEMACS to be used as a callable editor from MAIL or NOTES. 
  4390. (Method 1 above.)
  4391.  
  4392.     If you edit any of the Emacs sources, note that any global or
  4393. external data must be declared as "noshare" in order for the VMS
  4394. callable editor support to work properly. This applies to all global
  4395. data used in the VMS version, but not to routines or to "static "data. 
  4396. The "noshare" declaration is #define'd away on non-VMS systems. If you
  4397. fail to do this, VMS will not allow you to INSTALL MicroEMACS as a
  4398. sharable library.
  4399. @newpage
  4400. @appendix(Mode Flags)
  4401.  
  4402.     The two environment variables, $cmode and $gmode, contain a
  4403. number the corresponds to the modes set for the current buffer and
  4404. the editor as a whole. These are encoded as the sum of the following
  4405. numbers for each of the possible modes:
  4406.  
  4407. @begin(verbatim)
  4408. WRAP      1        Word wrap
  4409. CMODE      2        C indentation and fence match
  4410. SPELL      4        Interactive spell checking (Not Implemented Yet)
  4411. EXACT      8        Exact matching for searches
  4412. VIEW     16        Read-only buffer
  4413. OVER     32        Overwrite mode
  4414. MAGIC     64        Regular expressions in search
  4415. CRYPT    128        Encryption mode active
  4416. ASAVE    256        Auto-save mode
  4417. @end(verbatim)
  4418.  
  4419.     So, if you wished to set the current buffer to have CMODE,
  4420. EXACT, and MAGIC on, and all the others off, you would add up the values
  4421. for those three, CMODE 2  +  EXACT 8  +  MAGIC 64 = 74, and use a
  4422. statement like:
  4423.  
  4424. set $cmode 74
  4425.  
  4426.     or, use the binary or operator to combine the different modes:
  4427.  
  4428. set $cmode &bor &bor 2 8 64
  4429.  
  4430. @flushleft(@big[Internal Flags])
  4431.  
  4432.     Some of the ways EMACS controls its internal functions can be
  4433. modified by the value in the $gflags@index($gflags) environment
  4434. variable. Each bit in this variable will be used to control a
  4435. different function.
  4436.  
  4437. @begin(verbatim)
  4438. GFFLAG        1    If this bit is set to zero, EMACS will not
  4439.             automatically switch to the buffer of the
  4440.             first file after executing the startup macros.
  4441. GFSDRAW        2    If this bit is set to one, supress redraw events.
  4442. @end(verbatim)
  4443.  
  4444. @flushleft(@big[Current buffer flags])
  4445.  
  4446.     The $cbflags@index($cbflags) environment variable allows the
  4447. user to modify some of the characteristics of the current buffer. The
  4448. various characteristics are encoded as the sum of the following
  4449. numbers:
  4450.  
  4451. @begin(verbatim)
  4452. BFINVS        1    Internal invisible buffer
  4453. BFCHG        2    Changed since last write
  4454. BFTRUNC     4    buffer was truncated when read
  4455. BFNAROW     8    buffer has been narrowed
  4456. @end(verbatim)
  4457.  
  4458.     Only the invisible and changed flags can be modified by setting
  4459. the $cbflags variable. The truncated file and narrowed flags are read
  4460. only.
  4461.