home *** CD-ROM | disk | FTP | other *** search
/ ftp.cse.unsw.edu.au / 2014.06.ftp.cse.unsw.edu.au.tar / ftp.cse.unsw.edu.au / pub / doc / manuals / uemacs.ms < prev   
Encoding:
Text File  |  1992-10-18  |  99.2 KB  |  3,457 lines

  1. .nr PO 3.5c
  2. .de sf
  3. .in +.2i
  4. ..
  5. .de sb
  6. .in -.2i
  7. ..
  8. .DS C
  9. .sp 2i
  10. .ps +9
  11. MicroEMACS
  12. .ps -9
  13. .sp
  14. Full Screen Text Editor
  15. Reference Manual (preliminary draft)
  16. .sp
  17. Version 3.8i
  18. April 27, 1987
  19. .sp
  20. (C)opyright 1987 by Daniel M. Lawrence
  21. Reference Manual (C)opyright 1987
  22. .ti +4
  23. by Brian Straight and Daniel M. Lawrence
  24. All Rights Reserved
  25. .sp
  26. .I
  27. MicroEMACS 3.8i can be copied and distributed freely
  28. for any non-commercial purposes. MicroEMACS 3.8i can
  29. only be incorporated into commercial software with
  30. the permission of the current author.)
  31. .R
  32. .DE
  33. .bp
  34. .SH
  35. Introduction
  36. .sf
  37. .PP
  38. MicroEMACS is a tool for creating and changing documents,
  39. programs, and other text files.  It is both relatively easy for the
  40. novice to use, but also very powerful in the hands of an expert.
  41. MicroEMACS can be extensively customized for the needs of the
  42. individual user.
  43. .PP
  44. MicroEMACS allows several files to be edited at the same time.
  45. The screen can be split into different windows, and text may be moved
  46. freely from one window to the next.  Depending on the type of file being
  47. edited, MicroEMACS can change how it behaves to make editing simple. 
  48. Editing standard text files, program files and word processing documents
  49. are all possible at the same time.
  50. .PP
  51. There are extensive capabilities to make word processing and
  52. editing easier.  These include commands for string searching and
  53. replacing, paragraph reformatting and deleting, automatic word wrapping,
  54. word move and deletes, easy case controlling, and automatic word counts.
  55. .PP
  56. For complex and repetitive editing tasks editing macros can be
  57. written.  These macros allow the user a great degree of flexibility in
  58. determining how MicroEMACS behaves.  Also any and all the commands can
  59. be used by any keystroke by changing, or rebinding, what commands
  60. various keys are connected, or bound, to. 
  61. .PP
  62. Special features are also available to perform a diverse set of
  63. operations such as file encryption, automatic backup file generation,
  64. entabbing and detabbing lines, executing of DOS commands and filtering
  65. of text through other programs (like SORT to allow sorting text).
  66. .sb
  67. .SH
  68. History
  69. .sf
  70. .PP
  71. EMACS was originally a text editor written by Richard Stahlman
  72. at MIT in the early 1970s for Digital Equipment computers. Various
  73. versions, rewrites and clones have made an appearance since.
  74. .PP
  75. This version of MicroEMACS is derived from code written by Dave
  76. G.  Conroy in 1985.  Later modifications were performed by Steve Wilhite
  77. and George Jones.  In December of 1985 Daniel Lawrence picked up the
  78. then current source (version 2.0) and has made extensive modifications
  79. and additions to it over the course of the next two years.  Updates and
  80. support for the current version is still in progress.  The current
  81. program author can be contacted by writing to:
  82. .sp
  83. .in +8
  84. .IP USMAIL: 12
  85. Daniel Lawrence
  86. 617 New York St
  87. Lafayette, IN 47901
  88. .IP UUCP:
  89. ihnp4!pur-ee!pur-phy!duncan!lawrence
  90. .nr PD 0
  91. .IP ARPA:
  92. nwd@j.cc.purdue.edu
  93. .IP FIDO:
  94. Fido 201/2 The Programmer's Room (317) 742-5533
  95. .nr PD 0.3vs
  96. .in -8
  97. .sb
  98. .bp
  99. .SH
  100. Basic Concepts
  101. .sf
  102. .PP
  103. The current version of MicroEMACS is 3.8i (Third major re-write,
  104. eighth public release, Ith (or ninth) minor release), and for the rest of
  105. this document, we shall simply refer to this version as "EMACS".  Any
  106. modifications for later versions will be listed in the appendixes at the
  107. end of this manual. 
  108. .SH
  109. Keys and the Keyboard
  110. .sf
  111. .PP
  112. Many times throughout this manual we will be talking about
  113. .I "special keys"
  114. commands and the keys on the keyboard needed use
  115. them.  There are a number of "special" keys which can be used and are
  116. listed here:
  117. .sp
  118. .IP "<NL>" 15
  119. NewLine which is also called RETURN or ENTER, this key is used to
  120. end different commands. 
  121. .IP "^"
  122. The control key can be used before any alphabetic character and some
  123. symbols.  For example, ^C means to hold down the <CONTROL> key and type
  124. the C key at the same time. 
  125. .IP "^X"
  126. The CONTROL-X key is used at the beginning of many different commands. 
  127. .IP "META or M-"
  128. This is a special EMACS key used to begin many commands as well.
  129. This key is pressed, and then released before
  130. typing the next character.  On most systems, this is the <ESC> key, but
  131. it can be changed.  (consult appendix D to learn what key is used for
  132. META on your computer).
  133. .sp
  134. .LP
  135. Whenever a command is described, the manual will list the actual
  136. keystrokes needed to execute it in
  137. .B "boldface"
  138. using the above conventions, and also the name of the command in
  139. .I "italics."
  140. .sb
  141. .SH
  142. Getting Started
  143. .sf
  144. .PP
  145. In order to use EMACS, you must call it up from your system's or
  146. computer's command prompt.  On UNIX and MSDOS machines, just type
  147. "emacs" from the main command prompt and follow it with the <RETURN> or
  148. <ENTER> key (we will refer to this key as <NL> for "new-line" for the
  149. remainder of this manual).  On the Macintosh, the Amiga, the ATARI ST
  150. and other icon based operating systems, double click on the uEMACS icon.
  151. Shortly after this, a screen similar to the one below should appear.
  152. .sb
  153. .SH
  154. Parts and Pieces
  155. .sf
  156. .PP
  157. The screen is divided into a number of areas or 
  158. .B "windows."
  159. On some systems the top window contains a function list of unshifted and
  160. shifted function keys.  We will discuss these keys later. 
  161. Below them is an EMACS
  162. .B "mode line"
  163. which, as we will
  164. see, informs you of the present mode of operation of the editor -- for
  165. example "(WRAP)" if you set EMACS to wrap at the end of each line. 
  166. Under the mode line is the
  167. .B "text window"
  168. where text appears and is manipulated.
  169. Since each window has its own mode line,
  170. below the text window is it's mode line.
  171. The last line of the screen is the
  172. .B "command line"
  173. where EMACS takes commands and reports on what it is doing. 
  174. .KS
  175. .TS
  176. tab(;);
  177. r1 l1 r1 l1 c1 r1 l1 r1 l1
  178. r1 l1 r1 l1 c1 r1 l1 r1 l1
  179. r1 l1 r1 l1 c1 r1 l1 r1 l1
  180. r1 l1 r1 l1 c1 r1 l1 r1 l1
  181. r1 l1 r1 l1 c1 r1 l1 r1 l1
  182. l s s s s s s s s
  183. l s s s s s s s s.
  184. =
  185. f1;search;f2;search back;:;F1;toggle function list;F2;toggle help file
  186. f3;hunt;f4;hunt back;:;F3;find command/apropos;F4;describe key
  187. f5;next window;f6;exec macro;:;F5;reformat paragragh;F6;ref undented region 
  188. f7;find file;f8;exec file;:;F7;indent region;F8;undent region
  189. f9;save file;f10;exit emacs;:;F9;execute DOS command;F10;shell up
  190. =
  191.  -- MicroEMACS 3.8i () -- Function Keys ---------------------------------------
  192. =
  193. .sp 1i
  194. =
  195.  -- MicroEMACS 3.8i () -- Main ------------------------------------------------
  196. =
  197. .TE
  198. .sp
  199. .IP "Fig 1:" 10
  200. EMACS screen on an IBM-PC
  201. .KE
  202. .sb
  203. .SH
  204. Entering Text
  205. .sf
  206. .PP
  207. Entering text in EMACS is simple.  Type the following sentence fragment:
  208. .IP
  209. .I
  210. Fang Rock lighthouse, center of a series of mysterious and
  211. .R
  212. .LP
  213. The text is displayed at the top of the text window.  Now type:
  214. .IP
  215. .I
  216. terrifying events at the turn of the century
  217. .R
  218. .LP
  219. Notice the text to the left of the cursor disappears and a '$' sign
  220. appears.  Don't panic--your text is safe!!! You've just discovered that
  221. EMACS doesn't "wrap" text to the next line like most word processors
  222. unless you hit <NL>.  But since EMACS is used for both word processing,
  223. and text editing, it has a bit of a dual personality.  You can change
  224. the way it works by setting various
  225. .B "modes."
  226. In this case, you need to set
  227. .B "WRAP"
  228. mode, using the
  229. .I "add-mode"
  230. command, by typing
  231. .B "^X-M."
  232. The command line at the
  233. base of the screen will prompt you for the mode you wish to add.*
  234. .FS
  235. * In some versions of EMACS,
  236. .B "WRAP"
  237. is a default mode in which case you don't
  238. have to worry about the instructions relating to adding this mode.
  239. .FE
  240. Type
  241. .B "wrap"
  242. followed by the <NL> key and any text you now enter will be
  243. wrapped.  However, the command doesn't wrap text already entered.  To
  244. get rid of the truncated line, delete characters with the <BACKSPACE>
  245. key until the '$' goes away.  Now type in the words you deleted, watch
  246. how EMACS goes down to the next line at the right time.
  247. .PP
  248. Now let's type a longer insert.  Hit <NL> a couple of times to tab
  249. down from the text you just entered.  Now type the following paragraphs. 
  250. Press <NL> twice to indicate a paragraph break. 
  251. .IP
  252. .I
  253. Fang Rock lighthouse, center of a series of mysterious and
  254. terrifying events at the turn of the century, is built on a rocky island
  255. a few miles of the Channel coast.  So small is the island that wherever
  256. you stand its rocks are wet with sea spray. 
  257. .sp .5
  258. The lighthouse tower is in the center of the island.  A steep flight of
  259. steps leads to the heavy door in its base.  Winding stairs lead up to
  260. the crew room.
  261. .R
  262. .sb
  263. .SH
  264. Basic cursor movement
  265. .sf
  266. .PP
  267. Now let's practice moving around in this text.  To move the cursor back
  268. to the word "Winding," enter
  269. .B "M-B"
  270. .I "previous-word."
  271. This command moves the cursor backwards by one
  272. word at a time.  Note you have to press the key combination every time
  273. the cursor steps back by one word.  Continuously pressing META and
  274. toggling B produces an error message.  To move forward to the word
  275. "stairs" enter 
  276. .B "M-F,"
  277. which moves the cursor forward by one word at a time. 
  278. .PP
  279. Notice that EMACS commands are usually mnemonic -- F for forward, B for
  280. backward, for example.
  281. .PP
  282. To move the cursor up one line, enter
  283. .B "^P"
  284. .I "previous-line,"
  285. down one line
  286. .B "^N"
  287. .I "next-line."
  288. Practice this movement by moving the cursor to the word
  289. "terrifying" in the second line. 
  290. .PP
  291. The cursor may also be moved forward or backward in smaller increments. 
  292. To move forward by one character, enter
  293. .B "^F"
  294. .I "forward-character,"
  295. to move backward,
  296. .B "^B"
  297. .I "backward-character."
  298. EMACS also allows
  299. you to specify a number which is normally used to tell a command to
  300. execute many times.  To repeat most commands, press META and then the
  301. number before you enter the command.  Thus, the command META 5 ^F
  302. .B "M-5^F"
  303. will move the cursor forward by five characters.  Try moving
  304. around in the text by using these commands.  For extra practice, see how
  305. close you can come to the word "small" in the first paragraph by giving
  306. an argument to the commands listed here. 
  307. .PP
  308. Two other simple cursor commands that are useful to help us move around
  309. in the text are
  310. .B "M-N"
  311. .I "next-paragraph"
  312. which moves the cursor to the second paragraph, and
  313. .B "M-P"
  314. .I "previous-paragraph"
  315. which moves it back to the previous paragraph.
  316. The cursor may also be moved rapidly from one
  317. end of the line to the other.  Move the cursor to the word "few" in the
  318. second line.  Press
  319. .B "^A"
  320. .I "beginning-of-line."
  321. Notice the cursor moves to the word "events"
  322. at the beginning of the line.  Pressing
  323. .B "^E"
  324. .I "end-of-line"
  325. moves the cursor to the end of the line. 
  326. .PP
  327. Finally, the cursor may be moved from any point in the file to the end
  328. or beginning of the file.  Entering
  329. .B "M->"
  330. .I "end-of-file"
  331. moves the cursor to the end of the buffer,
  332. .B "M-<"
  333. .I "beginning-of-file"
  334. to the first character of the file. 
  335. .PP
  336. On the IBM-PC, the ATARI ST and many other machines, the cursor keys
  337. can also be used to move the cursor about.  Also, if
  338. there is one available, moving the mouse will move the cursor.
  339. .PP
  340. Practice moving the cursor in the text until you are comfortable with
  341. the commands we've explored in this chapter.
  342. .sb
  343. .SH
  344. Saving your text
  345. .sf
  346. .PP
  347. When you've finished practicing cursor movement, save your file.
  348. Your file currently resides in a
  349. .B "BUFFER."
  350.  The buffer is a
  351. temporary storage area for your text, and is lost when the computer is
  352. turned off.  You can save the buffer to a file by entering
  353. .B "^X-^S"
  354. .I "save-file."
  355. Notice that EMACS informs you that
  356. your file has no name and will not let you save it. 
  357. .PP
  358. To save your buffer to a file with a different name than it's current
  359. one (which is empty), press
  360. .B "^X^W"
  361. .I "write-file."
  362. EMACS will prompt you for the filename you wish to write.  Enter the
  363. name
  364. .B "fang.txt"
  365. and press return.  On a micro, the drive light will
  366. come on, and EMACS will inform you it is writing the file.  When it
  367. finishes, it will inform you of the number of lines it has written to
  368. the disk. 
  369. .PP
  370. Congratulations!! You've just saved your first EMACS file!
  371. .sb
  372. .SH
  373. Summary
  374. .sf
  375. .PP
  376. In this chapter, you learned how to enter text, how
  377. to use wrap mode, how to move the cursor, and to save a buffer.  The
  378. following is a table of the commands covered in this chapter and their
  379. corresponding key bindings:
  380. .KS
  381. .TS
  382. tab(;);
  383. l l l
  384. lfI lfB l.
  385. Key Binding;Keystroke;Effect
  386. _
  387. abort-command;^G;aborts current command
  388. .sp .5
  389. add-mode;^XM;allows addition of EMACS mode such as \fBWARP\fR
  390. .sp .5
  391. backward-character;^B;moves cursor left one character
  392. .sp .5
  393. beginning-of-file;M-<;moves cursor to beginning of file
  394. .sp .5
  395. beginning-of-line;^A;moves cursor to beginning of line
  396. .sp .5
  397. end-of-file;M->;moves cursor to end of file
  398. .sp .5
  399. end-of-line;^E;moves cursor to end of line
  400. .sp .5
  401. forward-character;^F;moves cursor right one character
  402. .sp .5
  403. next-line;^N;moves cursor to next line
  404. .sp .5
  405. next-paragraph;M-N;moves cursor to next paragraph
  406. .sp .5
  407. next-word;M-F;moves cursor forward one word
  408. .sp .5
  409. previous-line;^P;moves cursor backward by one line
  410. .sp .5
  411. previous-paragraph;M-P;moves cursor to previous paragraph
  412. .sp .5
  413. previous-word;M-B;moves cursor backward by one word
  414. .sp .5
  415. save-file;^X-^S;saves current buffer to a file
  416. .sp .5
  417. write-file;^X-^W;save current buffer under a new name
  418. .TE
  419. .KE
  420. .sb
  421. .sb
  422. .bp
  423. .SH
  424. Basic Editing--Simple Insertions and Deletions
  425. .sf
  426. .SH
  427. A Word About Windows, Buffers, Screens, and Modes
  428. .sf
  429. .PP
  430. In the first chapter, you learned how to create and save a file in
  431. EMACS.    Let's do some more editing on this file.  Call up emacs by
  432. typing in the following command.
  433. .IP
  434. .B "emacs fang.txt"
  435. .LP
  436. On icon oriented systems, double click on the uEMACS icon, usually a
  437. file dialog box of some sort will appear.  Choose
  438. .B "FANG.TXT"
  439. from the appropriate folder.
  440. .PP
  441. Shortly after you invoke EMACS, the text should appear on the screen
  442. ready for you to edit.  The text you are looking at currently resides in a
  443. .B "buffer."
  444. A buffer is a temporary area of computer memory which is
  445. the primary unit internal to EMACS -- this is the place
  446. where EMACS goes to work.  The mode line at the bottom of the screen
  447. lists the buffer name,
  448. .B "FANG.TXT"
  449. and the name of the file with which this buffer is associated,
  450. .B "FANG.TXT."
  451. .PP
  452. The computer talks to you through the use of its
  453. .B "screen."
  454. This screen usually has an area of 24 lines each of 80
  455. characters across.  You can use EMACS to subdivide the screen into
  456. several separate work areas, or
  457. .B "windows,"
  458. each of which can be 'looking into' different files or sections of text.
  459. Using windows, you can work on several related texts at one time, copying and
  460. moving blocks of text between windows with ease.  To keep track of what
  461. you are editing, each window is identified by a
  462. .B "mode line"
  463. on the last line of the window which lists the name of the
  464. .B "buffer"
  465. which it is looking into, the file from which the
  466. text was read, and how the text is being edited. 
  467. .PP
  468. An EMACS
  469. .B "mode"
  470. tells EMACS how to deal with user input.  As we have
  471. already seen, the mode 'WRAP' controls how EMACS deals with long lines
  472. (lines with over 79 characters) while the user is typing them in.  The
  473. 'VIEW' mode, allows you to read a file without modifying it.  Modes are
  474. associated with buffers and not with files; hence, a mode needs to be
  475. explicitly set or removed every time you edit a file.  A new file read
  476. into a buffer with a previously specified mode will be edited under this
  477. mode.  If you use specific modes frequently, EMACS allows you to set
  478. the modes which are used by all new buffers, called
  479. .B "global"
  480. modes.
  481. .sb
  482. .SH
  483. Insertions
  484. .sf
  485. .PP
  486. Your previously-saved text should look like this:
  487. .IP
  488. .I
  489. Fang Rock lighthouse, center of a series of mysterious and
  490. terrifying events at the turn of the century, is built on a rocky island
  491. a few miles of the Channel coast.  So small is the island that wherever
  492. you stand its rocks are wet with sea spray. 
  493. .sp
  494. The lighthouse tower is in the center of the island.  A steep flight of
  495. steps leads to the heavy door in its base.  Winding stairs lead up to
  496. the crew room.
  497. .LP
  498. .R
  499. Let's assume you want to add a sentence in the second paragraph after
  500. the word "base."  Move the cursor until it is on the "W" of "Winding".
  501. Now type the following:
  502. .IP
  503. .I
  504. This gives entry to the lower floor where the big steam
  505. generator throbs steadily away, providing power for the electric
  506. lantern.
  507. .LP
  508. .R
  509. If the line fails to wrap and you end up with a '$' sign in the right
  510. margin, just enter
  511. .B "M-Q"
  512. .I "fill-paragraph"
  513. to reformat the paragraph.  This new command attempts to fill out a
  514. paragraph.  Long lines are divided up, and words are shuffled around to
  515. make the paragraph look nicer. 
  516. .PP
  517. Notice that all visible EMACS characters are self-inserting -- all you
  518. had to do was type the characters to insert and the existing text made
  519. space for it.  With a few exceptions discussed later, all non-printing
  520. characters (such as control or escape sequences) are commands.  To
  521. insert spaces, simply use the space bar.  Now move to the first line of
  522. the file and type
  523. .B "^O"
  524. .I "open-line"
  525. (Oh, not zero). 
  526. You've just learned how to insert a blank line in your text. 
  527. .sb
  528. .SH
  529. Deletions
  530. .sf
  531. .PP
  532. EMACS offers a number of deletion options.  For example, move the cursor
  533. until it's under the period at the end of the insertion you just did. 
  534. Press the backspace key.  Notice the "n" on "lantern" disappeared.  The
  535. backspace implemented on EMACS is called a
  536. .B "destructive"
  537. backspace -- it
  538. removes text immediately before the current cursor position from the
  539. buffer.  Now type
  540. .B "^H"
  541. .I "delete-previous-character."
  542. Notice that the cursor moves back
  543. and obliterates the "r" -- either command will backspace the cursor. 
  544. .PP
  545. Type in the two letters you erased to restore your text and move the
  546. cursor to the beginning of the buffer
  547. .B "M->"
  548. .I "beginning-of-file."
  549. Move the cursor down one line to the
  550. beginning of the first paragraph. 
  551. .PP
  552. To delete the forward character, type
  553. .B "^D"
  554. .I "delete-next-character."
  555. The "F" of "Fang" disappears.  Continue to type
  556. .B "^D"
  557. until the whole word is erased EMACS also permits the
  558. deletion of larger elements of text.  Move the cursor to the word
  559. "center" in the first line of text.  Pressing
  560. .B "M-<backspace>"
  561. .I "delete-previous-word"
  562. kills the word immediately before the cursor.
  563. .B "M-^H"
  564. has the same effect. 
  565. .PP
  566. Notice that the commands are very similar to the control commands you
  567. used to delete individual letters.  As a general rule in EMACS, control
  568. sequences affect small areas of text, META sequences larger areas.  The
  569. word forward of the cursor position can therefore be deleted by typing
  570. .B "M-D"
  571. .I "delete-next-word."
  572. Now let's take out the remainder of the first line by typing
  573. .B "^K"
  574. .I "kill-to-end-of-line."
  575. You now have a blank line at the top of your screen.  Typing
  576. .B "^K"
  577. again or
  578. .B "^X-^O"
  579. .I "delete-blank-lines"
  580. deletes the blank line
  581. and flushes the second line to the top of the text.  Now exit EMACS by typing
  582. .B "^X-^C"
  583. .I "exit-emacs."
  584. Notice EMACS
  585. reminds you that you have not saved your buffer.  Ignore the warning and
  586. exit.  This way you can exit EMACS without saving any of the changes you
  587. just made. 
  588. .sb
  589. .SH
  590. Summary
  591. .sf
  592. .PP
  593. In this chapter, you learned about the basic 'building
  594. blocks' of an EMACS text file--buffers, windows, and files. 
  595. .KS
  596. .TS
  597. tab(;);
  598. l l l
  599. lfI lfB lw(3i).
  600. Key Binding;Keystroke;Effect
  601. _
  602. delete-previous-character;^H;T{
  603. deletes character immediately before the current cursor position
  604. T}
  605. .sp .5
  606. delete-next-character;^D;T{
  607. deletes character immediately after current cursor position
  608. T}
  609. .sp .5
  610. delete-previous-word;M-^H;T{
  611. deletes word immediately before current cursor position
  612. T}
  613. .sp .5
  614. delete-next-word;M-D;T{
  615. deletes word immediately after current cursor position
  616. T}
  617. .sp .5
  618. kill-to-end-of-line;^K;T{
  619. deletes from current cursor position to end of line
  620. T}
  621. .sp .5
  622. insert-space;^C;inserts a space to right of cursor
  623. .sp .5
  624. open-line;^O;inserts blank line
  625. .sp .5
  626. delete-blank-lines;^X-^O;removes blank line
  627. .sp .5
  628. exit-emacs;^X-^C;exits emacs
  629. .TE
  630. .KE
  631. .sb
  632. .sb
  633. .bp
  634. .SH
  635. Using Regions
  636. .sf
  637. .SH
  638. Defining and Deleting a Region
  639. .sf
  640. .PP
  641. At this point its time to familiarize ourselves with two more EMACS
  642. terms -- the
  643. .B "point"
  644. and the
  645. .B "mark."
  646. The point is located directly
  647. .I "point"
  648. behind the current cursor position.  The mark
  649. (as we shall see shortly) is user defined.  These two elements together
  650. are called the current
  651. .B "region"
  652. and limit the
  653. .B "region"
  654. of text on which EMACS performs many of its editing functions. 
  655. .PP
  656. Let's begin by entering some new text.  Don't forget to add
  657. .B "wrap"
  658. mode if its not set on this buffer.  Start EMACS and open a file called
  659. .B "PUBLISH.TXT."
  660. Type in the following text:
  661. .IP
  662. .I
  663. One of the largest growth areas in personal computing is
  664. electronic publishing.  There are packages available for practically
  665. every machine from elegantly simple programs for the humble Commodore 64
  666. to sophisticated professional packages for PC and Macintosh computers. 
  667. .sp
  668. Electronic publishing is as revolutionary in its way as the Gutenburg
  669. press.  Whereas the printing press allowed the mass production and
  670. distribution of the written word, electronic publishing puts the means
  671. of production in the hands of nearly every individual.  From the class
  672. magazine to the corporate report, electronic publishing is changing the
  673. way we produce and disseminate information. 
  674. .sp
  675. Personal publishing greatly increases the utility of practically every
  676. computer.  Thousands of people who joined the computer revolution of
  677. this decade only to hide their machines unused in closets have
  678. discovered a new use for them as dedicated publishing workstations.
  679. .LP
  680. .R
  681. Now let's do some editing.  The last paragraph seems a little out of
  682. place.  To see what the document looks like without it we can cut it
  683. from the text by moving the cursor to the beginning of the paragraph. 
  684. Enter
  685. .B "M-<space>"
  686. .I "set-mark."
  687. EMACS will respond
  688. with "[Mark set]".  Now move the cursor to the end of the paragraph. 
  689. You have just defined a region of text.  To remove this text from the
  690. screen, type
  691. .B "^W"
  692. .I "kill-region."
  693. The paragraph disappears from the screen. 
  694. .PP
  695. On further consideration, however, perhaps the paragraph we cut wasn't
  696. so bad after all.  The problem may have been one of placement.  If we
  697. could tack it on to the end of the first paragraph it might work quite
  698. well to support and strengthen the argument.  Move the cursor to the end
  699. of the first paragraph and enter
  700. .B "^Y"
  701. .I "yank."
  702. Your text should now look like this:
  703. .IP
  704. .I
  705. One of the largest growth areas in personal computing is
  706. electronic publishing.  There are packages available for practically
  707. every machine from elegantly simple programs for the humble Commodore 64
  708. to sophisticated professional packages for PC and Macintosh computers. 
  709. Personal publishing greatly increases the utility of practically every
  710. computer.  Thousands of people who joined the computer revolution of
  711. this decade only to hide their machines unused in closets have
  712. discovered a new use for them as dedicated publishing workstations. 
  713. .sp
  714. Electronic publishing is as revolutionary in its way as the Gutenburg
  715. press.  Whereas the printing press allowed the mass production and
  716. distribution of the written word, electronic publishing puts the means
  717. of production in the hands of nearly every individual.    From the class
  718. magazine to the corporate report, electronic publishing is changing the
  719. way we produce and disseminate information.
  720. .LP
  721. .R
  722. .sb
  723. .SH
  724. Yanking a Region
  725. .sf
  726. .PP
  727. The text you cut initially didn't simply just disappear, it was cut into
  728. a buffer that retains the 'killed' text appropriately called the
  729. .B "kill buffer."
  730. .B  "^Y"
  731. "yanks" the text back from this buffer into the current
  732. buffer. If you have a long line (indicated, remember, by the "$"
  733. sign), simply hit
  734. .B "M-Q"
  735. to reformat the paragraph. 
  736. .PP
  737. There are other uses to which the kill buffer can be put.  Using the
  738. method we've already learned, define the last
  739. paragraph as a region.  Now type
  740. .B "M-W"
  741. .I "copy-region."
  742. Nothing seems to have happened; the cursor stays
  743. blinking at the point.  But things have changed, even though you may not
  744. be able to see any alteration. 
  745. .PP
  746. To see what has happened to the contents of the kill buffer, move the
  747. cursor down a couple of lines and "yank" the contents of the kill buffer
  748. back with
  749. .B "^Y."
  750. Notice the last paragraph is now repeated.  The
  751. region you defined is "tacked on" to the end of your file because
  752. .B "M-W"
  753. .B "copies"
  754. a region to the kill buffer while leaving the
  755. original text in your working buffer.  Some caution is needed however,
  756. because the contents of the kill buffer are updated when you delete any
  757. regions, lines or words.  If you are moving large quantities of text,
  758. complete the operation before you do any more deletions or you could
  759. find that the text you want to move has been replaced by the most recent
  760. deletion.  Remember--a buffer is a temporary area of computer memory
  761. that is lost when the machine is powered down or switched off.  In order
  762. to make your changes permanent, they must be saved to a file before you
  763. leave EMACS.  Let's delete the section of text we just added and save
  764. the file to disk. 
  765. .sb
  766. .SH
  767. Summary
  768. .sf
  769. .PP
  770. In this chapter, you learned how to achieve longer insertions
  771. and deletions.  The EMACS terms
  772. .B "point"
  773. and
  774. .B "mark"
  775. were introduced and you learned how to manipulate text with the kill buffer. 
  776. .KS
  777. .TS
  778. tab(;);
  779. l l l
  780. lfI lfB lw(3i).
  781. Key Binding;Keystroke;Effect
  782. _
  783. Delete-Region;^W;T{
  784. Deletes region between point and mark and places it in KILL buffer
  785. T}
  786. .sp .5
  787. Copy-Region;M-W;T{
  788. Copies text between point and mark into KILL buffer
  789. T}
  790. .sp .5
  791. Yank-Text;^Y;T{
  792. Inserts a copy of the KILL buffer into current buffer at point
  793. T}
  794. .TE
  795. .KE
  796. .sb
  797. .sb
  798. .bp
  799. .SH
  800. Search and Replace
  801. .sf
  802. .SH
  803. Forward Search
  804. .sf
  805. .PP
  806. Load EMACS and bring in the file you just saved.  Your file should look
  807. like the one below.
  808. .IP
  809. .I
  810. One of the largest growth areas in personal computing is
  811. electronic publishing.  There are packages available for practically every
  812. machine from elegantly simple programs for the humble Commodore 64 to
  813. sophisticated professional packages for PC and Macintosh computers. 
  814. Personal publishing greatly increases the utility of practically every
  815. computer.  Thousands of people who joined the computer revolution of
  816. this decade only to hide their machines unused in closets have
  817. discovered a new use for them as dedicated publishing workstations. 
  818. .sp
  819. Electronic publishing is as revolutionary in its way as the Gutenburg
  820. press.  Whereas the printing press allowed the mass production and
  821. distribution of the written word, electronic publishing puts the means
  822. of production in the hands of nearly every individual.    From the class
  823. magazine to the corporate report, electronic publishing is changing the
  824. way we produce and disseminate information.
  825. .LP
  826. .R
  827. Let's use EMACS to search for the word "revolutionary" in the second
  828. paragraph.  Because EMACS searches from the current cursor position
  829. toward the end of buffers, and we intend to search forward, move the
  830. cursor to the beginning of the text.  Enter
  831. .B "^S"
  832. .I "search-forward."
  833. Note that the command line now reads
  834. .IP
  835. "Search [] <META>:" 
  836. .LP
  837. EMACS is prompting you to enter the
  838. .B "search string"
  839.  -- the text you want to find.  Enter the word
  840. .B "revolutionary"
  841. and hit the
  842. .B "META"
  843. key.  The cursor moves to the end of the word "revolutionary."
  844. .PP
  845. Notice that you must enter the <META> key to start the search.  If you
  846. simply press <NL> the command line responds with "<NL>". 
  847. Although this may seem infuriating to users who are used to pressing the
  848. return key to execute any command, EMACS' use of <META> to begin
  849. searches allows it to pinpoint text with great accuracy.  After every
  850. line wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
  851. If you need to search for a word at the end of a line, you can specify
  852. this word uniquely in EMACS. 
  853. .PP
  854. In our sample text for example, the word "and" occurs a number of times,
  855. but only once at the end of a line.  To search for this particular
  856. occurrence of the word, move the cursor to the beginning of the buffer
  857. and type
  858. .B "^S."
  859. Notice that EMACS stores the last specified
  860. search string as the
  861. .B "default"
  862. string.  If you press
  863. .B "<META>"
  864. now, EMACS will search for the default string, in this case, "revolutionary."
  865. .PP
  866. To change this string so we can search for our specified "and" simply
  867. enter the word
  868. .B "and"
  869. followed by
  870. .B "<NL>."
  871. The command line now shows:
  872. .IP
  873. "search [and<NL>]<META>:"
  874. .LP
  875. Press
  876. .B "<META>"
  877. and the cursor moves to "and" at the end of the second last line.
  878. .sb
  879. .SH
  880. Exact Searches
  881. .sf
  882. .PP
  883. If the mode EXACT is active in the current buffer, EMACS searches on a case
  884. sensitive basis.  Thus, for example you could search for
  885. .B "Publishing"
  886. as distinct from
  887. .B "publishing."
  888. .sb
  889. .SH
  890. Backward Search
  891. .sf
  892. .PP
  893. Backward searching is very similar to forward searching except that it
  894. is implemented in the reverse direction.  To implement a reverse search,
  895. type
  896. .B "^R"
  897. .I "search-reverse."
  898. Because EMACS
  899. makes no distinction between forward and backward stored search strings,
  900. the last search item you entered appears as the default string.  Try
  901. searching back for any word that lies between the cursor and the
  902. beginning of the buffer.  Notice that when the item is found, the point
  903. moves to the beginning of the found string (i.e., the cursor appears
  904. under the first letter of the search item). 
  905. .PP
  906. Practice searching for other words in your text.
  907. .sb
  908. .SH
  909. Searching and Replacing
  910. .sf
  911. .PP
  912. Searching and replacing is a powerful and quick way of making changes to
  913. your text.  Our sample text is about electronic publishing, but the
  914. correct term is 'desktop' publishing.  To make the necessary changes we
  915. need to replace all occurrences of the word "electronic" with "desktop."
  916. First, move the cursor to the top of the current buffer with the @b(M-<)
  917. command.  Then type
  918. .B "M-R"
  919. .I "replace-string."
  920. The command line responds:
  921. .IP
  922. "Replace []<META>:"
  923. .LP
  924. where the square brackets enclose the default string.  Type the word
  925. .B "electronic"
  926. and hit
  927. .B "<META>."
  928. The command line responds:
  929. .IP
  930. "with []<META>"
  931. .LP
  932. type
  933. .B "desktop<META>."
  934. EMACS replaces all instances of the original
  935. word with your revision.  Of course, you will have to capitalize the
  936. first letter of "desktop" where it occurs at the beginning of a
  937. sentence.
  938. .PP
  939. You have just completed an
  940. .B "unconditional replace."
  941. In this
  942. operation, EMACS replaces every instance of the found string with the
  943. replacement string. 
  944. .sb
  945. .SH     
  946. Query-Replace
  947. .sf
  948. .PP
  949. You may also replace text on a case by case basis.  The
  950. .B "M-^R"
  951. .I "query-replace-string"
  952. command causes EMACS to pause at each instance of the found string. 
  953. .PP
  954. For example, assume we want to replace some instances of the word
  955. "desktop" with the word "personal." Go back to the beginning of the
  956. current buffer and enter the
  957. .B "M-^R"
  958. .I "query-replace"
  959. command.  The procedure is very similar to that
  960. which you followed in the unconditional search/replace option.  When the
  961. search begins however, you will notice that EMACS pauses at each
  962. instance of "publishing" and asks whether you wish to replace it with
  963. the replacement string.  You have a number of options available for
  964. response:
  965. .KS
  966. .TS
  967. tab(;);
  968. l lw(4i).
  969. Response;Effect
  970. _
  971. Y(es);T{
  972. Make the current replacement and skip to the next occurrence
  973. of the search string
  974. T}
  975. .sp .5
  976. N(o);Do not make this replacement but continue
  977. .sp .5
  978.  !;Do the rest of the replacements with no more queries
  979. .sp .5
  980. U(ndo);T{
  981. Undo just the last replacement and query for it again (This
  982. can only go back ONE time)
  983. T}
  984. .sp .5
  985. ^G;T{
  986. Abort the replacement command (This action does not
  987. undo previously-authorized replacements
  988. T}
  989. .sp .5
  990.  .;T{
  991. Same effect as ^G, but cursor returns to the point at
  992. which the replacement command was given
  993. T}
  994. .sp .5
  995.  ?;This lists help for the query replacement command
  996. .TE
  997. .KE
  998. .sp
  999. Practice searching and searching and replacing until you feel
  1000. comfortable with the commands and their effects.
  1001. .sb
  1002. .SH
  1003. Summary
  1004. .sf
  1005. .PP
  1006. In this chapter, you learned how to search for specified strings of text
  1007. in EMACS.  The chapter also dealt with searching for and replacing
  1008. elements within a buffer. 
  1009. .KS
  1010. .TS
  1011. tab(;);
  1012. l l l
  1013. lfI lfB lw(3i).
  1014. Key Binding;Keystroke;Effect
  1015. _
  1016. Search-Forward;^S;T{
  1017. Searches from point to end of buffer.
  1018. Point is moved from current location to the end of the found string
  1019. T}
  1020. .sp .5
  1021. Search-Backward;^R;T{
  1022. Searches from point to beginning of buffer. 
  1023. Point is moved from current location to beginning of found string
  1024. T}
  1025. .sp .5
  1026. Replace;M-R;T{
  1027. Replace ALL occurrences of search string with 
  1028. specified (null) string from point to the end of the current buffer
  1029. T}
  1030. .sp .5
  1031. Query-Replace;M-^R;T{
  1032. As above, but pause at each found string and query for action
  1033. T}
  1034. .TE
  1035. .KE
  1036. .sb
  1037. .sb
  1038. .bp
  1039. .SH
  1040. Windows
  1041. .sf
  1042. .SH
  1043. Creating Windows
  1044. .sf
  1045. .PP
  1046. We have already met windows in an earlier chapter.  In this chapter, we
  1047. will explore one of EMACS' more powerful features -- text manipulation
  1048. through multiple windowing.
  1049. .PP
  1050. You will recall that windows are areas of buffer text that you can see
  1051. on the screen.  Because EMACS can support several screen
  1052. windows simultaneously you can use them to look into different places in
  1053. the same buffer.  You can also use them to look at text in different
  1054. buffers.  In effect, you can edit several files at the same time. 
  1055. .PP
  1056. Let's invoke EMACS and pull back our file on desktop publishing by
  1057. typing
  1058. .IP
  1059. .I
  1060. emacs publish.txt
  1061. .LP
  1062. .R
  1063. When the text appears, type the
  1064. .B "^X-2"
  1065. .I "split-current-window"
  1066. command.  The window splits into two
  1067. windows.  The window where the cursor resides is called the
  1068. .B "current"
  1069. window -- in this case the bottom window.  Notice that each window has a
  1070. text area and a mode line.  The
  1071. .B "command line"
  1072. is however, common to all windows on the screen. 
  1073. .PP
  1074. The two windows on your screen are virtually mirror images of each other
  1075. because the new window is opened into the same buffer as the one you are
  1076. in when you issue the Open-Window command.  All commands issued to EMACS
  1077. are executed on the current buffer in the current window.
  1078. .PP
  1079. To move the cursor to the upper window (i.e., to make that window the
  1080. current window, type
  1081. .B "^X-P"
  1082. .I "previous-window."
  1083. Notice the cursor moves to the upper or
  1084. .B "previous"
  1085. window.  Entering
  1086. .B "^X-O"
  1087. .I "next-window"
  1088. moves to the
  1089. .B "next"
  1090. window.  Practice moving between windows.  You will notice that
  1091. you can also move into the Function Key menu by entering these commands. 
  1092. .PP
  1093. Now move to the upper window.  Let's open a new file.  On the EMACS disk
  1094. is a tutorial file.  Let's call it into the upper window by typing:
  1095. .IP
  1096. .B "^X-^F"
  1097. .I "find-file"
  1098. .LP
  1099. and press return.  Then enter the filename
  1100. .B "emacs.tut."
  1101. .PP
  1102. In a short time, the tutorial file will appear in the window.  We now
  1103. have two windows on the screen, each looking into different buffers.  We
  1104. have just used the
  1105. .B "^X-^F"
  1106. .I "find-file"
  1107. command to find a file and bring it into our current window. 
  1108. .PP
  1109. You can scroll any window up and down with the cursor keys, or with the
  1110. commands we've learned so far.    However, because the area of visible
  1111. text in each window is relatively small, you can scroll the current
  1112. window a line at a time.  
  1113. .PP
  1114. Type
  1115. .B "^X-^N"
  1116. .I "move-window-down"
  1117. .PP
  1118. The current window scrolls down by one line -- the top line of text
  1119. scrolls out of view, and the bottom line moves towards the top of the
  1120. screen.  You can imagine, if you like, the whole window slowly moving
  1121. down to the end of the buffer in increments of one line.  The command
  1122. .B "^X-^P"
  1123. .I "move-window-up"
  1124. scrolls the window in the opposite direction. 
  1125. .PP
  1126. As we have seen, EMACS editing commands are executed in the current
  1127. window, but the program does support a useful feature that allows you to
  1128. scroll the
  1129. .B "next"
  1130. window.
  1131. .B "M-^Z"
  1132. .I "scroll-next-up"
  1133. scrolls the next window up,
  1134. .B "M-^U"
  1135. .I "scroll-next-down"
  1136. scrolls it downward.  From
  1137. the tutorial window, practice scrolling the window with the desktop
  1138. publishing text in it up and down. 
  1139. .PP
  1140. When you're finished, exit EMACS without saving any changes in your
  1141. files. 
  1142. .PP
  1143. Windows offer you a powerful and easy way to edit text.  By
  1144. manipulating a number of windows and buffers on the screen
  1145. simultaneously, you can perform complete edits and revisions on the
  1146. computer screen while having your draft text or original data
  1147. available for reference in another window. 
  1148. .PP
  1149. Experiment with splitting the windows on your screen.  Open windows into
  1150. different buffers and experiment with any other files you may have.  Try
  1151. editing the text in each window, but
  1152. don't forget to save any changes you want to keep -- you still have to
  1153. save each buffer separately.
  1154. .sb
  1155. .SH
  1156. Deleting Windows
  1157. .sf
  1158. .sb
  1159. .SH
  1160. Resizing Windows
  1161. .sf
  1162. .sb
  1163. .SH
  1164. Other Window commands
  1165. .sf
  1166. .sb
  1167. .SH
  1168. Summary
  1169. .sf
  1170. .PP
  1171. In this chapter you learned how to manipulate windows and the
  1172. editing flexibility they offer. 
  1173. .KS
  1174. .TS
  1175. tab(;);
  1176. l l l
  1177. lfI lfB lw(3i).
  1178. Key Binding;Keystroke;Effect
  1179. _
  1180. Open-Window;^X-2;T{
  1181. Splits current window into two windows if space is available
  1182. T}
  1183. .sp .5
  1184. Close-Windows;^X-1;T{
  1185. Closes all windows except current window
  1186. T}
  1187. .sp .5
  1188. Next-Window;^X-O;T{
  1189. Moves point into next (i.e. downward) window
  1190. T}
  1191. .sp .5
  1192. Previous-Window;^X-P;T{
  1193. Moves point to previous (i.e. upward) window
  1194. T}
  1195. .sp .5
  1196. Move-Window-Down;^X-^N; Scrolls current window down one line
  1197. .sp .5
  1198. Move-Window-Up;^X-^P;Scrolls current window up one line
  1199. .sp .5
  1200. Redraw-display;M-!;T{
  1201. Window is moved so line with point (with cursor) is at center of window
  1202. T}
  1203. \^;M-^L\^
  1204. .sp .5
  1205. Grow-Window;^X-^;T{
  1206. Current window is enlarged by one line and nearest window is shrunk by one line
  1207. T}
  1208. .sp .5
  1209. Shrink-Window;^X-^Z;T{
  1210. Current window is shrunk by one line and nearest window is enlarged by one line
  1211. T}
  1212. .sp .5
  1213. Clear-and-Redraw;^L;T{
  1214. Screen is blanked and redrawn. Keeps screen updates in sync with your commands
  1215. T}
  1216. .sp .5
  1217. Scroll-Next-Up;M-^Z;Scrolls next window up by one line
  1218. .sp .5
  1219. Scroll-Next-Down;M-^U;Scrolls next window down by one line
  1220. .TE
  1221. .KE
  1222. .sb
  1223. .sb
  1224. .bp
  1225. .SH
  1226. Buffers
  1227. .sf
  1228. .SH
  1229. More Buffer Stuff
  1230. .sf
  1231. .PP
  1232. We have already learned a number of things about buffers. 
  1233. As you will recall, they are the major internal entities in EMACS -- the
  1234. place where editing commands are executed.  They are characterized by
  1235. their
  1236. .B "names,"
  1237. their
  1238. .B "modes,"
  1239. and by the file with which they are
  1240. associated.  Each buffer also "remembers" its
  1241. .B "mark"
  1242. and
  1243. .B "point."
  1244. This convenient feature allows you to go to other buffers and return to
  1245. the original location in the "current" buffer. 
  1246. .PP
  1247. Advanced users of EMACS frequently have a number of buffers in the
  1248. computer's memory simultaneously.  In the last chapter, for example, you
  1249. opened at least two buffers -- one into the text you were editing, and
  1250. the other into the EMACS on-line tutorial.  If you deal with complex
  1251. text files -- say, sectioned chapters of a book, you may have five or
  1252. six buffers in the computer's memory.  You could select different
  1253. buffers by simply calling up the file with
  1254. .B "^X-^F"
  1255. .I "find-file,"
  1256. and let EMACS open or reopen the buffer.  However,
  1257. EMACS offers fast and sophisticated buffering techniques that you will
  1258. find easy to master and much more convenient to use. 
  1259. .PP
  1260. Let's begin by opening three buffers.  You can open any three you
  1261. choose, for example call the following files into memory:
  1262. .B "fang.txt,"
  1263. .B "publish.txt,"
  1264. and
  1265. .B "emacs.tut"
  1266. in the order listed here.  When
  1267. you've finished this process, you'll be looking at a screen showing the
  1268. EMACS tutorial.  Let's assume that you want to move to the fang.txt
  1269. buffer.  Enter:
  1270. .IP
  1271. .B "^X-X"
  1272. .I "next-buffer"
  1273. .LP
  1274. This command moves you to the next buffer.  Because EMACS cycles
  1275. through the buffer list, which is alphabetized, you will now be in the
  1276. .B "fang.txt"
  1277. buffer. Using
  1278. .B "^X-X"
  1279. again places you in the
  1280. .B "publish.txt"
  1281. buffer*.
  1282. .FS
  1283. * If you are on a machine that supports function keys, using
  1284. .B "^X-X"
  1285. again places you in the
  1286. .B "Function Keys"
  1287. buffer). Using
  1288. .B "^X-X"
  1289. one last time cycles you back to the beginning of the list.
  1290. .FE
  1291. .PP
  1292. If you have a large number of buffers to deal with, this cycling process
  1293. may be slow and inconvenient.  The command
  1294. .B "^X-B"
  1295. .I "select-buffer"
  1296. allows you to specify the buffer you wish to be
  1297. switched to.  When the command is entered, EMACS prompts, "Use buffer:". 
  1298. Simply enter the buffer name (NOT the file name), and that buffer will
  1299. then become the current buffer. 
  1300. .PP
  1301. Multiple buffer manipulation and editing is a complex activity, and you
  1302. will probably find it very inconvenient to re-save each buffer as you
  1303. modify it.  The command
  1304. .B "^X-^B"
  1305. .I "list-buffers"
  1306. creates a new window that gives details about all the buffers currently
  1307. known to EMACS.  Buffers that have been modified are identified by the
  1308. "buffer changed" indicator (an asterisk in the second column).  You can
  1309. thus quickly and easily identify buffers that need to be saved to files
  1310. before you exit EMACS.  The buffer window also provides other
  1311. information -- buffer specific modes, buffer size, and buffer name are
  1312. also listed.  To close this window, simply type the close-windows
  1313. command,
  1314. .B "^X-1."
  1315. .PP
  1316. To delete any buffer, type
  1317. .B "^X-K"
  1318. .I "delete-buffer."
  1319. EMACS prompts you "Kill buffer:".  Enter the
  1320. buffer name you want to delete.  As this is destructive command, EMACS
  1321. will ask for confirmation if the buffer was changed and not saved. 
  1322. Answer Y(es) or N(o).  As usual
  1323. .B "^G"
  1324. cancels the command. 
  1325. .sb
  1326. .SH
  1327. Summary
  1328. .sf
  1329. .PP
  1330. In this chapter you learned how to manipulate buffers. 
  1331. .KS
  1332. .TS
  1333. tab(;);
  1334. l l l
  1335. lfI lfB lw(3i).
  1336. Key Binding;Keystroke;Effect
  1337. _
  1338. Next-Buffer;^X-^X;Switch to the next buffer in the buffer list
  1339. .sp .5
  1340. Select-Buffer;^X-B;Switch to a particular buffer
  1341. .sp .5
  1342. List-Buffers;^X-^B;List all buffers
  1343. .sp .5
  1344. Delete-Buffer;^X-K;delete a particular buffer if it is off-screen
  1345. .TE
  1346. .KE
  1347. .sb
  1348. .sb
  1349. .bp
  1350. .SH
  1351. Modes
  1352. .sf
  1353. .PP
  1354. EMACS allows you to change the way it works in order to
  1355. customized it to the style of editing you are using.  It does this by
  1356. providing a number of different
  1357. .B "modes."
  1358. These modes
  1359. can effect either a single buffer, or any new buffer that is created. 
  1360. To add a mode to the current buffer, type
  1361. .B "^X-M"
  1362. .I "add-mode."
  1363. EMACS will then prompt you for the name of a mode to
  1364. add.  When you type in a legal mode name, and type a <NL>, EMACS will
  1365. add the mode name to the list of current mode names in the mode line of
  1366. the current buffer. 
  1367. .PP
  1368. To remove an existing mode, typing the
  1369. .B "^X-^M"
  1370. .I "delete-mode"
  1371. will cause EMACS to prompt you for the name of a
  1372. mode to delete from the current buffer.  This will remove that mode from
  1373. the mode list on the current mode line.
  1374. .PP
  1375. Global modes are the modes which are inherited by any new
  1376. buffers which are created.  For example, if you wish to always do string
  1377. searching with character case being significant, you would want global
  1378. mode EXACT to be set so that any new files read in inherent the EXACT
  1379. mode.  Global modes are set with the
  1380. .B "M-M"
  1381. .I "add-global-mode"
  1382. command, and unset with the
  1383. .B "M-^M"
  1384. .I "delete-global-mode"
  1385. command.  Also, the
  1386. current global modes are displayed in the first line of a
  1387. .B "^X-^B"
  1388. .I "list-buffers"
  1389. command.
  1390. .PP
  1391. On machines which are capable of displaying colors,
  1392. the mode commands can also set the background and
  1393. foreground character colors.  Using
  1394. .I "add-mode"
  1395. or
  1396. .I "delete-mode"
  1397. with a lowercase color will set the background color in the current window. 
  1398. An uppercase color will set the foreground color in the current window. 
  1399. Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
  1400. red, green, and black.  If the computer you are running on does not have
  1401. eight colors, EMACS will attempt to make some intelligent guess at what
  1402. color to use when you ask for one which is not there. 
  1403. .SH
  1404. ASAVE mode
  1405. .sf
  1406. .PP
  1407. Automatic Save mode tells EMACS to automatically write out the
  1408. current buffer to its associated file on a regular basis.  Normally this
  1409. will be every 256 characters typed into the file.  The environment
  1410. variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
  1411. value used to reset $ACOUNT after a save occurs. 
  1412. .sb
  1413. .SH
  1414. CMODE mode
  1415. .sf
  1416. .PP
  1417. CMODE is useful to C programmers.  When CMODE is active, EMACS
  1418. will try to assist the user in a number of ways.  This mode is set
  1419. automatically with files that have a .c or .h extension. 
  1420. .PP
  1421. The <NL> key will normally attempt to return the user to the next
  1422. line at the same level of indentation as the current line, unless the
  1423. current line ends with a open brace ({) in which case the new line will
  1424. be further indented by one tab position.
  1425. .PP
  1426. A close brace (}) will delete one tab position preceding itself
  1427. as it is typed.  This should line up the close brace with its matching
  1428. IF, FOR or WHILE statement. 
  1429. .PP
  1430. A pound sign (#) with only leading whitespace will delete all
  1431. the whitespace preceding itself. This will always bring preprocessor
  1432. directives flush to the left margin.
  1433. .PP
  1434. Whenever any close fence is typed, i.e )]>}, if the matching open
  1435. fence is on screen in the current window, the cursor will briefly flash
  1436. to it, and then back. This makes balancing expressions, and matching
  1437. blocks much easier.
  1438. .sb
  1439. .SH
  1440. CRYPT mode
  1441. .sf
  1442. .PP
  1443. When a buffer is in CRYPT mode, it is
  1444. encrypted whenever it is written to a file, and decrypted when it is
  1445. read from the file.  The encryption key can be specified on the command
  1446. line with the -k switch, or with the
  1447. .B "M-E"
  1448. .I "set-encryption-key"
  1449. command.  If you attempt to read or write a
  1450. buffer in crypt mode and now key has not been set, EMACS will execute
  1451. .I "set-encryption-key"
  1452. automatically, prompting you for the needed key. 
  1453. Whenever EMACS prompts you for a key, it will not echo the key to your
  1454. screen as you type it (i.e make SURE you get it right when you set it
  1455. originally).
  1456. .PP
  1457. The encryption algorithm used changes all characters into normal
  1458. printing characters, thus the resulting file is suitable for sending via
  1459. electronic mail.  All version of MicroEMACS should be able decrypt the
  1460. resulting file regardless of what machine encrypted it.  Also available
  1461. with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
  1462. the files produced by CRYPT mode in EMACS.
  1463. .sb
  1464. .SH
  1465. EXACT mode
  1466. .sf
  1467. .PP
  1468. All string searches and replacements will take upper/lower case
  1469. into account. Normally the case of a string during a search or replace
  1470. is not taken into account.
  1471. .sb
  1472. .SH
  1473. MAGIC mode
  1474. .sf
  1475. .PP
  1476. In the MAGIC mode certain characters gain special meanings when
  1477. used in a search pattern.  Collectively they are know as regular
  1478. expressions, and a limited number of them are supported in MicroEmacs. 
  1479. They grant greater flexibility when using the search command.  However,
  1480. they do not affect the incremental search command. 
  1481. .PP
  1482. The symbols that have special meaning in MAGIC mode are
  1483.  ^, $, ., *, [ (and ], used with it), and \.
  1484. .PP
  1485. The characters ^ and $ fix the search pattern to the beginning and
  1486. end of line, respectively.  The ^ character must appear at the beginning
  1487. of the search string, and the $ must appear at the end, otherwise they
  1488. loose their meaning and are treated just like any other character.  For
  1489. example, in MAGIC mode, searching for the pattern "t$" would put the
  1490. cursor at the end of any line that ended with the letter 't'.  Note that
  1491. this is different than searching for "t<NL>", that is, 't' followed by a
  1492. newline character.  The character $ (and ^, for that matter) matches a
  1493. position, not a character, so the cursor remains at the end of the line. 
  1494. But a newline is a character that must be matched, just like any other
  1495. character, which means that the cursor is placed just after it - on the
  1496. beginning of the next line. 
  1497. .PP
  1498. The character .  has a very simple meaning -- it matches any single
  1499. character, except the newline.  Thus a search for "bad.er" could match
  1500.  "badger", "badder" (slang), or up to the 'r' of "bad error". 
  1501. .PP
  1502. The character * is known as closure, and means that zero or more of
  1503. the preceding character will match.  If there is no character preceding,
  1504.  * has no special meaning, and since it will not match with a newline, *
  1505. will have no special meaning if preceded by the beginning of line symbol
  1506.  ^ or the literal newline character <NL>. 
  1507. .PP
  1508. The notion of zero or more characters is important.  If, for
  1509. example, your cursor was on the line
  1510. .IP
  1511. .I
  1512. This line is missing two vowels.
  1513. .LP
  1514. .R
  1515. and a search was made for "a*", the cursor would not move, because it is
  1516. guaranteed to match no letter 'a' , which satisfies the search
  1517. conditions.  If you wanted to search for one or more of the letter 'a',
  1518. you would search for "aa*", which would match the letter a, then zero or
  1519. more of them. 
  1520. .PP
  1521. The character [ indicates the beginning of a character class.  It
  1522. is similar to the 'any' character ., but you get to choose which
  1523. characters you want to match.  The character class is ended with the
  1524. character ].  So, while a search for "ba.e" will match "bane", "bade",
  1525. "bale", "bate", et cetera, you can limit it to matching "babe" and
  1526. "bake" by searching for "ba[bk]e".  Only one of the characters inside
  1527. the [ and ] will match a character.  If in fact you want to match any
  1528. character except those in the character class, you can put a ^ as the
  1529. first character.  It must be the first character of the class, or else
  1530. it has no special meaning.  So, a search for [^aeiou] will match any
  1531. character except a vowel, but a search for [aeiou^] will match any vowel
  1532. or a ^.
  1533. .PP
  1534. If you have a lot of characters in order that you want to put in the
  1535. character class, you may use a dash (-) as a range character.  So, [a-z]
  1536. will match any letter (or any lower case letter if EXACT mode is on),
  1537. and [0-9a-f] will match any digit or any letter 'a' through 'f', which
  1538. happen to be the characters for hexadecimal numbers.  If the dash is at
  1539. the beginning or end of a character class, it is taken to be just a
  1540. dash. 
  1541. .PP
  1542. The escape character \ is for those times when you want to be in
  1543. MAGIC mode, but also want to use a regular expression character
  1544. to be just a character.  It turns off the special meaning of the
  1545. character.  So a search for "it\." will search for a line with "it.",
  1546. and not "it" followed by any other character.  The escape character
  1547. will also let you put ^, -, or ] inside a character class with no
  1548. special side effects.
  1549. .sb
  1550. .SH
  1551. OVER mode
  1552. .sf
  1553. .PP
  1554. OVER mode stands for overwrite mode.  When in this mode, when
  1555. characters are typed, instead of simply inserting them into the file,
  1556. EMACS will attempt to overwrite an existing character past the point. 
  1557. This is very useful for adjusting tables and diagrams. 
  1558. .sb
  1559. .SH
  1560. WRAP mode
  1561. .sf
  1562. .PP
  1563. Wrap mode is used when typing in continuous text.  Whenever the
  1564. cursor is past the currently set fill column (72 by
  1565. default) and the user types a space or a <NL>, the last word of the line
  1566. is brought down to the beginning of the next line.  Using this, one just
  1567. types a continuous stream of words and EMACS automatically inserts <NL>s
  1568. at appropriate places.
  1569. .DS C
  1570. NOTE to programmers:
  1571. .DE
  1572. .IP
  1573. EMACS actually calls up the function bound to the illegal
  1574. keystroke M-FNW.  This is bound to the function
  1575. .I "wrap-word"
  1576. by default, but can be re-bound to activate different
  1577. functions and macros at wrap time.
  1578. .sb
  1579. .SH
  1580. VIEW mode
  1581. .sf
  1582. .PP
  1583. VIEW mode disables all commands which can change the current
  1584. buffer.  EMACS will display an error message and ring the bell every
  1585. time you attempt to change a buffer in VIEW mode.
  1586. .sb
  1587. .SH
  1588. Summary
  1589. .sf
  1590. .PP
  1591. In this chapter you learned about modes and their effects.
  1592. .KS
  1593. .TS
  1594. tab(;);
  1595. l l l
  1596. lfI lfB lw(3i).
  1597. Key Binding;Keystroke;Effect
  1598. _
  1599. Add-Mode;^X-M;Add a mode to the current buffer
  1600. .sp .5
  1601. Delete-Mode;^X-^M;Delete a mode from the current buffer
  1602. .sp .5
  1603. Add-Global-Mode;M-M;Add a global mode to the current buffer
  1604. Delete-Global-Mode;M-^M;Delete a global mode from the current buffer
  1605. .TE
  1606. .KE
  1607. .sb
  1608. .sb
  1609. .bp
  1610. .SH
  1611. Files
  1612. .sf
  1613. .PP
  1614. A file is simply a collection of related data.  In EMACS we are dealing
  1615. with text files -- named collections of text residing on a disk (or some
  1616. other storage medium).  You will recall that the major entities EMACS
  1617. deals with are buffers.  Disk-based versions of files are only active in
  1618. EMACS when you are reading into or writing out of buffers.  As we have
  1619. already seen, buffers and physical files are linked by associated
  1620. filenames.  For example, the buffer "ch7.txt" which is associated with
  1621. the physical disk file "ch7.txt." You will notice that the file is
  1622. usually specified by the drive name or (in the case of a hard drive) a
  1623. path.  Thus you can specify full filenames in EMACS,
  1624. .IP
  1625. e.g. disk:\directories\filename.extension
  1626. .LP
  1627. If you do not specify a disk and directories, the default disk is used.
  1628. .PP
  1629. IMPORTANT -- If you do not explicitly save your buffer to a file, all your
  1630. edits will be lost when you leave EMACS (although EMACS will prompt you
  1631. when you are about to lose edits by exiting).  In addition, EMACS does
  1632. not protect your disk-based files from overwriting when it saves files. 
  1633. Thus when you instruct EMACS to save a file to disk, it will create a
  1634. file if the specified file doesn't exist, or it will overwrite the
  1635. previously saved version of the file thus replacing it.  Your old
  1636. version is gone forever. 
  1637. .PP
  1638. If you are at all unsure about your edits, or if (for any reason) you
  1639. wish to keep previous versions of a file, you can change the name of the
  1640. associated file with the command
  1641. .B "^X-N."
  1642. When this file is saved
  1643. to disk, EMACS will create a new physical file under the new name.  The
  1644. earlier disk file will be preserved.
  1645. .PP
  1646. For example, let's load the file
  1647. .B "fang.txt"
  1648. into EMACS.  Now, type
  1649. .B "^X-N."
  1650. The EMACS command line prompts "name:".  Enter a new name
  1651. for the file -- say
  1652. .B "new.txt"
  1653. and press <NL>.  The file will be
  1654. saved under the new filename, and your disk directory will show both
  1655. .B "fang.txt"
  1656. and
  1657. .B "new.txt."
  1658. .PP
  1659. An alternative method is to write the file directly to disk under a new
  1660. filename.  Let's pull our "publish.txt" file into EMACS.  To write this
  1661. file under another filename, type
  1662. .B "^X-^W."
  1663. EMACS will prompt you "write file:".  Enter an alternate filename --
  1664. .B "desktop.txt."
  1665. Your file will be saved as the physical file "desktop.txt".
  1666. .PP
  1667. Note that in the examples above, although you have changed the names of
  1668. the related files, the buffer names remain the same.  However, when you
  1669. pull the physical file back into EMACS, you will find that the buffer
  1670. name now relates to the filename.
  1671. .PP
  1672. For example -- You are working with a buffer "fang.txt" with the related
  1673. file "fang.txt".  You change the name of the file to "new.txt".  EMACS
  1674. now shows you working with the buffer "fang.txt" and the related file
  1675. "new.txt".  Now pull the file "new.txt" into EMACS.  Notice that the
  1676. buffer name has now changed to "new.txt".
  1677. .PP
  1678. If for any reason a conflict of buffer names occurs,(if you have files
  1679. of the same name on different drives for example) EMACS will prompt
  1680. you "use buffer:".  Enter an alternative buffer name if you need to. 
  1681. .PP
  1682. For a list of file related commands (including some we`ve already
  1683. seen), see the summary page.
  1684. .SH
  1685. Summary
  1686. .sf
  1687. .PP
  1688. In this chapter you learned some of the more advanced
  1689. concepts of file naming and manipulation.  The relationship between
  1690. files and buffers was discussed in some detail. 
  1691. .KS
  1692. .TS
  1693. tab(;);
  1694. l l l
  1695. lfI lfB lw(3i).
  1696. Key Binding;Keystroke;Effect
  1697. _
  1698. Save-file;^X-^S;T{
  1699. Saves contents of current buffer with
  1700. associated filename on default disk/directory (if not specified)
  1701. T}
  1702. .sp .5
  1703. Write-File;^X-^W;T{
  1704. Current buffer contents will be saved under specified name 
  1705. T}
  1706. .sp .5
  1707. Change-File-name;^X-N;T{
  1708. The associated filename is changed (or associated if not previously
  1709. specified) as specified
  1710. T}
  1711. .sp .5
  1712. Find-File;^X-^F;T{
  1713. Reads specified file into buffer and  switches you to that buffer, or switches
  1714. to buffer in which the file has previously been read
  1715. T}
  1716. .sp .5
  1717. Read-File;^X-^R;T{
  1718. Reads file into buffer thus overwriting buffer contents.  If file has already
  1719. been read into another buffer, you will be switched to it
  1720. T}
  1721. .sp .5
  1722. View-File;^X-^V;T{
  1723. The same as read-file except the buffer
  1724. is automatically put into VIEW mode thus 
  1725. preventing any changes from being made
  1726. T}
  1727. .TE
  1728. .KE
  1729. .sb
  1730. .sb
  1731. .bp
  1732. .SH
  1733. Screen Formatting
  1734. .sf
  1735. .SH
  1736. Wrapping Text
  1737. .sf
  1738. .PP
  1739. As we learned in the introduction, EMACS is not a word processor, but an
  1740. editor.  Some simple formatting options are available however, although
  1741. in most cases they will not affect the appearance of the finished text
  1742. when it is run through the formatter.  We have
  1743. already encountered WRAP mode which wraps lines longer than a certain
  1744. length (default is 75 characters).  You will recall that WRAP is enabled
  1745. by entering
  1746. .B "^X-M"
  1747. and responding to the command line prompt with
  1748. .B "wrap."
  1749. .PP
  1750. You can also set your own wrap margin with the command
  1751. .B "^X-F"
  1752. .I "set-fill-column."
  1753. Notice EMACS responds
  1754. "[Fill column is 1]." Now try typing some text.  You'll notice some very
  1755. strange things happening -- your text wraps at every word!! This effect
  1756. occurs because the set wrap margin command must be preceded by a
  1757. numeric argument or EMACS sets it to the first column.  Thus any text
  1758. you type that extends past the first column will wrap at the most
  1759. convenient line break. 
  1760. .PP
  1761. To reset the wrap column to 72 characters, press the
  1762. .B "<META>"
  1763. key and enter 72.  EMACS will respond "Arg: 72".  Now press
  1764. .B "^X-F."
  1765. EMACS will respond "[Fill column is 72]".  Your text will again wrap at the
  1766. margin you've been using up to this point.
  1767. .sb
  1768. .SH
  1769. Reformatting Paragraphs
  1770. .sf
  1771. .PP
  1772. After an intensive editing session, you may find that you have
  1773. paragraphs containing lines of differing lengths.  Although this
  1774. disparity will not affect the formatted text, aesthetic and technical
  1775. concerns may make it desirable to have consistent paragraph blocks on
  1776. the screen.  If you are in WRAP mode, you can reformat a paragraph with
  1777. the command
  1778. .B "M-Q"
  1779. .I "fill-paragraph."
  1780. This command 'fills' the current paragraph reformatting it so all the lines
  1781. are filled and wrap logically.  The process is complex, and (especially
  1782. with longer paragraphs) may take a little time. 
  1783. .sb
  1784. .SH
  1785. Changing Case
  1786. .sf
  1787. .PP
  1788. There may be occasions when you find it necessary to change the case of
  1789. the text you've entered.  EMACS allows you to change the case of even
  1790. large amounts of text with ease.  Let's try and convert a few of the
  1791. office traditionalists to the joy of word processing.  Type in the
  1792. following text:
  1793. .IP
  1794. .I
  1795. Throw away your typewriter and learn to use a word processor. 
  1796. Word processing is relatively easy to learn and will increase your
  1797. productivity enormously.  Enter the Computer Age and find out just how
  1798. much fun it can be!!
  1799. .LP
  1800. .R
  1801. Let's give it a little more impact by capitalizing the first four words. 
  1802. The first step is to define the region of text just as you would if you
  1803. were doing an extensive deletion.  Set the mark at the beginning of the
  1804. paragraph with
  1805. .B "M-<space>"
  1806. .I "set-mark"
  1807. and move the cursor to the space beyond "typewriter." Now enter
  1808. .B "^X-^U"
  1809. .I "case-region-upper."
  1810. Your text should now look like this:
  1811. .IP
  1812. .I
  1813. THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
  1814. Word processing is relatively easy to learn and will increase your
  1815. productivity enormously.  Enter the Computer Age and find out just how
  1816. much fun it can be!!
  1817. .LP
  1818. .R
  1819. If you want to change the text back to lower case, type
  1820. .B "^X-^L"
  1821. .I "case-region-lower."
  1822. You can also
  1823. capitalize individual words.  To capitalize the word "fun", position the
  1824. cursor in front of the word and type
  1825. .B "M-U"
  1826. .I "case-word-upper."
  1827. The word is now capitalized.  To change it
  1828. back to lower case, move the cursor back to the beginning of the word
  1829. and type
  1830. .B "M-L"
  1831. .I "case-word-lower."
  1832. .PP
  1833. You may also capitalize individual letters in EMACS.  The command
  1834. .B "M-C"
  1835. .I "case-word-capitalize"
  1836. capitalizes the first letter after the point.  This command would
  1837. normally be issued with the cursor positioned in front of the first
  1838. letter of the word you wish to capitalize.  If you issue it in the
  1839. middle of a word, you can end up with some strAnge looking text. 
  1840. .sb
  1841. .SH
  1842. Tabs
  1843. .sf
  1844. .PP
  1845. Unless your formatter is instructed to take screen text literally (as
  1846. MicroSCRIBE does in the 'verbatim' environment for example), tabs in
  1847. EMACS generally affect screen formatting only. 
  1848. .PP
  1849. When EMACS is first started, it sets the default tab to every eighth
  1850. column.  As long as you stay with default, every time you press the tab
  1851. key a tab character,
  1852. .B "^I"
  1853. is inserted.  This character, like other
  1854. control characters, is invisible -- but it makes a subtle and
  1855. significant difference to your file and editing. 
  1856. .PP
  1857. For example, in default mode, press the tab key and then type the word
  1858. .B "Test."
  1859. "Test" appears at the eighth column.  Move your cursor to the
  1860. beginning of the word and delete the backward character.  The word
  1861. doesn't move back just one character, but flushes to the left margin. 
  1862. The reason for this behavior is easily explained.  In tab default, EMACS
  1863. inserts a 'real' tab character when you press the tab key.  This
  1864. character is inserted at the default position, but NO SPACES are
  1865. inserted between the tab character and the margin (or previous tab
  1866. character).  As you will recall, EMACS only recognizes characters (such
  1867. as spaces or letters) and thus when the tab character is removed, the
  1868. text beyond the tab is flushed back to the margin or previous tab mark.
  1869. .PP
  1870. This situation changes if you alter the default configuration.  The
  1871. default value may be changed by entering a numeric argument before
  1872. pressing the tab key.  As we saw earlier, pressing the
  1873. .B "META"
  1874. key and entering a number allows you to specify how EMACS performs a given
  1875. action.  In this case, let's specify an argument of 10 and hit the tab
  1876. key. 
  1877. .PP
  1878. Now hit the tab key again and type
  1879. .B "Test."
  1880. Notice the word now
  1881. appears at the tenth column.  Now move to the beginning of the word and
  1882. delete the backward character.    "Test" moves back by one character. 
  1883. .PP
  1884. EMACS behaves differently in these circumstances because the
  1885. .B "^I"
  1886. .I "handle-tab"
  1887. function deals
  1888. with tabbing in two distinct ways.  In default conditions, or if the
  1889. numeric argument of zero is used,
  1890. .I "handle-tab"
  1891. inserts a true tab
  1892. character.  If, however, a non-zero numeric argument is specified,
  1893. .I "handle-tab"
  1894. inserts the correct number of spaces needed to position
  1895. the cursor at the next specified tab position.  It does NOT insert the
  1896. single tab character and hence any editing functions should take account
  1897. of the number of spaces between tabbed columns. 
  1898. .PP
  1899. Many times you would like to take a line which has been created using
  1900. the tab character and change it to use just spaces.  The command
  1901. .B "^X-^D"
  1902. .I "detab-line"
  1903. changes any tabs from the
  1904. point to the end of the current line into the right number of spaces so
  1905. the line does not change.  This is very useful for times when the file
  1906. must be printed or transferred to a machine which does not understand
  1907. tabs. 
  1908. .PP
  1909. Also, the inverse command,
  1910. .B "^X-^E"
  1911. .I "entab-lines"
  1912. changes multiple spaces to tabs where possible.  This is a good way to
  1913. shrink the size of large documents, especially with data tables.  Both
  1914. of these commands can take a numeric argument which will be interpreted
  1915. as the number of lines to en/detab. 
  1916. .sb
  1917. .SH
  1918. Summary
  1919. .sf
  1920. .PP
  1921. This chapter introduced some of the formatting features of
  1922. EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
  1923. some detail.  The commands in the following table were covered in the
  1924. chapter. 
  1925. .KS
  1926. .TS
  1927. tab(;);
  1928. l l l
  1929. lfI lfB lw(3i).
  1930. Key Binding;Keystroke;Effect
  1931. _
  1932. Add-Mode/WRAP;^X-M [WRAP];Add wrap mode to current buffer
  1933. .sp .5
  1934. Delete-Mode/WRAP;^X-^M [WRAP];Remove wrap mode from current buffer
  1935. .sp .5
  1936. Set-Fill-Column;^X-F;Set fill column to given numeric argument  
  1937. .sp .5
  1938. Fill-Paragraph;M-Q;Logically reformats the current paragraph
  1939. .sp .5
  1940. Case-Word-Upper;M-U;T{
  1941. Text from point to end of the current word is changed to uppercase
  1942. T}
  1943. .sp .5
  1944. Case-Word-Lower;M-L;T{
  1945. Text from point to end of the  current word is changed to lowercase
  1946. T}
  1947. .sp .5
  1948. Case-Word-Capitalize;M-C;T{
  1949. First word (or letter) after the point is capitalized
  1950. T}
  1951. .sp .5
  1952. Case-Region-Upper;^X-^U;The current region is uppercased
  1953. .sp .5
  1954. Case-Region-Lower;^X-^L;The current region is lowercased
  1955. .sp .5
  1956. Handle-Tab;^I;T{
  1957. Tab interval is set to the given numeric argument
  1958. T}
  1959. .sp .5
  1960. Entab-Line;^X-^E;T{
  1961. Changes multiple spaces to tabs characters where possible
  1962. T}
  1963. .sp .5
  1964. Detab-Line;^X-^D;T{
  1965. Changes tab characters to the appropriate number of spaces
  1966. T}
  1967. .TE
  1968. .KE
  1969. .sb
  1970. .sb
  1971. .bp
  1972. .SH
  1973. Keyboard Macros
  1974. .sf
  1975. .PP
  1976. In many applications, it may be necessary to repeat a series of
  1977. characters or commands frequently.  For example, a paper may require the
  1978. frequent repetition of a complex formula or a long name.  You may also
  1979. have a series of EMACS commands that you invoke frequently.  Keyboard
  1980. macros offer a convenient method of recording and repeating these
  1981. commands. 
  1982. .PP
  1983. Imagine, for example, you are writing a scholarly paper on
  1984. .I "Asplenium platyneuron,"
  1985. the spleenwort fern.  Even the dedicated botanist would
  1986. probably find it a task bordering on the agonizing to type
  1987. .I "Asplenium platyneuron"
  1988. frequently throughout the paper.  An
  1989. alternative method is 'record' the name in a keyboard macro.  Try it
  1990. yourself.
  1991. .PP
  1992. The command
  1993. .B "^X-("
  1994. .I "begin-macro"
  1995. starts recording the all the keystrokes and commands you input.  After you've
  1996. typed it, enter
  1997. .I "Asplenium platyneuron."
  1998. To stop recording, type
  1999. .B "^X-)"
  2000. .I "end-macro."
  2001. EMACS has stored all the
  2002. keystrokes between the two commands.  To repeat the name you've stored,
  2003. just enter
  2004. .B "^X-E"
  2005. .I "execute-macro,"
  2006. and the name "Asplenium platyneuron" appears.  You can repeat this action as
  2007. often as you want, and of course as with any EMACS command, you may
  2008. precede it with a numerical argument. 
  2009. .PP
  2010. Because EMACS records keystrokes, you may freely intermix commands and
  2011. text.  Unfortunately, you can only store one macro at a time.  Thus, if
  2012. you begin to record another macro, the previously defined macro is
  2013. lost. Be careful to ensure that you've finished with one macro before
  2014. defining another.  If you have a series of commands that you would like
  2015. to 'record' for future use, use the macro or procedure facilities
  2016. detailed in chapter <X>.
  2017. .SH
  2018. Summary
  2019. .sf
  2020. .SH
  2021. This chapter covered keyboard macros.  You learned how to
  2022. record keystrokes and how to repeat the stored sequence. 
  2023. .KS
  2024. .TS
  2025. tab(;);
  2026. l l l
  2027. lfI lfB lw(3i).
  2028. Key Binding;Keystroke;Effect
  2029. _
  2030. Start-Macro;^X-(;Starts recording all keyboard input
  2031. .sp .5
  2032. End-Macro;^X-);Stops recording keystrokes for macro
  2033. .sp .5
  2034. Execute-Macro;^X-E;T{
  2035. Entire sequence of recorded keystrokes is replayed
  2036. T}
  2037. .TE
  2038. .KE
  2039. .sb
  2040. .sb
  2041. .bp
  2042. .SH
  2043. MicroEMACS Macros
  2044. .sf
  2045. .PP
  2046. Macros are programs that are used to customize the editor and to
  2047. perform complicated editing tasks.  They may be stored in files or
  2048. buffers and may be executed using an appropriate command, or bound to a
  2049. particular keystroke.  Portions of the standard start-up file are
  2050. implement via macros, as well as the example menu system.  The
  2051. .I "execute-macro-<n>"
  2052. commands cause the
  2053. macro, numbered from 1 to 40, to be executed.  The
  2054. .I "execute-file"
  2055. command allows you to execute a macro stored in a
  2056. disk file, and the
  2057. .I "execute-buffer"
  2058. command allows you to execute a macro stored in a buffer.  Macros are stored for
  2059. easy execution by executing files that contain the store-macro command. 
  2060. .PP
  2061. There are many different aspects to the macro language within
  2062. MicroEMACS.  Editor commands are the various commands that manipulate
  2063. text, buffers, windows, etc, within the editor.  Directives are commands
  2064. which control what lines get executed within a macro.  Also there are
  2065. various types of variables.  Environmental variables both control and
  2066. report on different aspects of the editor.  User variables hold string
  2067. values which may be changed and inspected.  Buffer variables allow text
  2068. to be placed into variables.  Interactive variable allow the program to
  2069. prompt the user for information.  Functions can be used to manipulate
  2070. all these variables. 
  2071. .SH
  2072. Variables
  2073. .sf
  2074. .PP
  2075. Variables in MicroEMACS can be used to return values within
  2076. expressions, as repeat counts to editing commands, or as text to be
  2077. inserted into buffers and messages.  The value of these variables is set
  2078. using the set
  2079. .B "^X-A"
  2080. command.  For example, to set the current fill
  2081. column to 64 characters, the following macro line would be used:
  2082. .IP
  2083. set $fillcol 64
  2084. .LP
  2085. or to have the contents of
  2086. .B "%name"
  2087. inserted at the point in the current buffer, the command to use would be:
  2088. .IP
  2089. insert-string %name
  2090. .sb
  2091. .SH
  2092. Environmental Variables
  2093. .sf
  2094. .PP
  2095. "What good is a quote if you can't change it?"
  2096. .PP
  2097. These variables are used to change different aspects of the way
  2098. the editor works.  Also they will return the current settings if used as
  2099. part of an expression.  All environmental variable names begin with a
  2100. dollar sign ($) and are in lower case.
  2101. .TS
  2102. tab(;);
  2103. l lw(4i).
  2104. $fillcol;Current fill column
  2105. .sp .5
  2106. $pagelen;Number of screen lines used currently
  2107. .sp .5
  2108. $curwidth;Number of columns used currently
  2109. .sp .5
  2110. $curcol;Current column of point in current buffer
  2111. .sp .5
  2112. $curline;Current line of point in current buffer
  2113. .sp .5
  2114. $flicker;T{
  2115. Flicker Flag set to TRUE if IBM CGA set to FALSE for most others
  2116. T}
  2117. .sp .5
  2118. $cbufname;Name of the current buffer
  2119. .sp .5
  2120. $cfname;File name of the current buffer
  2121. .sp .5
  2122. $sres;T{
  2123. Current screen resolution (CGA, MONO or EGA on the IBM-PC driver.
  2124. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on all others)
  2125. T}
  2126. .sp .5
  2127. $debug;T{
  2128. Flag to trigger macro debugging (try it... you'll like it!)
  2129. T}
  2130. .sp .5
  2131. $status;T{
  2132. return status of the success of the last command
  2133. (TRUE or FALSE) usually used with !force
  2134. T}
  2135. .sp .5
  2136. $palette;T{
  2137. string used to control the palette register settings on graphics versions.
  2138. The usually form consists of groups of three octal digits
  2139. setting the red, green, and blue levels.
  2140. T}
  2141. .sp .5
  2142. $asave;T{
  2143. The number of inserted characters between automatic file-saves in ASAVE mode.
  2144. T}
  2145. .sp .5
  2146. $acount;T{
  2147. The countdown of inserted characters until the next save-file.
  2148. T}
  2149. .sp .5
  2150. $lastkey;Last keyboard character typed
  2151. .sp .5
  2152. $curchar;Character currently at the point
  2153. .sp .5
  2154. $discmd;T{
  2155. Flag to disable the echoing of messages on the command line
  2156. T}
  2157. .sp .5
  2158. $version;T{
  2159. Contains the current MicroEMACS version number
  2160. T}
  2161. .sp .5
  2162. $progname;T{
  2163. Always contains the string "MicroEMACS" for standard MicroEMACS.
  2164. Could be something else if used as part of someone else's program
  2165. T}
  2166. .sp .5
  2167. $seed;integer seed of the random number generator
  2168. .sp .5
  2169. $disinp;T{
  2170. Flag to disable the echoing of characters during command line input
  2171. T}
  2172. .TE
  2173. .PP
  2174. Obviously, many more of these variables will be available in
  2175. future releases of MicroEMACS. (Yes, send a vote for your favorite new
  2176. environmental variables today).
  2177. .sb
  2178. .SH
  2179. User variables
  2180. .sf
  2181. .PP
  2182. User variables allow you, the user, to store strings and
  2183. manipulate them.  These strings can be pieces of text, numbers (in text
  2184. form), or the logical values
  2185. .B "TRUE"
  2186. and
  2187. .B "FALSE."
  2188. These variables
  2189. can be combined, tested, inserted into buffers, and otherwise used to
  2190. control the way your macros execute.  At the moment, up to 100 user
  2191. variables may be in use in one editing session.  All users variable
  2192. names must begin with a percent sign (%) and may contain any printing
  2193. characters.  Only the first 10 characters are significant (i.e
  2194. differences beyond the tenth character are ignored).  Most operators
  2195. will truncate strings to a length of 128 characters. 
  2196. .sb
  2197. .SH
  2198. Buffer Variables
  2199. .sf
  2200. .PP
  2201. Buffer variables are special in that they can only be queried
  2202. and cannot be set.  What buffer variables are is a way to take text from
  2203. a buffer and place it in a variable. For example, if I have a buffer by
  2204. the name of RIGEL2, and it contains the text:
  2205. .KS
  2206. .TS
  2207. tab(;);
  2208. l l
  2209. l l
  2210. l l
  2211. l l
  2212. l l
  2213. l s.
  2214. ;Richmond
  2215. ;Lafayette
  2216. <*>;Bloomington
  2217. ;Indianapolis
  2218. ;Gary
  2219.  =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2220. .TE
  2221. .KE
  2222. .FS
  2223. where <*> is the current point
  2224. .FE
  2225. and within a command I reference #rigel2, like:
  2226. .IP
  2227. insert-string #rigel2
  2228. .PP
  2229. MicroEMACS would start at the current point in the RIGEL2
  2230. buffer and grab all the text up to the end of that line and pass that
  2231. back.  Then it would advance the point to the beginning of the next line.
  2232. Thus, after our last command executes, the string "Bloomington" gets
  2233. inserted into the current buffer, and the buffer RIGEL2 now looks like
  2234. this:
  2235. .KS
  2236. .TS
  2237. tab(;);
  2238. l l
  2239. l l
  2240. l l
  2241. l l
  2242. l l
  2243. l s.
  2244. ;Richmond
  2245. ;Lafayette
  2246. ;Bloomington
  2247. <*>;Indianapolis
  2248. ;Gary
  2249.  =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
  2250. .TE
  2251. .KE
  2252. as you have probably noticed, a buffer variable consists of the
  2253. buffer name, preceded by a pound sign (#).
  2254. .sb
  2255. .SH
  2256. Interactive variables
  2257. .sf
  2258. .PP
  2259. Interactive variables are actually a method to prompt the user
  2260. for a string.  This is done by using an at sign (@) followed either with
  2261. a quoted string, or a variable containing a string.  The string is the
  2262. placed on the bottom line, and the editor waits for the user to type in
  2263. a string.  Then the string typed in by the users is returned as the
  2264. value of the interactive variable.  For example:
  2265. .IP
  2266. set %quest "What file? "
  2267. .br
  2268. find-file @%quest
  2269. .LP
  2270. will ask the user for a file name, and then attempt to find it.
  2271. .sb
  2272. .sb
  2273. .SH
  2274. Functions
  2275. .sf
  2276. .PP
  2277. Functions can be used to manipulate variables in various ways. 
  2278. Functions can have one, two, or three arguments.  These arguments will
  2279. always be placed after the function on the current command line.  For
  2280. example, if we wanted to increase the current fill column by two, using
  2281. emacs's set
  2282. .B "^X-A"
  2283. command, we would write:
  2284. .KS
  2285. .TS
  2286. tab(;);
  2287. l l l l l l
  2288. c c c c c l.
  2289. set;$fillcol;&add;$fillcol;2;
  2290. ;;;;\(ua;second operand
  2291. ;;;\(ua;;first operand
  2292. ;;\(ua;;;function to execute
  2293. ;\(ua;;;;variable to set
  2294. \(ua;;;;;set (^X-A) command
  2295. .TE
  2296. .KE
  2297. .PP
  2298. Function names always begin with the ampersand (&) character,
  2299. and are only significant to the first three characters after the
  2300. ampersand.  Functions will normal expect one of three types of
  2301. arguments, and will automatically convert types when needed.
  2302. .KS
  2303. .TS
  2304. tab(;);
  2305. l lw(4i).
  2306. <num>;T{
  2307. an ascii string of digits which is interpreted as a numeric value. 
  2308. Any string which does not start with a digit or a minus sign (-) will be
  2309. considered zero. 
  2310. T}
  2311. .sp .5
  2312. <str>;T{
  2313. An arbitrary string of characters.  At the moment, strings are
  2314. limited to 128 characters in length. 
  2315. T}
  2316. .sp .5
  2317. <log>;T{
  2318. A logical value consisting of the string "TRUE" or "FALSE". 
  2319. Numeric strings will also evaluate to "FALSE" if they are equal to zero,
  2320. and "TRUE" if they are non-zero.  Arbitrary text strings will have the
  2321. value of "FALSE".
  2322. T}
  2323. .TE
  2324. .KE
  2325. A list of the currently available functions follows: (Once
  2326. again, send in those votes on what kind of functions you would like to
  2327. see added!) Functions are always used in lower case, the uppercase
  2328. letters in the function table are the short form of the function (i.e
  2329. &div for ÷).
  2330. .KS
  2331. .TS
  2332. tab(;);
  2333. l s l
  2334. l l lw(3i).
  2335. Numeric Functions:;(returns <num>)
  2336. _
  2337. &ADD;<num> <num>;Add two numbers
  2338. .sp .5
  2339. &SUB;<num> <num>;T{
  2340. Subtract the second number from the first
  2341. T}
  2342. .sp .5
  2343. &TIMes;<num> <num>;Multiply two numbers
  2344. .sp .5
  2345. &DIVide;<num> <num>;T{
  2346. Divide the first number by the second giving an integer result
  2347. T}
  2348. .sp .5
  2349. &MOD;<num> <num>;T{
  2350. Return the reminder of dividing the first number by the second
  2351. T}
  2352. .sp .5
  2353. &NEGate;<num>;Multiply the arg by -1
  2354. .sp .5
  2355. &LENgth;<str>;Returns length of string
  2356. .sp .5
  2357. &ASCii;<str>;T{
  2358. Return the ascii code of the first character in <str>
  2359. T}
  2360. .sp .5
  2361. &RND;<num>;T{
  2362. Returns a random integer between 1 and <num>
  2363. T}
  2364. .sp .5
  2365. &ABS;<num>;T{
  2366. Returns the absolute value of <num>
  2367. T}
  2368. .TE
  2369. .KE
  2370. .KS
  2371. .TS
  2372. tab(;);
  2373. l s l
  2374. l l lw(3i).
  2375. String manipulation functions:;(returns <str>)
  2376. _
  2377. &CAT;<str> <str>;Concatenate the two strings to form one
  2378. .sp .5
  2379. &LEFt;<str> <num>;T{
  2380. return the <num> leftmost characters from <str>
  2381. T}
  2382. .sp .5
  2383. &RIGht;<str> <num>;T{
  2384. return the <num> rightmost characters from <str>
  2385. T}
  2386. .sp .5
  2387. &MID;<str> <num1> <num2>;T{
  2388. Starting from <num1> position in <str>, return <num2> characters.
  2389. T}
  2390. .sp .5
  2391. &UPPer;<str>;Uppercase <str>
  2392. .sp .5
  2393. &LOWer;<str>;lowercase <str>
  2394. .sp .5
  2395. &CHR;<num>;T{
  2396. return a string with the character represented by ascii code <num>
  2397. T}
  2398. .sp .5
  2399. >K;;T{
  2400. return a string containing a single keystroke from the user
  2401. T}
  2402. .TE
  2403. .KE
  2404. .KS
  2405. .TS
  2406. tab(;);
  2407. l s l
  2408. l l lw(3i).
  2409. Logical Testing functions:;(returns <log>)
  2410. _
  2411. &NOT;<log>;Return the opposite logical value
  2412. .sp .5
  2413. &AND;<log1> <log2>;T{
  2414. Returns TRUE if BOTH logical arguments are TRUE
  2415. T}
  2416. .sp .5
  2417. &OR;<log1> <log2>;T{
  2418. Returns TRUE if either argument is TRUE
  2419. T}
  2420. .sp .5
  2421. &EQUal;<num> <num>;T{
  2422. If <num> and <num> are numerically equal, return TRUE
  2423. T}
  2424. .sp .5
  2425. &LESs;<num1> <num2>;T{
  2426. If <num1> is less than <num2>, return TRUE.
  2427. T}
  2428. .sp .5
  2429. &GREater;<num1> <num2>;T{
  2430. If <num1> is greater than, or equal to <num2>, return TRUE.
  2431. T}
  2432. .sp .5
  2433. &SEQual;<str1> <str2>;T{
  2434. If the two strings are the same, return TRUE.
  2435. T}
  2436. .sp .5
  2437. &SLEss;<str1> <str2>;T{
  2438. If <str1> is less alphabetically than <str2>, return TRUE.
  2439. T}
  2440. .sp .5
  2441. &SGReater;<str1> <str2>;T{
  2442. If <str1> is alphabetically greater than or equal to <str2>, return TRUE.
  2443. T}
  2444. .TE
  2445. .KE
  2446. .KS
  2447. .TS
  2448. tab(;);
  2449. l s l
  2450. l l lw(3i).
  2451. Special Functions:;;
  2452. _
  2453. &INDirect;<str>;Evaluate <str> as a variable.
  2454. .TE
  2455. .KE
  2456. .PP
  2457. This last function deserves more explanation. The &IND function
  2458. evaluates its argument, takes the resulting string, and then uses it as
  2459. a variable name.  For example, given the following code sequence:
  2460. .IP
  2461. ; set up reference table
  2462. .sp
  2463. set %one    "elephant"
  2464. .br
  2465. set %two    "giraffe"
  2466. .br
  2467. set %thee    "donkey"
  2468. .sp
  2469. set %index "two"
  2470. .br
  2471. insert-string &ind %index
  2472. .LP
  2473. the string "giraffe" would have been inserted at the point in
  2474. the current buffer.  This indirection can be safely nested up to about
  2475. 10 levels.
  2476. .sb
  2477. .SH
  2478. Directives
  2479. .sf
  2480. .PP
  2481. Directives are commands which only operate within an executing
  2482. macro, i.e they do not make sense as a single command. As such, they
  2483. cannot be called up singly or bound to keystroke. Used within macros,
  2484. they control what lines are executed and in what order.
  2485. .PP
  2486. Directives always start with the exclamation mark (!) character
  2487. and must be the first thing placed on a line. Directives executed singly
  2488. (via the execute-command-line command) interactively will be ignored.
  2489. .SH
  2490. !ENDM Directive
  2491. .sf
  2492. .PP
  2493. This directive is used to terminate a macro being stored. For
  2494. example, if a file is being executed contains the text:
  2495. .KS
  2496. .TS
  2497. tab(%);
  2498. l s
  2499. l l
  2500. l l
  2501. l l
  2502. l l
  2503. l s.
  2504. ;  Read in a file in view mode, and make the window red
  2505. .sp
  2506. 26%store-macro
  2507. %find-file @"File to view: "
  2508. %add-mode "view"
  2509. %add-mode "red"
  2510. !endm
  2511. .sp
  2512. write-message "[Consult macro has been loaded]"
  2513. .TE
  2514. .KE
  2515. only the lines between the store-macro command and the !ENDM
  2516. directive are stored in macro 26.
  2517. .sb
  2518. .SH
  2519. !FORCE Directive
  2520. .sf
  2521. .PP
  2522. When MicroEMACS executes a macro, if any command fails, the
  2523. macro is terminated at that point. If a line is preceded by a !FORCE
  2524. directive, execution continues weather the command succeeds or not. For
  2525. example:
  2526. .KS
  2527. .TS
  2528. tab(%);
  2529. l s
  2530. l l.
  2531. ; Merge the top two windows
  2532. .sp
  2533. save-window%;remember what window we are at
  2534. 1 next-window%;go to the top window
  2535. delete-window%;merge it with the second window
  2536. !force restore-window%;This will continue regardless
  2537. add-mode "red"%
  2538. .TE
  2539. .KE
  2540. .sb
  2541. .SH
  2542. !IF, !ELSE, and !ENDIF Directives
  2543. .sf
  2544. .PP
  2545. This directive allows statements only to be executed if a
  2546. condition specified in the directive is met.  Every line following the
  2547. !IF directive, until the first !ELSE or !ENDIF directive, is only
  2548. executed if the expression following the !IF directive evaluates to a
  2549. TRUE value.  For example, the following macro segment creates the
  2550. portion of a text file automatically.  (yes believe me, this will be
  2551. easier to understand then that last explanation....)
  2552. .KS
  2553. .IP
  2554. !if &sequal %curplace "timespace vortex"
  2555. .ti +4
  2556. insert-string "First, rematerialize~n"
  2557. .br
  2558. !endif
  2559. .br
  2560. !if &sequal %planet "earth"    ;If we have landed on earth...
  2561. .ti +4
  2562. !if &sequal %time "late 20th century"  ;and we are then
  2563. .ti +8
  2564. write-message "Contact U.N.I.T."
  2565. .ti +4
  2566. !else
  2567. .ti +8
  2568. insert-string "Investigate the situation....~n"
  2569. .ti +8
  2570. insert-string "(SAY 'stay here Sara')~n"
  2571. .ti +4
  2572. !endif
  2573. .br
  2574. !else
  2575. .ti +4
  2576. set %conditions @"Atmosphere conditions outside? "
  2577. .ti +4
  2578. !if &sequal %conditions "safe"
  2579. .ti +8
  2580. insert-string &cat "Go outside......" "~n"
  2581. .ti +8
  2582. insert-string "lock the door~n"
  2583. .ti +4
  2584. !else
  2585. .ti +8
  2586. insert-string "Dematerialize..try somewhere else"
  2587. .ti +8
  2588. newline
  2589. .ti +4
  2590. !endif
  2591. .br
  2592. !endif
  2593. .KE
  2594. .sb
  2595. .SH
  2596. !GOTO Directive
  2597. .sf
  2598. .PP
  2599. Flow can be controlled within a MicroEMACS macro using the !GOTO
  2600. directive. It takes as an argument a label. A label consists of a line
  2601. starting with an asterisk (*) and then an alphanumeric label.  Only
  2602. labels in the currently executing macro can be jumped to, and trying to
  2603. jump to a non-existing label terminates execution of a macro.  For
  2604. example..
  2605. .KS
  2606. .IP
  2607. ;Create a block of DATA statements for a BASIC program
  2608. .sp
  2609. .ti +4
  2610. insert-string "1000 DATA "
  2611. .ti +4
  2612. set %linenum 1000
  2613. .sp
  2614. *nxtin
  2615. .ti +4
  2616. update-screen        ;make sure we see the changes
  2617. .ti +4
  2618. set %data @"Next number: "
  2619. .ti +4
  2620. !if &equal %data 0
  2621. .ti +8
  2622. !goto finish
  2623. .ti +4
  2624. !endif
  2625. .sp
  2626. .ti +4
  2627. !if &greater $curcol 60
  2628. .ti +8
  2629. 2 delete-previous-character
  2630. .ti +8
  2631. newline
  2632. .ti +8
  2633. set %linenum &add %linenum 10
  2634. .ti +8
  2635. insert-string &cat %linenum " DATA "
  2636. .ti +4
  2637. !endif
  2638. .sp
  2639. .ti +4
  2640. insert-string &cat %data ", "
  2641. .ti +4
  2642. !goto nxtin
  2643. .sp
  2644. *finish
  2645. .sp
  2646. .ti +4
  2647. 2 delete-previous-character
  2648. .ti +4
  2649. newline
  2650. .KE
  2651. .sb
  2652. .SH
  2653. !RETURN Directive
  2654. .sf
  2655. .PP
  2656. The !RETURN Directive causes the current macro to exit, either
  2657. returning to the caller (if any) or to interactive mode.  For example:
  2658. .KS
  2659. .IP
  2660. ; Check the monitor type and set %mtyp
  2661. .sp
  2662. !if &sres "CGA"
  2663. .ti +4
  2664. set %mtyp 1
  2665. .ti +4
  2666. !return
  2667. .br
  2668. !else
  2669. .ti +4
  2670. set %mtyp 2
  2671. .br
  2672. !endif
  2673. .sp
  2674. insert-string "You are on a MONOCHROME machine!~n"
  2675. .KE
  2676. .sb
  2677. .sb
  2678. .sb
  2679. .bp
  2680. .SH
  2681. MicroEMACS commands
  2682. .sf
  2683. .PP
  2684. Below is a complete list of the commands in EMACS, the keys
  2685. normally used to do the command, and what the command does.  Remember,
  2686. on some computers there may also be additional ways of using a command
  2687. (cursor keys and special function keys for example). 
  2688. .TS
  2689. tab(;);
  2690. l l l
  2691. lfI lfB lw(3i).
  2692. Key Binding;Keystroke;Effect
  2693. _
  2694. abort-command;^G;T{
  2695. This allows the user to abort out of any command that is waiting for input
  2696. T}
  2697. .sp .5
  2698. add-mode;^X-M;Add a mode to the current buffer
  2699. .sp .5
  2700. add-global-mode;M-M;Add a global mode for all new buffers
  2701. .sp .5
  2702. apropos;M-A;T{
  2703. List out commands whose name contains the string specified
  2704. T}
  2705. .sp .5
  2706. backward-character;^B;Move one character to the left
  2707. .sp .5
  2708. begin-macro;^X-(;Begin recording a keyboard macro
  2709. .sp .5
  2710. beginning-of-file;M-<;T{
  2711. Move to the beginning of the file in the current buffer
  2712. T}
  2713. .sp .5
  2714. beginning-of-line;^A;Move to the beginning of the current line
  2715. .sp .5
  2716. bind-to-key;M-K;Bind a key to a function
  2717. .sp .5
  2718. buffer-position;^X-=;T{
  2719. List the position of the cursor in the current window on the command line
  2720. T}
  2721. .sp .5
  2722. case-region-lower;^X-^L;Make a marked region all lower case
  2723. .sp .5
  2724. case-region-upper;^X-^U;Make a marked region all upper case
  2725. .sp .5
  2726. case-word-capitalize;M-C;Capitalize the following word
  2727. .sp .5
  2728. case-word-lower;M-L;Lower case the following word
  2729. .sp .5
  2730. case-word-upper;M-U;Upper case the following word
  2731. .sp .5
  2732. change-file-name;^X-N;T{
  2733. Change the name of the file in the current buffer
  2734. T}
  2735. .sp .5
  2736. change-screen-size;M-^S;T{
  2737. Change the number of lines of the screen currently being used
  2738. T}
  2739. .sp .5
  2740. change-screen-width;M-^T;T{
  2741. Change the number of columns of the screen currently being used
  2742. T}
  2743. .sp .5
  2744. clear-and-redraw;^L;Clear the physical screen and redraw it
  2745. .sp .5
  2746. clear-message-line;(none);Clear the command line
  2747. .sp .5
  2748. copy-region;M-W;T{
  2749. Copy the currently marked region into the kill buffer
  2750. T}
  2751. .sp .5
  2752. count-words;M-^C;T{
  2753. Count how many words, lines and characters are in the current marked region
  2754. T}
  2755. .sp .5
  2756. ctlx-prefix;^X;Change the key used as the ^X prefix
  2757. .sp .5
  2758. delete-blank-lines;^X-^O;Delete all blank lines around the cursor
  2759. .sp .5
  2760. delete-buffer;^X-K;T{
  2761. Delete a buffer which is not being currently displayed in a window
  2762. T}
  2763. .TE
  2764. .bp
  2765. .TS
  2766. tab(;);
  2767. l l l
  2768. lfI lfB lw(3i).
  2769. Key Binding;Keystroke;Effect
  2770. _
  2771. delete-mode;^X-^M;Turn off a mode in the current buffer
  2772. .sp .5
  2773. delete-global-mode;M-^M;Turn off a global mode
  2774. .sp .5
  2775. delete-next-character;^D;Delete the character following the cursor
  2776. .sp .5
  2777. delete-next-word;M-D;Delete the word following the cursor
  2778. .sp .5
  2779. delete-other-windows;^X-1;T{
  2780. Make the current window cover the entire screen
  2781. T}
  2782. .sp .5
  2783. delete-previous-character;^H;T{
  2784. Delete the character to the left of the cursor
  2785. T}
  2786. .sp .5
  2787. delete-previous-word;M-^H;Delete the word to the left of the cursor
  2788. .sp .5
  2789. delete-window;^X-0;Remove the current window from the screen
  2790. .sp .5
  2791. describe-bindings;(none);Make a list of all legal commands
  2792. .sp .5
  2793. describe-key;^X-?;T{
  2794. Describe what command is bound to a keystroke sequence
  2795. T}
  2796. .sp .5
  2797. detab-line;^X-^D;T{
  2798. Change all tabs in a line to the equivalent spaces
  2799. T}
  2800. .sp .5
  2801. end-macro;^X-);stop recording a keyboard macro
  2802. .sp .5
  2803. end-of-file;M->;Move cursor to the end of the current buffer
  2804. .sp .5
  2805. end-of-line;^E;Move to the end of the current line
  2806. .sp .5
  2807. entab-line;^X-^E;T{
  2808. Change multiple spaces to tabs where possible
  2809. T}
  2810. .sp .5
  2811. exchange-point-and-mark;^X-^X;T{
  2812. Move cursor to the last marked spot, make the original position be marked
  2813. T}
  2814. .sp .5
  2815. execute-buffer;(none);Execute a buffer as a macro
  2816. .sp .5
  2817. execute-command-line;(none);T{
  2818. Execute a line typed on the command line as a macro command
  2819. T}
  2820. .sp .5
  2821. execute-file;FNB;Execute a file as a macro
  2822. .sp .5
  2823. execute-macro;^X-E;T{
  2824. Execute the keyboard macro (play back the recorded keystrokes)
  2825. T}
  2826. .sp .5
  2827. execute-macro-<n>;(none);T{
  2828. Execute numbered macro <N> where <N> is an integer from 1 to 40
  2829. T}
  2830. .sp .5
  2831. execute-named-command;M-X;Execute a command by name
  2832. .sp .5
  2833. execute-procedure;M-^E;Execute a procedure by name
  2834. .sp .5
  2835. exit-emacs;^X-^C;T{
  2836. Exit EMACS. If there are unwritten, changed buffers EMACS will ask to confirm
  2837. T}
  2838. .sp .5
  2839. fill-paragraph;M-Q;Fill the current paragraph
  2840. .sp .5
  2841. filter-buffer;^X-#;T{
  2842. Filter the current buffer through an external filter
  2843. T}
  2844. .sp .5
  2845. find-file;^X-^F;Find a file to edit in the current window
  2846. .sp .5
  2847. forward-character;^F;Move cursor one character to the right
  2848. .sp .5
  2849. goto-line;M-G;Goto a numbered line
  2850. .sp .5
  2851. goto-matching-fence;M-^F;Goto the matching fence
  2852. .TE
  2853. .bp
  2854. .TS
  2855. tab(;);
  2856. l l l
  2857. lfI lfB lw(3i).
  2858. Key Binding;Keystroke;Effect
  2859. _
  2860. grow-window;^X-^;Make the current window larger
  2861. .sp .5
  2862. handle-tab;^I;Insert a tab or set tab stops
  2863. .sp .5
  2864. hunt-forward;FN=;T{
  2865. Hunt for the next match of the last search string
  2866. T}
  2867. .sp .5
  2868. hunt-backward;FN>;T{
  2869. Hunt for the last match of the last search string
  2870. T}
  2871. .sp .5
  2872. help;M-?;Read EMACS.HLP into a buffer and display it
  2873. .sp .5
  2874. i-shell;^X-C;Shell up to a new command processor
  2875. .sp .5
  2876. incremental-search;^X-S;Search for a string, incrementally
  2877. .sp .5
  2878. insert-file;^X-^I;T{
  2879. insert a file at the cursor in the current file
  2880. T}
  2881. .sp .5
  2882. insert-space;^C;Insert a space to the right of the cursor
  2883. .sp .5
  2884. insert-string;(none);Insert a string at the cursor
  2885. .sp .5
  2886. kill-paragraph;M-^W;Delete the current paragraph
  2887. .sp .5
  2888. kill-region;^W;T{
  2889. Delete the current marked region, moving it to the kill buffer
  2890. T}
  2891. .sp .5
  2892. kill-to-end-of-line;^K;Delete the rest of the current line
  2893. .sp .5
  2894. list-buffers;^X-^B;List all existing buffers
  2895. .sp .5
  2896. meta-prefix;<ESC>;Key used to precede all META commands
  2897. .sp .5
  2898. move-window-down;^X-^N;TMove all the lines in the current window down
  2899. .sp .5
  2900. move-window-up;^X-^P;Move all the lines in the current window up
  2901. .sp .5
  2902. name-buffer;M-^N;Change the name of the current buffer
  2903. .sp .5
  2904. newline;^M;Insert a <NL> at the cursor
  2905. .sp .5
  2906. newline-and-indent;^J;T{
  2907. Insert a <NL> at the cursor and indent
  2908. the new line the same as the preceding line
  2909. T}
  2910. .sp .5
  2911. next-buffer;^X-X;T{
  2912. Bring the next buffer in the list into the current window
  2913. T}
  2914. .sp .5
  2915. next-line;^N;Move the cursor down one line
  2916. .sp .5
  2917. next-page;^V;Move the cursor down one page
  2918. .sp .5
  2919. next-paragraph;M-N;Move cursor to the next paragraph
  2920. .sp .5
  2921. next-window;^X-O;Move cursor to the next window
  2922. .sp .5
  2923. next-word;M-F;T{
  2924. Move cursor to the beginning of the next word
  2925. T}
  2926. .sp .5
  2927. open-line;^O;Open a line at the cursor
  2928. .sp .5
  2929. pipe-command;^X-@;T{
  2930. Execute an external command and place its output in a buffer
  2931. T}
  2932. .sp .5
  2933. previous-line;^P;Move cursor up one line
  2934. .sp .5
  2935. previous-page;^Z;Move cursor up one page
  2936. .sp .5
  2937. previous-paragraph;M-P;Move back one paragraph
  2938. .sp .5
  2939. previous-window;^X-P;Move the cursor to the last window
  2940. .TE
  2941. .bp
  2942. .TS
  2943. tab(;);
  2944. l l l
  2945. lfI lfB lw(3i).
  2946. Key Binding;Keystroke;Effect
  2947. _
  2948. previous-word;M-B;T{
  2949. Move the cursor to the beginning of the word to the left of the cursor
  2950. T}
  2951. .sp .5
  2952. query-replace-string;M-^R;T{
  2953. Replace all of one string with another
  2954. string, interactively querying the user
  2955. T}
  2956. .sp .5
  2957. quick-exit;M-Z;Exit EMACS, writing out all changed buffers
  2958. .sp .5
  2959. quote-character;^Q;Insert the next character literally
  2960. .sp .5
  2961. read-file;^X-^R;Read a file into the current buffer
  2962. .sp .5
  2963. redraw-display;M-^L;T{
  2964. Redraw the display, centering the current line
  2965. T}
  2966. .sp .5
  2967. resize-window;^X-W;T{
  2968. Change the number of lines in the current window
  2969. T}
  2970. .sp .5
  2971. restore-window;(none);Move cursor to the last saved window
  2972. .sp .5
  2973. replace-string;M-R;T{
  2974. Replace all occurrences of one string
  2975. with another string from the cursor to the end of the buffer
  2976. T}
  2977. .sp .5
  2978. reverse-incremental-search;^X-R;Search backwards, incrementally
  2979. .sp .5
  2980. run;M-^E;Execute a named procedure
  2981. .sp .5
  2982. save-file;^X-^S;Save the current buffer if it is changed
  2983. .sp .5
  2984. save-window;(none);Remember current window (to restore later)
  2985. .sp .5
  2986. scroll-next-up;M-^Z;Scroll the next window up
  2987. .sp .5
  2988. scroll-next-down;M-^V;Scroll the next window down
  2989. .sp .5
  2990. search-forward;^S;Search for a string
  2991. .sp .5
  2992. search-reverse;^R;Search backwards for a string
  2993. .sp .5
  2994. select-buffer;^X-B;T{
  2995. Select a buffer to display in the current window
  2996. T}
  2997. .sp .5
  2998. set;^X-A;Set a variable to a value
  2999. .sp .5
  3000. set-encryption-key;M-E;Set the encryption key of the current buffer
  3001. .sp .5
  3002. set-fill-column;^X-F;Set the current fill column
  3003. .sp .5
  3004. set-mark;^X-.;Set the mark
  3005. .sp .5
  3006. shell-command;^X-!;Execute an external command
  3007. .sp .5
  3008. shrink-window;^X-^Z;Make the current window smaller
  3009. .sp .5
  3010. split-current-window;^X-2;Split the current window in two
  3011. .sp .5
  3012. store-macro;(none);T{
  3013. Store the following macro lines to a numbered macro
  3014. T}
  3015. .sp .5
  3016. store-procedure;(none);T{
  3017. Store the following macro lines to a named procedure
  3018. T}
  3019. .sp .5
  3020. transpose-characters;^T;T{
  3021. Transpose the character at the cursor with the character to the left
  3022. T}
  3023. .sp .5
  3024. trim-line;^X-^T;Trim any trailing whitespace from line
  3025. .sp .5
  3026. unbind-key;M-^K;Unbind a key from a function
  3027. .sp .5
  3028. universal-argument;^U;Execute the following command 4 times
  3029. .sp .5
  3030. unmark-buffer;M-~;T{
  3031. Unmark the current buffer (so it is no longer changed)
  3032. T}
  3033. .sp .5
  3034. update-screen;(none);Force a screen update during macro execution
  3035. .sp .5
  3036. view-file;^X-^V;Find a file,and put it in view mode
  3037. .sp .5
  3038. wrap-word;M-FNW;T{
  3039. Wrap the current word, this is an internal function
  3040. T}
  3041. .sp .5
  3042. write-file;^X-^W;T{
  3043. Write the current buffer under a new file name
  3044. T}
  3045. .sp .5
  3046. write-message;(none);Display a string on the command line
  3047. .sp .5
  3048. yank;^Y;T{
  3049. yank the kill buffer into the current buffer at the cursor
  3050. T}
  3051. .TE
  3052. .sb
  3053. .bp
  3054. .SH
  3055. MicroEMACS Bindings
  3056. .sf
  3057. .PP
  3058. Below is a complete list of the key bindings used in MicroEMACS.
  3059. This can be used as a wall chart reference for MicroEMACS commands.
  3060. .KS
  3061. .TS
  3062. tab(;);
  3063. c s s s
  3064. lfB l lfB l.
  3065. Default Key Bindings for MicroEmacs 3.8i
  3066. _
  3067. ^A;Move to start of line;ESC A;Apropos (list some commands)
  3068. ^B;Move backward by characters;ESC B;Backup by words
  3069. ^C;Insert space;ESC C;Initial capitalize word
  3070. ^D;Forward delete;ESC D;Delete forward word
  3071. ^E;Goto end of line;ESC E;Reset Encryption Key
  3072. ^F;Move forward by characters;ESC F;Advance by words
  3073. ^G;Abort out of things;ESC G;Go to a line
  3074. ^H;Backward delete              
  3075. ^I;Insert tab/Set tab stops
  3076. ^J;Insert CR-LF, then indent             
  3077. ^K;Kill forward;ESC K;Bind Key to function
  3078. ^L;Refresh the screen;ESC L;Lower case word
  3079. ^M;Insert CR-LF;ESC M;Add global mode
  3080. ^N;Move forward by lines;ESC N;Goto End paragraph
  3081. ^O;Open up a blank line          
  3082. ^P;Move backward by lines;ESC P;Goto Beginning of paragraph
  3083. ^Q;Insert literal;ESC Q;Fill current paragraph
  3084. ^R;Search backwards;ESC R;Search and replace
  3085. ^S;Search forward
  3086. ^T;Transpose characters               
  3087. ^U;Repeat command four times;ESC U;Upper case word
  3088. ^V;Move forward by pages;ESC V;Move backward by pages
  3089. ^W;Kill region;ESC W;Copy region to kill buffer
  3090. ^Y;Yank back from killbuffer;ESC X;Execute named command
  3091. ^Z;Move backward by pages;ESC Z;Save all buffers and exit
  3092. .sp
  3093. ESC ^C;Count words in region;ESC ~;Unmark current buffer
  3094. ESC ^F;Goto matching fence;ESC !;Reposition window
  3095. ESC ^H;Delete backward word;ESC <;Move to start of buffer
  3096. ESC ^K;Unbind Key from function;ESC >;Move to end of buffer
  3097. ESC ^L;Reposition window;ESC .;Set mark
  3098. ESC ^M;Delete global mode;ESC space;Set mark
  3099. ESC ^N;Rename current buffer;ESC rubout;Delete backward word
  3100. ESC ^R;Search & replace w/query;rubout;Backward delete
  3101. ESC ^S;Change screen rows
  3102. ESC ^T;Change screen columns
  3103. ESC ^V;Scroll next window down
  3104. ESC ^W;Delete Paragraph
  3105. ESC ^Z;Scroll next window up
  3106. .TE
  3107. .KE
  3108. .KS
  3109. .TS
  3110. tab(;);
  3111. c s s s
  3112. lfB l lfB l.
  3113. Default Key Bindings for MicroEmacs 3.8i
  3114. _
  3115. .sp
  3116. ^X ?;Describe a key;^X !;Run 1 command in a subjob
  3117. ^X =;Show the cursor position;^X @;Pipe DOS command to buffer
  3118. ^X ^;Enlarge display window;^X #;Filter buffer thru DOS filter
  3119. ^X 0;Delete current window;^X (;Begin macro
  3120. ^X 1;Delete other windows;^X );End macro
  3121. ^X 2;Split current window
  3122. ;;^X A;Set variable value
  3123. ^X ^B;Display buffer list;^X B;Switch a window to a buffer
  3124. ^X ^C;Exit MicroEMACS;^X C;Start a new command processor
  3125. ;;^X D;Suspend MicroEMACS (BSD4.2 only)
  3126. ;;^X E;Execute macro
  3127. ^X ^F;Find file;^X F;Set fill column
  3128. ^X ^I;Insert file
  3129. ;;^X K;Delete buffer
  3130. ^X ^L;Lower case region
  3131. ^X ^M;Delete Mode;^X M;Add a mode
  3132. ^X ^N;Move window down;^X N;Rename current filename
  3133. ^X ^O;Delete blank lines;^X O;Move to the next window
  3134. ^X ^P;Move window up;^X P;Move to the previous window
  3135. ^X ^R;Get a file from disk;^X R;Incremental reverse search
  3136. ^X ^S;Save current file;^X S;Incremental forward search
  3137. ^X ^U;Upper case region
  3138. ^X ^V;View file
  3139. ^X ^W;Write a file to disk;^X W;resize Window
  3140. ^X ^X;Swap "." and mark;^X X;Use next buffer
  3141. ^X ^Z;Shrink window;^X Z;Enlarge display window
  3142. .TE
  3143. .KE
  3144. .KS
  3145. .TS
  3146. tab (;);
  3147. l l.
  3148. Only under PCDOS:
  3149. .sp .5
  3150. <ALT>-S Hunt forward;SHIFT <F1> - <F10>
  3151. <ALT>-R Hunt backward;Execute macros 1 - 10
  3152. .TE
  3153. .KE
  3154. .KS
  3155. .TS
  3156. tab(;);
  3157. l s
  3158. l l.
  3159. Usable Modes
  3160. _
  3161. WRAP;Lines going past right margin "wrap" to a new line
  3162. VIEW;Read-Only mode where no modifications are allowed
  3163. CMODE;Change behavior of some commands to work with C better
  3164. EXACT;Exact case matching on search strings
  3165. OVER;Overwrite typed characters instead of inserting them
  3166. CRYPT;Current buffer will be encrypted on write, decrypted on read
  3167. MAGIC;Use regular expression matching in searches
  3168. ASAVE;Save the file every 256 inserted characters
  3169. .TE
  3170. .sp .5
  3171. .TS
  3172. tab(;);
  3173. l l.
  3174. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK;Sets foreground color
  3175. white/cyan/magenta/yellow/blue/red/green/black;Sets background color
  3176. .TE
  3177. .KE
  3178. .sb
  3179. .bp
  3180. .SH
  3181. Supported machines
  3182. .sf
  3183. .PP
  3184. The following table lists all the hardware/compilers for which I
  3185. currently support MicroEMACS.  This is not exclusive of all machines
  3186. which MicroEMACS will run on, but I have either run it myself, or had a
  3187. first hand report of it running.
  3188. .KS
  3189. .TS
  3190. tab(;);
  3191. l l l l.
  3192. Hardware;OS;Compiler;Comments
  3193. _
  3194. VAX 780;UNIX V5;native
  3195. ;UNIX V7;native
  3196. ;BSD 4.2;native;job control supported
  3197. ;*VMS;native;only some terminals supported
  3198. .sp
  3199. NCR Tower;UNIX V5;native
  3200. .sp
  3201. Fortune 32:16;UNIX V7;native
  3202. .sp
  3203. IBM-PC;MSDOS 2/3.2;Lattice 2.15;Large CODE/Large DATA
  3204. ;;AZTEC 3.4e;Small CODE/Large DATA
  3205. ;;*MSC 4.0
  3206. ;;*MWC 86
  3207. .sp
  3208. HP150;MSDOS;Lattice 2.15;T{
  3209. Function key labels for the touch screen
  3210. T}
  3211. .sp
  3212. HP110;MSDOS;Lattice 2.15
  3213. ;;Aztec 3.4e
  3214. .sp
  3215. T{
  3216. *Data General 10
  3217. T};MSDOS;Lattice 2.15
  3218. .sp
  3219. T{
  3220. *Texas Instruments Professional
  3221. T};MSDOS;Lattice 2.15
  3222. .sp
  3223. Amiga;Intuition;Lattice 3.03;no mouse or menus yet
  3224. ;;*Aztec 3
  3225. .sp
  3226. ST520;TOS;Lattice 3.10;T{
  3227. no menus yet, no shell commands
  3228. T}
  3229. +Macintosh;Finder 5.0;Aztec
  3230. .TE
  3231. .KE
  3232. .FS
  3233. * means that I do not own or have access to the listed compiler and/or
  3234. machine and must rely upon others to help support it.
  3235. .FE
  3236. .FS
  3237. + Systems to be supported (i.e some code is already written:)
  3238. .FE
  3239. .sb
  3240. .bp
  3241. .SH
  3242. Machine Dependent Notes
  3243. .sf
  3244. .PP
  3245. This appendix lists some notes specific to individual
  3246. implementations of MicroEMACS. Every attempt has been made to allow
  3247. EMACS to be identical on all machines, but we have also tried to take
  3248. advantage of function keys, cursor keys, mice, and special screen modes
  3249. where possible.
  3250. .SH
  3251. IBM-PC/XT/AT and its clones
  3252. .sf
  3253. .PP
  3254. The IBM-PC family of computers is supported with a variety of
  3255. different display adapters.  EMACS will attempt to discover what adapter
  3256. is connected and use the proper driver for it.    Below is a list of the
  3257. currently supported video adapters:
  3258. .KS
  3259. .TS
  3260. tab(;);
  3261. l l l.
  3262. ;Adapter;$sres;Original mode used
  3263. _
  3264. Monochrome Graphics Adapter;MONO;MONO
  3265. Color Graphics Adapter;CGA;CGA
  3266. Enhanced graphics Adapter;EGA;CGA
  3267. .TE
  3268. .KE
  3269. .PP
  3270. EMACS also takes advantage of various function keys and the keys
  3271. on the keypad on an IBM-PC.  The function keys are initially not bound
  3272. to any particular functions (except by the emacs.rc startup file), but
  3273. the keypad keys do default to the following:
  3274. .KS
  3275. .TS
  3276. tab(;);
  3277. l l.
  3278. Keypad key;Function
  3279. _
  3280. Home;beginning-of-file
  3281. CSRS UP;previous-line
  3282. Pg Up;previous-page
  3283. CSRS LEFT;backward-character
  3284. CSRS RIGHT;forward-character
  3285. End;end-of-file
  3286. CSRS DOWN;next-line
  3287. Pg Dn;Next-page
  3288. .TE
  3289. .KE
  3290. .PP
  3291. All these special keys are indicated in EMACS macros by use of the
  3292. .B "FN"
  3293. prefix.  Below is a list of many of the keys and the codes
  3294. used to specify them.  Also the codes may be gotten by using the
  3295. describe-key (^X ?) command on the suspect key.
  3296. .KS
  3297. .TS
  3298. tab(%);
  3299. l s s s s
  3300. l l l l l.
  3301. IBM PC function keys in MicroEmacs
  3302. .sp .5
  3303. %function%Function%^function%Alt-function
  3304. f1)%FN;%FNT%FN^%FNh
  3305. f2)%FN<%FNU%FN_%FNi
  3306. f3)%FN=%FNV%FN`%FNj
  3307. f4)%FN>%FNW%FNa%FNk
  3308. f5)%FN?%FNX%FNb%FNl
  3309. f6)%FN@%FNY%FNc%FNm
  3310. f7)%FNA%FNZ%FNd%FNn
  3311. f8)%FNB%FN[%FNe%FNo
  3312. f9)%FNC%FN\%FNf%FNp
  3313. f10)%FND%FN]%FNg%FNq
  3314. .sp
  3315. home)%FNG%%FNw
  3316. CuUp)%FNH
  3317. PgUp)%FNI%%FN {Alt 132}
  3318. CuLf)%FNK%%FNs
  3319.  5  )
  3320. CuRt)%FNM%%FNt
  3321.  End)%FNO%%FNu
  3322. CuDn)%FNP
  3323. PgDn)%FNQ%%FNv
  3324.  Ins)%FNR
  3325.  Del)%FNS
  3326. .TE
  3327. .KE
  3328. .sb
  3329. .bp
  3330. .SH
  3331. Atari 520/1040ST
  3332. .sf
  3333. .PP
  3334. The ATARI ST family of computers have a dual personality.  They
  3335. may use either a monochrome or a color screen.    EMACS supports two
  3336. screen resolutions on each monitor. 
  3337. .KS
  3338. .TS
  3339. tab(;);
  3340. l l l l l.
  3341. Monitor;$sres;size;#color;$palette format
  3342. _
  3343. Color;LOW;40x25;16;000111222333444555666777
  3344. ;MEDIUM;80x25;4;000111222333
  3345. Mono;HIGH;80x25;2;000
  3346. ;DENSE*;80x40;2;000
  3347. .TE
  3348. .KE
  3349. .FS
  3350. * DENSE mode is not yet supported in 3.8i.  It will be soon
  3351. .FE
  3352. .PP
  3353. The $palette environment variable can be used to change what
  3354. color is associated with each color name.  With a color monitor, each
  3355. group of three digits indicates an octal number specifying the RED,
  3356. GREEN and BLUE levels of that color.  Each color digit can vary from 0
  3357. to 7.  For example, the initial setting of $palette in LOW resolution is:
  3358. .IP
  3359. 000700070770007707077777
  3360. .LP
  3361. which broken up is:
  3362. .IP
  3363. 000 700 070 770 007 707 077 777
  3364. .LP
  3365. which means:
  3366. .KS
  3367. .TS
  3368. tab(;);
  3369. l l.
  3370. 000;Black
  3371. 700;Red
  3372. 070;Green
  3373. 770;Yellow
  3374. 007;Blue
  3375. 707;Magenta
  3376. 077;Cyan
  3377. 777;White
  3378. .TE
  3379. .KE
  3380. .PP
  3381. Also the mouse generates FN prefix codes when moved, or when one
  3382. of the two buttons is pressed.    Initially the movement of the mouse is
  3383. bound to movement of the cursor, and the left mouse button generates a
  3384. set-mark (M-space) command.  The cursor keys and the function keys are
  3385. bound similarly to IBM-PC.
  3386. .sb
  3387. .SH
  3388. Amiga 1000
  3389. .sf
  3390. .PP
  3391. The Commodore AMIGA 1000 version of MicroEMACS does not have
  3392. extensive support of the mouse or of pull down menus as of yet.  It does
  3393. however come up in a window, and it is possible to re-size it to run in
  3394. different sized windows.  The
  3395. .B "M-^S"
  3396. .I "change-screen-size"
  3397. takes its numeric argument as the new number
  3398. of lines for EMACS to use.  The
  3399. .B "M-^T"
  3400. .I "change-screen-width"
  3401. command allows you to change the number of
  3402. columns EMACS will use.  The defaults for these are 23 lines and 77
  3403. characters across for a full screen window.
  3404. .DS C
  3405. Note about Compiling MicroEMACS
  3406. .DE
  3407. .IP
  3408. .I
  3409. If you are compiling the sources on the AMIGA to produce an
  3410. executable image, and you are using the Lattice compiler, be sure to
  3411. give the CLI command 'STACK 40000' before compiling to make sure the
  3412. compiler has sufficient stack space to successfully complete
  3413. compilation.
  3414. .sb
  3415. .bp
  3416. .SH
  3417. UNIX V5, V7, and BSD4.[23]
  3418. .sf
  3419. .PP
  3420. MicroEMACS under UNIX utilizes the
  3421. .B "TERMCAP"
  3422. library to provide machine independent screen functions.  Make sure that
  3423. termcap is available and properly set on your account before attempting
  3424. to use MicroEMACS. 
  3425. .PP
  3426. Under systems which support job control, you can use the
  3427. .B "^X-D"
  3428. .I "suspend-emacs"
  3429. command to place EMACS
  3430. into the background.  This carries a much smaller overhead than bringing
  3431. up a new shell under EMACS.  EMACS will properly redraw the screen when
  3432. you bring it back to the foreground.
  3433. .PP
  3434. With the addition of some very machine/operating system specific
  3435. code, EMACS can prevent two or more people from modifying the same file
  3436. at the same time. The upper level of a set of
  3437. functions to provide file locking exist in the source file
  3438. .B "LOCK.C."
  3439. It requires two machine specific functions written and linked into EMACS
  3440. for it to operate properly. 
  3441. .IP
  3442. char *dolock(fname)
  3443. .sp
  3444. char *fname;
  3445. .sp
  3446. dolock() locks a file, preventing others from modifying it. If
  3447. it succeeds, it returns NULL, otherwise it returns a pointer to
  3448. a string in the form "LOCK ERROR: explanation".
  3449. .sp
  3450. char *undolock(fname)
  3451. .sp
  3452. char *fname;
  3453. .sp
  3454. undolock() unlocks a file, allowing others to modifying it. If
  3455. it succeeds, it returns NULL, otherwise it returns a pointer to
  3456. a string in the form "LOCK ERROR: explanation".
  3457.