home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE3112.ZIP / emacs.doc < prev    next >
Text File  |  1991-12-22  |  230KB  |  7,240 lines

  1. MicroEMACS
  2.  
  3. Full Screen Text Editor
  4. Reference Manual
  5.  
  6. Version 3.11
  7. October 29, 1991
  8.  
  9. (C)Copyright 1988, 1989, 1990, 1991 by Daniel M. Lawrence
  10. Reference Manual (C)opyright 1988, 1989, 1990, 1991
  11.         by Brian Straight and Daniel M. Lawrence
  12. All Rights Reserved
  13.  
  14. (C)Copyright 1988, 1989, 1990, 1991 by Daniel M. Lawrence
  15. MicroEMACS 3.11 can be copied and  distributed  freely for any
  16. non-commercial purposes. Commercial users may use MicroEMACS
  17. 3.11 inhouse. Shareware distributors may redistribute
  18. MicroEMACS 3.11 for media costs only. MicroEMACS 3.11 can only
  19. be incorporated into commercial software or resold with the
  20. permission of the current author.
  21.  
  22.  
  23.  
  24. Introduction
  25.  
  26.         MicroEMACS  is  a  tool  for  creating  and   changing  documents,
  27. programs, and other text files. It is both relatively easy for  the novice
  28. to use, but also very powerful in the hands of  an  expert. MicroEMACS can
  29. be extensively customized for the needs of the individual user.
  30.  
  31.         MicroEMACS allows several files to be edited at the same time. The
  32. screen  can  be  split into different windows and screens, and text may be
  33. moved freely from one window on any screen to the  next.  Depending on the
  34. type  of  file  being edited, MicroEMACS can change how it behaves to make
  35. editing  simple.    Editing  standard  text files, program files and  word
  36. processing documents are all possible at the same time.
  37.  
  38.         There are  extensive  capabilities  to  make  word  processing and
  39. editing easier. These include commands for string searching and replacing,
  40. paragraph reformatting and deleting, automatic  word  wrapping,  word move
  41. and deletes, easy case controlling, and automatic word counts.
  42.  
  43.         For complex and repetitive  editing  tasks  editing macroes can be
  44. written. These macroes  allow  the  user  a great degree of flexibility in
  45. determining how MicroEMACS behaves. Also, any and all the commands  can be
  46. used by any keystroke  by  changing,  or  rebinding, what commands various
  47. keys invoke.
  48.  
  49.         Special  features  are  also available to perform a diverse set of
  50. operations such as  file  encryption,  automatic  backup  file generation,
  51. entabbing and detabbing lines,  executing  operating  system  commands and
  52. filtering  of  text  through  other  programs (like SORT to allow  sorting
  53. text).
  54.  
  55. History
  56.  
  57.         EMACS was originally a text  editor written by Richard Stallman at
  58. MIT in the early 1970s  for Digital Equipment computers. Various versions,
  59. rewrites and clones have made an appearance since.
  60.  
  61.         This version of MicroEMACS is derived from code written by Dave G.
  62. Conroy  in  1985.  Later modifications were performed by Steve Wilhite and
  63. George Jones.  In  December  of  1985  Daniel  Lawrence picked up the then
  64. current  source  (version  2.0)  and  made  extensive   modifications  and
  65. additions to it over the course of the next six years. Updates and support
  66. for the current version are  still available. Commercial support and usage
  67. and resale licences are also available. The current program author  can be
  68. contacted by writing to:
  69.  
  70.         USMAIL: Daniel Lawrence
  71.                 617 New York St
  72.                 Lafayette, IN 47901
  73.  
  74.         UUCP:   pur-ee!mdbs!dan
  75.         ARPA:   mdbs!dan@ee.ecn.purdue.edu
  76.  
  77.         Support is provided through:
  78.  
  79.         The Programmer's Room
  80.         Opus 201/10
  81.         300/1200/2400 and 9600 (Hayes V series only)
  82.         (317) 742-5533  no parity  8 databits  no stop bits
  83.  
  84.  
  85.  
  86. Credits
  87.  
  88.         Many  people  have  been involved in creating this software and we
  89. wish to credit some of them here. Dave Conroy, of  course,  wrote the very
  90. first version of MicroEMACS, and it is a credit to  his  clean coding that
  91. so much work  was able to be done to expand it. John Gamble is responsible
  92. for writing the MAGIC mode search routines, and for  maintaining  all  the
  93. search code. Jeff Lomicka wrote the appendix on DEC VMS and has supplied a
  94. lot of code to support VMS and the  ATARI  1040ST  versions.  Curtis Smith
  95. wrote the original  VMS  code  and  help support the Commodore AMIGA. Also
  96. Lance Jones  has  done  a  lot of work on the AMIGA code. Professor Suresh
  97. Konda at Carnegie Mellon University has  put  a lot of effort into writing
  98. complex macros  and  finding  all  the  bugs  in the macro language before
  99. anyone else does.
  100.  
  101.         A special thanks to Dana Hoggatt who has provided an  almost daily
  102. sounnding board for ideas, algorithyms and code. He is responcible for the
  103. encryption code directly and has prodded me into adding many features with
  104. simple but poignant questions (Dan? How  do  we move the upper left corner
  105. of the screen? . . . which forced me to write the text windowing system).
  106.  
  107.         As  to  people  sending  source  code and text  translations  over
  108. computer networks like USENET and ARPA net, there are simply more than can
  109. be  listed  here.  [The comments in the edit history in the history.c file
  110. mention each and the  piece  they contributed]. All these people should be
  111. thanked for the hard work they have put into MicroEMACS.
  112.  
  113.  
  114.                                      Daniel M. Lawrence
  115.  
  116. Basic Concepts                                 MicroEMACS Reference Manual
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.                                 Chapter 1
  126.  
  127.                               Basic Concepts
  128.  
  129.  
  130.         The current version  of  MicroEMACS is 3.11 (Third major re-write,
  131. eleventh  public release), and for the rest of  this  document,  we  shall
  132. simply  refer  to  this  version  as "EMACS". Any modifications for  later
  133. versions will be in the file README on the MicroEMACS distribution disk.
  134.  
  135.  
  136. 1.1  Keys and the Keyboard
  137.  
  138.  
  139.         Many  times  throughout  this  manual  we  will  be talking  about
  140. commands  and  the keys on the keyboard needed to use them.  There  are  a
  141. number of "special" keys which can be used and are listed here:
  142.  
  143. <NL>              NewLine which is also  called  RETURN,  ENTER,  or <NL>,
  144.                   this key is used to end different commands.
  145.  
  146. ^                 The  control  key  can  be  used  before  any alphabetic
  147.                   character and some symbols.  For  example,  ^C  means to
  148.                   hold down the <CONTROL> key and type the C  key  at  the
  149.                   same time.
  150.  
  151. ^X                The  CONTROL-X  key  is used at the  beginning  of  many
  152.                   different commands.
  153.  
  154. META or M-        This is a special EMACS key used to begin many commands.
  155.                   his key  is pressed and then released before typing the
  156.                   next character.  On most systems, this is the <ESC> key,
  157.                   but it can be changed. (consult appendix E to learn what
  158.                   key is used for META on your computer).
  159.  
  160.         Whenever a command is described, the manual will  list  the actual
  161. keystrokes needed to execute it in boldface using  the  above conventions,
  162. and also the name of the command in italics.
  163.  
  164.  
  165. 1.2  Getting Started
  166.  
  167.  
  168.         In order  to  use  EMACS,  you must call it up from your system or
  169. computer's command prompt. On UNIX and MSDOS machines,  just  type "emacs"
  170. from the command prompt and follow it with the <RETURN> or <ENTER> key (we
  171. will refer to this key as  <NL>  for  "new-line" for the remainder of this
  172. manual). On the Macintosh, the Amiga, the ATARI  ST,  and  under  OS/2 and
  173.  
  174.  
  175. 1
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182. MicroEMACS Reference Manual                                 Basic Concepts
  183.  
  184.  
  185. other  icon  based  operating  systems,  double click on the uEMACS  icon.
  186. Shortly after this, a screen similar to the one below should appear.
  187.  
  188.  
  189. 1.3  Parts and Pieces
  190.  
  191.  
  192.         The screen is divided into a  number  of areas or windows. On some
  193. systems the top window  contains  a function list of unshifted and shifted
  194. function keys. We will discuss these keys later.  Below  them  is an EMACS
  195. mode line which,  as  we  will  see,  informs  you  of the present mode of
  196. operation of the editor--for example "(WRAP)" if you set EMACS to  wrap at
  197. the end of each line. Under the mode line is the  text  window  where text
  198. appears and is manipulated. Since each window has its own mode line, below
  199. the text window is it's  mode  line.  The  last  line of the screen is the
  200. command line where EMACS takes commands and reports on what it is doing.
  201.  
  202. ==========================================================================
  203. f1 search-> f2 <-search |    MicroEMACS:  Text Editor
  204. f3 hunt->   f4 <-hunt   |
  205. f5 fkeys    f6 help     |  Available function key Pages include:
  206. f7 nxt wind f8 pg[    ] |    WORD  BOX  EMACS  PASCAL  C  cObal  Lisp
  207. f9 save     f10 exit    |  [use the f8 key to load Pages]
  208. ==========================================================================
  209.    MicroEMACS 3.11 ()    Function Keys
  210. ==========================================================================
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. ==========================================================================
  223. ---- MicroEMACS 3.11 () -- Main ------------------------------------------
  224. ==========================================================================
  225.                 Fig 1:  EMACS screen on an IBM-PC
  226.  
  227.  
  228. 1.4  Entering Text
  229.  
  230.  
  231.         Entering  text in EMACS is simple.  Type  the  following  sentence
  232. fragment:
  233.  
  234.      Fang Rock lighthouse, center of a series of mysterious and
  235.  
  236. The text is displayed at the top of the text window. Now type:
  237.  
  238.  
  239.  
  240.                                                                          2
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247. Basic Concepts                                 MicroEMACS Reference Manual
  248.  
  249.  
  250.      terrifying events at the turn of the century
  251.  
  252.         Notice that some of your text has dissapeared off the left side of
  253. the screen. Don't panic--your text  is safe!!! You've just discovered that
  254. EMACS doesn't  "wrap"  text  to  the  next  line like most word processors
  255. unless you hit <NL>. But since EMACS is used for both word processing, and
  256. text  editing, it has a bit of a dual personality. You can change the  way
  257. it  works  by setting various modes. In this case, you need  to  set  WRAP
  258. mode, using the add-mode command, by  typing  ^XM. The command line at the
  259. base of the screen will prompt you for the mode you wish to add. Type wrap
  260. followed by the <NL> key and any  text  you  now  enter  will  be wrapped.
  261. However, the command doesn't wrap text already entered. To get rid  of the
  262. long line, press and hold down the <BACKSPACE> key until the line is gone.
  263. Now  type in the words you deleted, watch how EMACS goes down to the  next
  264. line at the right time. (In some versions of EMACS, WRAP is a default mode
  265. in which case you don't have  to  worry about the instructions relating to
  266. adding this mode.)
  267.  
  268.         Now  let's type a longer insert. Hit <NL> a couple of times to tab
  269. down from the text you just entered. Now type  the  following  paragraphs.
  270. Press <NL> twice to indicate a paragraph break.
  271.  
  272.      Fang  Rock  lighthouse,  center of a series  of  mysterious  and
  273.      terrifying  events at the turn of the century,  is  built  on  a
  274.      rocky island a few miles of  the  Channel coast. So small is the
  275.      island that wherever you stand its rocks are wet with sea spray.
  276.  
  277.      The lighthouse tower  is  in  the  center of the island. A steep
  278.      flight of steps  leads  to  the  heavy door in its base. Winding
  279.      stairs lead up to the crew room.
  280.  
  281.  
  282. 1.5  Basic cursor movement
  283.  
  284.  
  285.         Now let's practice moving around in this text. To move  the cursor
  286. back  to  the  word "Winding," enter M-B previous-word. This command moves
  287. the cursor backwards by one word at a time. Note you have to press the key
  288. combination every time the  cursor  steps  back  by one word. Continuously
  289. pressing META and toggling B produces an error message. To move forward to
  290. the word "stairs" enter  M-F  next-word, which moves the cursor forward by
  291. one word at a time.
  292.  
  293.         Notice that  EMACS commands are usually mnemonic--F for forward, B
  294. for backward, for example.
  295.  
  296.         To move the cursor  up  one line, enter ^P previous-line, down one
  297. line ^N next-line. Practice this movement by moving the cursor to the word
  298. "terrifying" in the second line.
  299.  
  300.         The cursor may  also  be  moved  forward  or  backward  in smaller
  301. increments.  To move forward by one character, enter ^F forward-character,
  302. to move backward, ^B backward-character.  EMACS also allows you to specify
  303. a number which is normally used to tell a command  to  execute many times.
  304.  
  305.  
  306. 3
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313. MicroEMACS Reference Manual                                 Basic Concepts
  314.  
  315.  
  316. To repeat most commands, press META  and  then the number before you enter
  317. the command. Thus,  the  command  META  5  ^F (M-5^F) will move the cursor
  318. forward by five characters. Try moving  around  in the text by using these
  319. commands.  For  extra  practice, see how close you can come  to  the  word
  320. "small" in  the  first  paragraph  by  giving  an argument to the commands
  321. listed here.
  322.  
  323.         Two other simple cursor  commands  that are useful to help us move
  324. around  in  the  text are M-N next-paragraph which moves the cursor to the
  325. second  paragraph,  and  M-P previous-paragraph which moves it back to the
  326. previous paragraph. The cursor may also  be  moved rapidly from one end of
  327. the line to the other. Move the cursor  to  the  word  "few" in the second
  328. line.  Press ^A beginning-of-line. Notice the cursor  moves  to  the  word
  329. "events" at the beginning  of  the line. Pressing ^E end-of-line moves the
  330. cursor to the end of the line.
  331.  
  332.         Finally, the cursor may be moved from any point in the file to the
  333. end or beginning of the file. Entering M-> end-of-file moves the cursor to
  334. the end of the buffer, M-< beginning-of-file to the first character of the
  335. file.
  336.  
  337.         On the IBM-PC, the ATARI ST and many other  machines,  the  cursor
  338. keys can also be used to move the cursor.
  339.  
  340.         Practice moving the cursor in the text until  you  are comfortable
  341. with the commands we've explored in this chapter.
  342.  
  343.  
  344. 1.6  Saving your text
  345.  
  346.  
  347.         When you've finished practicing cursor movement,  save  your file.
  348. Your file currently resides in a BUFFER. The buffer is a temporary storage
  349. area  for your text, and is lost when the computer is turned off. You  can
  350. save  the  buffer  to a file by entering ^X^S save-file. Notice that EMACS
  351. informs you that your file has no name and will not let you save it.
  352.  
  353.         To save your  buffer  to  a  file  with a different name than it's
  354. current one (which is empty), press ^X^W write-file.   EMACS  will  prompt
  355. you  for the filename you wish to write. Enter the name fang.txt and press
  356. return. On a micro, the drive  light  will  come on, and EMACS will inform
  357. you it is writing the file. When it finishes, it will  inform  you  of the
  358. number of lines it has written to the disk.
  359.  
  360.         Congratulations!! You've just saved your first EMACS file!
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.                                                                          4
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379. Basic Concepts                                 MicroEMACS Reference Manual
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.                             Chapter 1 Summary
  387.  
  388.  
  389.         In chapter 1, you learned how to enter text, how to use wrap mode,
  390. how to move the cursor,  and to save a buffer. The following is a table of
  391. the commands covered in this chapter and their corresponding key bindings:
  392.  
  393. Key Binding             Keystroke       Effect
  394.  
  395. abort-command           ^G              aborts current command
  396.  
  397. add-mode                ^XM             allows addition of EMACS
  398.                                         mode such as WRAP
  399.  
  400. backward-character      ^B              moves cursor left one character
  401.  
  402. beginning-of-file       M-<             moves cursor to beginning of file
  403.  
  404. beginning-of-line       ^A              moves cursor to beginning of line
  405.  
  406. end-of-file             M->             moves cursor to end of file
  407.  
  408. end-of-line             ^E              moves cursor to end of line
  409.  
  410. forward-character       ^F              moves cursor right one character
  411.  
  412. next-line               ^N              moves cursor to next line
  413.  
  414. next-paragraph          M-N             moves cursor to next paragraph
  415.  
  416. next-word               M-F             moves cursor forward one word
  417.  
  418. previous-line           ^P              moves cursor backward by one line
  419.  
  420. previous-paragraph      M-P             moves cursor to previous paragraph
  421.  
  422. previous-word           M-B             moves cursor backward by one word
  423.  
  424. save-file               ^X^S            saves current buffer to a file
  425.  
  426. write-file              ^X^W            save current buffer under a new name
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438. 5
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445. MicroEMACS Reference Manual Basic Editing--Simple Insertions and Deletions
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.                                 Chapter 2
  455.  
  456.               Basic Editing--Simple Insertions and Deletions
  457.  
  458.  
  459. 2.1  A Word About Windows, Buffers, Screens, and Modes
  460.  
  461.  
  462.         In the first chapter, you learned how to create and save a file in
  463. EMACS. Let's do some more editing on this file. Call up emacs by typing in
  464. the following command.
  465.  
  466.         emacs fang.txt
  467.  
  468.         On icon oriented systems, double click on the uEMACS icon, usually
  469. a  file  dialog  box of some sort will appear. Choose  FANG.TXT  from  the
  470. appropriate folder.
  471.  
  472.         Shortly  after you invoke EMACS, the text  should  appear  on  the
  473. screen ready for you to  edit.  The  text  you  are  looking  at currently
  474. resides in a buffer. A buffer is a temporary area of computer memory which
  475. is the  primary  unit  internal  to EMACS -- this is the place where EMACS
  476. goes  to work. The mode line at the bottom of the screen lists the  buffer
  477. name,  FANG.TXT  and  the name of the  file  with  which  this  buffer  is
  478. associated, FANG.TXT
  479.  
  480.         The  computer talks to you through the use  of  its  screen.  This
  481. screen usually has an area of 24 lines each of  80  characters across. You
  482. can use EMACS to subdivide the screen into several separate work areas, or
  483. windows, each of which  can  be 'looking into' different files or sections
  484. of text. Using windows, you can work on several related texts at one time,
  485. copying and moving blocks of text between windows with ease. To keep track
  486. of  what you are editing, each window is identified by a mode line on  the
  487. last line of the window which lists the  name  of  the  buffer which it is
  488. looking  into, the file from which the text was read, and how the text  is
  489. being edited.
  490.  
  491.         An  EMACS mode tells EMACS how to deal with user input. As we have
  492. already seen, the  mode  'WRAP'  controls  how EMACS deals with long lines
  493. (lines with over  79  characters)  while  the  user is typing them in. The
  494. 'VIEW' mode, allows you to read a file  without  modifying  it.  Modes are
  495. associated with buffers  and  not  with  files;  hence, a mode needs to be
  496. explicitly set or removed every time you edit a file. A new file read into
  497. a buffer with a previously specified mode will be edited under  this mode.
  498. If  you  use  specific modes frequently, EMACS allows you to set the modes
  499. which are used by all new buffers, called global modes.
  500.  
  501.  
  502.  
  503.  
  504.                                                                          6
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511. Basic Editing--Simple Insertions and Deletions MicroEMACS Reference Manual
  512.  
  513.  
  514. 2.2  Insertions
  515.  
  516.  
  517.         Your previously-saved text should look like this:
  518.  
  519.      Fang  Rock  lighthouse,  center of a series  of  mysterious  and
  520.      terrifying  events at the turn of the century,  is  built  on  a
  521.      rocky island a few miles of  the  Channel coast. So small is the
  522.      island that wherever you stand its rocks are wet with sea spray.
  523.  
  524.      The lighthouse tower  is  in  the  center of the island. A steep
  525.      flight of steps  leads  to  the  heavy door in its base. Winding
  526.      stairs lead up to the crew room.
  527.  
  528.         Let's assume you want to add a sentence in  the  second  paragraph
  529. after  the word "base."  Move the  cursor  until  it  is  on  the  "W"  of
  530. "Winding". Now type the following:
  531.  
  532.      This  gives  entry  to  the  lower  floor  where the  big  steam
  533.      generator throbs steadily away, providing power for the electric
  534.      lantern.
  535.  
  536.         If  the  line  fails to wrap and you end up with a '$' sign in the
  537. right margin, just enter M-Q  fill-paragraph  to  reformat  the paragraph.
  538. This new command attempts to fill out a paragraph. Long lines  are divided
  539. up, and words are shuffled around to make the paragraph look nicer.
  540.  
  541.         Notice that all visible EMACS characters are self-inserting -- all
  542. you had to do was type the characters to insert and the existing text made
  543. space  for it. With a few exceptions  discussed  later,  all  non-printing
  544. characters (such as control or escape sequences) are  commands.  To insert
  545. spaces,  simply use the space bar. Now move to the first line of the  file
  546. and type ^O open-line (Oh, not zero).  You've just learned how to insert a
  547. blank line in your text.
  548.  
  549.  
  550. 2.3  Deletions
  551.  
  552.  
  553.         EMACS offers a number of deletion options. For  example,  move the
  554. cursor until it's under the period  at  the  end of the insertion you just
  555. did.  Press the backspace key. Notice the "n"  on  "lantern"  disappeared.
  556. The backspace implemented  on  EMACS is called a destructive backspace--it
  557. removes  text  immediately  before the current cursor  position  from  the
  558. buffer. Now type  ^H  delete-previous-character.  Notice  that  the cursor
  559. moves  back and obliterates the "r"--either  command  will  backspace  the
  560. cursor.
  561.  
  562.         Type in the two letters you  erased  to restore your text and move
  563. the cursor to the beginning of the buffer M-> beginning-of-file.  Move the
  564. cursor down one line to the beginning of the first paragraph.
  565.  
  566.         To delete the forward  character,  type  ^D delete-next-character.
  567. The  "F" of "Fang" disappears. Continue to type ^D until the whole word is
  568.  
  569.  
  570. 7
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577. MicroEMACS Reference Manual Basic Editing--Simple Insertions and Deletions
  578.  
  579.  
  580. erased EMACS also permits the deletion of larger elements  of  text.  Move
  581. the cursor to the word  "center"  in  the  first  line  of  text. Pressing
  582. M-<backspace>  delete-previous-word kills the word immediately before  the
  583. cursor. M-^H has the same effect.
  584.  
  585.         Notice that the commands are  very similar to the control commands
  586. you used to delete individual letters. As a general rule in EMACS, control
  587. sequences affect small areas  of  text,  META  sequences larger areas. The
  588. word forward of the cursor position can therefore be deleted by typing M-D
  589. delete-next-word. Now let's take out the remainder of the  first  line  by
  590. typing ^K kill-to-end-of-line. You now have a blank  line  at  the  top of
  591. your screen. Typing ^K again  or ^X^O delete-blank-lines deletes the blank
  592. line and flushes the second line to the top of the text. Now exit EMACS by
  593. typing ^X^C exit-emacs. Notice  EMACS  reminds you that you have not saved
  594. your buffer. Ignore  the  warning  and  exit.  This way you can exit EMACS
  595. without saving any of the changes you just made.
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.                                                                          8
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643. Basic Editing--Simple Insertions and Deletions MicroEMACS Reference Manual
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.                             Chapter 2 Summary
  651.  
  652.  
  653.         In Chapter 2, you learned about the basic 'building blocks'  of an
  654. EMACS text file--buffers, windows, and files.
  655.  
  656. Key binding             Keystroke       Effect
  657. delete-previous-character
  658.                         ^H              deletes character immediately before
  659.                                         the current cursor position
  660.  
  661. delete-next-character   ^D              deletes character immediately after
  662.                                         current cursor position
  663.  
  664. delete-previous-word    M-^H            deletes word immediately before
  665.                                         current cursor position
  666.  
  667. delete-next-word        M-D             deletes word immediately after
  668.                                         current cursor position
  669.  
  670. kill-to-end-of-line     ^K              deletes from current cursor
  671.                                         position to end of line
  672.  
  673. insert-space            ^C              inserts a space to right of cursor
  674.  
  675. open-line               ^O              inserts blank line
  676.  
  677. delete-blank-lines      ^X^O            removes blank line
  678.  
  679. exit-emacs              ^X^C            exits emacs
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702. 9
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709. MicroEMACS Reference Manual                                  Using Regions
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.                                 Chapter 3
  719.  
  720.                               Using Regions
  721.  
  722.  
  723. 3.1  Defining and Deleting a Region
  724.  
  725.  
  726.         At  this point its time to familiarize  ourselves  with  two  more
  727. EMACS terms--the point and the mark. The point is located  directly behind
  728. the  current  cursor  position. The mark (as we shall see shortly) is user
  729. defined. These two elements  together  are  called  the current region and
  730. limit  the  region  of text on which EMACS performs many  of  its  editing
  731. functions.
  732.  
  733.         Let's begin by entering some new text. Don't forget  to  add  wrap
  734. mode if its not set on this buffer.  Start  EMACS  and  open a file called
  735. PUBLISH.TXT. Type in the following text:
  736.  
  737.      One  of  the  largest  growth  areas  in  personal computing  is
  738.      electronic   publishing.   There   are  packages  available  for
  739.      practically every machine from elegantly simple programs for the
  740.      humble  Commodore 64 to sophisticated professional packages  for
  741.      PC and Macintosh computers.
  742.  
  743.      Electronic  publishing is as revolutionary in  its  way  as  the
  744.      Gutenburg press. Whereas the  printing  press  allowed  the mass
  745.      production  and  distribution of the  written  word,  electronic
  746.      publishing puts the means of production in the  hands  of nearly
  747.      every individual.  From  the  class  magazine  to  the corporate
  748.      report, electronic publishing is changing the way we produce and
  749.      disseminate information.
  750.  
  751.      Personal publishing greatly increases the utility of practically
  752.      every computer. Thousands  of  people  who  joined  the computer
  753.      revolution of this decade only  to hide their machines unused in
  754.      closets  have  discovered  a  new  use  for  them  as  dedicated
  755.      publishing workstations.
  756.  
  757.         Now let's do some  editing.  The last paragraph seems a little out
  758. of place. To see what the document looks  like  without  it  we can cut it
  759. from the text  by  moving  the  cursor  to the beginning of the paragraph.
  760. Enter M-<space> set-mark. EMACS will respond with "[Mark  set]".  Now move
  761. the cursor to the end of the paragraph.  You have just defined a region of
  762. text.  To  remove this text from the  screen,  type  ^W  kill-region.  The
  763. paragraph disappears from the screen.
  764.  
  765.  
  766.  
  767.  
  768.                                                                         10
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775. Using Regions                                  MicroEMACS Reference Manual
  776.  
  777.  
  778.         On further consideration, however, perhaps  the  paragraph  we cut
  779. wasn't so bad after all. The problem may have been one of placement. If we
  780. could tack it on to the end of  the  first  paragraph  it might work quite
  781. well to support and strengthen the argument. Move the cursor to the end of
  782. the first paragraph  and  enter  ^Y  yank.  Your text should now look like
  783. this:
  784.  
  785.      One  of  the  largest  growth  areas  in  personal computing  is
  786.      electronic   publishing.   There   are  packages  available  for
  787.      practically every machine from elegantly simple programs for the
  788.      humble  Commodore 64 to sophisticated professional packages  for
  789.      PC  and  Macintosh   computers.    Personal  publishing  greatly
  790.      increases  the utility of practically every computer.  Thousands
  791.      of people who joined the computer revolution of this decade only
  792.      to hide their machines unused in closets have  discovered  a new
  793.      use for them as dedicated publishing workstations.
  794.  
  795.      Electronic  publishing is as revolutionary in  its  way  as  the
  796.      Gutenburg press. Whereas the  printing  press  allowed  the mass
  797.      production  and  distribution of the  written  word,  electronic
  798.      publishing puts the means of production in the  hands  of nearly
  799.      every individual.  From  the  class  magazine  to  the corporate
  800.      report, electronic publishing is changing the way we produce and
  801.      disseminate information.
  802.  
  803.  
  804. 3.2  Yanking a Region
  805.  
  806.  
  807.         The  text  you  cut initially didn't simply just disappear, it was
  808. cut into a buffer that retains the 'killed' text appropriately  called the
  809. kill  buffer.  ^Y  "yanks" the text back from this buffer into the current
  810. buffer.  If  you  have a long line (indicated, remember, by the "$" sign),
  811. simply hit M-Q to reformat the paragraph.
  812.  
  813.         There  are  other  uses to which the kill buffer can be put. Using
  814. the method we've already  learned,  define the last paragraph as a region.
  815. Now type M-W copy-region. Nothing seems to have happened; the cursor stays
  816. blinking at the point. But things have changed, even though you may not be
  817. able to see any alteration.
  818.  
  819.         To see what has happened to the contents of the kill  buffer, move
  820. the  cursor  down a couple of lines and "yank" the contents  of  the  kill
  821. buffer back with ^Y. Notice the last paragraph is now repeated. The region
  822. you defined is "tacked on" to the end of your file  because  M-W  copies a
  823. region to the kill buffer while leaving the original text in  your working
  824. buffer. Some caution is  needed  however, because the contents of the kill
  825. buffer are updated when you delete any regions, lines or words. If you are
  826. moving large quantities of text, complete the operation before you  do any
  827. more  deletions or you could find that the text you want to move has  been
  828. replaced  by  the  most recent deletion. Remember--a buffer is a temporary
  829. area of computer memory that is lost when the machine  is  powered down or
  830. switched off. In order to make your changes permanent, they must  be saved
  831.  
  832.  
  833.  
  834. 11
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841. MicroEMACS Reference Manual                                  Using Regions
  842.  
  843.  
  844. to a file before you leave EMACS. Let's delete the section of text we just
  845. added and save the file to disk.
  846.  
  847.  
  848.  
  849.  
  850.                             Chapter 3 Summary
  851.  
  852.  
  853.         In Chapter 3, you  learned  how  to  achieve longer insertions and
  854. deletions. The EMACS terms point and mark were introduced and  you learned
  855. how to manipulate text with the kill buffer.
  856.  
  857. Key Binding     Keystroke       Effect
  858.  
  859. set-mark        M-<space>       Marks the beginning of a region
  860.  
  861. delete-region   ^W              Deletes region between point and mark and
  862.                                 places it in KILL buffer
  863.  
  864. copy-region     M-W             Copies text between point and mark into
  865.                                 KILL buffer
  866.  
  867. yank-text       ^Y              Inserts a copy of the KILL buffer into
  868.                                 current buffer at point
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.                                                                         12
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907. Search and Replace                             MicroEMACS Reference Manual
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                 Chapter 4
  917.  
  918.                             Search and Replace
  919.  
  920.  
  921. 4.1  Forward Search
  922.  
  923.  
  924.         Load EMACS and bring in the file you just saved. Your  file should
  925. look like the one below.
  926.  
  927.      One  of  the  largest  growth  areas  in  personal computing  is
  928.      electronic   publishing.   There   are  packages  available  for
  929.      practically every machine from elegantly simple programs for the
  930.      humble  Commodore 64 to sophisticated professional packages  for
  931.      PC  and  Macintosh   computers.    Personal  publishing  greatly
  932.      increases  the utility of practically every computer.  Thousands
  933.      of people who joined the computer revolution of this decade only
  934.      to hide their machines unused in closets have  discovered  a new
  935.      use for them as dedicated publishing workstations.
  936.  
  937.      Electronic  publishing is as revolutionary in  its  way  as  the
  938.      Gutenburg press. Whereas the  printing  press  allowed  the mass
  939.      production  and  distribution of the  written  word,  electronic
  940.      publishing puts the means of production in the  hands  of nearly
  941.      every individual.  From  the  class  magazine  to  the corporate
  942.      report, electronic publishing is changing the way we produce and
  943.      disseminate information.
  944.  
  945.         Let's  use EMACS to search for the  word  "revolutionary"  in  the
  946. second paragraph.  Because EMACS searches from the current cursor position
  947. toward  the  end  of buffers, and we intend to search  forward,  move  the
  948. cursor to the beginning of the text. Enter ^S  search-forward.  Note  that
  949. the command line now reads
  950.  
  951.         "Search [] <META>:"
  952.  
  953.         EMACS is prompting you to enter the search string -- the  text you
  954. want  to  find.  Enter the word revolutionary and hit the  META  key.  The
  955. cursor moves to the end of the word "revolutionary."
  956.  
  957.         Notice that you must enter the <META> key to start the  search. If
  958. you simply press  <NL>  the  command  line responds with "<NL>".  Although
  959. this may seem infuriating to users who are used to pressing the return key
  960. to execute any command, EMACS' use  of  <META> to begin searches allows it
  961. to pinpoint text with great accuracy. After every line  wrap  or  carriage
  962. return, EMACS 'sees' a new line character (<NL>).  If  you  need to search
  963.  
  964.  
  965.  
  966. 13
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973. MicroEMACS Reference Manual                             Search and Replace
  974.  
  975.  
  976. for  a  word at the end of a line, you can specify this word  uniquely  in
  977. EMACS.
  978.  
  979.         In our sample text for example, the word "and" occurs a  number of
  980. times,  but only once at the end of a line. To search for this  particular
  981. occurrence of the word, move the cursor to the beginning of the buffer and
  982. type ^S. Notice that EMACS stores the last specified search string  as the
  983. default string. If you press <META> now, EMACS will search for the default
  984. string, in this case, "revolutionary."
  985.  
  986.         To change this  string  so  we  can search for our specified "and"
  987. simply enter the word and followed by <NL>. The command line now shows:
  988.  
  989.         "search [and<NL>]<META>:"
  990.  
  991.         Press  <META>  and  the cursor moves to "and" at the  end  of  the
  992. second last line.
  993.  
  994.  
  995. 4.2  Exact Searches
  996.  
  997.  
  998.         If the mode EXACT is active in the current buffer,  EMACS searches
  999. on  a  case  sensitive basis. Thus,  for  example  you  could  search  for
  1000. Publishing as distinct from publishing.
  1001.  
  1002.  
  1003. 4.3  Backward Search
  1004.  
  1005.  
  1006.         Backward searching is very  similar  to  forward  searching except
  1007. that it is implemented in the reverse direction. To  implement  a  reverse
  1008. search, type ^R search-reverse. Because EMACS makes no distinction between
  1009. forward  and  backward  stored  search  strings, the last search item  you
  1010. entered appears as  the  default  string.  Try searching back for any word
  1011. that lies between the cursor and the beginning of the buffer.  Notice that
  1012. when  the  item is found, the point moves to the beginning  of  the  found
  1013. string  (i.e., the cursor appears under the first  letter  of  the  search
  1014. item).
  1015.  
  1016.         Practice searching for other words in your text.
  1017.  
  1018.  
  1019. 4.4  Searching and Replacing
  1020.  
  1021.  
  1022.         Searching  and replacing is a powerful and  quick  way  of  making
  1023. changes to your text. Our sample text is about electronic  publishing, but
  1024. the correct term is 'desktop' publishing. To make the necessary changes we
  1025. need to replace all occurrences of the word  "electronic"  with "desktop."
  1026. First, move the cursor to the top  of  the  current  buffer  with  the M-<
  1027. command. Then type M-R replace-string.  The command line responds:
  1028.  
  1029.         "Replace []<META>:"
  1030.  
  1031.  
  1032.                                                                         14
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039. Search and Replace                             MicroEMACS Reference Manual
  1040.  
  1041.  
  1042.         where the square brackets enclose  the  default  string.  Type the
  1043. word electronic and hit <META>. The command line responds:
  1044.  
  1045.         "with []<META>"
  1046.  
  1047.         type desktop<META>. EMACS replaces all instances  of  the original
  1048. word with your revision. Of course, you will have to capitalize  the first
  1049. letter of "desktop" where it occurs at the beginning of a sentence.
  1050.  
  1051.         You  have  just  completed  an  unconditional  replace.   In  this
  1052. operation,  EMACS replaces every instance of the  found  string  with  the
  1053. replacement string.
  1054.  
  1055.  
  1056. 4.5  Query-Replace
  1057.  
  1058.  
  1059.         You may also replace text on a case by case basis. The M-^R query-
  1060. replace-string command causes EMACS to pause at each instance of the found
  1061. string.
  1062.  
  1063.         For example, assume we want to replace some instances of  the word
  1064. "desktop"  with  the word "personal." Go back  to  the  beginning  of  the
  1065. current buffer and enter the  M-^R query-replace command. The procedure is
  1066. very   similar  to  that  which  you   followed   in   the   unconditional
  1067. search/replace option. When the search  begins  however,  you  will notice
  1068. that EMACS pauses at each instance of "publishing" and  asks  whether  you
  1069. wish  to  replace  it with the replacement string. You have  a  number  of
  1070. options available for response:
  1071.  
  1072.         Response        Effect
  1073.         Y(es)   Make the current replacement and skip to the next
  1074.                 occurrence of the search string
  1075.  
  1076.         N(o)    Do not make this replacement but continue
  1077.  
  1078.         !       Do the rest of the replacements with no more queries
  1079.  
  1080.         U(ndo)  Undo just the last replacement and query for it
  1081.                 again (This can only go back ONE time)
  1082.  
  1083.         ^G      Abort the replacement command (This action does not
  1084.                 undo previously-authorized replacements
  1085.  
  1086.         . Same effect as ^G, but cursor returns to the point at
  1087.                 which the replacement command was given
  1088.  
  1089.         ?       This lists help for the query replacement command
  1090.  
  1091.         Practice searching and  searching  and  replacing  until  you feel
  1092. comfortable with the commands and their effects.
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098. 15
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105. MicroEMACS Reference Manual                             Search and Replace
  1106.  
  1107.  
  1108.                             Chapter 4 Summary
  1109.  
  1110.  
  1111.         In this chapter, you learned how to search  for  specified strings
  1112. of text in EMACS. The chapter also dealt with searching for  and replacing
  1113. elements within a buffer.
  1114.  
  1115. Key Binding             Keystroke                        Effect
  1116.  
  1117. search-forward          ^S      Searches from point to end of buffer.
  1118.                                 Point is moved from current location to
  1119.                                 the end of the found string
  1120.  
  1121. search-backward         ^R      Searches from point to beginning of buffer.
  1122.                                 Point is moved from current location to
  1123.                                 beginning of found string
  1124.  
  1125. replace                 M-R Replace ALL occurrences of search string with
  1126.                                 specified (null) string from point to the
  1127.                                 end of the current buffer
  1128.  
  1129. query-replace          M-^R As above, but pause at each found string
  1130.                                 and query for action
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.                                                                         16
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171. Windows                                        MicroEMACS Reference Manual
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.                                 Chapter 5
  1181.  
  1182.                                  Windows
  1183.  
  1184.  
  1185. 5.1  Creating Windows
  1186.  
  1187.  
  1188.         We  have  already  met windows in  an  earlier  chapter.  In  this
  1189. chapter,  we will explore one of EMACS' more  powerful  features  --  text
  1190. manipulation through  multiple windowing. Windows offer you a powerful and
  1191. easy  way to edit text. By manipulating a number of windows and buffers on
  1192. the screen simultaneously, you can perform complete edits and revisions on
  1193. the  computer  screen  while  having  your  draft  text or  original  data
  1194. available for reference in another window.
  1195.  
  1196.         You will recall that windows are areas of buffer text that you can
  1197. see on the  screen.  Because  EMACS  can  support  several  screen windows
  1198. simultaneously you can use them to look into different places in  the same
  1199. buffer. You  can  also  use  them to look at text in different buffers. In
  1200. effect, you can edit several files at the same time.
  1201.  
  1202.         Let's invoke EMACS and pull back our file on desktop publishing by
  1203. typing
  1204.  
  1205.      emacs publish.txt
  1206.  
  1207.         When the text appears, type the ^X2  split-current-window command.
  1208. The window splits into two windows. The window where the cursor resides is
  1209. called the current window -- in  this  case the bottom window. Notice that
  1210. each window has  a text area and a mode line. The command line is however,
  1211. common to all windows on the screen.
  1212.  
  1213.         The two windows on your screen are virtually mirror images of each
  1214. other because the new window is opened into the same buffer as the one you
  1215. are in when you issue the open-window command  .  All  commands  issued to
  1216. EMACS are executed on the current buffer in the current window.
  1217.  
  1218.         To move the cursor to the upper window (i.e., to make  that window
  1219. the current window, type ^XP previous-window.  Notice the cursor  moves to
  1220. the upper or previous  window.  Entering ^XO next-window moves to the next
  1221. window. Practice moving between windows. You will notice that you can also
  1222. move into the Function Key menu by entering these commands.
  1223.  
  1224.         Now  move to the upper window. Let's open a new file. On the EMACS
  1225. disk is a tutorial file. Let's call it into the upper window by typing:
  1226.  
  1227.      ^X^F
  1228.  
  1229.  
  1230. 17
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237. MicroEMACS Reference Manual                                        Windows
  1238.  
  1239.  
  1240.         and press return.
  1241.  
  1242.         Enter the filename emacs.tut.
  1243.  
  1244.         In a short time, the tutorial  file  will appear in the window. We
  1245. now have two windows  on  the screen, each looking into different buffers.
  1246. We  have just used the ^X^F find-file command to find a file and bring  it
  1247. into our current window.
  1248.  
  1249.         You can scroll any window up and down  with  the  cursor  keys, or
  1250. with the  commands  we've  learned  so  far.  However, because the area of
  1251. visible  text  in each window is relatively  small,  you  can  scroll  the
  1252. current window a line at a time.
  1253.  
  1254.         Type ^X^N move-window-down
  1255.  
  1256.         The current window scrolls down by one line  --  the  top  line of
  1257. text scrolls out of view, and the bottom line moves towards the top of the
  1258. screen. You can imagine, if you like, the whole window slowly  moving down
  1259. to the end of the buffer in increments of one line. The command ^X^P move-
  1260. window-up  scrolls the window in the opposite direction.
  1261.  
  1262.         As we have  seen,  EMACS  editing  commands  are  executed  in the
  1263. current window, but the program does support a useful feature  that allows
  1264. you to  scroll  the  next  window.    M-^Z scroll-next-up scrolls the next
  1265. window up, M-^V scroll-next-down  scrolls it downward.  From  the tutorial
  1266. window, practice scrolling the window  with the desktop publishing text in
  1267. it up and down.
  1268.  
  1269.         When you're finished, exit EMACS  without  saving  any  changes in
  1270. your files.
  1271.  
  1272.  
  1273.         Experiment with splitting the windows on your screen. Open windows
  1274. into different buffers and  experiment  with any other files you may have.
  1275. Try  editing the text in each window, but don't forget to save any changes
  1276. you want to keep -- you still have to save each buffer separately.
  1277.  
  1278.  
  1279. 5.2  Deleting Windows
  1280.  
  1281.  
  1282.         Windows  allow you to perform complex  editing  tasks  with  ease.
  1283. However, they become an inconvenience when your screen  is  cluttered with
  1284. open windows you have  finished  using. The simplest solution is to delete
  1285. unneeded windows. The command ^X0 delete-window will delete the window you
  1286. are currently working in and move you to the next window.
  1287.  
  1288.         If you have a number of windows open, you can  delete  all but the
  1289. current window by entering ^X1 delete-other-windows.
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.                                                                         18
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303. Windows                                        MicroEMACS Reference Manual
  1304.  
  1305.  
  1306. 5.3  Resizing Windows
  1307.  
  1308.  
  1309.         During complex editing tasks, you will probably find it convenient
  1310. to have a  number  of  windows  on the screen simultaneously. However this
  1311. situation may present inconveniences because  the more windows you have on
  1312. the  screen the smaller they are; in some cases, a window may show only  a
  1313. couple  of  lines  of text. To increase the flexibility and utility of the
  1314. window environment, EMACS allows you to resize the window you  are working
  1315. in (called, as you will recall,  the  current window) to a convenient size
  1316. for easier editing, and then shrink it when you no longer need it to be so
  1317. large.
  1318.  
  1319.         Let's  try  an  example. Load in any EMACS text file and split the
  1320. current window  into two. Now type ^X^(Shift-6), grow-window. Your current
  1321. window  should be the lower one on the screen. Notice that it increases in
  1322. size upwards by  one line. If you are in the upper window, it increases in
  1323. size  in  a   downward   direction.   The   command   ^X^Z,  shrink-window
  1324. correspondingly decreases window size by one line at a time.
  1325.  
  1326.         EMACS  also  allows  you to resize  a  window  more  precisely  by
  1327. entering a numeric argument specifying the size of the window in lines. To
  1328. resize  the  window  this  way,  press  the  META key and enter a  numeric
  1329. argument (remember to keep it smaller than the  number  of  lines  on your
  1330. screen display) then press ^XW resize-window.  The current window  will be
  1331. enlarged  or  shrunk  to  the  number  of  lines  specified in the numeric
  1332. argument. For example entering:
  1333.  
  1334.      M-8 ^XW
  1335.  
  1336.         will resize the current window to 8 lines.
  1337.  
  1338.  
  1339. 5.4  Repositioning within a Window
  1340.  
  1341.  
  1342.         The cursor may be centered within a window by entering M-! or M-^L
  1343. redraw-display.  This  command  is especially useful in  allowing  you  to
  1344. quickly  locate the cursor if you are moving  frequently  from  window  to
  1345. window. You can  also  use  this  command  to move the line containing the
  1346. cursor  to any position within the current window. This is done by using a
  1347. numeric  argument before the command. Type M-<n> M-^L  where  <n>  is  the
  1348. number of the  line within the window that you wish the current line to be
  1349. displayed.
  1350.  
  1351.         The  ^L clear-and-redraw command is useful  for  'cleaning  up'  a
  1352. 'messy'  screen  that  can result of using EMACS on a mainframe system and
  1353. being interrupted by a system message.
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362. 19
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369. MicroEMACS Reference Manual                                        Windows
  1370.  
  1371.  
  1372.         Chapter 5 summary
  1373.  
  1374.         In Chapter 5 you learned how to manipulate windows and the editing
  1375. flexibility they offer.
  1376.  
  1377. Key Binding     Keystroke       Effect
  1378.  
  1379. open-window     ^X2             Splits current window into two windows if
  1380.                                 space available
  1381.  
  1382. close-windows   ^X1             Closes all windows except current window
  1383.  
  1384. next-window     ^XO[oh]         Moves point into next (i.e. downward) window
  1385.  
  1386. previous-window ^XP             Moves point to previous (i.e. upward) window
  1387.  
  1388. move-window-down ^X^N           Scrolls current window down one line
  1389.  
  1390. move-window-up  ^X^P            Scrolls current window up one line
  1391.  
  1392. redraw-display  M ! or          Window is moved so line with point
  1393.                 M ^L            (with cursor) is at center of window
  1394.  
  1395. grow-window     M-X ^           Current window is enlarged by one
  1396.                                 line and nearest window is shrunk by
  1397.                                 one line
  1398.  
  1399. shrink-window   ^X^Z            Current window is shrunk by one line
  1400.                                 and nearest window is enlarged by one line
  1401.  
  1402. clear-and-redraw ^L             Screen is blanked and redrawn. Keeps
  1403.                                 screen updates in sync with your commands
  1404.  
  1405. scroll-next-up  M-^Z            Scrolls next window up by one line
  1406.  
  1407. scroll-next-down M-^V           Scrolls next window down by one line
  1408.  
  1409. delete-window   ^X0             Deletes current window
  1410.  
  1411. delete-other-windows ^X1        Deletes all but current window
  1412.  
  1413. resize-window   ^X^W            Resizes window to a given numeric argument
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.                                                                         20
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435. Using a Mouse                                  MicroEMACS Reference Manual
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.                                 Chapter 6
  1445.  
  1446.                               Using a Mouse
  1447.  
  1448.  
  1449.         On computers equipped with a mouse, the mouse can usually  be used
  1450. to  make editing easier. If your computer has a mouse, let's try using it.
  1451. Start MicroEMACS by typing:
  1452.  
  1453.         emacs publish.txt
  1454.  
  1455.         This  brings EMACS up and allows it to edit the file from the last
  1456. chapter. If the function key window is visible on the screen, press the F5
  1457. key to cause it to disappear. Now use the ^X2 split-current-window command
  1458. to split the screen into two windows.  Next use the ^X^F find-file command
  1459. to read in  the  fang.txt  file.  Now  your screen should have two windows
  1460. looking into two different files.
  1461.  
  1462.         Grab the mouse  and  move  it  around.  On the screen an arrow, or
  1463. block  of  color  appears.  This  is  called  the mouse cursor and can  be
  1464. positioned on any character on  the screen. On some computers, positioning
  1465. the  mouse cursor in the extreme upper right or left corner may bring down
  1466. menus which allow you to access that computers utilities, sometimes called
  1467. Desk Accessories.
  1468.  
  1469.  
  1470. 6.1  Moving around with the mouse
  1471.  
  1472.  
  1473.         Using the mouse button (or the  left  button if the mouse has more
  1474. than one), position the  mouse  over some character in the current window.
  1475. Click the mouse button once. The point will move to where the mouse cursor
  1476. is. If you  place  the mouse cursor past the end of a line, the point will
  1477. move to the end of that line.
  1478.  
  1479.         Move  the  mouse  cursor into the other window and click on one of
  1480. the characters there.  MicroEMACS  will automatically make this window the
  1481. current window (notice that the mode line changes) and position  the point
  1482. to the mouse cursor. This makes it very easy to use the mouse to switch to
  1483. a different window quickly.
  1484.  
  1485.  
  1486. 6.2  Dragging around
  1487.  
  1488.  
  1489.         Besides just using the mouse to move around on the screen, you can
  1490. use the same  button to move text. Move the mouse cursor to a character in
  1491. one of the windows, and click down... but don't let the button up yet! The
  1492.  
  1493.  
  1494. 21
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501. MicroEMACS Reference Manual                                  Using a Mouse
  1502.  
  1503.  
  1504. point will move to where the mouse cursor is. Now move the mouse cursor up
  1505. or down on the screen, and release the button. The  point  will again move
  1506. to  where the mouse cursor is, but this time it will bring the text  under
  1507. it along for the ride. This is called dragging, and is  how  you  can make
  1508. the text appear just where you want it to. If you try to drag text  out of
  1509. the current window,  EMACS  will  ignore  your attempt and leave the point
  1510. where you first clicked down.
  1511.  
  1512.         Now, click down on a word in  one  of  the  windows,  and  drag it
  1513. directly  to  the  left. Release the button and watch as the entire window
  1514. slides, or scrolls to the left.  The missing text has not been deleted, it
  1515. is simply not visible, off the  left  hand  side of the screen. Notice the
  1516. mode line has changed and now looks like:
  1517.  
  1518. ==== MicroEMACS 3.11 [<12] () == fang.txt == File: fang.txt =========
  1519.  
  1520.         The number insided the brackets [] shows that the  screen  is  now
  1521. scrolled 12 characters from the left margin.
  1522.  
  1523.         Now  grab  the  same text again, and drag it to the right, pulling
  1524. the  rest  of the text back into the current window. The  [<]  field  will
  1525. disappear,  meaning that the window is no longer  scrolled  to  the  left.
  1526. This  feature  is  very  useful  for  looking  at  wide charts and tables.
  1527. Remember,  MicroEMACS  will  only  scroll  the text in the current  window
  1528. sideways if you drag it straight to the side, otherwise  it  will drag the
  1529. text vertically.
  1530.  
  1531.         Now, place the  mouse  cursor  over  a character on the upper mode
  1532. line, click down, move the  mouse cursor up or down a few lines and let go
  1533. of the button.  The mode line moves to where you dragged it,  changing the
  1534. size of the  windows  above and below it. If you try to make a window with
  1535. less than one line, EMACS will  not  let  you. Dragging the mode lines can
  1536. make  it very fast and easy for you to rearrange the windows as you  would
  1537. like.
  1538.  
  1539.         If you have a  number  of different windows visible on the screen,
  1540. positioning  the  mouse  over the mode line of one window and clicking the
  1541. right mouse button will cause that window to be deleted.
  1542.  
  1543.  
  1544. 6.3  Cut and Paste
  1545.  
  1546.  
  1547.         If your mouse has two buttons,  then  you can use the right button
  1548. to do some other things as well.  Earlier,  we  learned  how  to  define a
  1549. region  by  using  the M-<space> set-mark command. Now, position the mouse
  1550. over  at the beginning of a region you would like to copy. Next click  and
  1551. hold down the right mouse button. Notice that the point jumps to the mouse
  1552. cursor and EMACS reports "[Mark Set]". Holding the button  down  move  the
  1553. mouse  to  the  end  of  the text you wish to copy and release  the  mouse
  1554. button.  Emacs reports "[Region Copied]" to let you know it has copied the
  1555. region  into the KILL buffer. This has done the same job as the M-W  copy-
  1556. region command.
  1557.  
  1558.  
  1559.  
  1560.                                                                         22
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567. Using a Mouse                                  MicroEMACS Reference Manual
  1568.  
  1569.  
  1570.         If you now click the right mouse button, without moving the mouse,
  1571. the region you defined dissapear, being cut from the current  buffer. This
  1572. works just like the ^W kill-region command.
  1573.  
  1574.         If  you move the mouse away from where you cut the text, and click
  1575. the right mouse button down and up without moving the  mouse,  the text in
  1576. the  KILL  buffer  gets inserted, or pasted into the current buffer at the
  1577. point.
  1578.  
  1579.  
  1580. 6.4  Screens
  1581.  
  1582.  
  1583.         MicroEMACS can use more than one screen at once. Each screen  is a
  1584. collection of windows along  with  a mode line. These screens usually fill
  1585. the terminal or computer screen on text based  systems,  but  can  also be
  1586. held  in different windows on graphically  based  systems  like  MicroSoft
  1587. Windows,  OS/2,  the  Macintosh Finder and X-Windows. Don't be confused by
  1588. the two different uses of the term "window". Inside EMACS style editors, a
  1589. window lets you view part of a buffer. Under graphical  operating systems,
  1590. a window holds a "virtual terminal", allowing you to manipulate  more than
  1591. one  job, editing session or program at  once.  Within  MicroEMACS,  these
  1592. operating  system  windows  are  called  screens.  All  these screens  are
  1593. displayed on your current desktop.
  1594.  
  1595.  
  1596. 6.5  Resizing a Screen
  1597.  
  1598.  
  1599.         You can change the size of  a  screen.  Move the mouse to the last
  1600. position of the command line. Press the left mouse  button  down.  Holding
  1601. it, move the mouse to the place  you  want  the  new  lower  right corner.
  1602. Release  the  mouse.  The desktop redraws, with your newly resized screen.
  1603. MicroEMACS will ignore size changes that can not be done,  like attempting
  1604. to  pull the lower left corner above the upper right corner of the current
  1605. screen.
  1606.  
  1607.  
  1608. 6.6  Moving a Screen
  1609.  
  1610.  
  1611.         To change where on the desktop a screen is placed, move  the mouse
  1612. to the upper right corner of the screen, press the left mouse button down,
  1613. move the mouse and release it where you want the screen  displayed. Again,
  1614. MicroEMACS will ignore placements that can not be done.
  1615.  
  1616.  
  1617. 6.7  Creating a Screen
  1618.  
  1619.  
  1620.         Creating a new screen is just like moving a screen, but  using the
  1621. right button. Move to the upper right of  an  existing  screen,  press the
  1622. right mouse button down, and move the mouse, releasing  the  button  where
  1623. the new screen  should  appear.  A  new  screen will have a single window,
  1624.  
  1625.  
  1626. 23
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633. MicroEMACS Reference Manual                                  Using a Mouse
  1634.  
  1635.  
  1636. containing the contents of the current window in the  copied  screen,  and
  1637. will  have  that window's colors. The new  screen  will  have  the  copied
  1638. screen's size.
  1639.  
  1640.  
  1641. 6.8  Switching to a Screen
  1642.  
  1643.  
  1644.         This is simple. Any mouse command can be  done  in  any  screen by
  1645. placing the mouse on a visible part of the screen  and  clicking. The last
  1646. screen  the  mouse is used on comes to front and is  the  current  screen.
  1647. Also, the A-C cycle-screens command brings the rearmost screen to front.
  1648.  
  1649.  
  1650. 6.9  Deleting a Screen
  1651.  
  1652.  
  1653.         Place the mouse  on  the  command  line  of the screen you want to
  1654. delete. Click the  right  mouse  button,  the screen will disapear. If you
  1655. delete the only remaining screen on the desktop, MicroEMACS will exit.
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.                                                                         24
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699. Using a Mouse                                  MicroEMACS Reference Manual
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.                             Chapter 6 Summary
  1707.  
  1708.  
  1709.         In  Chapter 6, you learned how to use the mouse to move the point,
  1710. switch windows, drag text, and resize windows. You also learned how to use
  1711. the right mouse button in order to copy and delete  regions  and yank them
  1712. back  at other places. And lastly, you learned  how  to  control  multiple
  1713. screens with the mouse.
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758. 25
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765. MicroEMACS Reference Manual                                  Using a Mouse
  1766.  
  1767.  
  1768. Action          Mouse Directions
  1769.  
  1770. Move Cursor     position mouse cursor over desired location
  1771.                 click down and up with left button
  1772.  
  1773. Drag Text       position mouse cursor over desired text
  1774.                 click left button down
  1775.                 move to new screen location for text
  1776.                 release mouse button
  1777.  
  1778. Resize Windows  position mouse cursor over mode line to move
  1779.                 click left button down
  1780.                 move to new location for mode line
  1781.                 release mouse button
  1782.  
  1783. Delete Window   position mouse cursor over mode line of window to delete
  1784.                 click right mouse button
  1785.  
  1786. Activate Screen Move mouse over existing screen
  1787.                 click left button down and up
  1788.  
  1789. Resize Screen   position mouse cursor over last character on message line
  1790.                 click left button down
  1791.                 move to new lower right corner of screen
  1792.                 release mouse button
  1793.  
  1794. Copy Region     position mouse at beginning of region
  1795.                 click right button down
  1796.                 move to end of region
  1797.                 release mouse button
  1798.  
  1799. Cut Region      position mouse at beginning of region
  1800.                 click right button down
  1801.                 move to end of region
  1802.                 release mouse button
  1803.                 click right button down and up
  1804.  
  1805. Paste Region    position mouse at place to paste
  1806.                 click right button down and up
  1807.  
  1808. Create Screen   position mouse at upper left corner of existing screen
  1809.                 click right button down
  1810.                 move to position of new screen
  1811.                 release mouse button
  1812.  
  1813. Resize Screen   position mouse at lower right corner of screen
  1814.                 click left button down
  1815.                 move to new lower left corner
  1816.                 release mouse button
  1817.  
  1818. Move Screen     position mouse at upper right corner of screen
  1819.                 click left button down
  1820.                 move to new screen position
  1821.                 release mouse button
  1822.  
  1823.  
  1824.                                                                         26
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831. Buffers                                        MicroEMACS Reference Manual
  1832.  
  1833.  
  1834. Delete Screen   position to command line of existing screen
  1835.                 click right button down
  1836.                 release mouse button
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.                                 Chapter 7
  1844.  
  1845.                                  Buffers
  1846.  
  1847.  
  1848.         We have already learned  a  number of things about buffers. As you
  1849. will  recall,  they  are the major internal entities in EMACS -- the place
  1850. where  editing  commands  are executed. They are  characterized  by  their
  1851. names, their modes, and by the  file  with which they are associated. Each
  1852. buffer also "remembers" its mark and point. This convenient feature allows
  1853. you  to  go to other buffers and return to the original  location  in  the
  1854. "current" buffer.
  1855.  
  1856.         Advanced users of EMACS frequently have a number of buffers in the
  1857. computer's memory simultaneously. In  the  last  chapter, for example, you
  1858. opened at least two buffers -- one into the text you were editing, and the
  1859. other into the EMACS on-line tutorial. If you deal with complex text files
  1860. -- say, sectioned  chapters of a book, you may have five or six buffers in
  1861. the  computer's  memory.  You  could  select different buffers  by  simply
  1862. calling  up the file with ^X^F find-file, and let EMACS open or reopen the
  1863. buffer. However, EMACS offers fast and sophisticated  buffering techniques
  1864. that you will find easy to master and much more convenient to use.
  1865.  
  1866.         Let's begin by opening  three  buffers. You can open any three you
  1867. choose,  for  example  call  the  following files into  memory:  fang.txt,
  1868. publish.txt, and emacs.tut in the  order listed here. When you've finished
  1869. this process, you'll be looking at a screen showing  the  EMACS  tutorial.
  1870. Let's assume that you want to move to the fang.txt buffer. Enter:
  1871.  
  1872.         ^XX next-buffer
  1873.  
  1874.         This  command  moves  you to the next buffer. Because EMACS cycles
  1875. through the buffer list, which is alphabetized, you  will  now  be  in the
  1876. fang.txt buffer. Using ^XX again places you in the publish.txt  buffer. If
  1877. you are on a machine that  supports  function keys, using ^XX again places
  1878. you in the Function Keys buffer. Using ^XX one last  time  cycles you back
  1879. to the beginning of the list.
  1880.  
  1881.         If you have a large number  of  buffers to deal with, this cycling
  1882. process may be slow and inconvenient. The command ^XB select-buffer allows
  1883. you to specify  the buffer you wish to be switched to. When the command is
  1884. entered, EMACS prompts, "Use buffer:".  Simply enter the buffer  name (NOT
  1885. the  file  name),  and that buffer will then become the current buffer. If
  1886. you type in part of  the  file  name  and  press the space bar, EMACS will
  1887. attempt  to  complete  the name from the list of current  buffers.  If  it
  1888.  
  1889.  
  1890. 27
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897. MicroEMACS Reference Manual                                        Buffers
  1898.  
  1899.  
  1900. succeeds, it  will  print  the  rest  of  the name and you can hit <NL> to
  1901. switch to that buffer. If EMACS beeps the bell, there  is  no such buffer,
  1902. and you may continue editing the name on the command line.
  1903.  
  1904.         Multiple buffer manipulation and editing  is  a  complex activity,
  1905. and you will probably find it very inconvenient to re-save each  buffer as
  1906. you modify it.  The  command  ^X^B  list-buffers creates a new window that
  1907. gives details about all the buffers currently known to EMACS. Buffers that
  1908. have  been  modified  are identified by the "buffer changed" indicator (an
  1909. asterisk in the second  column).  You can thus quickly and easily identify
  1910. buffers that need to be saved to files before you  exit  EMACS. The buffer
  1911. window also provides other  information  --  buffer specific modes, buffer
  1912. size, and buffer name are also  listed.  To close this window, simply type
  1913. the close-windows command, ^X1.
  1914.  
  1915.         To delete any buffer,  type  ^XK  delete-buffer. EMACS prompts you
  1916. "Kill  buffer:".  Enter  the buffer name you want to delete.  As  this  is
  1917. destructive command, EMACS will  ask  for  confirmation  if the buffer was
  1918. changed  and  not saved.  Answer Y(es) or N(o). As usual  ^G  cancels  the
  1919. command.
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.                                                                         28
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963. Buffers                                        MicroEMACS Reference Manual
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.                             Chapter 7 Summary
  1971.  
  1972.  
  1973.         In Chapter 7 you learned how to manipulate buffers.
  1974.  
  1975. Key Binding             Keystroke                      Effect
  1976. next-buffer             ^X^X            Switch to the next buffer in the
  1977.                                         buffer list
  1978.  
  1979. select-buffer           ^XB             Switch to a particular buffer
  1980.  
  1981. list-buffers            ^X^B            List all buffers
  1982.  
  1983. delete-buffer           ^XK             Delete a particular buffer if it
  1984.                                         is off-screen
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022. 29
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029. MicroEMACS Reference Manual                                          Modes
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.                                 Chapter 8
  2039.  
  2040.                                   Modes
  2041.  
  2042.  
  2043.         EMACS allows you to change the way it works in order to customized
  2044. it to the style of  editing  you  are  using.  It does this by providing a
  2045. number of different modes. These modes can effect either a  single buffer,
  2046. or any new  buffer  that is created.  To add a mode to the current buffer,
  2047. type ^XM add-mode. EMACS will then prompt you for the name  of  a  mode to
  2048. add. When you  type  in a legal mode name, and type a <NL>, EMACS will add
  2049. the  mode  name  to the list of current mode names in the mode line of the
  2050. current buffer.
  2051.  
  2052.         To remove an existing mode, typing the ^X^M delete-mode will cause
  2053. EMACS to prompt you for  the  name  of  a  mode to delete from the current
  2054. buffer.  This will remove that mode from the mode list on the current mode
  2055. line.
  2056.  
  2057.         Global modes are the modes which are inherited by any  new buffers
  2058. which are created. For example, if you wish to always do  string searching
  2059. with character case being significant, you would want global mode EXACT to
  2060. be set so that any new files read in inherent the EXACT mode. Global modes
  2061. are  set with the M-M add-global-mode command, and  unset  with  the  M-^M
  2062. delete-global-mode command. Also, the current global  modes  are displayed
  2063. in the first line of a ^X^B list-buffers command.
  2064.  
  2065.         On  machines  which  are capable of displaying  colors,  the  mode
  2066. commands  can also set the background  and  foreground  character  colors.
  2067. Using  add-mode  or  delete-mode  with  a  lowercase  color will  set  the
  2068. background color in the current window.    An uppercase color will set the
  2069. foreground color in  the  current  window.   Colors that EMACS knows about
  2070. are: white, cyan,  magenta,  yellow,  blue,  red, green, and black. If the
  2071. computer you are running on does not have eight colors, EMACS will attempt
  2072. to  make some intelligent guess at what color to use when you ask for  one
  2073. which is not there.
  2074.  
  2075.  
  2076. 8.1  ASAVE mode
  2077.  
  2078.  
  2079.         Automatic Save mode tells EMACS  to  automatically  write  out the
  2080. current buffer to its associated file on a regular  basis.  Normally  this
  2081. will be every 256 characters typed into the file. The environment variable
  2082. $ACOUNT counts down to the next auto-save, and $ASAVE is the value used to
  2083. reset $ACOUNT after a save occurs.
  2084.  
  2085.  
  2086.  
  2087.  
  2088.                                                                         30
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095. Modes                                          MicroEMACS Reference Manual
  2096.  
  2097.  
  2098. 8.2  CMODE mode
  2099.  
  2100.  
  2101.         CMODE is useful to C programmers. When CMODE is active, EMACS will
  2102. try to assist the user in a number of ways. This mode is set automatically
  2103. with files that have a .c or .h extension.
  2104.  
  2105.         The <NL> key will normally attempt to return the user to  the next
  2106. line at the same level of indentation as the last  non  blank line, unless
  2107. the current line ends with a open brace  ({)  in  which  case the new line
  2108. will be further indented by one tab position.
  2109.  
  2110.         A close brace (}) will search for the corresponding open brace and
  2111. line up with it.
  2112.  
  2113.         A pound sign (#) with only leading white space will delete all the
  2114. white  space  preceding  itself.  This  will  always   bring  preprocessor
  2115. directives flush to the left margin.
  2116.  
  2117.         Whenever any close fence  is  typed, IE )]>}, if the matching open
  2118. fence is on screen in the current window, the cursor will briefly flash to
  2119. it, and then back. This makes balancing expressions,  and  matching blocks
  2120. much easier.
  2121.  
  2122.  
  2123. 8.3  CRYPT mode
  2124.  
  2125.  
  2126.         When a buffer is in CRYPT mode, it  is  encrypted  whenever  it is
  2127. written to a  file,  and  decrypted  when  it  is  read from the file. The
  2128. encryption key can be specified on the command line with the -k switch, or
  2129. with the M-E set-encryption-key command. If you attempt to read or write a
  2130. buffer in crypt mode and now key has not been set, EMACS will execute set-
  2131. encryption-key automatically,  prompting you for the needed key.  Whenever
  2132. EMACS  prompts  you  for a key, it will not echo the key to your screen as
  2133. you type it (IE make SURE you get it right when you set it originally).
  2134.  
  2135.         The encryption algorithm used changes all  characters  into normal
  2136. printing characters, thus the resulting file is suitable  for  sending via
  2137. electronic  mail. All version of MicroEMACS should  be  able  decrypt  the
  2138. resulting file regardless of what  machine  encrypted  it.  Also available
  2139. with  EMACS  is  the stand alone program, MicroCRYPT, which can en/decrypt
  2140. the files produced by CRYPT mode in EMACS.
  2141.  
  2142.  
  2143. 8.4  EXACT mode
  2144.  
  2145.  
  2146.         All string searches and replacements  will  take  upper/lower case
  2147. into  account. Normally the case of a string during a search or replace is
  2148. not taken into account.
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154. 31
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161. MicroEMACS Reference Manual                                          Modes
  2162.  
  2163.  
  2164. 8.5  MAGIC mode
  2165.  
  2166.  
  2167.         In the MAGIC mode  certain  characters  gain special meanings when
  2168. used  in  a  search  pattern.   Collectively  they  are  know  as  regular
  2169. expressions, and a limited  number  of  them  are supported in MicroEmacs.
  2170. They grant greater flexibility when using the search command. They have no
  2171. affect on the incremental search command.
  2172.  
  2173.         The symbols that have special meaning  in  MAGIC mode are ^, $, .,
  2174. &, ?, *, +, [ (and ], used with it), and \.
  2175.  
  2176.         The characters ^ and $ fix the search pattern to the beginning and
  2177. end of line, respectively. The ^ character must appear at the beginning of
  2178. the  search string, and the $ must appear at the end, otherwise they loose
  2179. their meaning and are treated just like any other character.  For example,
  2180. in  MAGIC mode, searching for the pattern "t$" would put the cursor at the
  2181. end  of  any  line that ended with the  letter  't'.  Note  that  this  is
  2182. different than searching for  "t<NL>",  that is, 't' followed by a newline
  2183. character. The character $ (and ^, for that matter)  matches  a  position,
  2184. not  a character, so the cursor remains at the end of the  line.    But  a
  2185. newline  is a character that must be matched  like  any  other  character,
  2186. which means that  the cursor is placed just after it - on the beginning of
  2187. the next line.
  2188.  
  2189.         The character . has a very simple meaning -- it matches any single
  2190. character,  except the newline. Thus a search  for  "bad.er"  could  match
  2191. "badger", "badder" (slang), or up to the 'r' of "bad error".
  2192.  
  2193.         The character [ indicates the beginning of a  character  class. It
  2194. is similar  to  the  'any'  character  .,  but  you  get  to  choose which
  2195. characters  you  want to match. The character  class  is  ended  with  the
  2196. character  ]. So, while a search for "ba.e"  will  match  "bane",  "bade",
  2197. "bale", "bate", et cetera, you can limit it to matching "babe"  and "bake"
  2198. by  searching for "ba[bk]e". Only one of the characters inside the [ and ]
  2199. will  match a character. If in fact you want to match any character except
  2200. those  in the character class, you can put a ^ as the first character.  It
  2201. must be the  first  character  of  the  class,  or  else it has no special
  2202. meaning. So,  a  search  for  [^aeiou]  will  match any character except a
  2203. vowel, but a search for [aeiou^] will match any vowel or a ^.
  2204.  
  2205.         If  you have many characters in order, that you want to put in the
  2206. character class, you may use a  dash  (-)  as a range character. So, [a-z]
  2207. will match any  letter (or any lower case letter if EXACT mode is on), and
  2208. [0-9a-f] will match any digit or any letter 'a' through 'f',  which happen
  2209. to be the characters for  hexadecimal  numbers.  If  the  dash  is  at the
  2210. beginning or end of a character class, it is taken to be just a dash.
  2211.  
  2212.         The  ?  character  indicates  that  the  preceding   character  is
  2213. optional. The character may or may  not  appear in the matched string. For
  2214. example, a search  for  "bea?st"  would  match both "beast" and "best". If
  2215. there is no  preceding charcter for ? to modify, it is treated as a normal
  2216. question mark character.
  2217.  
  2218.  
  2219.  
  2220.                                                                         32
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227. Modes                                          MicroEMACS Reference Manual
  2228.  
  2229.  
  2230.         The * character is known as  closure,  and means that zero or more
  2231. of the preceding character will match. If there is no preceding character,
  2232.         * has no special meaning and is treated as a normal  asterisk. The
  2233. closure  symbol will also have no special meaning if it is preceded by the
  2234. beginning  of  line  symbol ^, since  it  represents  a  position,  not  a
  2235. character.
  2236.  
  2237.         The notion of  zero  or  more  characters  is  important.  If, for
  2238. example, your cursor was on the line
  2239.  
  2240.      This line is missing two vowels.
  2241.  
  2242.         and a search was made for "a*", the cursor would not move, because
  2243. it  is  guaranteed  to match no letter 'a' , which  satisfies  the  search
  2244. conditions. If you wanted to search for one or more of the letter 'a', you
  2245. could  search for "aa*", which would match the letter a, then zero or more
  2246. of them. A better way, however, is to use the + character.
  2247.  
  2248.         The + character behaves  in  every  respect  like the * character,
  2249. with the exception that its minimum match range is one, not zero. Thus the
  2250. pattern "a+" is identical to "aa*".
  2251.  
  2252.         Under older  versions of MicroEMACS, the closure symbols would not
  2253. operate on newlines. The current versions no longer have this restriction.
  2254.  
  2255.         The \ is the escape character. With the exception of groups, which
  2256. are explained below,  the  \ is used at those times when you want to be in
  2257. MAGIC mode, but  also  want  a  regular  expression character to be just a
  2258. character. It turns off the special meaning of the character. So  a search
  2259. for "it\." will search for a line with "it.", and not "it" followed by any
  2260. other  character. Or, a search for "TEST\*+" would  match  the  word  TEST
  2261. followed by one or more asterisks. The escape character will also  let you
  2262. put ^, -, or ] inside a character class with no special side effects.
  2263.  
  2264.         The character pair \( represent the  start  of a group in a search
  2265. string. A group is ended by the character pair \). All  characters matched
  2266. within  the \( and \) are part of a numbered group, and may be  referenced
  2267. with the &GROUP  function, or with a \ followed by the group number in the
  2268. replacement string of replace-string or the query-replace-string commands.
  2269. For  example,  a  search   for   "INDEX\([0-9]+\)",   to  be  replaced  by
  2270. "getind(\1)" would change
  2271.  
  2272.      indptr := INDEX42
  2273.  
  2274.          to
  2275.  
  2276.      indptr := getind(42)
  2277.  
  2278.         .
  2279.  
  2280.         There may be up to nine groups. Groups may be nested.
  2281.  
  2282.         The  character  &  (ampersand)  is  a  replacement  character, and
  2283. represents all the characters  which  were  matched  by the search string.
  2284.  
  2285.  
  2286. 33
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293. MicroEMACS Reference Manual                                          Modes
  2294.  
  2295.  
  2296. When  used  in  the M-R replace-string or  the  M-^R  query-replace-string
  2297. commands, the & will be substituted for the search string.
  2298.  
  2299.  
  2300. 8.6  OVER mode
  2301.  
  2302.  
  2303.         OVER  mode  stands  for  overwrite  mode. When in this mode,  when
  2304. characters  are typed, instead of simply inserting  them  into  the  file,
  2305. EMACS  will attempt to overwrite an existing  character  past  the  point.
  2306. This is very useful for adjusting tables and diagrams.
  2307.  
  2308.  
  2309. 8.7  WRAP mode
  2310.  
  2311.  
  2312.         Wrap mode is used  when  typing  in  continuous text. Whenever the
  2313. cursor  is past the currently set fill column (72 by default) and the user
  2314. types a space or a <NL>, the last word of the line is brought down  to the
  2315. beginning of the next line. Using this, one just types a continuous stream
  2316. of words and EMACS automatically inserts <NL>s at appropriate places.
  2317.  
  2318.                            NOTE to programmers:
  2319.  
  2320.      The EMACS variable  $wraphook  contains the name of the function
  2321.      which executes when EMACS detects it is time to  wrap.  This  is
  2322.      set to the function wrap-word by default, but can be  changed to
  2323.      activate different functions and macros at wrap time.
  2324.  
  2325.  
  2326. 8.8  VIEW mode
  2327.  
  2328.  
  2329.         VIEW  mode  disables  all commands which can  change  the  current
  2330. buffer. EMACS will display an error  message  and ring the bell every time
  2331. you attempt to change a buffer in VIEW mode.
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.                                                                         34
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359. Modes                                          MicroEMACS Reference Manual
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.                             Chapter 8 Summary
  2367.  
  2368.  
  2369.         In Chapter 8 you learned about modes and their effects.
  2370.  
  2371. Key Binding             Keystroke                      Effect
  2372. add-mode                ^XM             Add a mode to the current buffer
  2373.  
  2374. delete-mode             ^X^M            Delete a mode from the current buffer
  2375.  
  2376. add-global-mode         M-M             Add a global mode to the
  2377.                                         current buffer
  2378.  
  2379. delete-global-mode      M-^M            Delete a global mode from the
  2380.                                         current buffer
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418. 35
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425. MicroEMACS Reference Manual                                          Files
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.                                 Chapter 9
  2435.  
  2436.                                   Files
  2437.  
  2438.  
  2439.         A file is simply a collection of related  data.  In  EMACS  we are
  2440. dealing  with  text  files -- named collections of text residing on a disk
  2441. (or some other storage medium). You will recall that  the  major  entities
  2442. EMACS deals with are buffers. Disk-based versions of files are only active
  2443. in  EMACS when you are reading into or writing out of buffers. As we  have
  2444. already seen, buffers and  physical  files  are  linked by associated file
  2445. names.  For example, the buffer "ch7.txt" which  is  associated  with  the
  2446. physical disk file  "ch7.txt."  You  will  notice that the file is usually
  2447. specified by the drive name  or (in the case of a hard drive) a path. Thus
  2448. you can specify full file names in EMACS,
  2449.  
  2450.         e.g. disk:\directories\filename.extension
  2451.  
  2452.         If you do not specify a disk and directories, the default disk and
  2453. the current directory is used.
  2454.  
  2455.         IMPORTANT -- If you do not explicitly save your buffer to  a file,
  2456. all your edits  will  be  lost  when  you leave EMACS (although EMACS will
  2457. prompt you when  you  are  about  to  lose edits by exiting). In addition,
  2458. EMACS  does not protect your disk-based files  from  overwriting  when  it
  2459. saves files.  Thus when you instruct EMACS to save a file to disk, it will
  2460. create  a  file  if the specified file doesn't exist, or it will overwrite
  2461. the previously  saved  version  of  the  file  thus replacing it. Your old
  2462. version is gone forever.
  2463.  
  2464.         If  you are at all unsure about your edits, or if (for any reason)
  2465. you  wish to keep previous versions of a file, you can change the name  of
  2466. the associated file with the  command ^XN change-file-name. When this file
  2467. is  saved  to disk, EMACS will create a new physical file  under  the  new
  2468. name. The earlier disk file will be preserved.
  2469.  
  2470.         For  example,  let's  load the file fang.txt into EMACS. Now, type
  2471. ^XN. The EMACS command line prompts "Name:". Enter a new name for the file
  2472. -- say new.txt  and  press  <NL>.  The  file  will  be saved under the new
  2473. filename, and your disk directory will show both fang.txt and new.txt.
  2474.  
  2475.         An alternative method is to write the file directly to  disk under
  2476. a new filename.  Let's  pull  our  "publish.txt" file into EMACS. To write
  2477. this file under another filename,  type ^X^W write-file. EMACS will prompt
  2478. you "write file:".  Enter an alternate filename -- desktop.txt.  Your file
  2479. will be saved as the physical file "desktop.txt".
  2480.  
  2481.  
  2482.  
  2483.  
  2484.                                                                         36
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491. Files                                          MicroEMACS Reference Manual
  2492.  
  2493.  
  2494.         Note that in the  examples  above,  although  you have changed the
  2495. names of the  related  files,  the  buffer names remain the same. However,
  2496. when you pull the physical file  back  into  EMACS, you will find that the
  2497. buffer name now relates to the filename.
  2498.  
  2499.         For example -- You  are  working with a buffer "fang.txt" with the
  2500. related file "fang.txt".  You  change  the  name of the file to "new.txt".
  2501. EMACS now shows  you  working  with  the buffer "fang.txt" and the related
  2502. file "new.txt". Now pull the file "new.txt" into EMACS.  Notice  that  the
  2503. buffer name has now changed to "new.txt".
  2504.  
  2505.         If for any reason  a  conflict of buffer names occurs,(if you have
  2506. files of the same name on different drives for example) EMACS  will prompt
  2507. you "use buffer:". Enter an alternative buffer name if you need to.
  2508.  
  2509.         For a list of file  related commands (including some we`ve already
  2510. seen), see the summary page.
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550. 37
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557. MicroEMACS Reference Manual                                          Files
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.                             Chapter 9 Summary
  2565.  
  2566.  
  2567.         In Chapter 9  you  learned  some  of the more advanced concepts of
  2568. file naming and  manipulation.  The relationship between files and buffers
  2569. was discussed in some detail.
  2570.  
  2571. Key Binding     Keystroke       Effect
  2572.  
  2573. save-file       ^X^S            Saves contents of current buffer with
  2574.                                 associated filename on default disk/
  2575.                                 directory (if not specified)
  2576.  
  2577. write-file      ^X^W            Current buffer contents will be
  2578.                                 saved under specified name
  2579.  
  2580. change-file-name
  2581.                 ^XN             The associated filename is changed
  2582.                                 (or associated if not previously
  2583.                                 specified) as specified
  2584.  
  2585. find-file       ^X^F            Reads specified file into buffer and
  2586.                                 switches you to that buffer, or switches
  2587.                                 to buffer in which the file has previously
  2588.                                 been read
  2589.  
  2590. read-file       ^X^R            Reads file into buffer thus overwriting
  2591.                                 buffer contents. If file has already
  2592.                                 been read into another buffer, you will
  2593.                                 be switched to it
  2594.  
  2595. view-file       ^X^V            The same as read-file except the buffer
  2596.                                 is automatically put into VIEW mode thus
  2597.                                 preventing any changes from being made
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.                                                                         38
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623. Screen Formatting                              MicroEMACS Reference Manual
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.                                 Chapter 10
  2633.  
  2634.                             Screen Formatting
  2635.  
  2636.  
  2637. 10.1  Wrapping Text
  2638.  
  2639.  
  2640.         As we learned in the introduction, EMACS is not a  word processor,
  2641. but  an  editor.  Some simple formatting options  are  available  however,
  2642. although in most cases they will not affect the appearance of the finished
  2643. text when it  is  run  through  the formatter. We have already encountered
  2644. WRAP  mode  which  wraps lines longer than a certain length (default is 75
  2645. characters).  You will recall that WRAP is enabled  by  entering  ^XM  and
  2646. responding to the command line prompt with wrap.
  2647.  
  2648.         You  can  also  set your own wrap margin with the command ^XF set-
  2649. fill-column.  Notice  EMACS  responds "[Fill column is 1]." Now try typing
  2650. some text. You'll notice  some  very strange things happening -- your text
  2651. wraps at  every  word!!  This  effect  occurs  because the set wrap margin
  2652. command must  be  preceded  by  a numeric argument or EMACS sets it to the
  2653. first  column.  Thus  any text you type that extends past the first column
  2654. will wrap at the most convenient line break.
  2655.  
  2656.         To reset the wrap column to 72 characters, press  the  <META>  key
  2657. and enter 72.  EMACS  will  respond  "Arg:  72". Now press ^XF. EMACS will
  2658. respond "[Fill column is 72]". Your text will  again  wrap  at  the margin
  2659. you've been using up to this point.
  2660.  
  2661.  
  2662. 10.2  Reformatting Paragraphs
  2663.  
  2664.  
  2665.         After an intensive editing  session,  you  may  find that you have
  2666. paragraphs containing lines of differing lengths. Although  this disparity
  2667. will not affect the formatted text, aesthetic and  technical  concerns may
  2668. make it desirable to have consistent paragraph blocks on  the  screen.  If
  2669. you are in WRAP mode, you  can  reformat  a paragraph with the command M-Q
  2670. fill-paragraph. This command 'fills' the current paragraph reformatting it
  2671. so all the lines are filled and wrap logically.
  2672.  
  2673.  
  2674. 10.3  Changing Case
  2675.  
  2676.  
  2677.         There may be occasions when you find it necessary  to  change  the
  2678. case of the text you've entered.  EMACS  allows  you to change the case of
  2679. even  large amounts of text with ease. Let's try and convert a few of  the
  2680.  
  2681.  
  2682. 39
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689. MicroEMACS Reference Manual                              Screen Formatting
  2690.  
  2691.  
  2692. office  traditionalists  to  the  joy  of  word  processing. Type  in  the
  2693. following text:
  2694.  
  2695.      Throw  away  your  typewriter and learn to use a word processor.
  2696.      Word processing is relatively  easy  to  learn and will increase
  2697.      your productivity enormously. Enter the  Computer  Age  and find
  2698.      out just how much fun it can be!!
  2699.  
  2700.         Let's give it a little more impact by capitalizing the  first four
  2701. words.  The  first  step is to define the region of text just as you would
  2702. if  you were doing an extensive deletion. Set the mark at the beginning of
  2703. the paragraph with  M-<space>  set-mark  and  move the cursor to the space
  2704. beyond "typewriter." Now  enter  ^X^U case-region-upper.  Your text should
  2705. now look like this:
  2706.  
  2707.      THROW  AWAY  YOUR  TYPEWRITER and learn to use a word processor.
  2708.      Word processing is relatively  easy  to  learn and will increase
  2709.      your productivity enormously. Enter the  Computer  Age  and find
  2710.      out just how much fun it can be!!
  2711.  
  2712.         If you want to change the text back to lower case, type ^X^L case-
  2713. region-lower. You  can also capitalize individual words. To capitalize the
  2714. word "fun", position the cursor in  front  of  the word and type M-U case-
  2715. word-upper.  The  word  is now capitalized. To change it ck to lower case,
  2716. move  the cursor back to the beginning of the word and type M-L case-word-
  2717. lower.
  2718.  
  2719.         You may also  capitalize  individual letters in EMACS. The command
  2720. M-C case-word-capitalize capitalizes the  first  letter  after  the point.
  2721. This command would normally be issued with the cursor positioned  in front
  2722. of the first letter of the word you wish to capitalize. If you issue it in
  2723. the middle of a word, you can end up with some strAnge looking text.
  2724.  
  2725.  
  2726. 10.4  Tabs
  2727.  
  2728.  
  2729.         Unless your  formatter is instructed to take screen text literally
  2730. (as MicroSCRIBE does in the 'verbatim' environment for  example),  tabs in
  2731. EMACS generally affect screen formatting only.
  2732.  
  2733.         When  EMACS is first started, it sets the  default  tab  to  every
  2734. eighth  column. As long as you stay with default, every time you press the
  2735. tab  key  a tab character, ^I is  inserted.  This  character,  like  other
  2736. control characters, is invisible -- but it makes a subtle  and significant
  2737. difference to your file and editing.
  2738.  
  2739.         For example, in default mode, press the tab key and then  type the
  2740. word  Test.  "Test"  appears at the eighth column. Move your cursor to the
  2741. beginning of the word and delete the backward character. The  word doesn't
  2742. move  back just one character, but flushes to the left margin.  The reason
  2743. for this behavior  is  easily  explained.  In tab default, EMACS inserts a
  2744. 'real'  tab  character  when  you  press  the  tab  key. This character is
  2745. inserted at the default  position,  but NO SPACES are inserted between the
  2746.  
  2747.  
  2748.                                                                         40
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755. Screen Formatting                              MicroEMACS Reference Manual
  2756.  
  2757.  
  2758. tab  character and the margin (or previous tab  character).  As  you  will
  2759. recall, EMACS only recognizes characters (such as spaces  or  letters) and
  2760. thus when the tab character is removed, the text beyond the tab is flushed
  2761. back to the margin or previous tab mark.
  2762.  
  2763.         This situation changes if you alter the default configuration. The
  2764. default  value  may  be changed by  entering  a  numeric  argument  before
  2765. pressing  the  tab  key.  As  we  saw  earlier, pressing the META key  and
  2766. entering a number allows you to specify how EMACS performs a given action.
  2767. In this case, let's specify an argument of 10 and hit the tab key.
  2768.  
  2769.         Now  hit  the  tab key again and type Test. Notice  the  word  now
  2770. appears at  the  tenth  column.  Now move to the beginning of the word and
  2771. delete the backward character. "Test" moves back by one character.
  2772.  
  2773.         EMACS behaves differently in these  circumstances  because  the ^I
  2774. handle-tab  function  deals  with tabbing in two distinct ways. In default
  2775. conditions, or if the numeric argument of zero is used, handle-tab inserts
  2776. a  true  tab  character.  If,  however,  a  non-zero numeric  argument  is
  2777. specified,  handle-tab  inserts  the correct number of  spaces  needed  to
  2778. position the cursor at the next specified tab position. It does NOT insert
  2779. the  single  tab  character  and  hence any editing functions should  take
  2780. account of the number of spaces between tabbed columns.
  2781.  
  2782.         The distance which a true tab character moves the  cursor  can  be
  2783. modified  by  changing  the value of the  $hardtab  environment  variable.
  2784. Initially set to 8, this will  determine  how  far each tab stop is placed
  2785. from the previous one. (Use the ^XA set  command  to  set  the value of an
  2786. environment variable).
  2787.  
  2788.         Many  times you would like to take text  which  has  been  created
  2789. using the tab character and change it to use just spaces. The command ^X^D
  2790. detab-region changes any tabs    in the currently selected region into the
  2791. right number of spaces so the  text  does  not change. This is very useful
  2792. for  times when the file must be printed or transferred to a machine which
  2793. does not understand tabs.
  2794.  
  2795.         Also,  the  inverse command, ^X^E  entab-region  changes  multiple
  2796. spaces to tabs  where  possible.  This is a good way to shrink the size of
  2797. large documents, especially with data tables. Both of  these  commands can
  2798. take a numeric argument which will  be  interpreted as the number of lines
  2799. to en/detab.
  2800.  
  2801.         Another  function,  related  to those above is provided for by the
  2802. ^X^T trim-region when invoked will delete any trailing white space  in the
  2803. selected region. A preceding numeric argument will do this for that number
  2804. of lines.
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814. 41
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821. MicroEMACS Reference Manual                              Screen Formatting
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.                             Chapter 10 Summary
  2829.  
  2830.  
  2831.         In Chapter 10 introduced some of the formatting features of EMACS.
  2832. Text-wrap, paragraph reformatting, and tabs were discussed in some detail.
  2833. The commands in the following table were covered in the chapter.
  2834.  
  2835.  
  2836. Key Binding             Keystroke                   Effect
  2837. add-mode/WRAP           ^XM[WRAP]       Add wrap mode to current buffer
  2838.  
  2839. delete-mode/WRAP        ^X^M[WRAP]      Remove wrap mode from current buffer
  2840.  
  2841. set-fill-column         ^XF             Set fill column to given numeric
  2842.                                         argument
  2843.  
  2844. fill-paragraph          M-Q             Logically reformats the current
  2845.                                         paragraph
  2846.  
  2847. case-word-upper         M-U             Text from point to end of the
  2848.                                         current word is changed to uppercase
  2849.  
  2850. case-word-lower         M-L             Text from point to end of the
  2851.                                         current word is changed to lowercase
  2852.  
  2853. case-word-capitalize    M-C             First word (or letter) after the
  2854.                                         point is capitalized
  2855.  
  2856. case-region-upper       ^X^U            The current region is uppercased
  2857.  
  2858. case-region-lower       ^X^L            The current region is lowercased
  2859.  
  2860. handle-tab              ^I              Tab interval is set to the given
  2861.                                         numeric argument
  2862.  
  2863. entab-region            ^X^E            Changes multiple spaces to tabs
  2864.                                         characters where possible
  2865.  
  2866. detab-region            ^X^D            Changes tab characters to the
  2867.                                         appropriate number of spaces
  2868.  
  2869. trim-region             ^X^T            Trims white space from the end
  2870.                                         of the lines in the current region
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.                                                                         42
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887. Access to the Outside World                    MicroEMACS Reference Manual
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.                                 Chapter 11
  2897.  
  2898.                        Access to the Outside World
  2899.  
  2900.  
  2901.         EMACS  has  the  ability  to  interface to other programs and  the
  2902. environment  of the computer outside of itself. It  does  this  through  a
  2903. series  of  commands  that  allow  it  to  talk  to the computer's command
  2904. processor or shell. Just what  this is varies between different computers.
  2905. Under MSDOS or  PCDOS  this  is  the command.com command processor.  Under
  2906. UNIX it is the csh shell. On the Atari ST is can be the Mark  Williams MSH
  2907. or the  Beckmeyer  shell.  In  each case, it is the part of the computer's
  2908. operating system that is responsible  for  determining  what  programs are
  2909. executed, and when.
  2910.  
  2911.         The ^X! shell-command command prompts  the user for a command line
  2912. to send out to the shell to execute.  This  can  be  very useful for doing
  2913. file  listings  and  changing the current directory or folder. EMACS gives
  2914. control to the shell, which executed the command, and then types [END] and
  2915. waits for the user to type a character  before  redrawing  the  screen and
  2916. resuming editing. If the  shell-command  command  is  used from within the
  2917. macro language, there is no pause.
  2918.  
  2919.         ^X@ pipe-command  command allows EMACS to execute a shell command,
  2920. and if the particular computer allows  it,  send the results into a buffer
  2921. which  is automatically displayed on the  screen.  The  resulting  buffer,
  2922. called  "command"  can  be manipulated just like any other editing buffer.
  2923. Text can be copied out of it  or  rearranged  as  needed.  This  buffer is
  2924. originally created in VIEW  mode,  so remember to ^X^Mview<NL> in order to
  2925. change it.
  2926.  
  2927.         Many computers provide tools which  will allow you to filter text,
  2928. making some modifications to it along the way. A very  common  tool is the
  2929. SORT  program  which  accepts a file, sorts it, and prints the result out.
  2930. The EMACS command, ^X# filter-buffer sends the current buffer through such
  2931. a  filter. Therefore, if you wished to sort the current buffer on a system
  2932. which  supplied  a  sort filter, you would type ^X#sort<NL>.  You can also
  2933. create your own filters by writing programs and utilities which  read text
  2934. from the keyboard and display the results. EMACS  will  use  any  of these
  2935. which would normally be available from the current shell.
  2936.  
  2937.         If you would like to execute another program directly, without the
  2938. overhead  of an intervening shell, you can  use  the  ^X$  execute-program
  2939. command. It will prompt you for an external program and its  arguments and
  2940. attempt to execute it.  Like when EMACS  looks  for  command  files, EMACS
  2941. will look first in the HOME directory, then  down  the  execute  PATH, and
  2942. finally in the current  directory  for the named program. On some systems,
  2943. it  will  automatically tack the proper extension  on  the  file  name  to
  2944.  
  2945.  
  2946. 43
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953. MicroEMACS Reference Manual                    Access to the Outside World
  2954.  
  2955.  
  2956. indicate  it  is  a program. On  some  systems  that  don't  support  this
  2957. function, ^X$ will be equivalent to ^X! shell-command.
  2958.  
  2959.         Sometimes, you would  like  to  get  back to the shell and execute
  2960. other commands, without losing  the  current contents of EMACS. The ^XC i-
  2961. shell command  shells  out  of  EMACS,  leaving  EMACS in the computer and
  2962. executing another command shell. Most systems would allow you to return to
  2963. EMACS with the "exit" command.
  2964.  
  2965.         On some systems, mainly advanced  versions of UNIX, you can direct
  2966. EMACS to "go into the background" with the ^XD suspend-emacs command. This
  2967. places  EMACS  in  the  background  returning you to the original  command
  2968. shell.  EMACS can then be returned to at any time with the "fg" foreground
  2969. command.
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.                                                                         44
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019. Access to the Outside World                    MicroEMACS Reference Manual
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.                             Chapter 11 Summary
  3027.  
  3028.  
  3029.         In Chapter 11 introduced  different  ways  to access the computers
  3030. shell  or  command  processor  from  within  EMACS.  The commands  in  the
  3031. following table were covered in the chapter.
  3032.  
  3033.  
  3034. Key Binding             Keystroke                   Effect
  3035. execute-program         ^X$             Execute an external program
  3036.                                         directly
  3037.  
  3038. filter-command          ^X#             Send the current buffer through
  3039.                                         a shell filter
  3040.  
  3041. i-shell                 ^XC             Escape to a new shell
  3042.  
  3043. pipe-command            ^X@             Send the results of an external
  3044.                                         shell command to a buffer
  3045.  
  3046. shell-command           ^X!             Execute one shell command
  3047.  
  3048. suspend-emacs           ^XD             Place EMACS in the background
  3049.                                         (some UNIX systems only)
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078. 45
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085. MicroEMACS Reference Manual                                Keyboard Macros
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.                                 Chapter 12
  3095.  
  3096.                              Keyboard Macros
  3097.  
  3098.  
  3099.         In  many  applications,  you  may  need  to  repeat  a  series  of
  3100. characters  or  commands  frequently. For example, a paper may require the
  3101. frequent repetition of a complex formula or a long name. You may also have
  3102. a series of EMACS  commands  that  you  invoke frequently. Keyboard macros
  3103. offer a convenient method of recording and repeating these commands.
  3104.  
  3105.         Imagine,  for  example,  you  are  writing  a  scholarly paper  on
  3106. Asplenium platyneuron, the spleenwort fern.  Even  the  dedicated botanist
  3107. would probably find it a task bordering on the agonizing to type Asplenium
  3108. platyneuron frequently throughout  the  paper.  An  alternative  method is
  3109. 'record' the name in a keyboard macro. Try it yourself.
  3110.  
  3111.         The  command  ^X(  begin-macro  starts  recording   the   all  the
  3112. keystrokes and commands you input.  After you've typed it, enter Asplenium
  3113. platyneuron. To stop recording, type ^X) end-macro. EMACS  has  stored all
  3114. the keystrokes between the two commands. To repeat the name you've stored,
  3115. just  enter  ^XE  execute-macro,  and  the  name  "Asplenium  platyneuron"
  3116. appears. You can repeat this action as often as you want, and of course as
  3117. with  any  EMACS  command, you may precede it with a numerical argument to
  3118. repeat it many times.
  3119.  
  3120.         Because EMACS records keystrokes, you may freely intermix commands
  3121. and  text. Unfortunately, you can only store one macro at a time. Thus, if
  3122. you begin to record  another  macro, the previously defined macro is lost.
  3123. Be careful to ensure  that  you've finished with one macro before defining
  3124. another.  If you have a series of commands that you would like to 'record'
  3125. for future use, use the procedure facilities detailed in chapter 13.
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.                                                                         46
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151. Keyboard Macros                                MicroEMACS Reference Manual
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.                             Chapter 12 Summary
  3159.  
  3160.  
  3161.         Chapter  12 covered keyboard macros. You  learned  how  to  record
  3162. keystrokes and how to repeat the stored sequence.
  3163.  
  3164. Key Binding             Keystroke               Effect
  3165.  
  3166. start-macro             ^X(             Starts recording all keyboard input
  3167.  
  3168. end-macro               ^X)             Stops recording keystrokes for macro
  3169.  
  3170. execute-macro           ^XE             Entire sequence of recorded
  3171.                                         keystrokes is replayed
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210. 47
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.                                 Chapter 13
  3227.  
  3228.                           MicroEMACS Procedures
  3229.  
  3230.  
  3231.         Procedures, or macros, are programs that are used to customize the
  3232. editor and to  perform  complicated  editing  tasks. They may be stored in
  3233. files  or buffers and may be executed using  an  appropriate  command,  or
  3234. bound  to  a  particular keystroke. Portions of the standard start-up file
  3235. are implemented via procedures, as well  as  the built in help system. The
  3236. M-^E run command causes named  procedures to be executed. The execute-file
  3237. command allows you to execute a procedure stored in a  disk  file, and the
  3238. execute-buffer  command  allows  you  to  execute a procedure stored in  a
  3239. buffer. Procedures are stored for easy execution by  executing  files that
  3240. contain the store-procedure command.
  3241.  
  3242.         In  a command file, the store-procedure  command  takes  a  string
  3243. argument which is the name of a procedure to store. These  procedures than
  3244. can  be  executed with the M-^E run command. Also, giving the  name  of  a
  3245. stored  procedure  within  another  procedure  will  executed  that  named
  3246. procedure as if it had been called up with the run command.
  3247.  
  3248.         Some fairly length  examples  of MicroEMACS procedures can be seen
  3249. by examining the standard files that come with EMACS.  The  emacs.rc  file
  3250. (called  .emacsrc) under UNIX) is the MicroEMACS  command  file  which  is
  3251. executed when EMACS  is  normally  run.  It contains a number of different
  3252. stored procedures along with  the  lines to setup and display the Function
  3253. key  window  and  to  call  up  other  procedures  and command files using
  3254. function keys.
  3255.  
  3256.         There  are  many  different  aspects   to   the   language  within
  3257. MicroEMACS. Editor commands are the various commands that manipulate text,
  3258. buffers, windows, et cetera,  within  the  editor. Directives are commands
  3259. which control  what  lines  get  executed  within  a macro. Also there are
  3260. various types  of  variables.  Environmental  variables  both  control and
  3261. report  on different aspects of the editor.  User  variables  hold  string
  3262. values which may be changed and inspected. Buffer variables allow  text to
  3263. be placed into variables. Interactive variable allow the program to prompt
  3264. the user for information. Functions can be used to  manipulate  all  these
  3265. variables.
  3266.  
  3267.  
  3268. 13.1  Constants
  3269.  
  3270.  
  3271.         All constants and variable contents in EMACS are stored as strings
  3272. of  characters.  Numbers  are  stored  digit by digit as characters.  This
  3273. allows EMACS to be  "typeless",  not  having  different variables types be
  3274.  
  3275.  
  3276.                                                                         48
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3284.  
  3285.  
  3286. legal in different contexts. This has the disadvantage of forcing the user
  3287. to be  more  careful  about  the  context  of the statements variables are
  3288. placed in, but in turn gives them more flexibility in where they can place
  3289. variables. Needless  to say, this also allows EMACS's expression evaluator
  3290. to be both concise and quick.
  3291.  
  3292.         Wherever statements need to have arguments, it is  legal  to place
  3293. constants. A constant is a double quote character, followed by a string of
  3294. characters, and terminated by another double quote character. To represent
  3295. various special characters within a constant, the tilde  (~)  character is
  3296. used.  The  character  following the tilde is interpreted according to the
  3297. following table:
  3298.  
  3299. Sequence        Result
  3300. ~n                      EMACS newline character (breaks lines)
  3301. ~r              ^M      carriage return
  3302. ~l              ^J      linefeed
  3303. ~~              ~       tilde
  3304. ~b              ^H      backspace
  3305. ~f              ^L      formfeed
  3306. ~t              ^I      tab
  3307. ~"              "       quote
  3308.  
  3309.         Any character  not  in  the  table  which  follows a tilde will be
  3310. passed  unmodified.  This  action  is  similar to the  ^Q  quote-character
  3311. command available from the keyboard.
  3312.  
  3313.         EMACS  may  use  different  characters  for  line  terminators  on
  3314. different  computers.  The  ~n combination will always get the proper line
  3315. terminating sequence for the current system.
  3316.  
  3317.         The double quotes around constants  are not needed if the constant
  3318. contains no internal white space and it also does not  happen  to meet the
  3319. rules for any  other  EMACS commands, directives, variables, or functions.
  3320. This is reasonable useful for numeric constants.
  3321.  
  3322.  
  3323. 13.2  Variables
  3324.  
  3325.  
  3326.         Variables in MicroEMACS procedures  can  be  used to return values
  3327. within expressions, as repeat counts to editing commands, or as text to be
  3328. inserted into buffers and messages. The value of these  variables  is  set
  3329. using  the set ^XA command. For example, to set the current fill column to
  3330. 64 characters, the following macro line would be used:
  3331.  
  3332.         set $fillcol 64
  3333.  
  3334.         or to have  the  contents  of  %name  inserted at the point in the
  3335. current buffer, the command to use would be:
  3336.  
  3337.         insert-string %name
  3338.  
  3339.  
  3340.  
  3341.  
  3342. 49
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3350.  
  3351.  
  3352.  
  3353. 13.2.1  Environmental Variables
  3354.  
  3355.  
  3356.         "What good is a quote if you can't change it?"
  3357.  
  3358.         These  variables  are  used to change different aspects of the way
  3359. the  editor  works.  Also they will return the current settings if used as
  3360. part  of  an  expression.  All  environmental variable names begin with  a
  3361. dollar sign ($) and are in lower case.
  3362.  
  3363. $acount           The  countdown  of inserted characters  until  the  next
  3364.                   save-file.
  3365.  
  3366. $asave            The  number of  inserted  characters  between  automatic
  3367.                   file-saves in ASAVE mode.
  3368.  
  3369. $bufhook          The function named in this variable is run when a buffer
  3370.                   is entered. It can be  used to implement modes which are
  3371.                   specific to a paricular file or file type.
  3372.  
  3373. $cbflags          Current buffer  attribute  flags  (See  appendix  G  for
  3374.                   details).
  3375.  
  3376. $cbufname         Name of the current buffer.
  3377.  
  3378. $cfname           File name of the current buffer.
  3379.  
  3380. $cmdhook          Name of function to run before accepting a command. This
  3381.                   is by default set to nop.
  3382.  
  3383. $cmode            Integer containing the mode of the current  buffer. (See
  3384.                   Appendix F for values).
  3385.  
  3386. $curchar          Ascii value of the character currently at the point.
  3387.  
  3388. $curcol           Current column of point in current buffer.
  3389.  
  3390. $curline          Current line of point in current buffer.
  3391.  
  3392. $curwidth         Number of columns used currently.
  3393.  
  3394. $curwind          Current window number.
  3395.  
  3396. $cwline           Current display line in current window.
  3397.  
  3398. $debug            Flag to trigger macro debugging.
  3399.  
  3400. $deskcolor        Color to use for current desktop, default to BLACK.
  3401.  
  3402. $diagflag         If set to TRUE, diagonal dragging of text and mode lines
  3403.                   is enabled. If FALSE, text  and  modelines  can  only be
  3404.                   dragged horizontally or vertically at one time.
  3405.  
  3406.  
  3407.  
  3408.                                                                         50
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3416.  
  3417.  
  3418. $discmd           Controls  the  echoing of command  prompts.  Default  is
  3419.                   TRUE.
  3420.  
  3421. $disinp           Controls the echoing of input  at  the  command prompts.
  3422.                   Default is TRUE.
  3423.  
  3424. $disphigh         If  set  to   TRUE,  high-bit  characters  (single  byte
  3425.                   characters that are  greater  than 127 in value) will be
  3426.                   displayed in  a  pseudo-control  format.  The characters
  3427.                   "^!"  will  lead  off  the  sequence,  followed  by  the
  3428.                   character stripped of its high bit. Default is FALSE.
  3429.  
  3430. $exbhook          This  variable holds the name of  a  function  or  macro
  3431.                   which is run whenever you are switching out of a buffer.
  3432.  
  3433. $fcol             The current line position being displayed  in  the first
  3434.                   column of the current window.
  3435.  
  3436. $fillcol          Current fill column.
  3437.  
  3438. $flicker          Flicker Flag set  to  TRUE  if  IBM CGA set to FALSE for
  3439.                   most others.
  3440.  
  3441. $fmtlead          lists all  formatter  command  leadin  characters. Lines
  3442.                   beginning  with these characters will be considered  the
  3443.                   beginning of paragraphs.
  3444.  
  3445. $gflags           Global  flags controlling some EMACS internal  functions
  3446.                   (See appendix G for details).
  3447.  
  3448. $gmode            Global mode flags. (See Appendix F for values).
  3449.  
  3450. $hardtab          Number of spaces between  hard  tab  stops.  Normally 8,
  3451.                   this can be  used  to change indentation only within the
  3452.                   editor.
  3453.  
  3454. $hjump            The  number  in  here tells EMACS how  many  columns  to
  3455.                   scroll the screen  horizontally when a horizontal scroll
  3456.                   is required.
  3457.  
  3458. $hscroll          This flag determines if  EMACS  will  scroll  the entire
  3459.                   current  window horizontally, or just the current  line.
  3460.                   The default value, TRUE, results in  the  entire current
  3461.                   window being shifted left and right when the cursor goes
  3462.                   off the edge of the screen.
  3463.  
  3464. $kill             This contains the first 127 characters currently  in the
  3465.                   kill buffer and can  be  used to set the contents of the
  3466.                   kill buffer.
  3467.  
  3468. $language         [READ ONLY]Contains the name of the  language  which the
  3469.                   current  EMACS's message will display. (Currently  EMACS
  3470.                   is   available  in  English,  French,  Spanish,   Latin,
  3471.                   Portuguese, Dutch, German, and Pig Latin).
  3472.  
  3473.  
  3474. 51
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3482.  
  3483.  
  3484. $lastkey          [READ ONLY]Last keyboard character typed.
  3485.  
  3486. $lastmesg         [READ ONLY]Contains the text of the  last  message which
  3487.                   emacs wrote on the command line.
  3488.  
  3489. $line             The current  line in the current buffer can be retrieved
  3490.                   and set with this environment variable.
  3491.  
  3492. $lterm            Character(s) to write as a line terminator  when writing
  3493.                   a file to disk.  Default  is  null,  which causes a '\n'
  3494.                   character to  be  written.  Not  all  operating  systems
  3495.                   support this.
  3496.  
  3497. $lwidth           [READ ONLY]Returns  the  number  of  characters  in  the
  3498.                   current line.
  3499.  
  3500. $match            [READ ONLY]Last string matched in a search.
  3501.  
  3502. $modeflag         Determines if mode lines are currently displayed.
  3503.  
  3504. $msflag           If TRUE, the mouse (if  present) is active. If FALSE, no
  3505.                   mouse cursor is  displayed,  and  no  mouse  actions are
  3506.                   taken.
  3507.  
  3508. $numwind          The number of windows displayed.
  3509.  
  3510. $oldcrypt         Use the old method  of  encryption  (which  had a bug in
  3511.                   it).  Default is FALSE.
  3512.  
  3513. $orgrow           Desktop row position of current screen.
  3514.  
  3515. $orgcol           Desktop column position of current screen.
  3516.  
  3517. $pagelen          Number of screen lines used currently.
  3518.  
  3519. $palette          string used to control the palette register  settings on
  3520.                   graphics  versions. The usually form consists of  groups
  3521.                   of three octal  digits  setting the red, green, and blue
  3522.                   levels.
  3523.  
  3524. $paralead         Lists all paragraph start characters.
  3525.  
  3526. $pending          [READ  ONLY]Flag  to  determine   if   there   are  user
  3527.                   keystrokes waiting to be processed.
  3528.  
  3529. $popflag          Use pop-up windows. Default is TRUE.
  3530.  
  3531. $progname         [READ  ONLY]Always contains the string "MicroEMACS"  for
  3532.                   standard MicroEMACS. Could be something else if EMACS is
  3533.                   incorporated as part of someone else's program.
  3534.  
  3535. $ram                The  amount  of  remaining  memory  if  MicroEMACS was
  3536.                   compiled with RAMSIZE set. A debugging tool.
  3537.  
  3538.  
  3539.  
  3540.                                                                         52
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3548.  
  3549.  
  3550. $readhook         This variable holds the  name  of  a function to execute
  3551.                   whenever a  file is read into EMACS. Normally, using the
  3552.                   standard emacs.rc file,  this  is  bound  to  a function
  3553.                   which places EMACS into  CMODE  if  the extension of the
  3554.                   file read is .c or .h.
  3555.  
  3556. $region           Contains the  string  of  the  current  region.  It will
  3557.                   truncate at the stringsize limit, 255.
  3558.  
  3559. $replace          Current default replace string.
  3560.  
  3561. $rval             This contains the return value from the  last subprocess
  3562.                   which was invoked from EMACS.
  3563.  
  3564. $scrname          The current screen name.
  3565.  
  3566. $search           Current default search string.
  3567.  
  3568. $searchpnt        Set the placement of the of the cursor  on  a successful
  3569.                   search match. $searchpnt = 0 (the  default),  causes the
  3570.                   cursor to be placed at the end of the  matched  text  on
  3571.                   forward searches, and at  the  beginning  of the text on
  3572.                   reverse searches. $searchpnt = 1 causes the cursor to be
  3573.                   placed  at  the  the  beginning  of  the   matched  text
  3574.                   regardless of the search direction, while $searchpnt = 2
  3575.                   causes the cursor to be placed at the end.
  3576.  
  3577. $seed             Integer seed of the random number generator.
  3578.  
  3579. $softtab          Number of spaces inserted by EMACS  when  the handle-tab
  3580.                   command  (which is normally bound to  the  TAB  key)  is
  3581.                   invoked.
  3582.  
  3583. $sres             Current screen  resolution (CGA, MONO, EGA or VGA on the
  3584.                   IBM-PC driver. LOW,  MEDIUM,  HIGH or DENSE on the Atari
  3585.                   ST1040, NORMAL on most others).
  3586.  
  3587. $ssave            If TRUE, when EMACS is asked to save  the  current file,
  3588.                   it writes all files out to a temporary file, deletes the
  3589.                   original, and then renames the temporary to the old file
  3590.                   name. The default value of this is TRUE.
  3591.  
  3592. $sscroll          Changes EMACS, when  set  to  TRUE,  to  smoothly scroll
  3593.                   windows (one line at a time) when cursoring off the ends
  3594.                   of the current window.
  3595.  
  3596. $status           [READ ONLY]Status of the  success  of  the  last command
  3597.                   (TRUE or FALSE). This is  usually  used  with  !force to
  3598.                   check on the success of a search, or a file operation.
  3599.  
  3600. $sterm            This is the character used  to  terminate  search string
  3601.                   inputs.  The  default  for this is the last key bound to
  3602.                   meta-prefix.
  3603.  
  3604.  
  3605.  
  3606. 53
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3614.  
  3615.  
  3616. $target           Current target for line moves (setting this fool's EMACS
  3617.                   into believing the last command was a line move).
  3618.  
  3619. $time             [READ  ONLY]Contains  a  string  corresponding   to  the
  3620.                   current date and time. Usually this is in a form similar
  3621.                   to "Mon May 09 10:10:58 1988". Not all operating systems
  3622.                   will support this.
  3623.  
  3624. $tpause           Controls the length of  the  pause  to display a matched
  3625.                   fence  when  the  current buffer is in CMODE and a close
  3626.                   fence has been typed.
  3627.  
  3628. $version          [READ  ONLY]Contains  the  current  MicroEMACS   version
  3629.                   number.
  3630.  
  3631. $wchars           When set, MicroEMACS uses the characters listed in it to
  3632.                   determine if it is in a  word  or  not. If it is not set
  3633.                   (the default),  the characters it uses are the upper and
  3634.                   lower case letters, and the underscore.
  3635.  
  3636. $wline            Number of display lines in current window.
  3637.  
  3638. $wraphook         This variable contains the  name  of  an  EMACS function
  3639.                   which is executed when  a  buffer is in WRAP mode and it
  3640.                   is time to wrap. By default this is bound to wrap-word.
  3641.  
  3642. $writehook        This variable  contains the name of an EMACS function or
  3643.                   macro which is invoked whenever EMACS attempts  to write
  3644.                   a file out to disk. This is executed before the  file is
  3645.                   written, allowing you to process a file on the way out.
  3646.  
  3647. $xpos             The column the mouse was at the last mouse button press.
  3648.  
  3649. $yankflag         Controls  the  placement  of  the  cursor  after  a yank
  3650.                   command or  an  insert.  When  $yankflag  is  FALSE (the
  3651.                   default), the cursor is placed  at the end of the yanked
  3652.                   or inserted text. When it is TRUE, the cursor remains at
  3653.                   the start of the text.
  3654.  
  3655. $ypos             The  line  which  the mouse was on during the last mouse
  3656.                   button press.
  3657.  
  3658.  
  3659. 13.2.2  User variables
  3660.  
  3661.  
  3662.         User variables allow you to  store  strings  and  manipulate them.
  3663. These strings can be pieces  of  text,  numbers  (in  text  form),  or the
  3664. logical  values  TRUE  and FALSE. These variables can be combined, tested,
  3665. inserted into buffers, and  otherwise  used to control the way your macros
  3666. execute. At the moment, up  to  512  user  variables  may be in use in one
  3667. editing session. All users  variable  names must begin with a percent sign
  3668. (%) and may contain any printing characters. Only the first  10 characters
  3669.  
  3670.  
  3671.  
  3672.                                                                         54
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3680.  
  3681.  
  3682. are significant (IE  differences  beyond the tenth character are ignored).
  3683. Most operators will truncate strings to a length of 128 characters.
  3684.  
  3685.  
  3686. 13.2.3  Buffer Variables
  3687.  
  3688.  
  3689.         Buffer variables are special in that they can only be  queried and
  3690. cannot be set. What buffer  variables  are  is  a  way to take text from a
  3691. buffer and place it in  a variable. For example, if I have a buffer by the
  3692. name of RIGEL2, and it contains the text:
  3693.  
  3694.         Richmond
  3695.         Lafayette
  3696.         <*>Bloomington          (where <*> is the current point)
  3697.         Indianapolis
  3698.         Gary
  3699.         =* MicroEMACS 3.11 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  3700.  
  3701.         and within a command I reference #rigel2, like:
  3702.  
  3703.         insert-string #rigel2
  3704.  
  3705.         MicroEMACS would start at the current point in  the  RIGEL2 buffer
  3706. and grab all the text up to the end of that line and pass that  back. Then
  3707. it  would advance the point to the beginning of the next line. Thus, after
  3708. our last command executes, the string "Bloomington" gets inserted into the
  3709. current buffer, and the buffer RIGEL2 now looks like this:
  3710.  
  3711.         Richmond
  3712.         Lafayette
  3713.         Bloomington
  3714.         <*>Indianapolis         (where <*> is the current point)
  3715.         Gary
  3716.         =* MicroEMACS 3.11 (WRAP) == rigel2 == File: /data/rigel2.txt =====
  3717.  
  3718.         as  you  have  probably noticed, a buffer variable consists of the
  3719. buffer name, preceded by a pound sign (#).
  3720.  
  3721.  
  3722. 13.2.4  Interactive variables
  3723.  
  3724.  
  3725.         Interactive variables are actually a method to prompt the user for
  3726. a string. This is done  by  using  an  at  sign (@) followed either with a
  3727. quoted string, or a variable containing a string. The string is the placed
  3728. on the bottom line, and the editor waits for the user to type in a string.
  3729. Then the string typed in  by  the  users  is  returned as the value of the
  3730. interactive variable. For example:
  3731.  
  3732.         set %quest "What file? "
  3733.         find-file @%quest
  3734.  
  3735.  
  3736.  
  3737.  
  3738. 55
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3746.  
  3747.  
  3748.         will ask the user for a  file  name,  and then attempt to find it.
  3749. Note also that complex  expressions  can be built up with these operators,
  3750. such as:
  3751.  
  3752. set %default "file1"
  3753. @&cat &cat "File to decode[" %default "]: "
  3754.  
  3755.         which prompts the user with the string:
  3756.  
  3757.         File to decode[file1]:
  3758.  
  3759.  
  3760. 13.3  Functions
  3761.  
  3762.  
  3763.         Functions  can  be  used to act  on  variables  in  various  ways.
  3764. Functions  can have one, two, or three  arguments.  These  arguments  will
  3765. always be  placed  after  the  function  on  the current command line. For
  3766. example,  if  we  wanted to increase the current fill column by two, using
  3767. emacs's set (^XA) command, we would write:
  3768.  
  3769.         set $fillcol &add $fillcol 2
  3770.          \      \      \      \     \____second operand
  3771.           \      \      \      \_________first operand
  3772.            \      \      \_______________function to execute
  3773.             \      \_____________________variable to set
  3774.              \___________________________set (^XA) command
  3775.  
  3776.         Function names  always begin with the ampersand (&) character, and
  3777. are  only  significant  to the first three characters after the ampersand.
  3778. Functions will normal  expect  one  of  three types of arguments, and will
  3779. automatically convert types when needed. Different argument types include:
  3780.  
  3781. <num>             an  ascii string of digits which  is  interpreted  as  a
  3782.                   numeric value.  Any string which does not  start  with a
  3783.                   digit or a minus sign (-) will be considered zero.
  3784.  
  3785. <str>             An  arbitrary  string  of  characters.  At  the  moment,
  3786.                   strings are limited to 128 characters in length.
  3787.  
  3788. <log>             A logical  value  consisting  of  the  string  "TRUE" or
  3789.                   "FALSE".  Numeric strings will also evaluate  to "FALSE"
  3790.                   if they are equal  to  zero, and "TRUE" if they are non-
  3791.                   zero. Arbitrary text  strings  will  have  the  value of
  3792.                   "FALSE".
  3793.  
  3794.         A list of the currently available functions follows. Functions are
  3795. always used in lower case, the uppercase letters in the function table are
  3796. the short form of the function (IE &div for ÷).
  3797.  
  3798. Numeric Functions:      (returns <num>)
  3799.  
  3800. &ADD            <num> <num>     Add two numbers
  3801. &SUB            <num> <num>     Subtract the second number from the first
  3802.  
  3803.  
  3804.                                                                         56
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3812.  
  3813.  
  3814. &TIMes          <num> <num>     Multiply two numbers
  3815. &DIVide         <num> <num>     Divide the first number by the second
  3816.                                 giving an integer result
  3817. &MOD            <num> <num>     Return the reminder of dividing the
  3818.                                 first number by the second
  3819. &NEGate         <neg>           Multiply the arg by -1
  3820. &LENgth         <str>           Returns length of string
  3821. &SINdex         <str1> <str2>   Finds the position of <str2> within
  3822.                                 <str1>. Returns zero if not found.
  3823. &ASCii          <str>           Return the ascii code of the first
  3824.                                 character in <str>
  3825. &RND            <num>           Returns a random integer between 1 and <num>
  3826. &ABS            <num>           Returns the absolute value of <num>
  3827. &BANd           <num> <num>     Bitwise AND function
  3828. &BOR            <num> <num>     Bitwise OR function
  3829. &BXOr           <num> <num>     Bitwise XOR function
  3830. &BNOt           <num>           Bitwise NOT function
  3831.  
  3832. String manipulation functions:  (returns <str>)
  3833.  
  3834. &CAT            <str> <str>     Concatenate the two strings to form one
  3835. &LEFt           <str> <num>     return the <num> leftmost characters
  3836.                                 from <str>
  3837. &RIGht          <str> <num>     return the <num> rightmost characters
  3838.                                 from <str>
  3839. &MID            <str> <num1> <num2>
  3840.                                 Starting from <num1> position in <str>,
  3841.                                 return <num2> characters.
  3842. &UPPer          <str>           Uppercase <str>
  3843. &LOWer          <str>           Lowercase <str>
  3844. &CHR            <num>           return a string with the character
  3845.                                 represented by ascii code <num>
  3846. >C                            returns a string of characters
  3847.                                 containing a EMACS command input from
  3848.                                 the user
  3849. >K                            return a string containing a single
  3850.                                 keystroke from the user
  3851. &ENV            <str>           If the operating system is capable, this
  3852.                                 returns the environment string associated
  3853.                                 with <str>
  3854. &BIND           <str>           return the function name bound to the
  3855.                                 keystroke <str>
  3856. &XLATE          <str1> <str2> <str3>
  3857. &FINd           <str>           Find the named file <str> along the
  3858.                                 path and return its full file specification
  3859.                                 or an empty string if none exists
  3860. &TRIM           <str>           Trim the trailing whitespace from a string
  3861.  
  3862. Logical Testing functions:      (returns <log>)
  3863.  
  3864. &NOT            <log>           Return the opposite logical value
  3865. &AND            <log1> <log2>   Returns TRUE if BOTH logical arguments
  3866.                                 are TRUE
  3867. &OR             <log1> <log2>   Returns TRUE if either argument
  3868.  
  3869.  
  3870. 57
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877. MicroEMACS Reference Manual                          MicroEMACS Procedures
  3878.  
  3879.  
  3880.                                 is TRUE
  3881. &EQUal          <num> <num>     If <num> and <num> are numerically
  3882.                                 equal, return TRUE
  3883. &LESs           <num1> <num2>   If <num1> is less than <num2>, return
  3884.                                 TRUE.
  3885. &GREater        <num1> <num2>   If <num1> is greater than, or equal to
  3886.                                 <num2>, return TRUE.
  3887. &SEQual         <str1> <str2>   If the two strings are the same, return
  3888.                                 TRUE.
  3889. &SLEss          <str1> <str2>   If <str1> is less alphabetically than
  3890.                                 <str2>, return TRUE.
  3891. &SGReater       <str1> <str2>   If <str1> is alphabetically greater than
  3892.                                 or equal to <str2>, return TRUE.
  3893. &EXIst          <str>           Does the named file <str> exist?
  3894.  
  3895. &ISNum          <num>           Is the given argument a legitimate number?
  3896.  
  3897. Special Functions:
  3898.  
  3899. &GROup          <num>           Return group <num> as set by a MAGIC
  3900.                                 mode search.
  3901.  
  3902. &SUPper         <str1> <str2>   Translate the first char in <str1> to
  3903.                                 the first char in <str2> when uppercasing.
  3904.  
  3905. &SLOwer         <str1> <str2>   Translate the first char in <str1> to
  3906.                                 the first char in <str2> when lowercasing.
  3907.  
  3908. &INDirect       <str>           Evaluate <str> as a variable.
  3909.  
  3910.         This last function deserves more  explanation.  The  &IND function
  3911. evaluates its argument, takes the resulting string, and then uses it  as a
  3912. variable name. For example, given the following code sequence:
  3913.  
  3914.         ; set up reference table
  3915.  
  3916.         set %one        "elephant"
  3917.         set %two        "giraffe"
  3918.         set %three      "donkey"
  3919.  
  3920.         set %index "two"
  3921.         insert-string &ind %index
  3922.  
  3923.         the string "giraffe" would have been inserted at the point  in the
  3924. current buffer.  This  indirection  can  be  safely  nested up to about 10
  3925. levels.
  3926.  
  3927.  
  3928. 13.4  Directives
  3929.  
  3930.  
  3931.         Directives are commands which  only  operate  within  an executing
  3932. procedure, IE they do not make  sense  as  a single command. As such, they
  3933.  
  3934.  
  3935.  
  3936.                                                                         58
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943. MicroEMACS Procedures                          MicroEMACS Reference Manual
  3944.  
  3945.  
  3946. cannot  be called up singly or bound to  keystroke.  Used  within  command
  3947. files, they control what lines are executed and in what order.
  3948.  
  3949.         Directives always start with the  exclamation  mark  (!) character
  3950. and must be the first non-wite space placed on a line. Directives executed
  3951. interactively (via the execute-command-line command) will be ignored.
  3952.  
  3953.  
  3954. 13.4.1  !ENDM Directive
  3955.  
  3956.  
  3957.         This directive is used  to  terminate  a  procedure or macro being
  3958. stored. For example, if a file is being executed contains the text:
  3959.  
  3960.         ;       Read in a file in view mode, and make the window red
  3961.  
  3962.         store-procedure get-red-viewed-file
  3963.                 find-file @"File to view: "
  3964.                 add-mode "view"
  3965.                 add-mode "red"
  3966.         !endm
  3967.  
  3968.         print "[Consult procedure has been loaded]"
  3969.  
  3970.         only  the  lines  between the store-macro command  and  the  !ENDM
  3971. directive  are  stored  in   procedure   get-red-viewd-file.   Both  named
  3972. procedures and numbered macroes  (via  the  store-macro command) should be
  3973. terminated with this directive.
  3974.  
  3975.  
  3976. 13.4.2  !FORCE Directive
  3977.  
  3978.  
  3979.         When MicroEMACS executes a  procedure,  if  any command fails, the
  3980. procedure is terminated at that point. If a line is  preceded  by a !FORCE
  3981. directive, execution continues whether  the  command  succeeds or not. For
  3982. example:
  3983.  
  3984.         ;       Merge the top two windows
  3985.  
  3986.         save-window             ;remember what window we are at
  3987.         1 next-window           ;go to the top window
  3988.         delete-window           ;merge it with the second window
  3989.         !force restore-window   ;This will continue regardless
  3990.         add-mode "red"
  3991.         Often this  is used together with the $status environment variable
  3992. to test if a command succeeded. For example:
  3993.  
  3994.         set %seekstring "String to Find: "
  3995.         !force search-forward %seekstring
  3996.         !if &seq $status TRUE
  3997.                 print "Your string is Found"
  3998.         !else
  3999.                 print "No such STRING!"
  4000.  
  4001.  
  4002. 59
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009. MicroEMACS Reference Manual                          MicroEMACS Procedures
  4010.  
  4011.  
  4012.         !endif
  4013.  
  4014.  
  4015. 13.4.3  !IF, !ELSE, and !ENDIF Directives
  4016.  
  4017.  
  4018.         This  directive  allows  statements  only  to  be  executed  if  a
  4019. condition specified in the directive is met. Every line following  the !IF
  4020. directive, until the first !ELSE or !ENDIF directive, is only  executed if
  4021. the expression following the !IF directive evaluates to a TRUE  value. For
  4022. example,  the  following  commands creates the  portion  of  a  text  file
  4023. automatically. (yes believe me,  this  will  be  easier to understand then
  4024. that last explanation....)
  4025.  
  4026.         !if &sequal %curplace "timespace vortex"
  4027.                 insert-string "First, rematerialize~n"
  4028.         !endif
  4029.         !if &sequal %planet "earth"     ;If we have landed on earth...
  4030.                 !if &sequal %time "late 20th century"  ;and we are then
  4031.                         write-message "Contact U.N.I.T."
  4032.                 !else
  4033.                         insert-string "Investigate the situation....~n"
  4034.                         insert-string "(SAY 'stay here Sara')~n"
  4035.                 !endif
  4036.         !else
  4037.                 set %conditions @"Atmosphere conditions outside? "
  4038.                 !if &sequal %conditions "safe"
  4039.                         insert-string &cat "Go outside......" "~n"
  4040.                         insert-string "lock the door~n"
  4041.                 !else
  4042.                         insert-string "Dematerialize..try somewhen else"
  4043.                         newline
  4044.                 !endif
  4045.         !endif
  4046.  
  4047.  
  4048. 13.4.4  !GOTO Directive
  4049.  
  4050.  
  4051.         Flow can be controlled within  a  MicroEMACS  procedure  using the
  4052. !GOTO directive. It takes as an  argument  a  label. A label consists of a
  4053. line starting with an asterisk (*) and then an  alphanumeric  label.  Only
  4054. labels in the currently  executing  procedure can be jumped to, and trying
  4055. to jump to a  non-existing  label terminates execution of a procedure. For
  4056. example:
  4057.  
  4058.         ;Create a block of DATA statements for a BASIC program
  4059.  
  4060.                 insert-string "1000 DATA "
  4061.                 set %linenum 1000
  4062.  
  4063.         *nxtin
  4064.                 update-screen           ;make sure we see the changes
  4065.                 set %data @"Next number: "
  4066.  
  4067.  
  4068.                                                                         60
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075. MicroEMACS Procedures                          MicroEMACS Reference Manual
  4076.  
  4077.  
  4078.                 !if &equal %data 0
  4079.                         !goto finish
  4080.                 !endif
  4081.  
  4082.                 !if &greater $curcol 60
  4083.                         2 delete-previous-character
  4084.                         newline
  4085.                         set %linenum &add %linenum 10
  4086.                         insert-string &cat %linenum " DATA "
  4087.                 !endif
  4088.  
  4089.                 insert-string &cat %data ", "
  4090.                 !goto nxtin
  4091.  
  4092.         *finish
  4093.  
  4094.                 2 delete-previous-character
  4095.                 newline
  4096.  
  4097.  
  4098. 13.4.5  !WHILE and !ENDWHILE Directives
  4099.  
  4100.  
  4101.         This  directive  allows  you to set up repetitive tasks easily and
  4102. efficiently. If a group of statements need to be executed while  a certain
  4103. condition is true, enclose them with a while loop. For example,
  4104.  
  4105.         !while &less $curcol 70
  4106.                 insert-string &cat &cat "[" #stuff "]"
  4107.         !endwhile
  4108.  
  4109.         places  items from buffer "item" in the  current  line  until  the
  4110. cursor is at  or past column 70. While loops may be nested and can contain
  4111. and be the targets of !GOTOs with no ill effects. Using  a  while  loop to
  4112. enclose a repeated  task  will  run  much  faster  than  the corresponding
  4113. construct using !IFs.
  4114.  
  4115.  
  4116. 13.4.6  !BREAK Directive
  4117.  
  4118.  
  4119.         This  lets you abort out of the  most  executing  currently  inner
  4120. while  loop,  regardless  of  the  condition.  It  is  often used to abort
  4121. processing for error conditions. For example:
  4122.  
  4123. ;       Read in files and substitute "begining" with "beginning"
  4124.  
  4125.         set %filename #list
  4126.         !while ¬ &seq %filename "<end>"
  4127. !force          find-file %filename
  4128.                 !if &seq $status FALSE
  4129.                         write-message "[File read error]"
  4130.                         !break
  4131.                 !endif
  4132.  
  4133.  
  4134. 61
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141. MicroEMACS Reference Manual                          MicroEMACS Procedures
  4142.  
  4143.  
  4144.                 beginning-of-file
  4145.                 replace-string "begining" "beginning"
  4146.                 save-file
  4147.                 set %filename #list
  4148.         !endwhile
  4149.  
  4150.         This while loop will process files until the list is  exhausted or
  4151. there is an error while reading a file.
  4152.  
  4153.  
  4154. 13.4.7  !RETURN Directive
  4155.  
  4156.  
  4157.         The !RETURN Directive causes the current procedure to exit, either
  4158. returning to the caller (if any) or to interactive mode. For example:
  4159.  
  4160.         ;       Check the monitor type and set %mtyp
  4161.  
  4162.         !if &sres "CGA"
  4163.                 set %mtyp 1
  4164.                 !return
  4165.         !else
  4166.                 set %mtyp 2
  4167.         !endif
  4168.  
  4169.         insert-string "You are on a MONOCHROME machine!~n"
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.                                                                         62
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207. Debugging MicroEMACS Procedures                MicroEMACS Reference Manual
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.                                 Chapter 14
  4217.  
  4218.                      Debugging MicroEMACS Procedures
  4219.  
  4220.  
  4221.         When developing new procedures, it is very convenient  to  be able
  4222. to  trace  their  execution  to  discover errors. The  $debug  environment
  4223. variable enables procedure  debugging.  While this variable is TRUE, emacs
  4224. will stop at each line it intends to execute and allow you to view it, and
  4225. issue a number of  different  commands to help determine how the procedure
  4226. is executing.
  4227.  
  4228.         For example, we will step  through the procedure which toggles the
  4229. function key window off. The first  thing  to  do, is to set $debug, using
  4230. the ^XA  set  command.  Type  ^XA and emacs will prompt you on the command
  4231. line with "Variable to set: ". Type in "$debug" and  press  the enter key.
  4232. Emacs will then ask "Value: ". Type in  "TRUE"  (in  capital  letters) and
  4233. press the enter key.
  4234.  
  4235.         While macro debugging is enabled (as it is now) emacs  will report
  4236. each time a variable is assigned  a  value, by displaying the variable and
  4237. its value on the command line. Right now,
  4238.  
  4239. ((($debug <- TRUE)))
  4240.  
  4241.         appears on the command line to  tell  you that $debug now has been
  4242. assigned the value of TRUE. Press the space bar to continue.
  4243.  
  4244.         Now,  lets  try  to  debug  a  macro.  Press  function key 5 which
  4245. normally toggles the function key window. The first thing that appears is:
  4246.  
  4247. <<<[Macro 01]:!if %rcfkeys>>>
  4248.  
  4249.         At this point, emacs is waiting  for  a command. It is prepared to
  4250. see  if the user variable %rcfkeys is TRUE, and execute some lines if they
  4251. are. Suppose we want to see  the  value  of this variable, type the letter
  4252. "e"  to  evaluate  an expression. Emacs will prompt with "EXP:  ".    Type
  4253. "%rcfkeys"  followed  by  the  enter  key. Emacs should then respond  with
  4254. "TRUE" to indicate that the function key window is currently on screen.
  4255.  
  4256.         Press the space bar to allow the !if directive to execute.   Emacs
  4257. will decide that it is TRUE, and then display the next command to execute.
  4258.  
  4259. <<<[Macro 01]:!goto rcfoff>>>
  4260.  
  4261.         Notice emacs tells us  what  procedure  we are currently executing
  4262. (in this case, the macro bound to execute-macro-1). Press  the  space  bar
  4263. again to execute the !goto directive.
  4264.  
  4265.  
  4266. 63
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273. MicroEMACS Reference Manual                Debugging MicroEMACS Procedures
  4274.  
  4275.  
  4276. <<<[Macro 01]:save-window>>>
  4277.  
  4278.         Emacs is saving the position of the current window so that  it can
  4279. attempt to return to it after it has brought up the function key window.
  4280.  
  4281.         [...THIS CHAPTER IS NOT FINISHED...]
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308.  
  4309.  
  4310.  
  4311.  
  4312.  
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.                                                                         64
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339. Key Bindings, What they are and why            MicroEMACS Reference Manual
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.                                 Chapter 15
  4349.  
  4350.                    Key Bindings, What they are and why
  4351.  
  4352.  
  4353.         One of the features which makes MicroEMACS very  adaptable  is its
  4354. ability to use different keystrokes  to  execute  different  commands. The
  4355. process  of  changing  the particular command  a  key  invokes  is  called
  4356. rebinding. This  allows  us  to  make  the  editor look like other popular
  4357. editors and programs.
  4358.  
  4359.         Each command in MicroEMACS has a name which is  used  for  binding
  4360. purposes. For example, the command to move the  cursor  down  one  page is
  4361. called  next-line and is normally bound to the ^N key. If you decided that
  4362. you  also  wanted  to use the ^D key to move the cursor down one line, you
  4363. would use the M-K  bind-to-key  command. EMACS would respond with ": bind-
  4364. to-key " on the command line and allow you to type in a command name. Then
  4365. type  in  the  name of the command  you want to change, in this case next-
  4366. line, followed by the <NL> key. EMACS will then wait for  you  to  type in
  4367. the keys you want to activate the named function. Type  a  single ^D. From
  4368. now on, typing  ^D will cause EMACS to move down one line, rather than its
  4369. original function of deleting characters.
  4370.  
  4371.         To find out the name of a command, consult the list of valid EMACS
  4372. commands in Appendix B. Also, you can use the ^X? describe-key  command to
  4373. look up the name of a command. Type ^X? and  then  the  key  to  use  that
  4374. command, and EMACS will show you the name of the command.
  4375.  
  4376.         After you have  experimented  with changing your key bindings, you
  4377. may  decide that you want to change some  bindings  permanently.  To  have
  4378. EMACS  rebind keys to your pleasure each time you start EMACS, you can add
  4379. statements to the end of your startup file (emacs.rc or .emacsrc depending
  4380. on the system). For example,
  4381.  
  4382.         bind-to-key next-line ^D
  4383.  
  4384.         Notice,  that  control   D   character  in  the  startup  file  is
  4385. represented visibly as an uparrow key followed by a capital D. To know how
  4386. to  represent  any  keys you want to bind, use the describe-key command on
  4387. the key, and use the sequence that is displayed.
  4388.  
  4389.         bind-to-key split-current-window FN1
  4390.  
  4391.         This example would make function key 1 activate  the  command that
  4392. splits the current window in two.
  4393.  
  4394.         EMACS will let you define a large number of keys, but  will report
  4395. "Binding table FULL!" when it runs out of  space  to  bind  keys. Normally
  4396.  
  4397.  
  4398. 65
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405. MicroEMACS Reference Manual            Key Bindings, What they are and why
  4406.  
  4407.  
  4408. EMACS will allow up to 512 key bindings (including approx.  300 originally
  4409. bound keys).
  4410.  
  4411.         If you want to get a current listing of all  the  commands and the
  4412. keys bound to them, use the describe-bindings command.  Notice,  that this
  4413. command is not bound to any keys!
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.  
  4437.  
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.                                                                         66
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471. MicroEMACS Command Line Switches and Startup FilesroEMACS Reference Manual
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.                                 Appendix A
  4481.  
  4482.             MicroEMACS Command Line Switches and Startup Files
  4483.  
  4484.  
  4485.         When EMACS first executes, it always searches for  a  file, called
  4486. .emacsrc under most UNIX  systems  or emacs.rc on most other systems which
  4487. it will execute as EMACS macros before it reads in the named source files.
  4488. This file normally  contains  EMACS  macroes  to bind the function keys to
  4489. useful functions and load various useful macros. The contents of this file
  4490. will probably vary from system to system and can be  modified  by the user
  4491. as desired.
  4492.  
  4493.         When searching for this file, EMACS looks for it  in  this  order.
  4494. First, it attempts to find a definition for "HOME" in the  environment. It
  4495. will look in that directory first. Then it searches  all  the  directories
  4496. listed in the "PATH" environment variable. Then it looks through a list of
  4497. predefined standard directories which vary from system to system. Finally,
  4498. failing  all of these, it looks in the current directory. This is also the
  4499. same  method EMACS uses to look up any files to execute, and to find  it's
  4500. help file EMACS.HLP.
  4501.  
  4502.         On computers that call  up  EMACS via a command line process, such
  4503. as MSDOS  and  UNIX,  there  are different things that can be added to the
  4504. command line to  control  the  way  EMACS operates. These can be switches,
  4505. which  are  a  dash  ('-')  followed  by  a  letter,  and  possible  other
  4506. parameters, or a startup file specifier, which is an at sign  '@' followed
  4507. by a file name.
  4508.  
  4509. @<file>           This causes the named file to be executed instead of the
  4510.                   standard emacs.rc file before emacs reads  in  any other
  4511.                   files.  More  than  one  of  these can be placed on  the
  4512.                   command line, and they will  be  executed  in  the order
  4513.                   that they appear.
  4514.  
  4515. -C                The following source files  on  the  command line can be
  4516.                   changed  (as opposed to being in  VIEW  mode).  This  is
  4517.                   mainly used to cancel the  effects of the -v switch used
  4518.                   previously in the same command line.
  4519.  
  4520. -E                This flag causes emacs to automatically run  the startup
  4521.                   file "error.cmd" instead of emacs.rc.  This  is  used by
  4522.                   various  C compilers for error processing (for  example,
  4523.                   Mark Williams C).
  4524.  
  4525. -G<num>           Upon entering EMACS, position the  cursor  at  the <num>
  4526.                   line of the first file.
  4527.  
  4528.  
  4529.  
  4530. 67
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537. MicroEMACS Reference ManualroEMACS Command Line Switches and Startup Files
  4538.  
  4539.  
  4540. -I<var> <value>   Initialize an EMACS variable with <value>.  This  can be
  4541.                   useful to force EMACS to  start  in  a  particular mode.
  4542.                   (For example,  invoke  EMACS  with  "emacs  -i$sres  VGA
  4543.                   foo.bar" to edit file foo.bar in VGA 50 line mode  on an
  4544.                   IBM-PC).
  4545.  
  4546. -K<key>           This key tells emacs to  place the source files in CRYPT
  4547.                   mode and read it in using <key> as  the  encryption key.
  4548.                   If no key is listed  immediately  after  the  -K switch,
  4549.                   EMACS  will  prompt  for a key, and not echo it as it is
  4550.                   typed.
  4551.  
  4552. -R                This  places  EMACS   in  "restricted  mode"  where  any
  4553.                   commands allowing the user  to  read  or write any files
  4554.                   other  than  the  ones listed on the  command  line  are
  4555.                   disabled. Also all commands allowing the user  access to
  4556.                   the operating system are disabled. This makes EMACS very
  4557.                   useful as a  "safe"  environment  for  use  within other
  4558.                   applications and especially used as a remote  editor for
  4559.                   a BBS or electronic bulletin board system.
  4560.  
  4561. -S<string>        After EMACS is started,  it  automatically  searches for
  4562.                   <string> in the first source file.
  4563.  
  4564. -V                This tells EMACS that all the following sources files on
  4565.                   the command line should be in VIEW mode  to  prevent any
  4566.                   changes being made to them.
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.                                                                         68
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603. Command Completion                             MicroEMACS Reference Manual
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.                                 Appendix B
  4613.  
  4614.                             Command Completion
  4615.  
  4616.  
  4617.         Some versions of  MicroEMACS  will allow you to abbrieviate buffer
  4618. names, command names and file names as you enter them.  To  use this, type
  4619. in the first  few characters of the name you wish, and then hit either the
  4620. space bar, the META key or  the  TAB  key. MicroEMACS will then attempt to
  4621. look at the list of all the availible names and if there is only one which
  4622. will fit, it will choose  that  name.  If  there  are  several  names that
  4623. quailify, as many characters as are common to ALL of them will be entered.
  4624. If  there  are  no  possible  matches,  the  bell  will  ring to  indicate
  4625. MicroEMACS can not complete the command.
  4626.  
  4627.         For example, if you have several files in  your  current directory
  4628. with the following names:
  4629.  
  4630.         prog1.c
  4631.         prog1.obj
  4632.         prog1.exe
  4633.         prog1.doc
  4634.         program.one
  4635.         project.one
  4636.         test.c
  4637.         tes
  4638.  
  4639.         and you enter the ^X^F find-file command, if you type 'p' and then
  4640. hit the space  bar, EMACS will respond by typing the 'r' that is common to
  4641. all the above file names begining with 'p'. If you then type 'ogr' and hit
  4642. the tab key, EMACS will respond with 'am.one' and  automatically  hit  the
  4643. enter key for you.
  4644.  
  4645.         If you were to instead type  an  'a'  and hit the space bar, EMACS
  4646. will beep, informing you that there is no possible match.
  4647.  
  4648.         If you type a 'te' and hit the space bar, EMACS will then type the
  4649. following  's',  but it will not automatically  enter  it  because  it  is
  4650. possible you mean to get to the test.c file.
  4651.  
  4652.         Buffer  name,  and  command name completion is  available  in  all
  4653. versions of MicroEMACS. File name  completion is available on UNIX BSD4.3,
  4654. the Atari ST, the AMIGA and under MSDOS.
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662. 69
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669. MicroEMACS Reference Manual                            MicroEMACS Commands
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.                                 Appendix C
  4679.  
  4680.                            MicroEMACS Commands
  4681.  
  4682.  
  4683.         Below  is  a complete list of the  commands  in  EMACS,  the  keys
  4684. normally used to do the command,  and  what the command does. Remember, on
  4685. some  computers  there may also be additional  ways  of  using  a  command
  4686. (cursor keys and special function keys for example).
  4687.  
  4688. Command                         Binding         Meaning
  4689. abort-command            ^G     This allows the user to abort out of any
  4690.                                 command that is waiting for input
  4691.  
  4692. add-mode                 ^XM    Add a mode to the current buffer
  4693.  
  4694. add-global-mode          M-M    Add a global mode for all new buffers
  4695.  
  4696. append-file              ^X^A   Write a buffer to the end of a file
  4697.  
  4698. apropos                  M-A    List out commands whose name contains
  4699.                                 the string specified
  4700.  
  4701. backward-character       ^B     Move one character to the left
  4702.  
  4703. begin-macro              ^X(    Begin recording a keyboard macro
  4704.  
  4705. beginning-of-file        M-<    Move to the beginning of the file in
  4706.                                 the current buffer
  4707.  
  4708. beginning-of-line        ^A     Move to the beginning of the current line
  4709.  
  4710. bind-to-key              M-K    Bind a key to a function
  4711.  
  4712. buffer-position          ^X=    List the position of the cursor in the
  4713.                                 current window on the command line
  4714.  
  4715. case-region-lower        ^X^L   Make a marked region all lower case
  4716.  
  4717. case-region-upper        ^X^U   Make a marked region all upper case
  4718.  
  4719. case-word-capitalize     M-C    Capitalize the following word
  4720.  
  4721. case-word-lower          M-L    Lower case the following word
  4722.  
  4723. case-word-upper          M-U    Upper case the following word
  4724.  
  4725. change-file-name         ^XN    Change the name of the file in the
  4726.  
  4727.  
  4728.                                                                         70
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735. MicroEMACS Commands                            MicroEMACS Reference Manual
  4736.  
  4737.  
  4738.                                 current buffer
  4739.  
  4740. change-screen-size      (none)  Change the number of lines of the screen
  4741.                                 currently being used
  4742.  
  4743. change-screen-width     (none)  Change the number of columns of the
  4744.                                 screen currently being used
  4745.  
  4746. clear-and-redraw         ^L     Clear the physical screen and redraw it
  4747.  
  4748. clear-message-line      (none)  Clear the command line
  4749.  
  4750. copy-region              M-W    Copy the currently marked region into
  4751.                                 the kill buffer
  4752.  
  4753. count-words              M-^C   Count how many words, lines and
  4754.                                 characters are in the current marked region
  4755.  
  4756. ctlx-prefix              ^X     Change the key used as the ^X prefix
  4757.  
  4758. cycle-screens            A-C    Bring the rearmost screen to front
  4759.  
  4760. delete-blank-lines       ^X^O   Delete all blank lines around the cursor
  4761.  
  4762. delete-buffer            ^XK    Delete a buffer which is not being
  4763.                                 currently displayed in a window
  4764.  
  4765. delete-mode              ^X^M   Turn off a mode in the current buffer
  4766.  
  4767. delete-global-mode       M-^M   Turn off a global mode
  4768.  
  4769. delete-next-character    ^D     Delete the character following the cursor
  4770.  
  4771. delete-next-word         M-D    Delete the word following the cursor
  4772.  
  4773. delete-other-windows     ^X1    Make the current window cover the entire
  4774.                                 screen
  4775.  
  4776. delete-previous-character^H     Delete the character to the left of the
  4777.                                 cursor
  4778.  
  4779. delete-previous-word     M-^H   Delete the word to the left of the cursor
  4780.  
  4781. delete-screen            A-D    Delete a screen
  4782.  
  4783. delete-window            ^X0    Remove the current window from the screen
  4784.  
  4785. describe-bindings       (none)  Make a list of all legal commands
  4786.  
  4787. describe-functions      (none)  Make a list of all legal functions
  4788.  
  4789. describe-variables      (none)  Make a list of all environment
  4790.                                 and user variables
  4791.  
  4792.  
  4793.  
  4794. 71
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801. MicroEMACS Reference Manual                            MicroEMACS Commands
  4802.  
  4803.  
  4804. describe-key             ^X?    Describe what command is bound to a
  4805.                                 keystroke sequence
  4806.  
  4807. detab-region             ^X^D   Change all tabs in a region to the
  4808.                                 equivalent spaces
  4809.  
  4810. display                 ^XG     Prompts the user for a variable and
  4811.                                 displays its current value
  4812.  
  4813. dump-variables           none   Places into a buffer the current values
  4814.                                 of all environment and user variables
  4815.  
  4816. end-macro                ^X)    stop recording a keyboard macro
  4817.  
  4818. end-of-file              M->    Move cursor to the end of the current buffer
  4819.  
  4820. end-of-line              ^E     Move to the end of the current line
  4821.  
  4822. end-of-word             (none)  Move the point just past the end of
  4823.                                 the current word
  4824.  
  4825. entab-region             ^X^E   Change multiple spaces to tabs where
  4826.                                 possible
  4827.  
  4828. exchange-point-and-mark  ^X^X   Move cursor to the last marked spot,
  4829.                                 make the original position be marked
  4830.  
  4831. execute-buffer          (none)  Execute a buffer as a macro
  4832.  
  4833. execute-command-line    (none)  Execute a line typed on the command
  4834.                                 line as a macro command
  4835.  
  4836. execute-file            (none)  Execute a file as a macro
  4837.  
  4838. execute-macro            ^XE    Execute the keyboard macro (play back
  4839.                                 the recorded keystrokes)
  4840. execute-macro-<n>       (none)  Execute numbered macro <N> where <N> is
  4841.                                 an integer from 1 to 40
  4842.  
  4843. execute-named-command    M-X    Execute a command by name
  4844.  
  4845. execute-procedure        M-^E   Execute a procedure by name
  4846.  
  4847. execute-program         ^X$     Execute a program directly (not through
  4848.                                 an intervening shell)
  4849.  
  4850. exit-emacs               ^X^C   Exit EMACS. If there are unwritten,
  4851.                                 changed buffers EMACS will ask to confirm
  4852.  
  4853. fill-paragraph           M-Q    Fill the current paragraph
  4854.  
  4855. filter-buffer            ^X#    Filter the current buffer through an
  4856.                                 external filter
  4857.  
  4858.  
  4859.  
  4860.                                                                         72
  4861.  
  4862.  
  4863.  
  4864.  
  4865.  
  4866.  
  4867. MicroEMACS Commands                            MicroEMACS Reference Manual
  4868.  
  4869.  
  4870. find-file                ^X^F   Find a file to edit in the current window
  4871.  
  4872. find-screen              A-F    Bring the named screen to front,
  4873.                                 creating it if needed
  4874.  
  4875. forward-character        ^F     Move cursor one character to the right
  4876.  
  4877. goto-line                M-G    Goto a numbered line
  4878.  
  4879. goto-mark                M-^G   Goto a numbered mark
  4880.  
  4881. goto-matching-fence      M-^F   Goto the matching fence
  4882.  
  4883. grow-window              ^X^    Make the current window larger
  4884.  
  4885. handle-tab               ^I     Insert a tab or set tab stops
  4886.  
  4887. hunt-forward             A-S    Hunt for the next match of the last
  4888.                                 search string
  4889.  
  4890. hunt-backward            A-R    Hunt for the last match of the last
  4891.                                 search string
  4892.  
  4893. help                     M-?    Read EMACS.HLP into a buffer and display it
  4894.  
  4895. i-shell                  ^XC    Shell up to a new command processor
  4896.  
  4897. incremental-search       ^XS    Search for a string, incrementally
  4898.  
  4899. indent-region            M-(    Indent the current region one tab
  4900.  
  4901. insert-file              ^X^I   insert a file at the cursor in the
  4902.                                 current file
  4903.  
  4904. insert-space             ^C     Insert a space to the right of the cursor
  4905.  
  4906. insert-string           (none)  Insert a string at the cursor
  4907.  
  4908. kill-paragraph           M-^W   Delete the current paragraph
  4909.  
  4910. kill-region              ^W     Delete the current marked region, moving
  4911.                                 it to the kill buffer
  4912.  
  4913. kill-to-end-of-line      ^K     Delete the rest of the current line
  4914.  
  4915. label-function-key      (none)  Set the text on a function key label
  4916.                                 (HP150 only)
  4917.  
  4918. list-buffers             ^X^B   List all existing buffers
  4919.  
  4920. list-screens             A-B    List all existing screens
  4921.  
  4922. macro-to-key             M-^K   Bind a key to a macro
  4923.  
  4924.  
  4925.  
  4926. 73
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933. MicroEMACS Reference Manual                            MicroEMACS Commands
  4934.  
  4935.  
  4936. meta-prefix              <ESC>  Key used to precede all META commands
  4937.  
  4938. mouse-move-down          MSa
  4939.  
  4940. mouse-move-up            MSb
  4941.  
  4942. mouse-resize-screen      MS1
  4943.  
  4944. mouse-region-down        MSe
  4945.  
  4946. mouse-region-up          MSf
  4947.  
  4948. move-window-down         ^X^N   Move all the lines in the current window down
  4949.  
  4950. move-window-up           ^X^P   Move all the lines in the current window up
  4951.  
  4952. name-buffer              M-^N   Change the name of the current buffer
  4953.  
  4954. narrow-to-region         ^X<    hides all text not in the current region
  4955.  
  4956. newline                  ^M     Insert a <NL> at the cursor
  4957.  
  4958. newline-and-indent       ^J     Insert a <NL> at the cursor and indent
  4959.                                 the new line the same as the preceding line
  4960.  
  4961. next-buffer              ^XX    Bring the next buffer in the list into
  4962.                                 the current window
  4963.  
  4964. next-line                ^N     Move the cursor down one line
  4965.  
  4966. next-page                ^V     Move the cursor down one page
  4967.  
  4968. next-paragraph           M-N    Move cursor to the next paragraph
  4969.  
  4970. next-window              ^XO    Move cursor to the next window
  4971.  
  4972. next-word                M-F    Move cursor to the beginning of the
  4973.                                 next word
  4974.  
  4975. nop                     (none)  Does nothing
  4976.  
  4977. open-line                ^O     Open a line at the cursor
  4978.  
  4979. overwrite-string        (none)  Overwrite a string at the cursor
  4980.  
  4981. pipe-command             ^X@    Execute an external command and place
  4982.                                 its output in a buffer
  4983.  
  4984. pop-buffer              (none)  Display a buffer temporarily, paging
  4985.  
  4986. previous-line            ^P     Move cursor up one line
  4987.  
  4988. previous-page            ^Z     Move cursor up one page
  4989.  
  4990.  
  4991.  
  4992.                                                                         74
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999. MicroEMACS Commands                            MicroEMACS Reference Manual
  5000.  
  5001.  
  5002. previous-paragraph       M-P    Move back one paragraph
  5003.  
  5004. previous-window          ^XP    Move the cursor to the last window
  5005.  
  5006. previous-word            M-B    Move the cursor to the beginning of the
  5007.                                 word to the left of the cursor
  5008.  
  5009. print                   (none)  Display a string on the command line
  5010.                                 (a synonim to write-message)
  5011.  
  5012. query-replace-string     M-^R   Replace all of one string with another
  5013.                                 string, interactively querying the user
  5014.  
  5015. quick-exit               M-Z    Exit EMACS, writing out all changed buffers
  5016.  
  5017. quote-character          ^Q     Insert the next character literally
  5018.  
  5019. read-file                ^X^R   Read a file into the current buffer
  5020.  
  5021. redraw-display           M-^L   Redraw the display, centering the
  5022.                                 current line
  5023.  
  5024. remove-mark             (none)  Remove a numbered mark
  5025.  
  5026. resize-window            ^XW    Change the number of lines in the
  5027.                                 current window
  5028.  
  5029. restore-window          (none)  Move cursor to the last saved window
  5030.  
  5031. replace-string           M-R    Replace all occurrences of one string
  5032.                                 with another string from the cursor
  5033.                                 to the end of the buffer
  5034.  
  5035. reverse-incremental-search^XR   Search backwards, incrementally
  5036.  
  5037. run                      M-^E   Execute a named procedure
  5038.  
  5039. save-file                ^X^S   Save the current buffer if it is changed
  5040.  
  5041. save-window             (none)  Remember current window (to restore later)
  5042.  
  5043. scroll-next-up           M-^Z   Scroll the next window up
  5044.  
  5045. scroll-next-down         M-^V   Scroll the next window down
  5046.  
  5047. search-forward           ^S     Search for a string
  5048.  
  5049. search-reverse           ^R     Search backwards for a string
  5050.  
  5051. select-buffer            ^XB    Select a buffer to display in the
  5052.                                 current window
  5053.  
  5054. set                      ^XA    Set a variable to a value
  5055.  
  5056.  
  5057.  
  5058. 75
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065. MicroEMACS Reference Manual                            MicroEMACS Commands
  5066.  
  5067.  
  5068. set-encryption-key       M-E    Set the encryption key of the current buffer
  5069.  
  5070. set-fill-column          ^XF    Set the current fill column
  5071.  
  5072. set-mark                        Set the mark
  5073.  
  5074. shell-command            ^X!    Causes an external shell to execute
  5075.                                 a command
  5076.  
  5077. show-files              (none)  Pop up a list of files from the
  5078.                                 specified directory
  5079.  
  5080. shrink-window            ^X^Z   Make the current window smaller
  5081.  
  5082. source                  (none)  Execute a file as a macro
  5083.  
  5084. split-current-window     ^X2    Split the current window in two
  5085.  
  5086. store-macro             (none)  Store the following macro lines to a
  5087.                                 numbered macro
  5088.  
  5089. store-procedure         (none)  Store the following macro lines to a
  5090.                                 named procedure
  5091.  
  5092. transpose-characters     ^T     Transpose the character at the cursor
  5093.                                 with the character to the left
  5094.  
  5095. trim-region              ^X^T   Trim any trailing white space from a region
  5096.  
  5097. unbind-key               M-^K   Unbind a key from a function
  5098.  
  5099. undent-region            M-)    Remove a leading indent from a region
  5100.  
  5101. universal-argument       ^U     Execute the following command 4 times
  5102.  
  5103. unmark-buffer            M-~    Unmark the current buffer (so it is
  5104.                                 no longer changed)
  5105.  
  5106. update-screen           (none)  Force a screen update during macro execution
  5107.  
  5108. view-file                ^X^V   Find a file,and put it in view mode
  5109.  
  5110. widen-from-region        ^X>    restores hidden text (see narrow-to-region)
  5111.  
  5112. wrap-word               (none)  Wrap the current word, this is an
  5113.                                 internal function
  5114.  
  5115. write-file               ^X^W   Write the current buffer under a new
  5116.                                 file name
  5117.  
  5118. write-message           (none)  Display a string on the command line
  5119.  
  5120. yank                     ^Y     yank the kill buffer into the current
  5121.                                 buffer at the cursor
  5122.  
  5123.  
  5124.                                                                         76
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131. MicroEMACS Bindings                            MicroEMACS Reference Manual
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.                                 Appendix D
  5141.  
  5142.                            MicroEMACS Bindings
  5143.  
  5144.  
  5145.         Below is a complete  list  of the key bindings used in MicroEMACS.
  5146. This can be used as a wall chart reference for MicroEMACS commands.
  5147.  
  5148.                   Default Key Bindings for MicroEmacs 3.11
  5149.  
  5150.  ^A   Move to start of line           ESC A   Apropos (list some commands)
  5151.  ^B   Move backward by characters     ESC B   Backup by words
  5152.  ^C   Insert space                    ESC C   Initial capitalize word
  5153.  ^D   Forward delete                  ESC D   Delete forward word
  5154.  ^E   Goto end of line                ESC E   Reset Encryption Key
  5155.  ^F   Move forward by characters      ESC F   Advance by words
  5156.  ^G   Abort out of things             ESC G   Go to a line
  5157.  ^H   Backward delete
  5158.  ^I   Insert tab/Set tab stops
  5159.  ^J   Insert <NL>, then indent
  5160.  ^K   Kill forward                    ESC K   Bind Key to function
  5161.  ^L   Refresh the screen              ESC L   Lower case word
  5162.  ^M   Insert <NL>                     ESC M   Add global mode
  5163.  ^N   Move forward by lines           ESC N   Goto End paragraph
  5164.  ^O   Open up a blank line
  5165.  ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  5166.  ^Q   Insert literal                  ESC Q   Fill current paragraph
  5167.  ^R   Search backwards                ESC R   Search and replace
  5168.  ^S   Search forward                  ESC S   Suspend (BSD only)
  5169.  ^T   Transpose characters
  5170.  ^U   Repeat command four times       ESC U   Upper case word
  5171.  ^V   Move forward by pages           ESC V   Move backward by pages
  5172.  ^W   Kill region                     ESC W   Copy region to kill buffer
  5173.  ^Y   Yank back from killbuffer       ESC X   Execute named command
  5174.  ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  5175.  
  5176.  ESC ^C   Count words in region       ESC ~   Unmark current buffer
  5177.  ESC ^E   Execute named procedure
  5178.  ESC ^F   Goto matching fence         ESC !   Reposition window
  5179.  ESC ^H   Delete backward word        ESC <   Move to start of buffer
  5180.  ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  5181.  ESC ^L   Reposition window           ESC .  Set mark
  5182.  ESC ^M   Delete global mode          ESC space    Set mark
  5183.  ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  5184.  ESC ^R   Search & replace w/query        rubout   Backward delete
  5185.  ESC ^S   Source command file
  5186.  ESC ^V   Scroll next window down
  5187.  ESC ^W   Delete Paragraph
  5188.  
  5189.  
  5190. 77
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197. MicroEMACS Reference Manual                            MicroEMACS Bindings
  5198.  
  5199.  
  5200.  ESC ^X   Execute command line
  5201.  ESC ^Z   Scroll next window up
  5202.  
  5203.  ^X <   Narrow-to-region           ^X ?   Describe a key
  5204.  ^X >   Widen-from-region          ^X !   Run 1 command in a shell
  5205.  ^X =   Show the cursor position   ^X @    Pipe shell command to buffer
  5206.  ^X ^   Enlarge display window     ^X #   Filter buffer thru shell filter
  5207.  ^X 0   Delete current window      ^X $   Execute an external program
  5208.  ^X 1   Delete other windows       ^X (   Begin macro
  5209.  ^X 2   Split current window       ^X )   End macro
  5210.                                    ^X A   Set variable value
  5211.  ^X ^B   Display buffer list       ^X B   Switch a window to a buffer
  5212.  ^X ^C   Exit MicroEMACS           ^X C   Start a new command processor
  5213.  ^X ^D   Detab line                ^X D   Suspend MicroEMACS (BSD4.2 only)
  5214.  ^X ^E   Entab line                ^X E   Execute macro
  5215.  ^X ^F   Find file                 ^X F   Set fill column
  5216.  ^X ^I   Insert file
  5217.                                    ^X K   Delete buffer
  5218.  ^X ^L   Lower case region
  5219.  ^X ^M   Delete Mode               ^X M   Add a mode
  5220.  ^X ^N   Move window down          ^X N   Rename current filename
  5221.  ^X ^O   Delete blank lines        ^X O   Move to the next window
  5222.  ^X ^P   Move window up            ^X P   Move to the previous window
  5223.  ^X ^R   Get a file from disk      ^X R   Incremental reverse search
  5224.  ^X ^S   Save current file         ^X S   Incremental forward search
  5225.  ^X ^T   Trim line                 (Incremental search
  5226.  ^X ^U   Upper case region                not always available)
  5227.  ^X ^V   View file
  5228.  ^X ^W   Write a file to disk      ^X W   resize Window
  5229.  ^X ^X   Swap "." and mark         ^X X   Use next buffer
  5230.  ^X ^Z   Shrink window             ^X Z   Enlarge display window
  5231.  
  5232. Usable Modes
  5233. WRAP     Lines going past right margin "wrap" to a new line
  5234. VIEW     Read-Only mode where no modifications are allowed
  5235. CMODE    Change behavior of some commands to work better with C
  5236. EXACT    Exact case matching on search strings
  5237. OVER     Overwrite typed characters instead of inserting them
  5238. CRYPT    Current buffer will be encrypted on write, decrypted on read
  5239. MAGIC    Use regular expression matching in searches
  5240. ASAVE    Save the file every 256 inserted characters
  5241.  
  5242. WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK  Sets foreground color
  5243. white/cyan/magenta/yellow/blue/red/green/black  Sets background color
  5244.  
  5245.  
  5246.  
  5247.  
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.                                                                         78
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263. Numeric Arguments                              MicroEMACS Reference Manual
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.                                 Appendix E
  5273.  
  5274.                             Numeric Arguments
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.  
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.  
  5322. 79
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329. MicroEMACS Reference Manual                  Numeric Arguments to Commands
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.                                 Appendix F
  5339.  
  5340.                       Numeric Arguments to Commands
  5341.  
  5342.  
  5343.         In general, preceding a MicroEMACS command with a numeric argument
  5344. n  causes the command to be executed n times.  However, there are a  great
  5345. many commands for which this has  no  effect, simply because it would make
  5346. no sense for the command to be executed more than once.    There  are also
  5347. commands  that  take  advantage  of  the numeric arguments to alter  their
  5348. behavior subtly or unsubtly.  The  following  is a list of these commands.
  5349. Commands  that are not affected at all by  numeric  arguments  are  listed
  5350. afterwards.
  5351.  
  5352. backward-character
  5353.                   A negative argument invokes forward-character.
  5354.  
  5355. change-screen-size
  5356.                   With no arguments, the  number  of  rows defaults to the
  5357.                   largest.  Otherwise, set the screen size to n.
  5358.  
  5359. change-screen-width
  5360.                   With no arguments, the number of columns defaults to the
  5361.                   largest.  Otherwise, set the screen width to n.
  5362.  
  5363. clear-and-redraw  With an argument, centers the window around  the current
  5364.                   cursor position.
  5365.  
  5366. delete-next-character
  5367.                   A negative argument invokes delete-previous-character.
  5368.  
  5369. delete-next-word  With an argument of  0,  will  not delete the whitespace
  5370.                   trailing  the  deleted word. A  negative  argument  will
  5371.                   cause nothing to happen.
  5372.  
  5373. delete-previous-character
  5374.                   A negative argument invokes delete-next-character.
  5375.  
  5376. delete-previous-word
  5377.                   An negative  or  zero  argument  will  cause  nothing to
  5378.                   happen.
  5379.  
  5380. detab-region      Without  an argument, detab-region changes hard tabs  to
  5381.                   spaces in the lines between  the  mark  and  the cursor.
  5382.                   With an argument n, the commands detab n lines - forward
  5383.                   if n is positive, backwards if not.
  5384.  
  5385. end-of-word       A negative argument invokes next-word.
  5386.  
  5387.  
  5388.                                                                         80
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395. Numeric Arguments to Commands                  MicroEMACS Reference Manual
  5396.  
  5397.  
  5398. entab-region      Without an argument, entab-region changes spaces to hard
  5399.                   tabs in the lines between the mark and the cursor.  With
  5400.                   an argument n, the commands entab n lines - forward if n
  5401.                   is positive, backwards if not.
  5402.  
  5403. exchange-point-and-mark
  5404.                   Swap the current  cursor  position  and  mark  number n.
  5405.                   Without an argument, n defaults to 0.
  5406.  
  5407. exit-emacs        Providing a numeric  argument  n  causes  two  things to
  5408.                   happen.  First, no checking  for  modified  buffers will
  5409.                   occur.  Second, MicroEMACS exits with a status of n.
  5410.  
  5411. forward-character
  5412.                   A negative argument invokes backward-character.
  5413.  
  5414. goto-line         An argument n will be taken as the line number to go to.
  5415.                   Without  an  argument,  you  will  be asked for  a  line
  5416.                   number.  In either case, the line number must  be  1  or
  5417.                   greater.
  5418.  
  5419. goto-mark         Go to mark number n.  Without an argument, n defaults to
  5420.                   0.
  5421.  
  5422. grow-window       A negative argument  invokes shrink-window.  An argument
  5423.                   of 0 causes no action.
  5424.  
  5425. handle-tab        Without an  argument,  handle-tab  deals  with  the  tab
  5426.                   character, whether  it should be a single "hard" tab, or
  5427.                   expanded as spaces.  With an argument n, $softtab is set
  5428.                   to n.
  5429.  
  5430. hunt-backward     The command will hunt n  times.  The command will report
  5431.                   failure if it cannot find its pattern the nth time, even
  5432.                   if has  found an occurrence of the pattern before number
  5433.                   n.  A negative argument invokes hunt-forward.
  5434.  
  5435. hunt-forward      The command will hunt n  times.  The command will report
  5436.                   failure if it cannot find its pattern the nth time, even
  5437.                   if has  found an occurrence of the pattern before number
  5438.                   n.  A negative argument invokes hunt-backward.
  5439.  
  5440. kill-to-end-of-line
  5441.                   With no argument n, the command  deletes  all characters
  5442.                   to the end  of the line.  If it is already at the end of
  5443.                   the line, it will delete the newline.  With a positive n
  5444.                   as an  argument,  the  command  will  delete  n complete
  5445.                   lines,  newline  character and all,  starting  from  the
  5446.                   cursor.  With n equal to zero, the  command  deletes all
  5447.                   text from the cursor to the beginning of  the  line, but
  5448.                   will not  delete past the newline character.  A negative
  5449.                   n is illegal.
  5450.  
  5451.  
  5452.  
  5453.  
  5454. 81
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461. MicroEMACS Reference Manual                  Numeric Arguments to Commands
  5462.  
  5463.  
  5464. list-buffers      With  a  numeric argument, INVISIBLE  buffers  are  also
  5465.                   listed.
  5466.  
  5467. move-window-down  With a negative argument, invokes move-window-up.
  5468.  
  5469. move-window-up    With a negative argument, invokes move-window-down.
  5470.  
  5471. next-buffer       With an argument n, the nth buffer after the current one
  5472.                   is selected, and read in if necessary.   Any  buffers in
  5473.                   between the current buffer and  the  target  buffer that
  5474.                   have not yet been read in are read.
  5475.  
  5476. next-line         A negative argument invokes previous-line.
  5477.  
  5478. next-page         Without an argument, the window is scrolled forward by a
  5479.                   full page. With an  argument  n,  the window is scrolled
  5480.                   forwards   by  n  lines.    Negative  arguments   invoke
  5481.                   previous-page.
  5482.  
  5483. next-paragraph    A negative argument invokes previous-paragraph.
  5484.  
  5485. next-window       With a positive argument n,  the nth window from the top
  5486.                   becomes the working window.  With  a  negative argument,
  5487.                   the nth  window  from  the  bottom  becomes  the working
  5488.                   window.
  5489.  
  5490. next-word         A negative argument invokes next-word.
  5491.  
  5492. previous-line     A negative argument invokes next-line.
  5493.  
  5494. previous-page     Without an argument, the window is scrolled  backward by
  5495.                   a full page. With an  argument n, the window is scrolled
  5496.                   backwards by n lines.  Negative  arguments  invoke next-
  5497.                   page.
  5498.  
  5499. previous-paragraph
  5500.                   A negative argument invokes next-paragraph.
  5501.  
  5502. previous-window   With  a positive argument n, the  nth  window  from  the
  5503.                   bottom becomes the  working  window.    With  a negative
  5504.                   argument,  the  nth  window  from  the  top  becomes the
  5505.                   working window.
  5506.  
  5507. previous-word     A negative argument invokes next-word.
  5508.  
  5509. query-replace-string
  5510.                   With a numeric argument,  n  occurrences  of  the search
  5511.                   string  may  be  replaced,  depending  upon  the  user's
  5512.                   response.     The  count  is  based  on  the  number  of
  5513.                   occurrences found, not  the number of positive responses
  5514.                   from the user.
  5515.  
  5516. quick-exit        Saves all modifed buffers, and exits with a status of n.
  5517.  
  5518.  
  5519.  
  5520.                                                                         82
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527. Numeric Arguments to Commands                  MicroEMACS Reference Manual
  5528.  
  5529.  
  5530. redraw-display    With no argument, or when n is 0, the window is adjusted
  5531.                   so  that  the  cursor is in  the  center.    When  n  is
  5532.                   positive, the window  is  adjusted so that the cursor is
  5533.                   on the nth line of the screen.  When n is  negative, the
  5534.                   window is adjusted so  that  the  cursor  is on the last
  5535.                   line of the window, regardless of the magnitude of n.
  5536.  
  5537. remove-mark       Remove mark number  n.   Without an argument, n defaults
  5538.                   to 0.
  5539.  
  5540. replace-string    Will replace n occurrences of the search string with the
  5541.                   replacement string.  Otherwise,  with  no  argument, all
  5542.                   occurrences from  the cursor position to the end of file
  5543.                   are replaced.
  5544.  
  5545. resize-window     Requires an argument which must be positive.
  5546.  
  5547. scroll-next-down  Behavior is same as with next-page.
  5548.  
  5549. scroll-next-up    Behavior is same as with previous-page.
  5550.  
  5551. search-forward    The  command  will  search n times.   The  command  will
  5552.                   report failure if it cannot  find  its  pattern  the nth
  5553.                   time, even if has found  an  occurrence  of  the pattern
  5554.                   before number n.  A  negative  argument  invokes search-
  5555.                   reverse.
  5556.  
  5557. search-reverse    The  command  will  search n times.   The  command  will
  5558.                   report failure if it cannot  find  its  pattern  the nth
  5559.                   time, even if has found  an  occurrence  of  the pattern
  5560.                   before number n.  A  negative  argument  invokes search-
  5561.                   forward.
  5562.  
  5563. select-buffer     Without an argument, the buffer is  simply  displayed in
  5564.                   the  window.    With an argument, the buffer is not only
  5565.                   displayed, but also given the attribute INVISIBLE.
  5566.  
  5567. set               If using the set  command  interactively,  preceding the
  5568.                   command with a numeric argument then makes it unecessary
  5569.                   for the command to ask for the variable's value (it will
  5570.                   still ask for  the  variable's  name).    If  used  in a
  5571.                   command line, then the command
  5572.  
  5573.                           set <variable name> <number>
  5574.  
  5575. is identical to
  5576.  
  5577.                           <number> set <variable name>
  5578.  
  5579. set-fill-column   With  an argument, the fill column is set  to  n.    The
  5580.                   default argument is 1.
  5581.  
  5582. set-mark          Set mark number n.  Without an argument,  n  defaults to
  5583.                   0.
  5584.  
  5585.  
  5586. 83
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593. MicroEMACS Reference Manual                  Numeric Arguments to Commands
  5594.  
  5595.  
  5596. shrink-window     A negative argument  invokes shrink-window.  An argument
  5597.                   of 0 causes no action.
  5598.  
  5599. split-current-window
  5600.                   With n = 1,  the  new  upper  window becomes the current
  5601.                   window.   Any other numeric argument makes the new lower
  5602.                   window  the  current  window.    With  no  argument, the
  5603.                   current window becomes the  new  upper  or  lower window
  5604.                   depending upon whether the  cursor  was  in the upper or
  5605.                   lower half of the old window.
  5606.  
  5607. store-macro       Since macroes are numbered, a numeric  argument  must be
  5608.                   provided. These numbered macroes are being phased out in
  5609.                   preference for named macros.
  5610.  
  5611. store-procedure   If the command  is  provided a numeric argument, it will
  5612.                   assume that store-macro is actually being called.
  5613.  
  5614. trim-region       Without an argument, trim-region removes spaces and tabs
  5615.                   from  the  end  of  the  lines between the mark and  the
  5616.                   cursor. With an argument n,  the commands trim n lines -
  5617.                   forward if n is positive, backwards if not.
  5618.  
  5619.  
  5620. F.1  Commands unaffected by numeric arguments.
  5621.  
  5622.  
  5623. abort-command            describe-functions       narrow-to-region
  5624. add-global-mode          describe-key             nop
  5625. add-mode                 describe-variables       pipe-command
  5626. append-file              display                  pop-buffer
  5627. apropos                  end-macro                print
  5628. back-from-tag-word       end-of-file              re-tag-word
  5629. begin-macro              end-of-line              read-file
  5630. beginning-of-file        execute-command-line     restore-window
  5631. beginning-of-line        execute-program          reverse-incremental-
  5632. bind-to-key              fill-paragraph           search
  5633. buffer-position          filter-buffer            save-file
  5634. case-region-lower        find-file                save-window
  5635. case-region-upper        find-screen              set-encryption-key
  5636. change-file-name         goto-matching-fence      shell-command
  5637. clear-message-line       help                     suspend-emacs
  5638. copy-region              i-shell                  tag-word
  5639. count-words              incremental-search       transpose-characters
  5640. cycle-screens            insert-file              unbind-key
  5641. delete-blank-lines       kill-region              unmark-buffer
  5642. delete-buffer            macro-to-key             update-screen
  5643. delete-global-mode       mouse-move-down          view-file
  5644. delete-mode              mouse-move-up            widen-from-region
  5645. delete-other-windows     mouse-region-down        wrap-word
  5646. delete-screen            mouse-region-up          write-file
  5647. delete-window            mouse-resize-screen      write-message
  5648. describe-bindings        name-buffer
  5649.  
  5650.  
  5651.  
  5652.                                                                         84
  5653.  
  5654.  
  5655.  
  5656.  
  5657.  
  5658.  
  5659. Supported machines                             MicroEMACS Reference Manual
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.                                 Appendix G
  5669.  
  5670.                             Supported machines
  5671.  
  5672.  
  5673.         The following table  lists  all the hardware/compilers for which I
  5674. currently support MicroEMACS. This is  not exclusive of all machines which
  5675. MicroEMACS will run on, but I have either run it myself,  or  had  a first
  5676. hand report of it running.
  5677.  
  5678. Hardware        OS              Compiler        Comments
  5679. VAX 780         UNIX V5         native
  5680.                 UNIX V7         native
  5681.                 BSD 4.2         native          job control supported
  5682.                 VMS             native          SMG & ANSI support
  5683.  
  5684. SUN             SUNOS 3 & 4     native
  5685.                                 gcc
  5686.  
  5687. NCR Tower       UNIX V5         native
  5688.  
  5689. IBM-RT PC       BSD 4.3         native
  5690.                 AIX             native
  5691.  
  5692. HP9000          UNIX V5         native
  5693.  
  5694. Fortune 32:16   UNIX V7         native
  5695.  
  5696. IBM-PC          MSDOS           LATTICE 3       Large CODE/Large DATA
  5697.                  2.0 & 3.2      AZTEC 3.4e      Large CODE/Large DATA
  5698.                                 TURBO C 2.0     LARGE memory model
  5699.                                 MSC 6.0
  5700.                                 *MWC 86
  5701.                 SCO XENIX       native
  5702.  
  5703. HP150           MSDOS           Lattice 2.15    Function key labels
  5704.                                 Turbo C 2.0             for the touch screen
  5705.  
  5706. HP110           MSDOS           Lattice 2.15
  5707.                                 Aztec 3.4e
  5708.                                 Turbo C 2.0
  5709.  
  5710. *Data General 10
  5711.                 MSDOS           Lattice 2.1  Texas Instruments Professional
  5712.                 MSDOS           Lattice 2.15
  5713.  
  5714. Amiga           Intuition       Lattice 3.03
  5715.                                 Aztec 3.6
  5716.  
  5717.  
  5718. 85
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725. MicroEMACS Reference Manual                             Supported machines
  5726.  
  5727.  
  5728. ST520           TOS             Mark Williams C Spawns under MSH
  5729.                                 Lattice 3.1     (no shell commands)
  5730.  
  5731. Fujitsu FMR     MSDOS           MSC 6.0
  5732.    series
  5733.  
  5734. NEC 9800        MSDOS           Turbo 2.0       Function key support
  5735.    series                       MSC 6.0
  5736.  
  5737. HP3000 series   MPE             native
  5738.  
  5739. Systems to be supported (IE some code is already written:)
  5740. Macintosh       System 7        Lightspeed C
  5741.  
  5742. *means that I do not own or have access to the listed compiler and/or
  5743.  machine and must rely upon others to help support it.
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.  
  5750.  
  5751.  
  5752.  
  5753.  
  5754.  
  5755.  
  5756.  
  5757.  
  5758.  
  5759.  
  5760.  
  5761.  
  5762.  
  5763.  
  5764.  
  5765.  
  5766.  
  5767.  
  5768.  
  5769.  
  5770.  
  5771.  
  5772.  
  5773.  
  5774.  
  5775.  
  5776.  
  5777.  
  5778.  
  5779.  
  5780.  
  5781.  
  5782.  
  5783.  
  5784.                                                                         86
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791. Function Keys                                  MicroEMACS Reference Manual
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.                                 Appendix H
  5801.  
  5802.                               Function Keys
  5803.  
  5804.  
  5805.         All environments now support a set of machine independant bindings
  5806. for function keys. Below is a list of these bindings (not all of these are
  5807. supported on all systems).
  5808.  
  5809.                         Function keys in MicroEmacs
  5810.  
  5811.         function        Function        ^function       Alt-function
  5812.  f1)      FN1            S-FN1            FN^1            A-FN1
  5813.  f2)      FN2            S-FN2            FN^2            A-FN2
  5814.  f3)      FN3            S-FN3            FN^3            A-FN3
  5815.  f4)      FN4            S-FN4            FN^4            A-FN4
  5816.  f5)      FN5            S-FN5            FN^5            A-FN5
  5817.  f6)      FN6            S-FN6            FN^6            A-FN6
  5818.  f7)      FN7            S-FN7            FN^7            A-FN7
  5819.  f8)      FN8            S-FN8            FN^8            A-FN8
  5820.  f9)      FN9            S-FN9            FN^9            A-FN9
  5821. f10)      FN0            S-FN0            FN^0            A-FN0
  5822.  
  5823. home)     FN<                             FN^<
  5824. CsUp)     FNP                             FN^P
  5825. PgUp)     FNZ                             FN^Z
  5826. CsLf)     FNB                             FN^B
  5827.  5  )
  5828. CsRt)     FNF                             FN^F
  5829.  End)     FN>                             FN^>
  5830. CsDn)     FNN                             FN^N
  5831. PgDn)     FNV                             FN^V
  5832.  Ins)     FNC                             FN^C
  5833.  Del)     FND                             FN^D
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850. 87
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857. MicroEMACS Reference Manual                        Machine Dependent Notes
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.                                 Appendix I
  5867.  
  5868.                          Machine Dependent Notes
  5869.  
  5870.  
  5871.         This  appendix   lists   some   notes   specific   to   individual
  5872. implementations of MicroEMACS. Every attempt  has been made to allow EMACS
  5873. to  be identical on all machines, but we have also tried to take advantage
  5874. of function keys,  cursor  keys,  mice,  and  special  screen  modes where
  5875. possible.
  5876.  
  5877.  
  5878. I.1  IBM-PC/XT/AT and its clones
  5879.  
  5880.  
  5881.         The  IBM-PC family of computers is supported  with  a  variety  of
  5882. different display adapters. EMACS will attempt to discover what adapter is
  5883. connected  and  use  the  proper  driver  for it. Below is a list  of  the
  5884. currently supported video adapters:
  5885.  
  5886. Adapter                         $sres           Original mode used
  5887. Monochrome Graphics Adapter     MONO            MONO
  5888. Color Graphics Adapter          CGA             CGA
  5889.                                 CGA40           CGA40
  5890. Enhanced Graphics Adapter       EGA             CGA
  5891. Video Graphics Adapter          VGA             CGA
  5892.                                 VGA12
  5893.  
  5894.         If a driver for  a  Microsoft compatable mouse is installed on the
  5895. system,  EMACS will use the mouse in text mode and allow the user all  the
  5896. standard  mouse  functions.  The mouse cursor will appear to be a block of
  5897. color in the color opposite of it's background.
  5898.  
  5899.         EMACS also takes advantage of various function keys  and  the keys
  5900. on the keypad on an IBM-PC. The function keys are  initially  not bound to
  5901. any  particular  functions  (except by the emacs.rc startup file), but the
  5902. keypad keys do default to the following:
  5903.  
  5904. Keypad key      Function
  5905. Home            beginning-of-file
  5906. CSRS UP         previous-line
  5907. Pg Up           previous-page
  5908. CSRS LEFT       backward-character
  5909. CSRS RIGHT      forward-character
  5910. End             end-of-file
  5911. CSRS DOWN       next-line
  5912. Pg Dn           Next-page
  5913.  
  5914.  
  5915.  
  5916.                                                                         88
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923. Machine Dependent Notes                        MicroEMACS Reference Manual
  5924.  
  5925.  
  5926.         All these special keys are indicated in EMACS macroes  by  use  of
  5927. the FN prefix. Below is a list of many of the keys and the  codes  used to
  5928. specify them. Also the codes may  be  gotten by using the describe-key (^X
  5929. ?) command on the suspect key.
  5930.  
  5931. Compiling under TURBO C
  5932.  
  5933.         To  compile MicroEMACS under TURBO C,  set  the  TURBO  integrated
  5934. environment with the following options:
  5935.  
  5936.         Memory model            LARGE
  5937.         Floating point          NONE
  5938.         Default char type       UNSIGNED
  5939.         Data alignment          BYTE
  5940.         Merge duplicate strings ON
  5941.         Standard stack frame    off
  5942.         Test stack overflow     off
  5943.  
  5944.         Optimize for                    SIZE
  5945.         Use register optimization       ON
  5946.         Register optimization           ON
  5947.         Jump optimization               ON
  5948.  
  5949.         Initialize segments     OFF
  5950.         Stack warnings          OFF
  5951.  
  5952.         Names: Code names
  5953.                 Segment name    *
  5954.  
  5955.  
  5956.  
  5957.  
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.  
  5981.  
  5982. 89
  5983.  
  5984.  
  5985.  
  5986.  
  5987.  
  5988.  
  5989. MicroEMACS Reference Manual                        Machine Dependent Notes
  5990.  
  5991.  
  5992.  
  5993.  
  5994. I.2  HP 150
  5995.  
  5996.  
  5997.         This machine from Hewlett  Packard  is  very  unusual for an MSDOS
  5998. machine.  It  has  a touch screen and is very function  key  oriented.  An
  5999. additional command, label-function-key  allows  you to place labels on the
  6000. on screen function key labels. A numeric argument indicates which function
  6001. key to  label  (one  through  eight) and then the program prompts for a 16
  6002. character label, which will be used  as  two lines of eight characters. To
  6003. label function key three with "save file" from a macro, you would use:
  6004.  
  6005. 3 label-function-key "save              file"
  6006.  
  6007.         Notice the 4 spaces  after  "save". This forces "file" to begin on
  6008. the second line of the label.
  6009.  
  6010.  
  6011.  
  6012.  
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.                                                                         90
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055. Machine Dependent Notes                        MicroEMACS Reference Manual
  6056.  
  6057.  
  6058.  
  6059.  
  6060. I.3  Atari 520/1040ST
  6061.  
  6062.  
  6063.         The ATARI ST family of computers have a dual personality. They may
  6064. use either  a  monochrome  or  a  color  screen. EMACS supports two screen
  6065. resolutions on each monitor.
  6066.  
  6067.                                    NOTE
  6068.  
  6069.      When  you  set  MicroEMACS up on your system, please remember to
  6070.      install  it on the desktop as a GEM  application.  If  you  have
  6071.      EMACS  set as a TOS application, the  mouse  will  not  function
  6072.      properly,  and  EMACS  will alert you to this problem by beeping
  6073.      the bell.
  6074.  
  6075. Monitor $sres size #color $palette format
  6076. Color   LOW     40x25   16      000111222333444555666777
  6077.         MEDIUM  80x25   4       000111222333
  6078. Mono    HIGH    80x25   2       000
  6079.         DENSE   80x50   2       000
  6080.  
  6081.         The $palette environment variable can be used to change what color
  6082. is  associated  with  each color name. With a color monitor, each group of
  6083. three digits indicates an octal number specifying the RED, GREEN  and BLUE
  6084. levels of that  color. Each color digit can vary from 0 to 7. For example,
  6085. the initial setting of $palette in LOW resolution is:
  6086.  
  6087.         000700070770007707077777
  6088.  
  6089.         which broken up is:
  6090.  
  6091.         000 700 070 770 007 707 077 777
  6092.  
  6093.         which means:
  6094.  
  6095.         000     Black
  6096.         700     Red
  6097.         070     Green
  6098.         770     Yellow
  6099.         007     Blue
  6100.         707     Magenta
  6101.         077     Cyan
  6102.         777     White
  6103.  
  6104.         Also the mouse buttons are bound to mouse  functions  as described
  6105. in the chapter about mice. The cursor keys and the function keys are bound
  6106. similarly to IBM-PC.
  6107.  
  6108.         Files  generated by EMACS on the ATARI ST  have  a  single  return
  6109. character  at the end of each line, unlike the desktop files which want to
  6110. have two returns. This makes it display files strangely from  GEM's [SHOW]
  6111. option, but  makes  the  files  port  to  other computers much nicer. When
  6112.  
  6113.  
  6114. 91
  6115.  
  6116.  
  6117.  
  6118.  
  6119.  
  6120.  
  6121. MicroEMACS Reference Manual                        Machine Dependent Notes
  6122.  
  6123.  
  6124. compiling  MicroEMACS,  the  ADDCR symbol in estruct.h will cause emacs to
  6125. generate line ending sequences compatible with GEM.
  6126.  
  6127.         Currently, when operating under  the  Mark  Williams  MSH program,
  6128. EMACS can shell out and perform external commands. This capability will be
  6129. added later for the Beckmeyer shell and under GEMDOS.
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.  
  6148.  
  6149.  
  6150.  
  6151.  
  6152.  
  6153.  
  6154.  
  6155.  
  6156.  
  6157.  
  6158.  
  6159.  
  6160.  
  6161.  
  6162.  
  6163.  
  6164.  
  6165.  
  6166.  
  6167.  
  6168.  
  6169.  
  6170.  
  6171.  
  6172.  
  6173.  
  6174.  
  6175.  
  6176.  
  6177.  
  6178.  
  6179.  
  6180.                                                                         92
  6181.  
  6182.  
  6183.  
  6184.  
  6185.  
  6186.  
  6187. Machine Dependent Notes                        MicroEMACS Reference Manual
  6188.  
  6189.  
  6190.  
  6191.  
  6192. I.4  Amiga 1000
  6193.  
  6194.  
  6195.         The Commodore  AMIGA 1000 version of MicroEMACS does fully support
  6196. the  mouse,  window  resizing  and  the  close  gadget.  It runs in medium
  6197. resolution, using the colors defined for the workbench.
  6198.  
  6199.                      Note about Compiling MicroEMACS
  6200.  
  6201.              If you are compiling the sources on the AMIGA to produce
  6202.      an executable image, and you  are using the Lattice compiler, be
  6203.      sure to give the CLI command 'STACK 40000'  before  compiling to
  6204.      make  sure  the  compiler   has   sufficient   stack   space  to
  6205.      successfully complete compilation.
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.  
  6212.  
  6213.  
  6214.  
  6215.  
  6216.  
  6217.  
  6218.  
  6219.  
  6220.  
  6221.  
  6222.  
  6223.  
  6224.  
  6225.  
  6226.  
  6227.  
  6228.  
  6229.  
  6230.  
  6231.  
  6232.  
  6233.  
  6234.  
  6235.  
  6236.  
  6237.  
  6238.  
  6239.  
  6240.  
  6241.  
  6242.  
  6243.  
  6244.  
  6245.  
  6246. 93
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253. MicroEMACS Reference Manual                        Machine Dependent Notes
  6254.  
  6255.  
  6256.  
  6257.  
  6258. I.5  UNIX V5, V7, and BSD4.[23]
  6259.  
  6260.  
  6261.         MicroEMACS under UNIX  utilizes  the  TERMCAP  library  to provide
  6262. machine independent  screen functions. Make sure that termcap is available
  6263. and properly set on your account before attempting to use MicroEMACS.
  6264.  
  6265.         Under  systems  which  support  job  control, you can use the  ^XD
  6266. suspend-emacs command to place EMACS into the background.  This  carries a
  6267. much smaller overhead than bringing up a new shell under EMACS. EMACS will
  6268. properly redraw the screen when you bring it back to the foreground.
  6269.  
  6270.         If the symbol VT100 has been set to  1  in  the  estruct.h options
  6271. file, EMACS will recognize the key sequence <ESC>[ as the lead in sequence
  6272. for the FN function key prefix.
  6273.  
  6274.         With the addition of some very  machine/operating  system specific
  6275. code, EMACS can prevent two or more people from modifying the same file at
  6276. the same time. The upper level of  a  set  of  functions  to  provide file
  6277. locking exist in the source file LOCK.C.  It requires two machine specific
  6278. functions written and linked into EMACS for it to operate properly.
  6279.  
  6280.         char *dolock(fname)
  6281.  
  6282.         char *fname;
  6283.  
  6284.         dolock() locks a file, preventing others from modifying it. If
  6285.         it succeeds, it returns NULL, otherwise it returns a pointer to
  6286.         a string in the form "LOCK ERROR: explanation".
  6287.  
  6288.         char *undolock(fname)
  6289.  
  6290.         char *fname;
  6291.  
  6292.         undolock() unlocks a file, allowing others to modifying it. If
  6293.         it succeeds, it returns NULL, otherwise it returns a pointer to
  6294.         a string in the form "LOCK ERROR: explanation".
  6295.  
  6296.  
  6297.  
  6298.  
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.  
  6307.  
  6308.  
  6309.  
  6310.  
  6311.  
  6312.                                                                         94
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319. Machine Dependent Notes                        MicroEMACS Reference Manual
  6320.  
  6321.  
  6322.  
  6323.  
  6324. I.6  DEC VMS operating system
  6325.  
  6326.  
  6327. TERMINALS
  6328.  
  6329.         Depending upon  the  options  set  in  ESTRUCT.H,  MicroEMACS uses
  6330. either  the capabilities of VMS SMG, working with  any  terminal  that  is
  6331. defined in SMGTERMS.TXT or  TERMTABLE.TXT  (see  your  SMG manual for more
  6332. information), or the ANSI  escape  sequences.  Full keyboard support, with
  6333. function  keys  and  everything,  is  provided for VT100 and VT200  series
  6334. compatible terminals. Mouse support is  provided  under  the  ANSI version
  6335. only at this time. Mouse support is provided for  the  VSII  workstation's
  6336. VT220  terminal  emulator,  and other terminal emulators that use the same
  6337. escape sequences for mouse control. (There is some partial support for the
  6338. BBN  BitGraph  mouse  sequences  in  the  sources,  but  this  is not  yet
  6339. complete). Terminals may have up to 100 lines and 160 columns.
  6340.  
  6341.         The  maximum  terminal  size is 256 columns and 72 row. If you run
  6342. MicroEMACS on a terminal that is larger than this, MicroEMACS  will reduce
  6343. it to these limits while you are editing.
  6344.  
  6345. Flow control
  6346.         Some terminals will require the  use of XON/XOFF flow control when
  6347. used with MicroEMACS. When XON/XOFF flow control is used, you will  not be
  6348. able to use functions bound to ^S or ^Q, and should use bind-to-key to put
  6349. these functions on other keys. MicroEMACS does not change the flow control
  6350. characteristics  of  your  terminal line while  it  is  running.  If  your
  6351. terminal requires flow control, you should:
  6352.  
  6353.         $ SET TERM/HOSTSYNC/TTSYNC
  6354.  
  6355.         before  entering  MicroEMACS.  If  you  are  on  a  VSII  emulated
  6356. workstation terminal,  are using the SSU multi-session protocol (VT330 and
  6357. VT340  with  SSU enabled), or are certain  that  your  terminal  does  not
  6358. require XON/XOFF flow control, you should
  6359.  
  6360.         $ SET TERM /HOSTSYNC/NOTTSYNC
  6361.  
  6362.         This will allow you to use ^S and ^Q for MicroEMACS commands. Note
  6363. that  if  you  are using a VSII with VWS V3.2 or later, you must leave the
  6364. /HOSTSYNC enabled in order for  the cross/session cut and paste capability
  6365. to work properly.
  6366.  
  6367.  
  6368. KEYBOARD
  6369.  
  6370.         The VMS version  understands  the LK201 functions of VT200 series,
  6371. vt300 series,  and compatible terminals and terminal emulators, and allows
  6372. you  to  bind  to them as function keys. In addition,  the  VT100  numeric
  6373. keypad, in application mode, is  available  as  function  keys. MicroEMACS
  6374. will  only  put  the keypad into application mode for you  if  the  KEYPAD
  6375. option is set in ESTRUCT.H. In this situation, MicroEmacs will detect your
  6376.  
  6377.  
  6378. 95
  6379.  
  6380.  
  6381.  
  6382.  
  6383.  
  6384.  
  6385. MicroEMACS Reference Manual                        Machine Dependent Notes
  6386.  
  6387.  
  6388. kepad's state, and restore it to that state upon  exiting.  If  MicroEMACS
  6389. has  not been compiled with this option, you may still put the keypad into
  6390. application mode by issuing the  command  "SET  TERM  /APPLICATION" before
  6391. entering MicroEMACS.
  6392.  
  6393. VT200 keys
  6394.  
  6395. Note that F1 through F5 are local function keys on DEC terminals.
  6396.  
  6397. F6         = FN6        FIND = FNS
  6398. FN7        = FN7        INSERT = FNC
  6399. F8         = FN8        REMOVE = FND
  6400. F9         = FN9        SELECT = FN@
  6401. F10        = FN0        PREV = FNZ
  6402. F11        = S-FN1      NEXT = FNV
  6403. F12        = S-FN2      Arrow Up = FNP
  6404. F13        = S-FN3      Arrow Down = FNN
  6405. F14        = S-FN4      Arrow Right = FNF
  6406. HELP (F15) = S-FN5      Arrow Left = FNB
  6407. DO (F16)   = S-FN6
  6408. F17        = S-FN7
  6409. F18        = S-FN8
  6410. F19        = S-FN9
  6411. F20        = S-FN0
  6412.  
  6413. VT100 and VT200 numeric keypad in application mode
  6414.  
  6415. PF1 = FN^1      PF2 = FN^2      PF3 = FN^3      PF4   = FN^4
  6416. 7   = A-7       8   = A-8       9   = A-9       -     = A--
  6417. 4   = A-4       5   = A-5       6   = A-6       ,     = A-,
  6418. 1   = A-1       2   = A-2       3   = A-3       ENTER = A-E
  6419. 0   = A-0       .  = A-.
  6420.  
  6421.                                  WARNING
  6422.  
  6423.              The VMS version  contains code for interpreting function
  6424.      keys that are  sent  as  Ansi  sequences that begin with the ESC
  6425.      character.    Because  of  this,  MicroEMACS  cannot  process an
  6426.      incoming ESC until it knows  what character follows it. This can
  6427.      cause problems with terminating search and  replace  strings. If
  6428.      you use ESC as the  meta-prefix character (which is the default)
  6429.      you must type  one  additional  keystroke  following  ESC before
  6430.      emacs will recognize that you  have  edited  the  search command
  6431.      prompt,  and  are   continuing.  (The  additional  character  is
  6432.      processed normally be MicroEMACS, it is NOT discarded.)
  6433.  
  6434.              MicroEMACS must wait long enough for  the  network delay
  6435.      that might be involved  between  seeing  the  ESC and seeing the
  6436.      characters that follow it. If holding down one of the arrow keys
  6437.      causes characters to drop  into  your file, then you may want to
  6438.      alter    the    delay    yourself.    The    logical    variable
  6439.      MICROEMACS$SHORTWAIT may  be set to vary that delay. The default
  6440.      delay is 400ms (4  tenths  of a second). The equivalent value in
  6441.      MICROEMACS$SHORTWAIT is 4000000.
  6442.  
  6443.  
  6444.                                                                         96
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451. Machine Dependent Notes                        MicroEMACS Reference Manual
  6452.  
  6453.  
  6454. Special case for BBN BItGraph
  6455.  
  6456.         If you are using the  BBN BitGraph, execute the following commands
  6457. before entering MicroEMACS, and you will get mouse support:
  6458.  
  6459.         $ esc[0,8] = 27
  6460.         $ microemacs$mouse_enable == esc+":5;6;L"+esc+":0;63;;;;;;;;;9;16;c"
  6461.         $ microemacs$mouse_disable == esc+":5;1;L"+esc+":0;0c"
  6462.         $ exit
  6463.  
  6464.         Do NOT do this for any other terminals.
  6465.  
  6466. Search List for EMACS.RC
  6467.  
  6468.         VMS  MicroEMACS  will  first  search logical name MICROEMACS$LIB:,
  6469. then    SYS$LOGIN:,    then    the    current   directory,   and   finally
  6470. "sys$sysdevice:[vmstools]" when looking for startup files or help files.
  6471.  
  6472.         Please use MICROEMACS$LIB:,  and  allow  the  secondary  search of
  6473. [vmstools] to become archaic. If desired, MICROEMACS$LIB may be defined to
  6474. be  a  VMS search list that first searches a user directory,  and  then  a
  6475. system directory.
  6476.  
  6477.         Generally, you should create  a  private  directory where you keep
  6478. all your .CMD files, and in your LOGIN.COM $DEFINE a logical name to point
  6479. to this area.
  6480.  
  6481.         In addition to whatever commands you have in  your  EMACS.RC file,
  6482. one command you should certainly include is "set $ssave FALSE".  The "safe
  6483. save" mechanism, which writes a buffer to a temporary  file,  deletes  the
  6484. old  version of a file, and then moves the temporary file to its permanent
  6485. name, works wonderfully on most systems, but makes no sense on  VMS, which
  6486. maintains older versions of a file.
  6487.  
  6488. Using MicroEMACS as a subprocess
  6489.         MicroEmacs can now  be  kept  in  a subprocess. You can arrange to
  6490. start emacs only once in  a job, and to re-attach to it each time you want
  6491. to  use  it.  This is optional. To use this feature, install MicroEMACS in
  6492. the following way:
  6493.  
  6494. 1. MicroEMACS contains two images. ME.EXE is a small program for
  6495.     starting and stopping the Emacs subprocess. The source for ME.
  6496.     is in ME.C, and should not be linked into MESHR.EXE. MESHR.EXE
  6497.     is the actual MicroEMACS image. The name "MESHR" is required for
  6498.     MAIL/NOTES support, see next section for details.
  6499.  
  6500. 2. Make sure that the SYS$SHARE search list includes MESHR.EXE. If you
  6501.    don't have the privilages to move MESHR.EXE into SYS$SHARE, you
  6502.    can $ DEFINE the MESHR logical name to be the full name and location of
  6503.    the MESHR.EXE program. For example, you could store all of these
  6504.    programs in the MICROEMACS$LIB: search list, and say:
  6505.  
  6506.                 $ DEFINE MESHR microemacs$lib:meshr.exe
  6507.  
  6508.  
  6509.  
  6510. 97
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517. MicroEMACS Reference Manual                        Machine Dependent Notes
  6518.  
  6519.  
  6520. 3. Put ME.EXE in MICROEMACS$LIB and the following line in your LOGIN.COM:
  6521.  
  6522.                 $ me :== $microemacs$lib:me
  6523.  
  6524. 4. Put a line in your EMACS.RC that will
  6525.  
  6526.             bind-to-key suspend-emacs ^C  ; use your usual exit-emacs key
  6527.  
  6528.         Now,  use the "$ ME" command  to  invoke  microemacs.  Subseqeuent
  6529. invocations in the same  job  will re-use the existing subprocess. You can
  6530. use  the full capabilty of the microemacs command line in the first and in
  6531. all subsequent invocations of ME.
  6532.  
  6533.         WARNING:
  6534.  
  6535.         MicroEMACS will ALWAYS read in new copies of any files you specify
  6536. on the command line, even if you are  already  editing  it.  If you edit a
  6537. file a  second  time  with  the same MicroEMACS, you will get a NEW buffer
  6538. with  ANOTHER copy of the file. The old buffer is still there also. It  is
  6539. easy,  in this situation, to accidently edit in a WRONG BUFFER, and if you
  6540. write out an obsolete buffer, you will loose earlier edits!
  6541.  
  6542.         This is considered a bug and  may  be  fixed in a later version of
  6543. MicroEMACS. To avoid this situation, do not specify a file on  the command
  6544. line if MicroEMACS already has that file in a buffer. Use  the "find-file"
  6545. MicroEMACS command instead.
  6546.  
  6547.  
  6548.         Using MICROEMACS with MAIL and NOTES:
  6549.  
  6550.         With VMS V5 and later versions, the MAIL  interface  to Microemacs
  6551. is much simplified. With VMS V5, the MESHR.EXE image does  NOT  have to be
  6552. installed  as  a known image to be used as a callable  editor  from  MAIL.
  6553. Therefore, to  use  MicroEMACS  as  your  VMS  MAIL editor, simply add the
  6554. following lines to your LOGIN.COM:
  6555.  
  6556.                 $ DEFINE MAIL$EDIT CALLABLE_ME
  6557.                 $ MAIL :== MAIL/EDIT
  6558.  
  6559.         and make sure  that  the SYS$SHARE search list includes MESHR.EXE.
  6560. If you don't have privs or permission to move  MESHR.EXE  into  SYS$SHARE,
  6561. you  can $ DEFINE the MESHR logical name to be the full name and  location
  6562. of  the  MESHR.EXE program. For example, you  could  store  all  of  these
  6563. programs in the MICROEMACS$LIB: search list, and say:
  6564.  
  6565.                 $ DEFINE MESHR microemacs$lib:meshr.exe
  6566.  
  6567.         Note that this is the same location as is required for  using kept
  6568. MicroEMACS.
  6569.  
  6570.         To abort sending a  message,  exit  MicroEMACS without writing out
  6571. the mail message file.
  6572.  
  6573.  
  6574.  
  6575.  
  6576.                                                                         98
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583. Machine Dependent Notes                        MicroEMACS Reference Manual
  6584.  
  6585.  
  6586.         To  use  MicroEMACS  as your VAX NOTES editor, issue the following
  6587. command to VAX NOTES:
  6588.  
  6589.                 NOTES> SET PROFILE/EDIT=(ME,CALL)
  6590.  
  6591.         Note,  if you are still in the dark ages of VMS V4, you will  have
  6592. to  either  install MESHR as a known  image,  or  following  the  original
  6593. "Second way" instructions given in the existing appendix F.6 of  the older
  6594. MicroEMACS manual (previous to version 3.10).
  6595.  
  6596. Second way, as described in older versions
  6597.  
  6598.         In the event that you cannot get your system  manager  to  INSTALL
  6599. MicroEMACS as known image, you can use the following technique:
  6600.  
  6601. 1. In MICROEMACS$LIB:MEMAIL.COM, put the following command file:
  6602.  
  6603. $! Use on VAX/VMS as MAIL$EDIT for using MicroEMACS as mail editor.
  6604. $ if "''P1'" .NES. "_NL:" then if "''P1'" .NES. "" then copy 'P1' 'P2'
  6605. $ define/user sys$input sys$output
  6606. $ me 'P2'
  6607. $ exit
  6608.  
  6609. This file may have come with your MicroEMACS kit.
  6610.  
  6611. 2. In your LOGIN.COM, put the following lines:
  6612.  
  6613. $       me :== $MICROEMACS$LIB:MESHR.EXE ! Assumes meshr.exe is there
  6614. $       define mail$edit microemacs$lib:me_edit.com
  6615.  
  6616. 3. In NOTES, give the command
  6617.  
  6618. NOTES> SET PROFILE/EDIT=(@MicroEMACS$lib:me_edit.com,SPAWN)
  6619.  
  6620. Building MicroEMACS for VMS
  6621.  
  6622. The configuration options are set in file estruct.h:
  6623.  
  6624. - Under the category of "Machine/OS definitions", set VMS to "1" and all
  6625. others to "0".
  6626.  
  6627. - Under "Compiler definitions", set all selections to "0". Selecting
  6628. VMS implies that you are using VAXC.
  6629.  
  6630. - Under "Special keyboard definitions", be sure "VT100" is set to "0".
  6631. This option is not required for the VMS version, it is for other
  6632. systems using ANSI terminal support. VMS in combination with SMG or
  6633. ANSI already handles the special characteristics of Ansi keyboards.
  6634.  
  6635. - Under "Terminal Output definitions", set either ANSI or SMG to "1"
  6636. and all others to "0". As stated previously, only ANSI supports the
  6637. mouse at this time.
  6638.  
  6639. - Under "Configuration options", you may select as you wish, with the
  6640.  
  6641.  
  6642. 99
  6643.  
  6644.  
  6645.  
  6646.  
  6647.  
  6648.  
  6649. MicroEMACS Reference Manual                        Machine Dependent Notes
  6650.  
  6651.  
  6652. following notes:
  6653.  
  6654.     - COLOR     support does not exist for VMS, even when using
  6655.                 color workstations.
  6656.     - MOUSE     support should be enabled if you have any VSII
  6657.                 workstations. Only supported under the ANSI driver.
  6658.     - KEYPAD    support recognises whether your keypad is already
  6659.                 in application mode or not, and puts your keypad
  6660.                 in its correct state on exit.
  6661.     - XNONOFF   automatically allows you to use control-S or
  6662.                 control-Q in MicroEMACS, by disabling the TTSYNC
  6663.                 characteristic. This option should not be set if
  6664.                 MicroEMACS might be used on DecStations or VT100s.
  6665.                 It also should not be used with slow terminals or
  6666.                 terminal emulators connected to fast terminal lines.
  6667.     - RMSIO     support should absolutely be used. This option
  6668.                 allows the writing and reading of files in VMS's
  6669.                 variable-length format, as opposed to STREAM-LF,
  6670.                 and cuts down on file writing and reading time by
  6671.                 approximately two thirds.
  6672.     - OPTMEM    support may be used on VMS versions 5.0 and higher.
  6673.                 It substitutes the C library's memory allocation
  6674.                 calls for the native VAX calls, and gives a speed
  6675.                 improvement.
  6676.  
  6677.         If you have  MMS,  you  can  use the supplied DESCRIP.MMS to build
  6678. MicroEMACS. Otherwise, the  command  file  MEMAKE.COM  has  been provided.
  6679. These  files assume that you are using SMG as your terminal driver. If you
  6680. are using ANSI, then you must replace SMG with ANSI in the command and opt
  6681. files.  If  you  do not have MMS or are missing MEMAKE.COM, simply compile
  6682. each module with "CC", and link with the command:
  6683.  
  6684.         $ LINK MESHR/OPTION/SHARE
  6685.  
  6686.         Note that the executable  filename  must end in "SHR" in order for
  6687. MicroEMACS to be  used as a callable editor from MAIL or NOTES.  (Method 1
  6688. above.)
  6689.  
  6690.         If you edit  any  of  the  Emacs  sources, note that any global or
  6691. external data must be declared as "noshare" in order for the  VMS callable
  6692. editor support to work properly. This  applies  to all global data used in
  6693. the VMS version, but not to routines or to "static  "data.   The "noshare"
  6694. declaration is #define'd away on non-VMS systems. If you fail to  do this,
  6695. VMS will not allow you to INSTALL MicroEMACS as a sharable library.
  6696.  
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.                                                                        100
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715. Mode Flags                                     MicroEMACS Reference Manual
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.                                 Appendix J
  6725.  
  6726.                                 Mode Flags
  6727.  
  6728.  
  6729.         The two environment variables, $cmode and $gmode, contain a number
  6730. the  corresponds to the modes set for the current buffer and the editor as
  6731. a whole. These are encoded as the sum of the following numbers for each of
  6732. the possible modes:
  6733.  
  6734. WRAP      1             Word wrap
  6735. CMODE     2             C indentation and fence match
  6736. SPELL     4             Interactive spell checking (Not Implemented Yet)
  6737. EXACT     8             Exact matching for searches
  6738. VIEW     16             Read-only buffer
  6739. OVER     32             Overwrite mode
  6740. MAGIC    64             Regular expressions in search
  6741. CRYPT   128             Encryption mode active
  6742. ASAVE   256             Auto-save mode
  6743.  
  6744.         So, if you wished to set the current buffer to have  CMODE, EXACT,
  6745. and MAGIC on, and all  the  others  off,  you  would add up the values for
  6746. those three,  CMODE  2   +  EXACT 8  +  MAGIC 64 = 74, and use a statement
  6747. like:
  6748.  
  6749.         set $cmode 74
  6750.  
  6751.         or, use the binary or operator to combine the different modes:
  6752.  
  6753.         set $cmode &bor &bor 2 8 64
  6754.  
  6755. Internal Flags
  6756.  
  6757.         Some  of the ways EMACS controls its  internal  functions  can  be
  6758. modified by the  value  in  the  $gflags environment variable. Each bit in
  6759. this variable will be used to control a different function.
  6760.  
  6761. GFFLAG          1       If this bit is set to zero, EMACS will not
  6762.                         automatically switch to the buffer of the
  6763.                         first file after executing the startup macros.
  6764. GFSDRAW         2       If this bit is set to one, supress redraw events.
  6765.  
  6766. Current buffer flags
  6767.  
  6768.         The $cbflags environment  variable  allows the user to modify some
  6769. of the  characteristics of the current buffer. The various characteristics
  6770. are encoded as the sum of the following numbers:
  6771.  
  6772.  
  6773.  
  6774. 101
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781. MicroEMACS Reference Manual                                     Mode Flags
  6782.  
  6783.  
  6784. BFINVS          1       Internal invisible buffer
  6785. BFCHG           2       Changed since last write
  6786. BFTRUNC         4       buffer was truncated when read
  6787. BFNAROW         8       buffer has been narrowed
  6788.  
  6789.         Only  the  invisible  and changed flags can be modified by setting
  6790. the  $cbflags variable. The truncated file and  narrowed  flags  are  read
  6791. only.
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.  
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.  
  6811.  
  6812.  
  6813.  
  6814.  
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820.  
  6821.  
  6822.  
  6823.  
  6824.  
  6825.  
  6826.  
  6827.  
  6828.  
  6829.  
  6830.  
  6831.  
  6832.  
  6833.  
  6834.  
  6835.  
  6836.  
  6837.  
  6838.  
  6839.  
  6840.                                                                        102
  6841.  
  6842.  
  6843.  
  6844.  
  6845.  
  6846.  
  6847. Index                                          MicroEMACS Reference Manual
  6848.  
  6849.  
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.  
  6856.                                      Index
  6857.  
  6858.  
  6859.         $cbflags 101                     default string 14
  6860.         $debug 63                        delete-blank-lines 8
  6861.         $gflags 101                      delete-buffer 28
  6862.         .emacsrc 48, 67                  delete-global-mode 30
  6863.         <NL> 13                          delete-mode 30
  6864.                                          delete-next-character 7
  6865.         A                                delete-next-word 8
  6866.         add-global-mode 30               delete-previous-character
  6867.         add-mode 3, 30                        7
  6868.         ASAVE mode 30                    delete-previous-word 8
  6869.                                          describe-bindings 66
  6870.         B                                describe-key 65
  6871.         backward-character 3             desk accessories 21
  6872.         BBS 68                           desktop 23
  6873.         begin-macro 46                   detab-region 41
  6874.         beginning-of-file 4, 7           dragging 22
  6875.         beginning-of-line 4
  6876.         bind-to-key 65                   E
  6877.         buffer 4, 6, 27                  emacs.rc 48, 67
  6878.                                          encryption 31
  6879.         C                                end-macro 46
  6880.         case-region-lower 40             end-of-file 4
  6881.         case-word-capitalize 40          end-of-line 4
  6882.         case-word-lower 40               entab-region 41
  6883.         case-word-upper 40               error parsing 67
  6884.         change-file-name 36              EXACT mode 31
  6885.         clear-and-redraw 19              execute-buffer 48
  6886.         CMODE mode 31                    execute-file 48
  6887.         color 30                         execute-macro 46
  6888.         color pallette 52                execute-program 43
  6889.         command line 17                  exit-emacs 8
  6890.         command processor 43
  6891.         command.com 43                   F
  6892.         control key 1                    file locking 94
  6893.         control-x 1                      fill column 34
  6894.         copy-region 11                   fill-paragraph 7, 39
  6895.         CRYPT mode 31, 68                filter 43
  6896.         cshell 43                        filter-buffer 43
  6897.         cursor keys 4                    find-file 18, 27
  6898.         cut 23                           forward-character 3
  6899.         cycle-screens 24                 function key window 48
  6900.  
  6901.         D                                G
  6902.         debugging 63                     grow-window 19
  6903.  
  6904.  
  6905.  
  6906. 103
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913. MicroEMACS Reference Manual                                          Index
  6914.  
  6915.  
  6916.  
  6917.         H                                Q
  6918.         handle-tab 41                    query-replace 15
  6919.         Help File 67                     query-replace-string 15,
  6920.         HOME environment variable             33, 34
  6921.              67
  6922.         horizontal scrolling 22          R
  6923.                                          rebinding 65
  6924.         I                                redraw-display 19
  6925.         i-shell 44                       region 22
  6926.                                          regular expressions 32
  6927.         K                                replace-string 14, 33, 34
  6928.         kill buffer 11                   resize-window 19
  6929.         kill-region 10                   restricted mode 68
  6930.         kill-to-end-of-line 8            run 48
  6931.  
  6932.         L                                S
  6933.         label-function-key 90            save-file 4
  6934.         list-buffers 28, 30              screen 6, 23
  6935.                                          screen resolution 53
  6936.         M                                scroll-next-down 18
  6937.         MAGIC mode 32                    scroll-next-up 18
  6938.         mark 10                          search-forward 13
  6939.         meta key 1                       search-reverse 14
  6940.         mode line 2, 6                   select-buffer 27
  6941.         modes 3, 30                      set 41
  6942.         mouse 21, 52                     set-encryption-key 31
  6943.         mouse cursor 21                  set-fill-column 39
  6944.         move-window-down 18              set-mark 10
  6945.         move-window-up 18                shell 43
  6946.                                          shell-command 43
  6947.         N                                shrink-window 19
  6948.         newline 1                        special keys 1
  6949.         next-buffer 27                   split-current-window 17
  6950.         next-line 3                      startup files 67
  6951.         next-paragraph 4                 store-procedure 48
  6952.         next-word 3                      suspend-emacs 44, 94
  6953.         numeric arguments 80             switches 67
  6954.  
  6955.         O                                T
  6956.         open-line 7                      tab handling 41
  6957.         open-window 17                   tabs 51, 53
  6958.         OVER mode 34                     termcap 94
  6959.                                          text window 2
  6960.         P                                trim-region 41
  6961.         paste 23
  6962.         PATH environment variable        V
  6963.              67                          vertical scrolling 22
  6964.         pipe-command 43                  VIEW mode 34
  6965.         point 10
  6966.         previous-line 3                  W
  6967.         previous-paragraph 4             window 6
  6968.         previous-window 17               windows 2, 17
  6969.         previous-word 3                     Creating 17
  6970.  
  6971.  
  6972.                                                                        104
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.  
  6979. Index                                          MicroEMACS Reference Manual
  6980.  
  6981.  
  6982.            Deleting 18                   write-file 4
  6983.            Resizing 19                   writefile 36
  6984.         WRAP mode 34
  6985.         wrap-word 34                     Y
  6986.         wrapping text 39                 yank 11
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.  
  7027.  
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.  
  7035.  
  7036.  
  7037.  
  7038. 105
  7039.  
  7040.  
  7041.  
  7042.  
  7043.  
  7044.  
  7045.  
  7046.  
  7047.  
  7048.  
  7049.  
  7050.  
  7051.  
  7052.                                  Contents
  7053.  
  7054.  
  7055.  
  7056.  
  7057.  
  7058.      Chapter 1  Basic Concepts                                      1
  7059.         1.1  Keys and the Keyboard  . . . . . . . . . . . . . . . . 1
  7060.         1.2  Getting Started  . . . . . . . . . . . . . . . . . . . 1
  7061.         1.3  Parts and Pieces . . . . . . . . . . . . . . . . . . . 2
  7062.         1.4  Entering Text  . . . . . . . . . . . . . . . . . . . . 2
  7063.         1.5  Basic cursor movement  . . . . . . . . . . . . . . . . 3
  7064.         1.6  Saving your text . . . . . . . . . . . . . . . . . . . 4
  7065.  
  7066.      Chapter 2  Basic Editing--Simple Insertions and Deletions      6
  7067.         2.1  A Word About Windows, Buffers, Screens, and Modes  . . 6
  7068.         2.2  Insertions . . . . . . . . . . . . . . . . . . . . . . 7
  7069.         2.3  Deletions  . . . . . . . . . . . . . . . . . . . . . . 7
  7070.  
  7071.      Chapter 3  Using Regions                                      10
  7072.         3.1  Defining and Deleting a Region . . . . . . . . . . .  10
  7073.         3.2  Yanking a Region . . . . . . . . . . . . . . . . . .  11
  7074.  
  7075.      Chapter 4  Search and Replace                                 13
  7076.         4.1  Forward Search . . . . . . . . . . . . . . . . . . .  13
  7077.         4.2  Exact Searches . . . . . . . . . . . . . . . . . . .  14
  7078.         4.3  Backward Search  . . . . . . . . . . . . . . . . . .  14
  7079.         4.4  Searching and Replacing  . . . . . . . . . . . . . .  14
  7080.         4.5  Query-Replace  . . . . . . . . . . . . . . . . . . .  15
  7081.  
  7082.      Chapter 5  Windows                                            17
  7083.         5.1  Creating Windows . . . . . . . . . . . . . . . . . .  17
  7084.         5.2  Deleting Windows . . . . . . . . . . . . . . . . . .  18
  7085.         5.3  Resizing Windows . . . . . . . . . . . . . . . . . .  19
  7086.         5.4  Repositioning within a Window  . . . . . . . . . . .  19
  7087.  
  7088.      Chapter 6  Using a Mouse                                      21
  7089.         6.1  Moving around with the mouse . . . . . . . . . . . .  21
  7090.         6.2  Dragging around  . . . . . . . . . . . . . . . . . .  21
  7091.         6.3  Cut and Paste  . . . . . . . . . . . . . . . . . . .  22
  7092.         6.4  Screens  . . . . . . . . . . . . . . . . . . . . . .  23
  7093.         6.5  Resizing a Screen  . . . . . . . . . . . . . . . . .  23
  7094.         6.6  Moving a Screen  . . . . . . . . . . . . . . . . . .  23
  7095.         6.7  Creating a Screen  . . . . . . . . . . . . . . . . .  23
  7096.         6.8  Switching to a Screen  . . . . . . . . . . . . . . .  24
  7097.         6.9  Deleting a Screen  . . . . . . . . . . . . . . . . .  24
  7098.  
  7099.      Chapter 7  Buffers                                            27
  7100.  
  7101.  
  7102.  
  7103.  
  7104.                                      i
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.      Chapter 8  Modes                                              30
  7115.         8.1  ASAVE mode . . . . . . . . . . . . . . . . . . . . .  30
  7116.         8.2  CMODE mode . . . . . . . . . . . . . . . . . . . . .  31
  7117.         8.3  CRYPT mode . . . . . . . . . . . . . . . . . . . . .  31
  7118.         8.4  EXACT mode . . . . . . . . . . . . . . . . . . . . .  31
  7119.         8.5  MAGIC mode . . . . . . . . . . . . . . . . . . . . .  32
  7120.         8.6  OVER mode  . . . . . . . . . . . . . . . . . . . . .  34
  7121.         8.7  WRAP mode  . . . . . . . . . . . . . . . . . . . . .  34
  7122.         8.8  VIEW mode  . . . . . . . . . . . . . . . . . . . . .  34
  7123.  
  7124.      Chapter 9  Files                                              36
  7125.  
  7126.      Chapter 10  Screen Formatting                                 39
  7127.         10.1  Wrapping Text . . . . . . . . . . . . . . . . . . .  39
  7128.         10.2  Reformatting Paragraphs . . . . . . . . . . . . . .  39
  7129.         10.3  Changing Case . . . . . . . . . . . . . . . . . . .  39
  7130.         10.4  Tabs  . . . . . . . . . . . . . . . . . . . . . . .  40
  7131.  
  7132.      Chapter 11  Access to the Outside World                       43
  7133.  
  7134.      Chapter 12  Keyboard Macros                                   46
  7135.  
  7136.      Chapter 13  MicroEMACS Procedures                             48
  7137.         13.1  Constants . . . . . . . . . . . . . . . . . . . . .  48
  7138.         13.2  Variables . . . . . . . . . . . . . . . . . . . . .  49
  7139.            13.2.1  Environmental Variables  . . . . . . . . . . .  50
  7140.            13.2.2  User variables . . . . . . . . . . . . . . . .  54
  7141.            13.2.3  Buffer Variables . . . . . . . . . . . . . . .  55
  7142.            13.2.4  Interactive variables  . . . . . . . . . . . .  55
  7143.         13.3  Functions . . . . . . . . . . . . . . . . . . . . .  56
  7144.         13.4  Directives  . . . . . . . . . . . . . . . . . . . .  58
  7145.            13.4.1  !ENDM Directive  . . . . . . . . . . . . . . .  59
  7146.            13.4.2  !FORCE Directive . . . . . . . . . . . . . . .  59
  7147.            13.4.3  !IF, !ELSE, and !ENDIF Directives  . . . . . .  60
  7148.            13.4.4  !GOTO Directive  . . . . . . . . . . . . . . .  60
  7149.            13.4.5  !WHILE and !ENDWHILE Directives  . . . . . . .  61
  7150.            13.4.6  !BREAK Directive . . . . . . . . . . . . . . .  61
  7151.            13.4.7  !RETURN Directive  . . . . . . . . . . . . . .  62
  7152.  
  7153.      Chapter 14  Debugging MicroEMACS Procedures                   63
  7154.  
  7155.      Chapter 15  Key Bindings, What they are and why               65
  7156.  
  7157.      Appendix A  MicroEMACS Command Line Switches and Startup
  7158.                  Files                                             67
  7159.  
  7160.      Appendix B  Command Completion                                69
  7161.  
  7162.      Appendix C  MicroEMACS Commands                               70
  7163.  
  7164.      Appendix D  MicroEMACS Bindings                               77
  7165.  
  7166.      Appendix E  Numeric Arguments                                 79
  7167.  
  7168.  
  7169.  
  7170.                                     ii
  7171.  
  7172.  
  7173.  
  7174.  
  7175.  
  7176.  
  7177.  
  7178.  
  7179.  
  7180.      Appendix F  Numeric Arguments to Commands                     80
  7181.         F.1  Commands unaffected by numeric arguments.  . . . . .  84
  7182.  
  7183.      Appendix G  Supported machines                                85
  7184.  
  7185.      Appendix H  Function Keys                                     87
  7186.  
  7187.      Appendix I  Machine Dependent Notes                           88
  7188.         I.1  IBM-PC/XT/AT and its clones  . . . . . . . . . . . .  88
  7189.         I.2  HP 150 . . . . . . . . . . . . . . . . . . . . . . .  90
  7190.         I.3  Atari 520/1040ST . . . . . . . . . . . . . . . . . .  91
  7191.         I.4  Amiga 1000 . . . . . . . . . . . . . . . . . . . . .  93
  7192.         I.5  UNIX V5, V7, and BSD4.[23] . . . . . . . . . . . . .  94
  7193.         I.6  DEC VMS operating system . . . . . . . . . . . . . .  95
  7194.  
  7195.      Appendix J  Mode Flags                                       101
  7196.  
  7197.      Index                                                        103
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.  
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.  
  7210.  
  7211.  
  7212.  
  7213.  
  7214.  
  7215.  
  7216.  
  7217.  
  7218.  
  7219.  
  7220.  
  7221.  
  7222.  
  7223.  
  7224.  
  7225.  
  7226.  
  7227.  
  7228.  
  7229.  
  7230.  
  7231.  
  7232.  
  7233.  
  7234.  
  7235.  
  7236.                                     iii
  7237.  
  7238.  
  7239.  
  7240.