home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / text_ed / emacs / emacs.txt < prev    next >
Text File  |  1989-06-07  |  181KB  |  5,413 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                           MicroEMACS
  19.  
  20.                           Full Screen Text Editor
  21.                           Reference Manual (preliminary draft)
  22.  
  23.                           Version 3.9e
  24.                           November 4, 1987
  25.  
  26.                           (C)opyright 1987 by Daniel M. Lawrence
  27.                           Reference Manual (C)opyright 1987
  28.                                   by Brian Straight and Daniel M. Lawrence
  29.                           All Rights Reserved
  30.  
  31.                           MicroEMACS 3.9e  can  be  copied  and distributed
  32.           freely
  33.                           for any non-commercial purposes. MicroEMACS  3.9e
  34.           can
  35.                           only  be  incorporated into  commercial  software
  36.           with
  37.                           the permission of the current author.
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           Introduction
  74.  
  75.                   MicroEMACS is a tool for creating and changing documents,
  76.           programs, and other text  files.   It is both relatively easy for
  77.           the novice to  use,  but  also  very  powerful in the hands of an
  78.           expert. MicroEMACS can be extensively customized for the needs of
  79.           the individual user.
  80.  
  81.                   MicroEMACS allows  several files to be edited at the same
  82.           time.  The  screen  can be split into different windows, and text
  83.           may  be  moved  freely from one window to the next.  Depending on
  84.           the  type  of  file  being  edited, MicroEMACS can change how  it
  85.           behaves to make editing simple.    Editing  standard  text files,
  86.           program files and  word  processing documents are all possible at
  87.           the same time.
  88.  
  89.                   There are extensive  capabilities to make word processing
  90.           and editing  easier.  These include commands for string searching
  91.           and replacing,  paragraph  reformatting  and  deleting, automatic
  92.           word wrapping,  word move and deletes, easy case controlling, and
  93.           automatic word counts.
  94.  
  95.                   For complex and  repetitive editing tasks editing macroes
  96.           can be written.  These macroes  allow  the user a great degree of
  97.           flexibility in determining how MicroEMACS behaves.  Also, any and
  98.           all the commands  can  be  used  by any keystroke by changing, or
  99.           rebinding, what commands various keys  are  connected,  or bound,
  100.           to.
  101.  
  102.                   Special features are also available to perform  a diverse
  103.           set of  operations such as file encryption, automatic backup file
  104.           generation, entabbing  and  detabbing  lines,  executing  of  DOS
  105.           commands and  filtering of text through other programs (like SORT
  106.           to allow sorting text).
  107.  
  108.           History
  109.  
  110.                   EMACS was originally a  text  editor  written  by Richard
  111.           Stahlman  at  MIT  in  the  early  1970s  for  Digital  Equipment
  112.           computers. Various versions, rewrites  and  clones  have  made an
  113.           appearence since.
  114.  
  115.                   This version of MicroEMACS is derived  from  code written
  116.           by Dave G. Conroy in 1985.  Later modifications were performed by
  117.           Steve  Wilhite  and  George  Jones.   In December of 1985  Daniel
  118.           Lawrence picked up the then current source (version 2.0) and made
  119.           extensive modifications and additions  to  it  over the course of
  120.           the next two years.  Updates and support for the  current version
  121.           are still availible.  The current program author can be contacted
  122.           by writing to:
  123.  
  124.                   USMAIL: Daniel Lawrence
  125.                           617 New York St
  126.                           Lafayette, IN 47901
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.                   UUCP:   ihnp4!pur-ee!pur-phy!duncan!lawrence
  139.                   ARPA:   nwd@j.cc.purdue.edu
  140.                   FIDO:   Fido 201/2 The Programmer's Room (317) 742-5533
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.           Basic Concepts                        MicroEMACS Reference Manual
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.                                       Chapter 1
  212.  
  213.                                    Basic Concepts
  214.  
  215.  
  216.                   The current version of MicroEMACS  is  3.9e  (Third major
  217.           re-write, ninth public release,  fifth  minor  edit), and for the
  218.           rest of this document,  we  shall simply refer to this version as
  219.           "EMACS".  Any modifications for  later versions will be listed in
  220.           the appendixes at the end of this manual.
  221.  
  222.  
  223.           1.1  Keys and the Keyboard
  224.  
  225.  
  226.                   Many times throughout  this  manual  we  will  be talking
  227.           about commands and the  keys  on the keyboard needed to use them.
  228.           There  are  a  number of "special" keys which can be used and are
  229.           listed here:
  230.  
  231.           <NL>           NewLine which is also called RETURN or ENTER, this
  232.                          key is used to end different commands.
  233.  
  234.           ^              The control key can be used before  any alphabetic
  235.                          character and some symbols.  For example, ^C means
  236.                          to hold down the <CONTROL>  key and type the C key
  237.                          at the same time.
  238.  
  239.           ^X             The CONTROL-X key is used at the beginning of many
  240.                          different commands.
  241.  
  242.           META or M-     This is a special EMACS  key  used  to  begin many
  243.                          commands as well.   This  key  is pressed and then
  244.                          released  before  typing  the  next character.  On
  245.                          most systems, this is the <ESC> key, but it can be
  246.                          changed.  (consult appendix E to learn what key is
  247.                          used for META on your computer).
  248.  
  249.                   Whenever a command is described, the manual will list the
  250.           actual  keystrokes needed to execute it  in  boldface  using  the
  251.           above conventions, and also the name of the command in italics.
  252.  
  253.  
  254.           1.2  Getting Started
  255.  
  256.  
  257.                   In  order to use EMACS, you must call  it  up  from  your
  258.           system or computer's command prompt.  On UNIX and MSDOS machines,
  259.  
  260.  
  261.           1
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.           MicroEMACS Reference Manual                        Basic Concepts
  269.  
  270.  
  271.           just type "emacs" from the main command prompt and follow it with
  272.           the  <RETURN>  or  <ENTER> key (we will refer to this key as <NL>
  273.           for  "new-line"  for  the remainder of  this  manual).    On  the
  274.           Macintosh, the Amiga, the ATARI ST and other icon based operating
  275.           systems, double click on the uEMACS icon. Shortly  after  this, a
  276.           screen similar to the one below should appear.
  277.  
  278.  
  279.           1.3  Parts and Pieces
  280.  
  281.  
  282.                   The screen is divided into  a number of areas or windows.
  283.           On some systems  the  top  window  contains  a  function  list of
  284.           unshifted and shifted function keys.   We will discuss these keys
  285.           later.  Below  them  is an EMACS mode line which, as we will see,
  286.           informs you of the present mode of operation  of  the editor--for
  287.           example "(WRAP)" if  you  set  EMACS  to  wrap at the end of each
  288.           line. Under the mode  line  is the text window where text appears
  289.           and is manipulated.    Since  each  window has its own mode line,
  290.           below the text window is it's  mode  line.   The last line of the
  291.           screen is the command line where EMACS takes commands and reports
  292.           on what it is doing.
  293.  
  294.           ===============================================================================
  295.           f1 search-> f2 <-search |    MicroEMACS:  Text Editor
  296.           f3 hunt->   f4 <-hunt   |
  297.           f5 fkeys    f6 help     |  Available function key Pages include:
  298.           f7 nxt wind f8 pg[    ] |    WORD  PROG  BOX
  299.           f9 save     f10 exit    |  [use the f8 key to load Pages]
  300.           ===============================================================================
  301.           -- MicroEMACS 3.9e () -- Function Keys
  302.           ---------------------------------------
  303.           ===============================================================================
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.           ===============================================================================
  317.           -- MicroEMACS 3.9e () -- Main
  318.           ------------------------------------------------
  319.           ===============================================================================
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                           2
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.           Basic Concepts                        MicroEMACS Reference Manual
  335.  
  336.  
  337.                           Fig 1:  EMACS screen on an IBM-PC
  338.  
  339.  
  340.           1.4  Entering Text
  341.  
  342.  
  343.                   Entering text in EMACS is  simple.    Type  the following
  344.           sentence fragment:
  345.  
  346.                Fang Rock lighthouse, center of a series  of mysterious
  347.                and
  348.  
  349.           The text is displayed at the top of the text window.  Now type:
  350.  
  351.                terrifying events at the turn of the century
  352.  
  353.                   Notice the text to the  left of the cursor disappears and
  354.           a '$' sign appears.    Don't  panic--your  text is safe!!! You've
  355.           just discovered that EMACS doesn't "wrap" text to  the  next line
  356.           like most word processors  unless  you hit <NL>.  But since EMACS
  357.           is used for both word processing, and text editing, it has  a bit
  358.           of a dual personality.   You  can  change  the  way  it  works by
  359.           setting various modes.  In this case, you need to set  WRAP mode,
  360.           using the add-mode command, by typing ^X-M.  The command  line at
  361.           the base of the screen will prompt you for the  mode  you wish to
  362.           add.   Type  wrap  followed  by the <NL> key and any text you now
  363.           enter  will  be  wrapped.  However, the command doesn't wrap text
  364.           already entered.   To  get  rid  of  the  truncated  line, delete
  365.           characters with the <BACKSPACE> key until the '$' goes away.  Now
  366.           type in the words you deleted,  watch  how EMACS goes down to the
  367.           next line at the right time.  (In some versions of EMACS, WRAP is
  368.           a  default  mode  in which case you don't have to worry about the
  369.           instructions relating to adding this mode.)
  370.  
  371.                   Now let's type  a  longer  insert.   Hit <NL> a couple of
  372.           times to tab down from the text you just entered.    Now type the
  373.           following paragraphs.   Press  <NL> twice to indicate a paragraph
  374.           break.
  375.  
  376.                Fang Rock lighthouse, center of a series  of mysterious
  377.                and terrifying events at  the  turn  of the century, is
  378.                built  on a rocky island a few  miles  of  the  Channel
  379.                coast.  So small is  the island that wherever you stand
  380.                its rocks are wet with sea spray.
  381.  
  382.                The lighthouse tower is in the center of the island.  A
  383.                steep  flight  of  steps leads to the heavy door in its
  384.                base.  Winding stairs lead up to the crew room.
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.           3
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.           MicroEMACS Reference Manual                        Basic Concepts
  401.  
  402.  
  403.           1.5  Basic cursor movement
  404.  
  405.  
  406.                   Now let's practice moving around in this text.    To move
  407.           the cursor back  to  the word "Winding," enter M-B previous-word.
  408.           This command moves the cursor backwards by one word  at  a  time.
  409.           Note you have to press the key combination every time  the cursor
  410.           steps back by one word.   Continuously pressing META and toggling
  411.           B  produces  an  error  message.    To  move  forward to the word
  412.           "stairs" enter M-F, which moves the cursor forward by one word at
  413.           a time.
  414.  
  415.                   Notice that EMACS commands  are  usually  mnemonic--F for
  416.           forward, B for backward, for example.
  417.  
  418.                   To move the  cursor  up one line, enter ^P previous-line,
  419.           down one line ^N next-line.  Practice this movement by moving the
  420.           cursor to the word "terrifying" in the second line.
  421.  
  422.                   The  cursor  may  also be moved forward  or  backward  in
  423.           smaller increments.  To move forward by one  character,  enter ^F
  424.           forward-character,  to  move  backward,  ^B   backward-character.
  425.           EMACS also allows you to specify a number which is  normally used
  426.           to  tell  a  command to execute  many  times.    To  repeat  most
  427.           commands, press META and  then  the  number  before you enter the
  428.           command.   Thus,  the  command  META  5  ^F (M-5^F) will move the
  429.           cursor forward by five characters.  Try moving around in the text
  430.           by using these commands.    For extra practice, see how close you
  431.           can come to the word "small" in the first paragraph by  giving an
  432.           argument to the commands listed here.
  433.  
  434.                   Two other  simple cursor commands that are useful to help
  435.           us move around in the text are M-N next-paragraph which moves the
  436.           cursor to the second paragraph, and M-P  previous-paragraph which
  437.           moves it back to the previous paragraph.  The cursor may  also be
  438.           moved rapidly from one end of  the  line  to the other.  Move the
  439.           cursor to the word "few" in the second line.  Press ^A beginning-
  440.           of-line.  Notice  the  cursor  moves  to the word "events" at the
  441.           beginning of the line.   Pressing ^E end-of-line moves the cursor
  442.           to the end of the line.
  443.  
  444.                   Finally,  the  cursor  may be moved from any point in the
  445.           file to the end or beginning  of  the file.  Entering M-> end-of-
  446.           file moves the cursor to the end of the buffer, M-< beginning-of-
  447.           file to the first character of the file.
  448.  
  449.                   On the IBM-PC, the ATARI  ST and many other machines, the
  450.           cursor  keys can also be used to move the cursor about.  Also, if
  451.           there is one available, moving the mouse will move the cursor.
  452.  
  453.                   Practice  moving the cursor in the  text  until  you  are
  454.           comfortable with the commands we've explored in this chapter.
  455.  
  456.  
  457.  
  458.  
  459.                                                                           4
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.           Basic Concepts                        MicroEMACS Reference Manual
  467.  
  468.  
  469.           1.6  Saving your text
  470.  
  471.  
  472.                   When you've  finished  practicing  cursor  movement, save
  473.           your file.  Your file currently resides in a BUFFER.   The buffer
  474.           is a temporary storage area for  your  text, and is lost when the
  475.           computer is  turned  off.    You can save the buffer to a file by
  476.           entering ^X-^S save-file.  Notice  that  EMACS  informs  you that
  477.           your file has no name and will not let you save it.
  478.  
  479.                   To save your buffer to a file with a different  name than
  480.           it's current one (which is  empty), press ^X^W write-file.  EMACS
  481.           will  prompt  you  for the filename you wish to write.  Enter the
  482.           name fang.txt and press return.  On a micro, the drive light will
  483.           come  on, and EMACS will inform you it is writing the file.  When
  484.           it finishes, it will inform you of the  number  of  lines  it has
  485.           written to the disk.
  486.  
  487.                   Congratulations!!  You've just  saved  your  first  EMACS
  488.           file!
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.           5
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.           MicroEMACS Reference Manual                        Basic Concepts
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.                                   Chapter 1 Summary
  540.  
  541.  
  542.                   In chapter 1, you  learned  how to enter text, how to use
  543.           wrap mode,  how  to  move  the cursor, and to save a buffer.  The
  544.           following is a table of the commands covered in this  chapter and
  545.           their corresponding key bindings:
  546.  
  547.           Key Binding             Keystroke       Effect
  548.  
  549.           abort-command           ^G              aborts current command
  550.  
  551.           add-mode                ^XM             allows addition of EMACS
  552.                                                   mode such as WRAP
  553.  
  554.           backward-character      ^B              moves cursor left one character
  555.  
  556.           beginning-of-file       M-<             moves cursor to beginning of file
  557.  
  558.           beginning-of-line       ^A              moves cursor to beginning of line
  559.  
  560.           end-of-file             M->             moves cursor to end of file
  561.  
  562.           end-of-line             ^E              moves cursor to end of line
  563.  
  564.           forward-character       ^F              moves cursor right one character
  565.  
  566.           next-line               ^N              moves cursor to next line
  567.  
  568.           next-paragraph          M-N             moves cursor to next paragraph
  569.  
  570.           next-word               M-F             moves cursor forward one word
  571.  
  572.           previous-line           ^P              moves cursor backward by one line
  573.  
  574.           previous-paragraph      M-P             moves cursor to previous paragraph
  575.  
  576.           previous-word           M-B             moves cursor backward by one word
  577.  
  578.           save-file               ^X-^S           saves current buffer to a file
  579.  
  580.           write-file              ^X-^W           save current buffer under a new
  581.                                                   name
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                                                                           6
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.           Basic Editing--Simple Insertions and Deletions         MicroEMACS
  599.                                                            Reference Manual
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.                                       Chapter 2
  609.  
  610.                    Basic Editing--Simple Insertions and Deletions
  611.  
  612.  
  613.           2.1  A Word About Windows, Buffers, Screens, and Modes
  614.  
  615.  
  616.                   In the first chapter, you  learned how to create and save
  617.           a file in EMACS. Let's do some more editing on  this  file.  Call
  618.           up emacs by typing in the following command.
  619.  
  620.                   emacs fang.txt
  621.  
  622.                   On icon oriented  systems,  double  click  on  the uEMACS
  623.           icon, usually a file dialog box of some sort will appear.  Choose
  624.           FANG.TXT from the appropriate folder.
  625.  
  626.                   Shortly after you invoke EMACS, the text should appear on
  627.           the screen ready for you to  edit.    The text you are looking at
  628.           currently resides in a buffer.   A  buffer is a temporary area of
  629.           computer  memory  which  is the primary unit internal to EMACS --
  630.           this is the place where EMACS goes to work.  The mode line at the
  631.           bottom of the screen lists the buffer name, FANG.TXT and the name
  632.           of the file with which this buffer is associated, FANG.TXT
  633.  
  634.                   The computer talks to you  through the use of its screen.
  635.           This screen usually has an area of 24 lines each of 80 characters
  636.           across.  You can  use  EMACS to subdivide the screen into several
  637.           separate  work  areas,  or windows, each of which can be 'looking
  638.           into'  different  files  or sections of text.  Using windows, you
  639.           can work on several related texts at one time, copying and moving
  640.           blocks of text between windows with ease.  To keep track  of what
  641.           you are editing, each window is identified by a mode line  on the
  642.           last line of the window which lists the name of the  buffer which
  643.           it  is  looking  into, the file from which the text was read, and
  644.           how the text is being edited.
  645.  
  646.                   An  EMACS  mode  tells EMACS how to deal with user input.
  647.           As we have already seen, the mode 'WRAP' controls how EMACS deals
  648.           with long lines (lines with over 79 characters) while the user is
  649.           typing  them  in.   The 'VIEW' mode, allows you to  read  a  file
  650.           without modifying it.  Modes  are associated with buffers and not
  651.           with files; hence, a  mode  needs to be explicitly set or removed
  652.           every time you edit a file.  A new file read into a buffer with a
  653.           previously specified mode will be edited under this mode.  If you
  654.  
  655.  
  656.  
  657.           7
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.           MicroEMACS Reference Manual  Basic Editing--Simple Insertions and
  665.                                                                   Deletions
  666.  
  667.  
  668.           use specific modes frequently, EMACS  allows you to set the modes
  669.           which are used by all new buffers, called global modes.
  670.  
  671.  
  672.           2.2  Insertions
  673.  
  674.  
  675.                   Your previously-saved text should look like this:
  676.  
  677.                Fang Rock lighthouse, center of a series  of mysterious
  678.                and terrifying events at  the  turn  of the century, is
  679.                built  on a rocky island a few  miles  of  the  Channel
  680.                coast.  So small is  the island that wherever you stand
  681.                its rocks are wet with sea spray.
  682.  
  683.                The lighthouse tower is in the center of the island.  A
  684.                steep  flight  of  steps leads to the heavy door in its
  685.                base.  Winding stairs lead up to the crew room.
  686.  
  687.                   Let's assume you want  to  add  a  sentence in the second
  688.           paragraph after the word "base."  Move the cursor until it  is on
  689.           the "W" of "Winding". Now type the following:
  690.  
  691.                This gives entry to the lower floor where the big steam
  692.                generator throbs steadily away, providing power for the
  693.                electric lantern.
  694.  
  695.                   If  the line fails to wrap and you end up with a '$' sign
  696.           in the right margin,  just  enter  M-Q fill-paragraph to reformat
  697.           the  paragraph.    This  new  command  attempts  to  fill  out  a
  698.           paragraph.  Long lines  are  divided  up,  and words are shuffled
  699.           around to make the paragraph look nicer.
  700.  
  701.                   Notice  that  all  visible  EMACS  characters  are  self-
  702.           inserting -- all you had to do was type the characters  to insert
  703.           and the existing text made space  for  it.  With a few exceptions
  704.           discussed later, all non-printing characters (such as  control or
  705.           escape sequences) are commands.  To insert spaces, simply use the
  706.           space bar.  Now move to the first line of the  file  and  type ^O
  707.           open-line (Oh, not zero).  You've just learned how  to  insert  a
  708.           blank line in your text.
  709.  
  710.  
  711.           2.3  Deletions
  712.  
  713.  
  714.                   EMACS offers  a number of deletion options.  For example,
  715.           move the cursor until it's under the period  at  the  end  of the
  716.           insertion you just did.  Press the backspace key.  Notice the "n"
  717.           on "lantern"  disappeared.  The backspace implemented on EMACS is
  718.           called  a  destructive  backspace--it  removes  text  immediately
  719.           before the current cursor position from the buffer.  Now  type ^H
  720.  
  721.  
  722.  
  723.                                                                           8
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.           Basic Editing--Simple Insertions and Deletions         MicroEMACS
  731.                                                            Reference Manual
  732.  
  733.  
  734.           delete-previous-character.  Notice that the cursor moves back and
  735.           obliterates the "r"--either command will backspace the cursor.
  736.  
  737.                   Type in the two letters you erased to  restore  your text
  738.           and move the cursor to the beginning of the buffer M-> beginning-
  739.           of-file.  Move the cursor down  one  line to the beginning of the
  740.           first paragraph.
  741.  
  742.                   To  delete  the  forward  character, type ^D delete-next-
  743.           character.  The "F" of "Fang" disappears.  Continue  to  type  ^D
  744.           until the whole word is erased EMACS also permits the deletion of
  745.           larger elements of text.  Move the cursor to the word "center" in
  746.           the first line of text.  Pressing  M-<backspace> delete-previous-
  747.           word kills the word immediately before the cursor.  M-^H  has the
  748.           same effect.
  749.  
  750.                   Notice that  the commands are very similar to the control
  751.           commands you used to  delete  individual  letters.   As a general
  752.           rule in EMACS, control sequences affect small areas of text, META
  753.           sequences larger areas.  The  word forward of the cursor position
  754.           can therefore be deleted by  typing  M-D  delete-next-word.   Now
  755.           let's take out the remainder of the first line by typing ^K kill-
  756.           to-end-of-line.  You now have a blank line  at  the  top  of your
  757.           screen.   Typing ^K again or ^X-^O delete-blank-lines deletes the
  758.           blank  line  and  flushes the second line to the top of the text.
  759.           Now exit EMACS by typing ^X-^C exit-emacs .  Notice EMACS reminds
  760.           you that you have not saved your buffer.  Ignore the  warning and
  761.           exit.  This  way  you  can  exit  EMACS without saving any of the
  762.           changes you just made.
  763.  
  764.  
  765.  
  766.  
  767.                                   Chapter 2 Summary
  768.  
  769.  
  770.                   In Chapter  2,  you  learned  about  the  basic 'building
  771.           blocks' of an EMACS text file--buffers, windows, and files.
  772.  
  773.           Key binding             Keystroke       Effect
  774.           delete-previous-character
  775.                                   ^H              deletes character immediately
  776.                                                   before
  777.                                                   the current cursor position
  778.  
  779.           delete-next-character   ^D              deletes character immediately after
  780.                                                   current cursor position
  781.  
  782.           delete-previous-word    M-^H            deletes word immediately before
  783.                                                   current cursor position
  784.  
  785.           delete-next-word        M-D             deletes word immediately after
  786.                                                   current cursor position
  787.  
  788.  
  789.           9
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.           MicroEMACS Reference Manual  Basic Editing--Simple Insertions and
  797.                                                                   Deletions
  798.  
  799.  
  800.           kill-to-end-of-line     ^K              deletes from current cursor
  801.                                                   position to end of line
  802.  
  803.           insert-space            ^C              inserts a space to right of cursor
  804.  
  805.           open-line               ^O              inserts blank line
  806.  
  807.           delete-blank-lines      ^X-^O           removes blank line
  808.  
  809.           exit-emacs              ^X-^C           exits emacs
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                                                          10
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.           Using Regions                         MicroEMACS Reference Manual
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.                                       Chapter 3
  872.  
  873.                                     Using Regions
  874.  
  875.  
  876.           3.1  Defining and Deleting a Region
  877.  
  878.  
  879.                   At this  point its time to familiarize ourselves with two
  880.           more EMACS terms--the point  and  the mark.  The point is located
  881.           directly behind the current  cursor  position.    The mark (as we
  882.           shall see shortly) is user  defined.  These two elements together
  883.           are called the  current  region  and  limit the region of text on
  884.           which EMACS performs many of its editing functions.
  885.  
  886.                   Let's begin by entering some new text.   Don't  forget to
  887.           add wrap  mode  if  its  not set on this buffer.  Start EMACS and
  888.           open a file called PUBLISH.TXT.  Type in the following text:
  889.  
  890.                One of the largest growth areas  in  personal computing
  891.                is electronic publishing.  There are packages available
  892.                for practically  every  machine  from  elegantly simple
  893.                programs  for the humble Commodore 64 to  sophisticated
  894.                professional packages for PC and Macintosh computers.
  895.  
  896.                Electronic publishing is as revolutionary in its way as
  897.                the  Gutenburg  press.    Whereas  the  printing  press
  898.                allowed  the  mass  production  and distribution of the
  899.                written  word, electronic publishing puts the means  of
  900.                production  in  the  hands  of nearly every individual.
  901.                From  the  class  magazine  to  the  corporate  report,
  902.                electronic publishing is changing  the  way  we produce
  903.                and disseminate information.
  904.  
  905.                Personal  publishing  greatly  increases the utility of
  906.                practically every computer.   Thousands  of  people who
  907.                joined the computer revolution of this  decade  only to
  908.                hide their machines unused in closets have discovered a
  909.                new use for them as dedicated publishing workstations.
  910.  
  911.                   Now  let's  do  some editing.  The last paragraph seems a
  912.           little out of place.  To see what the document looks like without
  913.           it we can  cut  it  from  the  text  by  moving the cursor to the
  914.           beginning of the paragraph.   Enter  M-<space>  set-mark.   EMACS
  915.           will respond with "[Mark set]".   Now  move the cursor to the end
  916.           of the paragraph.  You have  just  defined  a region of text.  To
  917.           remove  this  text  from  the  screen, type ^W kill-region.   The
  918.           paragraph disappears from the screen.
  919.  
  920.  
  921.           11
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.           MicroEMACS Reference Manual                         Using Regions
  929.  
  930.  
  931.                   On further consideration, however, perhaps  the paragraph
  932.           we cut wasn't so bad after all.  The problem may have been one of
  933.           placement.  If  we  could  tack  it  on  to  the end of the first
  934.           paragraph it might work quite  well to support and strengthen the
  935.           argument.  Move the cursor to the end of the first  paragraph and
  936.           enter ^Y yank.  Your text should now look like this:
  937.  
  938.                One of the largest growth areas  in  personal computing
  939.                is electronic publishing.  There are packages available
  940.                for practically  every  machine  from  elegantly simple
  941.                programs  for the humble Commodore 64 to  sophisticated
  942.                professional  packages for PC and Macintosh  computers.
  943.                Personal  publishing  greatly  increases the utility of
  944.                practically every computer.   Thousands  of  people who
  945.                joined the computer revolution of this  decade  only to
  946.                hide their machines unused in closets have discovered a
  947.                new use for them as dedicated publishing workstations.
  948.  
  949.                Electronic publishing is as revolutionary in its way as
  950.                the  Gutenburg  press.    Whereas  the  printing  press
  951.                allowed  the  mass  production  and distribution of the
  952.                written  word, electronic publishing puts the means  of
  953.                production  in  the  hands  of nearly every individual.
  954.                From  the  class  magazine  to  the  corporate  report,
  955.                electronic publishing is changing  the  way  we produce
  956.                and disseminate information.
  957.  
  958.  
  959.           3.2  Yanking a Region
  960.  
  961.  
  962.                   The text you cut initially didn't simply  just disappear,
  963.           it  was  cut  into  a  buffer  that  retains  the  'killed'  text
  964.           appropriately called the kill buffer.  ^Y "yanks"  the  text back
  965.           from this buffer into the current buffer. If you have a long line
  966.           (indicated,  remember,  by  the  "$"  sign),  simply  hit M-Q  to
  967.           reformat the paragraph.
  968.  
  969.                   There are other uses to which the kill buffer can be put.
  970.           Using the method we've already learned, define the last paragraph
  971.           as  a  region.   Now type M-W copy-region.  Nothing seems to have
  972.           happened; the cursor stays  blinking  at  the  point.  But things
  973.           have  changed,  even  though you may  not  be  able  to  see  any
  974.           alteration.
  975.  
  976.                   To  see what has happened to the  contents  of  the  kill
  977.           buffer, move the  cursor  down  a  couple of lines and "yank" the
  978.           contents  of  the kill buffer back with  ^Y.    Notice  the  last
  979.           paragraph is now repeated.  The region you defined is "tacked on"
  980.           to the end of your file because M-W copies a  region  to the kill
  981.           buffer while leaving the  original  text  in your working buffer.
  982.           Some caution is needed however,  because the contents of the kill
  983.           buffer are updated when you delete any regions,  lines  or words.
  984.           If  you  are  moving  large  quantities  of  text,  complete  the
  985.  
  986.  
  987.                                                                          12
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.           Using Regions                         MicroEMACS Reference Manual
  995.  
  996.  
  997.           operation before you do any more deletions or you could find that
  998.           the  text  you  want to move has been replaced by the most recent
  999.           deletion.  Remember--a buffer is  a  temporary  area  of computer
  1000.           memory that is lost when the machine is powered down  or switched
  1001.           off.  In order to make your changes permanent, they must be saved
  1002.           to  a  file  before you leave EMACS.  Let's delete the section of
  1003.           text we just added and save the file to disk.
  1004.  
  1005.  
  1006.  
  1007.  
  1008.                                   Chapter 3 Summary
  1009.  
  1010.  
  1011.                   In  Chapter  3,  you  learned  how   to   achieve  longer
  1012.           insertions  and  deletions.   The EMACS terms point and mark were
  1013.           introduced and you learned how to manipulate text  with  the kill
  1014.           buffer.
  1015.  
  1016.           Key Binding     Keystroke       Effect
  1017.  
  1018.           Delete-Region   ^W              Deletes region between point and mark and
  1019.                                           places it in KILL buffer
  1020.  
  1021.           Copy-Region     M-W             Copies text between point and mark into
  1022.                                           KILL buffer
  1023.  
  1024.           Yank-Text       ^Y              Inserts a copy of the KILL buffer into
  1025.                                           current buffer at point
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.           13
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.           MicroEMACS Reference Manual                    Search and Replace
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.                                       Chapter 4
  1070.  
  1071.                                  Search and Replace
  1072.  
  1073.  
  1074.           4.1  Forward Search
  1075.  
  1076.  
  1077.                   Load EMACS and bring in the file you just  saved.    Your
  1078.           file should look like the one below.
  1079.  
  1080.                One of the largest growth areas  in  personal computing
  1081.                is electronic publishing.  There are packages available
  1082.                for practically  every  machine  from  elegantly simple
  1083.                programs  for the humble Commodore 64 to  sophisticated
  1084.                professional  packages for PC and Macintosh  computers.
  1085.                Personal  publishing  greatly  increases the utility of
  1086.                practically every computer.   Thousands  of  people who
  1087.                joined the computer revolution of this  decade  only to
  1088.                hide their machines unused in closets have discovered a
  1089.                new use for them as dedicated publishing workstations.
  1090.  
  1091.                Electronic publishing is as revolutionary in its way as
  1092.                the  Gutenburg  press.    Whereas  the  printing  press
  1093.                allowed  the  mass  production  and distribution of the
  1094.                written  word, electronic publishing puts the means  of
  1095.                production  in  the  hands  of nearly every individual.
  1096.                From  the  class  magazine  to  the  corporate  report,
  1097.                electronic publishing is changing  the  way  we produce
  1098.                and disseminate information.
  1099.  
  1100.                   Let's use EMACS to search for the word "revolutionary" in
  1101.           the second paragraph.   Because  EMACS  searches from the current
  1102.           cursor  position  toward  the  end  of buffers, and we intend  to
  1103.           search forward, move the  cursor  to  the  beginning of the text.
  1104.           Enter ^S search-forward.  Note that the command line now reads
  1105.  
  1106.                   "Search [] <META>:"
  1107.  
  1108.                   EMACS is prompting you to  enter the search string -- the
  1109.           text you want to find.  Enter the word revolutionary and  hit the
  1110.           META  key.     The   cursor   moves   to  the  end  of  the  word
  1111.           "revolutionary."
  1112.  
  1113.                   Notice  that  you  must enter the <META> key to start the
  1114.           search.  If you simply press <NL> the command line  responds with
  1115.           "<NL>".  Although this may seem infuriating to users who are used
  1116.           to pressing the return key to execute any command, EMACS'  use of
  1117.  
  1118.  
  1119.                                                                          14
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.           Search and Replace                    MicroEMACS Reference Manual
  1127.  
  1128.  
  1129.           <META>  to  begin  searches allows it to pinpoint text with great
  1130.           accuracy.  After every line wrap or carriage return, EMACS 'sees'
  1131.           a new line character (<NL>).  If you need to search for a word at
  1132.           the end of a line, you can specify this word uniquely in EMACS.
  1133.  
  1134.                   In our sample text for example, the word  "and"  occurs a
  1135.           number  of times, but only once at the end of a line.  To  search
  1136.           for this particular occurence of the word, move the cursor to the
  1137.           beginning of the buffer and type ^S.  Notice  that  EMACS  stores
  1138.           the last specified search  string  as the default string.  If you
  1139.           press  <META>  now,  EMACS will search for the default string, in
  1140.           this case, "revolutionary."
  1141.  
  1142.                   To change this string so  we can search for our specified
  1143.           "and" simply enter the word and followed by <NL>.    The  command
  1144.           line now shows:
  1145.  
  1146.                   "search [and<NL>]<META>:"
  1147.  
  1148.                   Press <META> and the cursor moves to "and" at the  end of
  1149.           the second last line.
  1150.  
  1151.  
  1152.           4.2  Exact Searches
  1153.  
  1154.  
  1155.                   If the mode EXACT is  active in the current buffer, EMACS
  1156.           searches on a case sensitive basis.  Thus, for example  you could
  1157.           search for Publishing as distinct from publishing.
  1158.  
  1159.  
  1160.           4.3  Backward Search
  1161.  
  1162.  
  1163.                   Backward  searching is very similar to forward  searching
  1164.           except  that  it  is  implemented  in the reverse direction.   To
  1165.           implement a reverse  search,  type  ^R  search-reverse.   Because
  1166.           EMACS makes no distinction between  forward  and  backward stored
  1167.           search strings, the last search item you entered  appears  as the
  1168.           default string.   Try  searching  back  for  any  word  that lies
  1169.           between the cursor and the beginning of the buffer.   Notice that
  1170.           when the item is found, the  point  moves to the beginning of the
  1171.           found string (i.e., the cursor  appears under the first letter of
  1172.           the search item).
  1173.  
  1174.                   Practice searching for other words in your text.
  1175.  
  1176.  
  1177.           4.4  Searching and Replacing
  1178.  
  1179.  
  1180.                   Searching and replacing is  a  powerful  and quick way of
  1181.           making changes to your text.  Our sample text is about electronic
  1182.           publishing, but the correct term  is  'desktop'  publishing.   To
  1183.  
  1184.  
  1185.           15
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.           MicroEMACS Reference Manual                    Search and Replace
  1193.  
  1194.  
  1195.           make the necessary changes we need to replace  all  occurences of
  1196.           the word "electronic"  with  "desktop." First, move the cursor to
  1197.           the top of the current buffer with the M-< command.  Then type M-
  1198.           R replace-string.  The command line responds:
  1199.  
  1200.                   "Replace []<META>:"
  1201.  
  1202.                   where  the  square  brackets  enclose the default string.
  1203.           Type the word  electronic  and  hit  <META>.    The  command line
  1204.           responds:
  1205.  
  1206.                   "with []<META>"
  1207.  
  1208.                   type desktop<META>.  EMACS replaces all instances  of the
  1209.           original word with your revision.  Of course, you  will  have  to
  1210.           capitalize the first letter of "desktop" where it  occurs  at the
  1211.           beginning of a sentence.
  1212.  
  1213.                   You have just completed  an  unconditional  replace.   In
  1214.           this operation, EMACS replaces every instance of the found string
  1215.           with the replacement string.
  1216.  
  1217.  
  1218.           4.5  Query-Replace
  1219.  
  1220.  
  1221.                   You may also replace text on  a  case by case basis.  The
  1222.           M-^R query-replace-string command causes EMACS to  pause  at each
  1223.           instance of the found string.
  1224.  
  1225.                   For example,  assume we want to replace some instances of
  1226.           the  word  "desktop"  with  the  word "personal." Go back to  the
  1227.           beginning of  the current buffer and enter the M-^R query-replace
  1228.           command.    The  procedure is very  similar  to  that  which  you
  1229.           followed in the unconditional search/replace  option.    When the
  1230.           search begins however, you will  notice that EMACS pauses at each
  1231.           instance of "publishing" and asks  whether you wish to replace it
  1232.           with the replacement  string.    You  have  a  number  of options
  1233.           available for response:
  1234.  
  1235.                   Response        Effect
  1236.                   Y(es)   Make the current replacement and skip to the next
  1237.                           occurence of the search string
  1238.  
  1239.                   N(o)    Do not make this replacement but continue
  1240.  
  1241.                   !       Do the rest of the replacements with no more queries
  1242.  
  1243.                   U(ndo)  Undo just the last replacement and query for it
  1244.                           again (This can only go back ONE time)
  1245.  
  1246.                   ^G      Abort the replacement command (This action does not
  1247.                           undo previously-authorized replacements
  1248.  
  1249.  
  1250.  
  1251.                                                                          16
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.           Search and Replace                    MicroEMACS Reference Manual
  1259.  
  1260.  
  1261.                   .       Same effect as ^G, but cursor returns to the point at
  1262.                           which the replacement command was given
  1263.  
  1264.                   ?       This lists help for the query replacement command
  1265.  
  1266.                   Practice searching and  searching and replacing until you
  1267.           feel comfortable with the commands and their effects.
  1268.  
  1269.  
  1270.  
  1271.  
  1272.                                   Chapter 4 Summary
  1273.  
  1274.  
  1275.                   In this  chapter, you learned how to search for specified
  1276.           strings of text in EMACS.  The chapter also dealt  with searching
  1277.           for and replacing elements within a buffer.
  1278.  
  1279.           Key Binding             Keystroke                        Effect
  1280.  
  1281.           Search-Forward          ^S      Searches from point to end of buffer.
  1282.                                           Point is moved from current location to
  1283.                                           the end of the found string
  1284.  
  1285.           Search-Backward         ^R      Searches from point to beginning of buffer.
  1286.                                           Point is moved from current location to
  1287.                                           beginning of found string
  1288.  
  1289.           Replace                 M-R Replace ALL ocurrences of search string with
  1290.                                           specified (null) string from point to the
  1291.                                           end of the current buffer
  1292.  
  1293.           Query-Replace          M-^R     As above, but pause at each found string
  1294.                                           and query for action
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.           17
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.           MicroEMACS Reference Manual                               Windows
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.                                       Chapter 5
  1334.  
  1335.                                        Windows
  1336.  
  1337.  
  1338.           5.1  Creating Windows
  1339.  
  1340.  
  1341.                   We  have  already  met windows in an earlier chapter.  In
  1342.           this  chapter,  we  will  explore  one  of  EMACS' more  powerful
  1343.           features   --  text  manipulation  through  multiple   windowing.
  1344.           Windows  offer  you  a powerful and easy way to edit  text.    By
  1345.           manipulating  a  number  of  windows  and buffers on  the  screen
  1346.           simultaneously, you can perform complete edits  and  revisions on
  1347.           the computer screen while having your draft text or original data
  1348.           available for reference in another window.
  1349.  
  1350.                   You will recall that windows  are  areas  of  buffer text
  1351.           that  you  can see on the screen.    Because  EMACS  can  support
  1352.           several screen windows simultaneously  you  can  use them to look
  1353.           into different places in the same buffer.  You can also  use them
  1354.           to  look  at  text in different buffers.  In effect, you can edit
  1355.           several files at the same time.
  1356.  
  1357.                   Let's  invoke EMACS and pull back  our  file  on  desktop
  1358.           publishing by typing
  1359.  
  1360.                emacs publish.txt
  1361.  
  1362.                   When  the  text   appears,  type  the  ^X-2  split-window
  1363.           command.  The window  splits  into two windows.  The window where
  1364.           the cursor resides is  called  the current window -- in this case
  1365.           the bottom window.  Notice that each window has a text area and a
  1366.           mode line.  The command line is however, common to all windows on
  1367.           the screen.
  1368.  
  1369.                   The two  windows  on  your  screen  are  virtually mirror
  1370.           images of each other because the new window is  opened  into  the
  1371.           same buffer as the one you are in when you issue  the open-window
  1372.           command.  All  commands  issued  to  EMACS  are  executed  on the
  1373.           current buffer in the current window.
  1374.  
  1375.                   To move the cursor  to  the  upper  window (i.e., to make
  1376.           that  window  the  current  window,  type  ^X-P  previous-window.
  1377.           Notice  the  cursor  moves  to  the  upper  or  previous  window.
  1378.           Entering ^X-O next-window moves to  the  next  window.   Practice
  1379.           moving between windows.   You  will notice that you can also move
  1380.           into the Function Key menu by entering these commands.
  1381.  
  1382.  
  1383.                                                                          18
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.           Windows                               MicroEMACS Reference Manual
  1391.  
  1392.  
  1393.                   Now move to the upper window.  Let's open a new file.  On
  1394.           the  EMACS disk is a tutorial file.  Let's call it into the upper
  1395.           window by typing:
  1396.  
  1397.                ^X-^F
  1398.  
  1399.                   and press return.
  1400.  
  1401.                   Enter the filename emacs.tut.
  1402.  
  1403.                   In a short time,  the  tutorial  file  will appear in the
  1404.           window.  We now have two windows on the screen, each looking into
  1405.           different buffers.  We have just used the ^X-^F find-file command
  1406.           to find a file and bring it into our current window.
  1407.  
  1408.                   You can scroll any  window  up  and  down with the cursor
  1409.           keys, or with the commands we've learned so far. However, because
  1410.           the area of visible text in each window is relatively  small, you
  1411.           can scroll the current window a line at a time.
  1412.  
  1413.                   Type ^X-^N move-window-down
  1414.  
  1415.                   The  current  window  scrolls down by one line -- the top
  1416.           line of  text  scrolls  out  of  view,  and the bottom line moves
  1417.           towards the top of the screen.  You can imagine, if you like, the
  1418.           whole window  slowly  moving  down  to  the  end of the buffer in
  1419.           increments of one line.  The command ^X-^P move-window-up scrolls
  1420.           the window in the opposite direction.
  1421.  
  1422.                   As we have  seen,  EMACS editing commands are executed in
  1423.           the current window, but the program does support a useful feature
  1424.           that allows you to scroll the next window.    M-^Z scroll-next-up
  1425.           scrolls the next  window  up,  M-^V  scroll-next-down  scrolls it
  1426.           downward.   From  the  tutorial  window,  practice  scrolling the
  1427.           window with the desktop publishing text in it up and down.
  1428.  
  1429.                   When you're  finished,  exit  EMACS  without  saving  any
  1430.           changes in your files.
  1431.  
  1432.  
  1433.                   Experiment  with  splitting  the  windows on your screen.
  1434.           Open windows into different buffers and experiment with any other
  1435.           files you may have.  Try editing the  text  in  each  window, but
  1436.           don't  forget  to  save any changes you want to keep -- you still
  1437.           have to save each buffer separately.
  1438.  
  1439.  
  1440.           5.2  Deleting Windows
  1441.  
  1442.  
  1443.           Windows allow you to perform  complex  editing  tasks  with ease.
  1444.           However,  they  become  an  inconvenience  when  your  screen  is
  1445.           cluttered  with  open  windows  you  have  finished  using.   The
  1446.           simplest solution is to delete  unneeded  windows.    The command
  1447.  
  1448.  
  1449.           19
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.           MicroEMACS Reference Manual                               Windows
  1457.  
  1458.  
  1459.           ^X-0 delete-window  will  delete  the  window  you  are currently
  1460.           working in and move you to the next window.
  1461.  
  1462.                   If you have a number of windows open, you can  delete all
  1463.           but the current window by entering ^X-1 delete-other-windows.
  1464.  
  1465.  
  1466.           5.3  Resizing Windows
  1467.  
  1468.  
  1469.                   During complex editing tasks, you will  probably  find it
  1470.           convenient  to  have  a  number   of   windows   on   the  screen
  1471.           simultaneously.       However   this   situation   may    present
  1472.           inconveniences because the more  windows  you  have on the screen
  1473.           the smaller they are; in some cases, a  window  may  show  only a
  1474.           couple of lines of text.  To increase the flexibility and utility
  1475.           of the window environment, EMACS  allows you to resize the window
  1476.           you  are  working  in  (called,  as you will recall, the  current
  1477.           window) to a convenient size  for easier editing, and then shrink
  1478.           it when you no longer need it to be so large.
  1479.  
  1480.                   Let's try an example.  Load in any EMACS  text  file  and
  1481.           split the current window into two.  Now type ^X-^(Shift-6), grow-
  1482.           window.   Your  current  window  should  be  the lower one on the
  1483.           screen.  Notice that it increases in size upwards  by  one  line.
  1484.           If  you  are  in  the  upper  window,  it increases in size in  a
  1485.           downward   direction.      The   command   ^X-^Z,   shrink-window
  1486.           correspondingly decreases window size by one line at a time.
  1487.  
  1488.                   EMACS also allows  you  to resize a window more precisely
  1489.           by entering a numeric argument  specifying the size of the window
  1490.           in  lines.  To resize the window this way, press the META key and
  1491.           enter  a  numeric  argument (remember to keep it smaller than the
  1492.           number of lines on your screen display) then  press  ^X-W resize-
  1493.           window.  The  current  window  will  be enlarged or shrunk to the
  1494.           number of lines specified in the numeric argument.    For example
  1495.           entering:
  1496.  
  1497.                M-8 ^X-W
  1498.  
  1499.           will resize the current window to 8 lines.
  1500.  
  1501.  
  1502.           5.4  Repositioning within a Window
  1503.  
  1504.  
  1505.                   The cursor may be  centered  within  a window by entering
  1506.           M-! or M-^L redraw-display.  This command is especially useful in
  1507.           allowing  you  to  quickly  locate  the cursor if you are  moving
  1508.           frequently from window to window.  You can also use  this command
  1509.           to move the line containing the cursor to any position within the
  1510.           current window.  This is done by using a numeric  argument before
  1511.           the command. Type M-<n> M-^L where <n> is the number of  the line
  1512.           within the window that you wish the current line to be displayed.
  1513.  
  1514.  
  1515.                                                                          20
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.           MicroEMACS Reference Manual                               Windows
  1523.  
  1524.  
  1525.                   The ^L Refresh-screen command is useful for 'cleaning up'
  1526.           a 'messy' screen that can result of using EMACS  on  a  mainframe
  1527.           system and being interupted by a system message.
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.                                                                          22
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.           Windows                               MicroEMACS Reference Manual
  1589.  
  1590.  
  1591.           Chapter 5 summary
  1592.  
  1593.                   In Chapter 5 you  learned  how  to manipulate windows and
  1594.           the editing flexibility they offer.
  1595.  
  1596.           Key Binding     Keystroke       Effect
  1597.  
  1598.           Open-Window     ^X-2            Splits current window into two windows if
  1599.                                           space available
  1600.  
  1601.           Close-Windows   ^X-1            Closes all windows except current window
  1602.  
  1603.           Next-Window     ^X-O[oh]        Moves point into next (i.e. downward)
  1604.                                           window
  1605.  
  1606.           Previous-Window ^XP             Moves point to previous (i.e. upward)
  1607.                                           window
  1608.  
  1609.           Move-Window-Down ^X-^N          Scrolls current window down one line
  1610.  
  1611.           Move-Window-Up  ^X-^P           Scrolls current window up one line
  1612.  
  1613.           Redraw-display  M ! or          Window is moved so line with point
  1614.                           M ^L            (with cursor) is at center of window
  1615.  
  1616.           Grow-Window     M-X ^ or        Current window is enlarged by one
  1617.                           M ^L            line and nearest window is shrunk by
  1618.                                           one line
  1619.  
  1620.           Shrink-Window   ^X-^Z           Current window is shrunk by one line
  1621.                                           and nearest window is enlarged by one line
  1622.  
  1623.           Clear-and-redraw ^L             Screen is blanked and redrawn.  Keeps
  1624.                                           screen updates in sync with your commands
  1625.  
  1626.           Scroll-Next-Up  M-^Z            Scrolls next window up by one line
  1627.  
  1628.           Scroll-Next-Down M-^V           Scrolls next window down by one line
  1629.  
  1630.           Delete-Window   ^X-0            Deletes current window
  1631.  
  1632.           Delete-Other-Windows ^X-1       Deletes all but current window
  1633.  
  1634.           Resize-Window   ^X-^W           Resizes window to a given numeric argument
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.           23
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.           MicroEMACS Reference Manual                               Buffers
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.                                       Chapter 6
  1664.  
  1665.                                        Buffers
  1666.  
  1667.  
  1668.                     We  have  already  learned  a  number  of things  about
  1669.           buffers.    As  you will recall,  they  are  the  major  internal
  1670.           entities  in  EMACS  --  the  place  where  editing commands  are
  1671.           executed.  They are  characterized  by  their names, their modes,
  1672.           and by the file with which they are associated.  Each buffer also
  1673.           "remembers" its mark  and  point.  This convenient feature allows
  1674.           you to go to other buffers and return to the original location in
  1675.           the "current" buffer.
  1676.  
  1677.                   Advanced users  of  EMACS  frequently  have  a  number of
  1678.           buffers in the computer's memory  simultaneously.    In  the last
  1679.           chapter, for example, you opened at least two buffers -- one into
  1680.           the text you were  editing,  and the other into the EMACS on-line
  1681.           tutorial.  If you deal with complex text files --  say, sectioned
  1682.           chapters  of  a  book, you may have five or six  buffers  in  the
  1683.           computer's memory.   You could select different buffers by simply
  1684.           calling up the file  with  ^X-^F find-file, and let EMACS open or
  1685.           reopen the  buffer.  However, EMACS offers fast and sophisticated
  1686.           buffering techniques that you will find easy to  master  and much
  1687.           more convenient to use.
  1688.  
  1689.                   Let's begin by opening three buffers.  You  can  open any
  1690.           three  you  choose,  for example call the  following  files  into
  1691.           memory: fang.txt, publish.txt, and emacs.tut in the  order listed
  1692.           here.  When you've finished this process, you'll be looking  at a
  1693.           screen showing the EMACS tutorial.  Let's assume that you want to
  1694.           move to the fang.txt buffer.  Enter:
  1695.  
  1696.                   ^X-X next-buffer
  1697.  
  1698.                   This command moves you to the next buffer.  Because EMACS
  1699.           cycles through the  buffer  list, which is alphabetized, you will
  1700.           now be in the fang.txt buffer. Using ^X-X again places you in the
  1701.           publish.txt  buffer.  If  you  are  on  a  machine that  supports
  1702.           function keys, using ^X-X again places you in  the  Function Keys
  1703.           buffer. Using ^X-X one last time cycles you back to the beginning
  1704.           of the list.
  1705.  
  1706.                   If you have a large number of buffers to deal  with, this
  1707.           cycling process may be slow and inconvenient.   The  command ^X-B
  1708.           select-buffer allows you to  specify  the  buffer  you wish to be
  1709.           switched  to.    When the command is entered, EMACS prompts, "Use
  1710.  
  1711.  
  1712.  
  1713.                                                                          24
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.           Buffers                               MicroEMACS Reference Manual
  1721.  
  1722.  
  1723.           buffer:".  Simply enter the buffer name (NOT the file  name), and
  1724.           that buffer will then become the current buffer.
  1725.  
  1726.                   Multiple  buffer  manipulation  and  editing is a complex
  1727.           activity, and you will probably  find it very inconvenient to re-
  1728.           save each  buffer  as  you  modify  it.   The command ^X-^B list-
  1729.           buffers creates a new  window  that  gives  details about all the
  1730.           buffers  currently  known  to  EMACS.    Buffers  that have  been
  1731.           modified are identified by  the  "buffer  changed"  indicator (an
  1732.           asterisk in the second column).  You can thus quickly  and easily
  1733.           identify buffers that need  to  be saved to files before you exit
  1734.           EMACS.   The buffer window also  provides  other  information  --
  1735.           buffer  specific modes, buffer size, and  buffer  name  are  also
  1736.           listed.   To close this window,  simply  type  the  close-windows
  1737.           command, ^X-1.
  1738.  
  1739.                   To delete any buffer,  type  ^X-K  delete-buffer.   EMACS
  1740.           prompts you "Kill buffer:".  Enter the buffer name  you  want  to
  1741.           delete.    As  this  is  destructive command, EMACS will ask  for
  1742.           confirmation if the buffer  was  changed  and  not saved.  Answer
  1743.           Y(es) or N(o).  As usual ^G cancels the command.
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.           25
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.           MicroEMACS Reference Manual                               Buffers
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.                                   Chapter 6 Summary
  1794.  
  1795.  
  1796.                   In Chapter 6 you learned how to manipulate buffers.
  1797.  
  1798.           Key Binding             Keystroke                      Effect
  1799.           Next-Buffer             ^X-^X           Switch to the next buffer in the
  1800.                                                   buffer list
  1801.  
  1802.           Select-Buffer           ^X-B            Switch to a particular buffer
  1803.  
  1804.           List-Buffers            ^X-^B           List all buffers
  1805.  
  1806.           Delete-Buffer           ^X-K            delete a particular buffer if it
  1807.                                                   is off-screen
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.                                                                          26
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.           Modes                                 MicroEMACS Reference Manual
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.                                       Chapter 7
  1862.  
  1863.                                         Modes
  1864.  
  1865.  
  1866.                   EMACS allows you to  change  the way it works in order to
  1867.           customized it to the style of editing you  are  using.    It does
  1868.           this by providing a number of different modes .  These  modes can
  1869.           effect either a single buffer, or any new buffer that is created.
  1870.           To add a mode to the  current  buffer, type ^X-M add-mode.  EMACS
  1871.           will then prompt you for the name of  a  mode  to  add.  When you
  1872.           type in a legal mode name,  and  type  a <NL>, EMACS will add the
  1873.           mode  name  to  the list of current mode names in the modeline of
  1874.           the current buffer.
  1875.  
  1876.                   To remove an existing mode, typing the  ^X-^M delete-mode
  1877.           will cause EMACS to prompt you for the name of  a  mode to delete
  1878.           from the current  buffer.    This  will remove that mode from the
  1879.           mode list on the current modeline.
  1880.  
  1881.                   Global modes are the modes which are inherited by any new
  1882.           buffers which are created.  For example, if you wish to always do
  1883.           string searching with character case being significant, you would
  1884.           want global mode EXACT to be  set  so  that any new files read in
  1885.           inherent the EXACT mode.  Global modes are set with the  M-M add-
  1886.           global-mode  command, and unset with the M-^M  delete-global-mode
  1887.           command.  Also, the  current  global  modes  are displayed in the
  1888.           first line of a ^X-^B list-buffers command.
  1889.  
  1890.                   On machines which are capable of  displaying  colors, the
  1891.           mode  commands  can  also  set  the  background   and  foreground
  1892.           character colors.  Using add-mode or delete-mode with a lowercase
  1893.           color will set the background color in the current  window.    An
  1894.           uppercase  color will set the foreground  color  in  the  current
  1895.           window.  Colors that EMACS knows about are: white, cyan, magenta,
  1896.           yellow, blue, red,  green,  and  black.   If the computer you are
  1897.           running on does not have eight colors, EMACS will attempt to make
  1898.           some intelligent guess at what color to use when you ask  for one
  1899.           which is not there.
  1900.  
  1901.  
  1902.           7.1  ASAVE mode
  1903.  
  1904.  
  1905.                   Automatic Save mode tells  EMACS  to  automatically write
  1906.           out the current buffer to its associated file on a regular basis.
  1907.           Normally this will be every 256 characters typed  into  the file.
  1908.           The environment variable $ACOUNT  counts  down  to the next auto-
  1909.  
  1910.  
  1911.           27
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.           MicroEMACS Reference Manual                                 Modes
  1919.  
  1920.  
  1921.           save, and $ASAVE is the value used to reset $ACOUNT after  a save
  1922.           occurs.
  1923.  
  1924.  
  1925.           7.2  CMODE mode
  1926.  
  1927.  
  1928.                   CMODE is useful to C  programmers.  When CMODE is active,
  1929.           EMACS will try to assist the user in a number of ways.  This mode
  1930.           is set automatically with files that have a .c or .h extension.
  1931.  
  1932.                   The <NL> key will normally  attempt to return the user to
  1933.           the next line  at  the  same  level of indentation as the current
  1934.           line, unless the current line ends with a open brace ({) in which
  1935.           case the new line will be further indented by one tab position.
  1936.  
  1937.                   A close brace (}) will delete one tab position preceeding
  1938.           itself  as it is typed.  This should line up the close brace with
  1939.           its matching IF, FOR or WHILE statement.
  1940.  
  1941.                   A pound sign (#) with only leading whitespace will delete
  1942.           all the whitespace  preceeding  itself.  This  will  always bring
  1943.           preprocessor directives flush to the left margin.
  1944.  
  1945.                   Whenever  any  close  fence  is  typed, ie )]>},  if  the
  1946.           matching  open  fence  is  on  screen in the current window,  the
  1947.           cursor will briefly  flash  to  it,  and  then  back.  This makes
  1948.           balancing expressions, and matching blocks much easier.
  1949.  
  1950.  
  1951.           7.3  CRYPT mode
  1952.  
  1953.  
  1954.                   When a buffer is in  CRYPT mode, it is encrypted whenever
  1955.           it is written to a file, and decrypted when it  is  read from the
  1956.           file.  The encryption key can be specified on  the  command  line
  1957.           with the -k  switch,  or with the M-E set-encryption-key command.
  1958.           If you attempt to read or  write  a  buffer in crypt mode and now
  1959.           key has  not  been  set,  EMACS  will  execute set-encryption-key
  1960.           automatically, prompting  you for the needed key.  Whenever EMACS
  1961.           prompts you for a key, it will not echo the key to your screen as
  1962.           you type it  (ie  make  SURE  you  get  it  right when you set it
  1963.           originally).
  1964.  
  1965.                   The encryption algorithm used changes all characters into
  1966.           normal printing characters, thus the resulting  file  is suitable
  1967.           for  sending  via  electronic mail.  All  version  of  MicroEMACS
  1968.           should  be able decrypt the resulting  file  regardless  of  what
  1969.           machine encrypted it.   Also  available  with  EMACS is the stand
  1970.           alone  program,  MicroCRYPT,   which  can  en/decrypt  the  files
  1971.           produced by CRYPT mode in EMACS.
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.                                                                          28
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.           Modes                                 MicroEMACS Reference Manual
  1985.  
  1986.  
  1987.           7.4  EXACT mode
  1988.  
  1989.  
  1990.                   All   string  searches   and   replacements   will   take
  1991.           upper/lower  case into account. Normally the  case  of  a  string
  1992.           during a search or replace is not taken into account.
  1993.  
  1994.  
  1995.           7.5  MAGIC mode
  1996.  
  1997.  
  1998.                   In  the  MAGIC   mode  certain  characters  gain  special
  1999.           meanings  when  used  in a search pattern.  Collectively they are
  2000.           know as regular expressions,  and  a  limited  number of them are
  2001.           supported in MicroEmacs.   They  grant  greater  flexibility when
  2002.           using the search  command.    However,  they  do  not  affect the
  2003.           incremental search command.
  2004.  
  2005.                   The symbols that  have  special meaning in MAGIC mode are
  2006.           ^, $, ., &, *, [ (and ], used with it), and \.
  2007.  
  2008.                   The  characters ^ and $ fix the  search  pattern  to  the
  2009.           beginning  and  end  of line, respectively.  The ^ character must
  2010.           appear  at the beginning of the search string,  and  the  $  must
  2011.           appear at the end,  otherwise  they  loose  their meaning and are
  2012.           treated just like any  other  character.    For example, in MAGIC
  2013.           mode, searching for the pattern "t$" would put the cursor  at the
  2014.           end of any line that ended with the letter 't'.    Note that this
  2015.           is different than searching for "t<NL>", that is, 't' followed by
  2016.           a newline character.  The character $ (and ^,  for  that  matter)
  2017.           matches a position, not a character, so the cursor remains at the
  2018.           end of the line.  But a  newline  is  a  character  that  must be
  2019.           matched,  just like any other character,  which  means  that  the
  2020.           cursor is placed just after it - on  the  beginning  of  the next
  2021.           line.
  2022.  
  2023.                   The character .  has a very simple meaning --  it matches
  2024.           any  single character, except the newline.   Thus  a  search  for
  2025.           "bad.er" could match "badger", "badder" (slang), or up to the 'r'
  2026.           of "bad error".
  2027.  
  2028.                   The character * is known  as closure, and means that zero
  2029.           or  more  of  the preceding character will match.  If there is no
  2030.           character preceding, * has no  special meaning, and since it will
  2031.           not match  with  a  newline,  *  will  have no special meaning if
  2032.           preceded by the beginning of line symbol ^ or the literal newline
  2033.           character <NL>.
  2034.  
  2035.                   The notion of zero or  more characters is important.  If,
  2036.           for example, your cursor was on the line
  2037.  
  2038.                This line is missing two vowels.
  2039.  
  2040.  
  2041.  
  2042.  
  2043.           29
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.           MicroEMACS Reference Manual                                 Modes
  2051.  
  2052.  
  2053.                   and  a search was made for "a*",  the  cursor  would  not
  2054.           move, because it  is  guaranteed  to  match no letter 'a' , which
  2055.           satifies the search conditions.  If you wanted to search  for one
  2056.           or  more of the letter 'a', you would  search  for  "aa*",  which
  2057.           would match the letter a, then zero or more of them.
  2058.  
  2059.                   The character [ indicates the  beginning  of  a character
  2060.           class.  It is similar to  the  'any'  character ., but you get to
  2061.           choose which characters you want to match.   The  character class
  2062.           is ended with the character ].  So,  while  a  search  for "ba.e"
  2063.           will match "bane", "bade", "bale",  "bate",  et  cetera,  you can
  2064.           limit  it   to  matching  "babe"  and  "bake"  by  searching  for
  2065.           "ba[bk]e".    Only  one of the characters inside the [ and ] will
  2066.           match  a  character.   If in fact you want to match any character
  2067.           except those in the character class, you can put a ^ as the first
  2068.           character.  It must be the first character of the class,  or else
  2069.           it has no special meaning.  So, a search for [^aeiou]  will match
  2070.           any  character except a vowel, but a  search  for  [aeiou^]  will
  2071.           match any vowel or a ^.
  2072.  
  2073.                   If you have a lot of characters in order that you want to
  2074.           put in  the  character  class,  you may use a dash (-) as a range
  2075.           character.  So, [a-z] will match any letter (or  any  lower  case
  2076.           letter if EXACT mode is on), and [0-9a-f] will match any digit or
  2077.           any letter 'a' through 'f', which happen to be the characters for
  2078.           hexadecimal numbers.  If the dash is at the beginning or end of a
  2079.           character class, it is taken to be just a dash.
  2080.  
  2081.                   The  character & (ampersand) is a replacement  character,
  2082.           and represents the characters which  matched  the  search string.
  2083.           When used in the  M-R  replace-string  or the M-^R query-replace-
  2084.           string commands, the & will be substituted for the search string.
  2085.  
  2086.                   The escape character \ is for those times  when  you want
  2087.           to  be  in  MAGIC mode, but also want to use a regular expression
  2088.           character to  be  just  a  character.    It turns off the special
  2089.           meaning of the character.  So a search for "it\." will search for
  2090.           a line with "it.", and not "it" followed by any  other character.
  2091.           The escape character will also let  you  put  ^, -, or ] inside a
  2092.           character class with no special side effects.
  2093.  
  2094.  
  2095.           7.6  OVER mode
  2096.  
  2097.  
  2098.                   OVER mode stands for overwrite  mode.  When in this mode,
  2099.           when characters  are typed, instead of simply inserting them into
  2100.           the file, EMACS  will  attempt to overwrite an existing character
  2101.           past the point.    This  is  very useful for adjusting tables and
  2102.           diagrams.
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.                                                                          30
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.           Modes                                 MicroEMACS Reference Manual
  2117.  
  2118.  
  2119.           7.7  WRAP mode
  2120.  
  2121.  
  2122.                   Wrap  mode  is  used  when  typing  in  continuous  text.
  2123.           Whenever the cursor is past the currently set fill column  (72 by
  2124.           default) and the user types a space or a <NL>,  the  last word of
  2125.           the line  is  brought  down  to  the  beginning of the next line.
  2126.           Using this, one just types a continuous stream of words and EMACS
  2127.           automatically inserts <NL>s at appropriate places.
  2128.  
  2129.                                 NOTE to programmers:
  2130.  
  2131.                EMACS actually  calls  up  the  function  bound  to the
  2132.                illegal keystroke M-FNW.  This is bound to the function
  2133.                wrap-word by default, but can be  re-bound  to activate
  2134.                different functions and macros at wrap time.
  2135.  
  2136.  
  2137.           7.8  VIEW mode
  2138.  
  2139.  
  2140.                   VIEW mode disables  all  commands  which  can  change the
  2141.           current buffer.  EMACS will display an error message and ring the
  2142.           bell every time you attempt to change a buffer in VIEW mode.
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.           31
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.           MicroEMACS Reference Manual                                 Modes
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.                                   Chapter 7 Summary
  2190.  
  2191.  
  2192.                   In Chapter 7 you learned about modes and their effects.
  2193.  
  2194.           Key Binding             Keystroke                      Effect
  2195.           Add-Mode                ^X-M            Add a mode to the current buffer
  2196.  
  2197.           Delete-Mode             ^X-^M           Delete a mode from the current
  2198.                                                   buffer
  2199.  
  2200.           Add-Global-Mode         M-M             Add a global mode to the
  2201.                                                   current buffer
  2202.  
  2203.           Delete-Global-Mode      M-^M            Delete a global mode from the
  2204.                                                   current buffer
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                                                                          32
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.           Files                                 MicroEMACS Reference Manual
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.                                       Chapter 8
  2258.  
  2259.                                         Files
  2260.  
  2261.  
  2262.                   A file is simply a collection of related data.   In EMACS
  2263.           we  are  dealing  with  text  files -- named collections of  text
  2264.           residing  on a disk (or some other storage  medium).    You  will
  2265.           recall  that the major entities EMACS  deals  with  are  buffers.
  2266.           Disk-based  versions  of  files are only active in EMACS when you
  2267.           are reading into or writing out  of  buffers.  As we have already
  2268.           seen, buffers and physical  files  are  linked by associated file
  2269.           names.  For example, the  buffer  "ch7.txt"  which  is associated
  2270.           with the physical disk file "ch7.txt." You will  notice  that the
  2271.           file  is usually specified by the drive name or (in the case of a
  2272.           hard drive) a  path.    Thus  you  can specify full file names in
  2273.           EMACS,
  2274.  
  2275.                   e.g. disk:\directories\filename.extension
  2276.  
  2277.                   If you do not specify a disk and directories, the default
  2278.           disk is used.
  2279.  
  2280.                   IMPORTANT -- If you do not explicitly save your buffer to
  2281.           a  file,  all  your edits will  be  lost  when  you  leave  EMACS
  2282.           (although EMACS will prompt you when you are about to  lose edits
  2283.           by exiting).  In addition, EMACS does not protect your disk-based
  2284.           files from overwriting  when  it  saves  files.    Thus  when you
  2285.           instruct EMACS to save a file to disk, it will  create  a file if
  2286.           the  specified  file  doesn't  exist,  or it will  overwrite  the
  2287.           previously saved version of the file thus replacing it.  Your old
  2288.           version is gone forever.
  2289.  
  2290.                   If you are at all unsure about your edits, or if (for any
  2291.           reason) you wish  to  keep  previous  versions of a file, you can
  2292.           change the name of  the  associated  file  with the command ^X-N.
  2293.           When this file is saved to disk, EMACS will create a new physical
  2294.           file  under  the  new  name.    The  earlier  disk  file will  be
  2295.           preserved.
  2296.  
  2297.                   For example, let's load  the  file  fang.txt  into EMACS.
  2298.           Now, type ^X-N.  The EMACS command line prompts "name:".  Enter a
  2299.           new name for the file --  say  new.txt  and press <NL>.  The file
  2300.           will be saved under  the  new  filename,  and your disk directory
  2301.           will show both fang.txt and new.txt.
  2302.  
  2303.                   An alternative method is  to  write  the file directly to
  2304.           disk under a new  filename.    Let's  pull our "publish.txt" file
  2305.  
  2306.  
  2307.           33
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.           MicroEMACS Reference Manual                                 Files
  2315.  
  2316.  
  2317.           into EMACS.  To write this file under another filename,  type ^X-
  2318.           ^W.  EMACS  will  prompt  you  "write file:".  Enter an alternate
  2319.           filename -- desktop.txt.  Your file will be saved as the physical
  2320.           file "desktop.txt".
  2321.  
  2322.                   Note  that  in  the  examples  above,  although  you have
  2323.           changed the names of the related files, the  buffer  names remain
  2324.           the same.   However,  when  you  pull the physical file back into
  2325.           EMACS,  you will find that the buffer name  now  relates  to  the
  2326.           filename.
  2327.  
  2328.                   For example --  You  are working with a buffer "fang.txt"
  2329.           with the related  file  "fang.txt".    You change the name of the
  2330.           file to "new.txt".   EMACS  now shows you working with the buffer
  2331.           "fang.txt" and the related  file  "new.txt".    Now pull the file
  2332.           "new.txt" into EMACS.    Notice  that  the  buffer  name  has now
  2333.           changed to "new.txt".
  2334.  
  2335.                   If for any  reason  a conflict of buffer names occurs,(if
  2336.           you have files of the same name on different drives  for example)
  2337.           EMACS will prompt you "use buffer:".  Enter an alternative buffer
  2338.           name if you need to.
  2339.  
  2340.                   For a list of file related commands (including some we`ve
  2341.           already seen), see the summary page.
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.                                                                          34
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.           Files                                 MicroEMACS Reference Manual
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.                                   Chapter 8 Summary
  2388.  
  2389.  
  2390.                   In  Chapter  8  you  learned  some of the  more  advanced
  2391.           concepts of  file  naming  and  manipulation.    The relationship
  2392.           between files and buffers was discussed in some detail.
  2393.  
  2394.           Key Binding     Keystroke       Effect
  2395.  
  2396.           Save-file       ^X-^S           Saves contents of current buffer with
  2397.                                           associated filename on default disk/
  2398.                                           directory (if not specified)
  2399.  
  2400.           Write-File      ^X-^W           Current buffer contents will be
  2401.                                           saved under specified name
  2402.  
  2403.           Change-File-name
  2404.                           ^X-N            The associated filename is changed
  2405.                                           (or associated if not previously
  2406.                                           specified) as specified
  2407.  
  2408.           Find-File       ^X-^F           Reads specified file into buffer and
  2409.                                           switches you to that buffer, or switches
  2410.                                           to buffer in which the file has previously
  2411.                                           been read
  2412.  
  2413.           Read-File       ^X-^R           Reads file into buffer thus overwriting
  2414.                                           buffer contents.  If file has already
  2415.                                           been read into another buffer, you will
  2416.                                           be switched to it
  2417.  
  2418.           View-File       ^X-^V           The same as read-file except the buffer
  2419.                                           is automatically put into VIEW mode thus
  2420.                                           preventing any changes from being made
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.           35
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.           MicroEMACS Reference Manual                     Screen Formatting
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.                                       Chapter 9
  2456.  
  2457.                                   Screen Formatting
  2458.  
  2459.  
  2460.           9.1  Wrapping Text
  2461.  
  2462.  
  2463.                   As  we  learned  in the introduction, EMACS is not a word
  2464.           processor, but an editor.   Some  simple  formatting  options are
  2465.           available however, although in  most  cases  they will not affect
  2466.           the appearence of the finished text when it is  run  through  the
  2467.           formatter.  We have already  encountered  WRAP  mode  which wraps
  2468.           lines longer than a  certain  length  (default is 75 characters).
  2469.           You  will  recall  that WRAP is  enabled  by  entering  ^X-M  and
  2470.           responding to the command line prompt with wrap.
  2471.  
  2472.                   You  can  also  set your own wrap margin with the command
  2473.           ^X-F set-fill-column.  Notice  EMACS  responds  "[Fill  column is
  2474.           1]." Now try typing  some  text.  You'll notice some very strange
  2475.           things happening -- your text wraps at every  word!!  This effect
  2476.           occurs because the set wrap margin command must be preceeded by a
  2477.           numeric argument or EMACS sets it to the first column.   Thus any
  2478.           text you type that extends past the first column will wrap at the
  2479.           most convenient line break.
  2480.  
  2481.                   To  reset the wrap column to  72  characters,  press  the
  2482.           <META> key and  enter  72.    EMACS  will respond "Arg: 72".  Now
  2483.           press ^X-F.  EMACS will respond "[Fill column is 72]".  Your text
  2484.           will again wrap at the margin you've been using up to this point.
  2485.  
  2486.  
  2487.           9.2  Reformatting Paragraphs
  2488.  
  2489.  
  2490.                   After an intensive editing session, you may find that you
  2491.           have paragraphs containing lines of differing lengths.   Although
  2492.           this disparity  will not affect the formatted text, aesthetic and
  2493.           technical concerns  may  make  it  desirable  to  have consistent
  2494.           paragraph blocks on the screen.  If you are in WRAP mode, you can
  2495.           reformat a paragraph  with  the command M-Q fill-paragraph.  This
  2496.           command 'fills'  the current paragraph reformatting it so all the
  2497.           lines are filled and wrap logically.  The process is complex, and
  2498.           (especially with longer paragraphs) may take a little time.
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.                                                                          36
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.           Screen Formatting                     MicroEMACS Reference Manual
  2513.  
  2514.  
  2515.           9.3  Changing Case
  2516.  
  2517.  
  2518.                   There  may be occasions when you  find  it  necessary  to
  2519.           change the case of the text you've entered.  EMACS allows  you to
  2520.           change the case of even large  amounts  of text with ease.  Let's
  2521.           try and convert a few of the office traditionalists to the joy of
  2522.           word processing.  Type in the following text:
  2523.  
  2524.                Throw  away your typewriter and learn  to  use  a  word
  2525.                processor.  Word processing is relatively easy to learn
  2526.                and will increase  your productivity enormously.  Enter
  2527.                the Computer Age and find out just how much fun  it can
  2528.                be!!
  2529.  
  2530.                   Let's give it a  little  more  impact by capitalizing the
  2531.           first four words.  The first step is to define the region of text
  2532.           just as you would if you  were  doing an extensive deletion.  Set
  2533.           the  mark  at  the beginning of the paragraph with M-<space> set-
  2534.           mark  and  move  the cursor to the space beyond "typewriter." Now
  2535.           enter ^X-^U case-region-upper.   Your  text  should now look like
  2536.           this:
  2537.  
  2538.                THROW  AWAY YOUR TYPEWRITER and learn  to  use  a  word
  2539.                processor.  Word processing is relatively easy to learn
  2540.                and will increase  your productivity enormously.  Enter
  2541.                the Computer Age and find out just how much fun  it can
  2542.                be!!
  2543.  
  2544.                   If you want to  change  the text back to lower case, type
  2545.           ^X-^L  case-region-lower.   You can  also  capitalize  individual
  2546.           words.   To capitalize the word "fun",  position  the  cursor  in
  2547.           front of the word and type M-U case-word-upper.  The word  is now
  2548.           capitalized.  To change it back to lower case,  move  the  cursor
  2549.           back to the beginning of the word and type M-L case-word-lower.
  2550.  
  2551.                   You may also capitalize individual letters in EMACS.  The
  2552.           command M-C  case-word-capitalize  capitalizes  the  first letter
  2553.           after the point.  This command would normally be issued  with the
  2554.           cursor positioned in front of the first letter of  the  word  you
  2555.           wish to capitalize.  If you issue it in the middle of a word, you
  2556.           can end up with some strAnge looking text.
  2557.  
  2558.  
  2559.           9.4  Tabs
  2560.  
  2561.  
  2562.                   Unless your formatter is instructed to  take  screen text
  2563.           literally (as MicroSCRIBE does in the 'verbatim'  environment for
  2564.           example), tabs in EMACS generally affect screen formatting only.
  2565.  
  2566.                   When EMACS is first started, it sets the  default  tab to
  2567.           every eighth column.    As  long  as you stay with default, every
  2568.           time you press the tab key a tab character, ^I is inserted.  This
  2569.  
  2570.  
  2571.           37
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.           MicroEMACS Reference Manual                     Screen Formatting
  2579.  
  2580.  
  2581.           character, like  other control characters, is invisible -- but it
  2582.           makes  a  subtle  and  significant  difference to your  file  and
  2583.           editing.
  2584.  
  2585.                   For example, in default mode,  press the tab key and then
  2586.           type the word Test.  "Test"  appears  at the eighth column.  Move
  2587.           your cursor to the beginning of the word and delete  the backward
  2588.           character.    The  word doesn't move back just one character, but
  2589.           flushes  to the left margin.  The reason  for  this  behavior  is
  2590.           easily explained.  In  tab  default,  EMACS  inserts a 'real' tab
  2591.           character when you press the tab key.  This character is inserted
  2592.           at the default position, but NO SPACES are  inserted  between the
  2593.           tab character and the margin (or previous tab character).  As you
  2594.           will recall,  EMACS only recognizes characters (such as spaces or
  2595.           letters) and thus when  the  tab  character  is removed, the text
  2596.           beyond  the tab is flushed back to the  margin  or  previous  tab
  2597.           mark.
  2598.  
  2599.                   This  situation  changes  if   you   alter   the  default
  2600.           configuration.    The  default value may be changed by entering a
  2601.           numeric argument before pressing the tab key.  As we saw earlier,
  2602.           pressing the META key and entering a number allows you to specify
  2603.           how EMACS performs a  given  action.  In this case, let's specify
  2604.           an argument of 10 and hit the tab key.
  2605.  
  2606.                   Now hit the tab key again and type Test.  Notice the word
  2607.           now  appears  at  the tenth column.  Now move to the beginning of
  2608.           the word and delete the  backward character. "Test" moves back by
  2609.           one character.
  2610.  
  2611.                   EMACS behaves differently in these  circumstances because
  2612.           the ^I handle-tab function deals  with  tabbing  in  two distinct
  2613.           ways.  In default conditions, or if the numeric argument  of zero
  2614.           is used, handle-tab inserts a true tab character.  If, however, a
  2615.           non-zero numeric argument is  specified,  handle-tab  inserts the
  2616.           correct number of spaces  needed  to  position  the cursor at the
  2617.           next specified tab position.    It does NOT insert the single tab
  2618.           character and  hence any editing functions should take account of
  2619.           the number of spaces between tabbed columns.
  2620.  
  2621.                   Many times you would  like  to take a line which has been
  2622.           created using the tab character and change it to use just spaces.
  2623.           The command ^X-^D detab-line changes any tabs from  the  point to
  2624.           the  end  of  the current line into the right number of spaces so
  2625.           the line does not change.  This is very useful for times when the
  2626.           file must be printed or transfered to a machine  which  does  not
  2627.           understand tabs.
  2628.  
  2629.                   Also,  the inverse  command,  ^X-^E  entab-lines  changes
  2630.           multiple  spaces  to  tabs where possible.  This is a good way to
  2631.           shrink the  size of large documents, especially with data tables.
  2632.           Both of these commands can take a numeric argument which  will be
  2633.           interpeted as the number of lines to en/detab.
  2634.  
  2635.  
  2636.  
  2637.                                                                          38
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.           Screen Formatting                     MicroEMACS Reference Manual
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.                                   Chapter 9 Summary
  2652.  
  2653.  
  2654.                   In Chapter 9 introduced some of  the  formatting features
  2655.           of  EMACS.  Text-wrap,  paragraph  reformatting,  and  tabs  were
  2656.           discussed  in  some  detail.  The commands in the following table
  2657.           were covered in the chapter.
  2658.  
  2659.  
  2660.           Key Binding             Keystroke                   Effect
  2661.           Add-Mode/WRAP           ^X-M[WRAP]      Add wrap mode to current buffer
  2662.  
  2663.           Delete-Mode/WRAP        ^X-^M[WRAP]     Remove wrap mode from current
  2664.                                                   buffer
  2665.  
  2666.           Set-Fill-Column         ^X-F            Set fill column to given numeric
  2667.                                                   argument
  2668.  
  2669.           Fill-Paragraph          M-Q             Logically reformats the current
  2670.                                                   paragraph
  2671.  
  2672.           Case-Word-Upper         M-U             Text from point to end of the
  2673.                                                   current word is changed to
  2674.           uppercase
  2675.  
  2676.           Case-Word-Lower         M-L             Text from point to end of the
  2677.                                                   current word is changed to
  2678.           lowercase
  2679.  
  2680.           Case-Word-Capitalize    M-C             First word (or letter) after the
  2681.                                                   point is capitalized
  2682.  
  2683.           Case-Region-Upper       ^X-^U           The current region is uppercased
  2684.  
  2685.           Case-Region-Lower       ^X-^L           The current region is lowercased
  2686.  
  2687.           Handle-Tab              ^I              Tab interval is set to the given
  2688.                                                   numeric argument
  2689.           Entab-Line              ^X-^E           Changes multiple spaces to tabs
  2690.                                                   characters where possible
  2691.           Detab-Line              ^X-^D           Changes tab characters to the
  2692.                                                   appropriate number of spaces
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.           39
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.           MicroEMACS Reference Manual           Access to the Outside World
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.                                      Chapter 10
  2720.  
  2721.                              Access to the Outside World
  2722.  
  2723.  
  2724.                   EMACS has  the ability to interface to other programs and
  2725.           the environment of the computer outside of itself.  It  does this
  2726.           through  a  series  of  commands  that  allow  it  to talk to the
  2727.           computer's command processor or shell.   Just what this is varies
  2728.           between  different  computers.   Under MSDOS or PCDOS this is the
  2729.           command.com command processor.  Under UNIX it is  the  csh shell.
  2730.           On  the Atari ST is can be the Mark Williams MSH or the Beckmeyer
  2731.           shell.  In each case, it is the part of the  computer's operating
  2732.           system that is  responcable  for  determining  what  programs are
  2733.           executed, and when.
  2734.  
  2735.                   The ^X-! shell-command command  prompts  the  user  for a
  2736.           command line to send out to the shell  to  execute.  This  can be
  2737.           very  useful for doing file listings  and  changing  the  current
  2738.           directory or folder.   EMACS  gives  control  to the shell, which
  2739.           executed the command, and then types [END] and waits for the user
  2740.           to  type a character before redrawing  the  screen  and  resuming
  2741.           editing. If the shell-command command  is  used  from  within the
  2742.           macro language, there is no pause.
  2743.  
  2744.                   ^X-@ pipe-command command allows EMACS to execute a shell
  2745.           command,  and  if  the particular computer allows  it,  send  the
  2746.           results into a buffer which  is  automatically  displayed  on the
  2747.           screen. The resulting buffer, called "command" can be manipulated
  2748.           just like any other editing buffer. Text can be copied out  of it
  2749.           or rearanged as needed. This buffer is originally created in VIEW
  2750.           mode, so remember to ^X-^Mview<NL> in order to change it.
  2751.  
  2752.                   Many computers provide  tools  which  will  allow  you to
  2753.           filter text, making some  modifications  to  it  along the way. A
  2754.           very common tool is the SORT program which accepts a  file, sorts
  2755.           it, and prints the  result  out.  The EMACS command, ^X-# filter-
  2756.           buffer  sends  the  current  buffer   through   such   a  filter.
  2757.           Therefore, if you wished  to  sort the current buffer on a system
  2758.           which supplied a sort filter, you would type  ^X-#sort<NL>.   You
  2759.           can  also  create  your  own  filters  by  writing  programs  and
  2760.           utilities  which  read  text from the keyboard  and  display  the
  2761.           results.  EMACS  will  use  any  of these which would normally be
  2762.           available from the current shell.
  2763.  
  2764.                   If you would like to  execute  another  program directly,
  2765.           without the overhead of  an  intervening  shell,  you can use the
  2766.           ^X-$ execute-program  command. It will prompt you for an external
  2767.  
  2768.  
  2769.                                                                          40
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.           Access to the Outside World           MicroEMACS Reference Manual
  2777.  
  2778.  
  2779.           program and its arguments  and  attempt to execute it.  Like when
  2780.           EMACS looks for command files, EMACS will look first in  the HOME
  2781.           directory, then down the execute PATH, and finally in the current
  2782.           directory  for  the  named  program.  On  some  systems, it  will
  2783.           automatically  tack  the  proper extension on the  file  name  to
  2784.           indicate it is a program. On some systems that don't support this
  2785.           function, ^X-$ will be equivalent to ^X-! shell-command.
  2786.  
  2787.                   Sometimes,  you  would  like to get back to the shell and
  2788.           execute other commands, without losing  the  current  contents of
  2789.           EMACS.  The ^X-C  i-shell  command  shells  out of EMACS, leaving
  2790.           EMACS in the computer and  executing another command shell.  Most
  2791.           systems would allow  you  to  return  to  EMACS  with  the "exit"
  2792.           command.
  2793.  
  2794.                   On some systems, mainly advanced  versions  of  UNIX, you
  2795.                   can
  2796.           direct EMACS to "go into the background" with  the  ^X-D suspend-
  2797.           emacs command.  This places EMACS in the background returning you
  2798.           to the original command  shell.  EMACS can then be returned to at
  2799.           any time with the "fg" foreground command.
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.           41
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.           MicroEMACS Reference Manual           Access to the Outside World
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.                                  Chapter 10 Summary
  2850.  
  2851.  
  2852.                   In Chapter 10 introduced  different  ways  to  access the
  2853.           computers  shell or command processor from  within  EMACS.    The
  2854.           commands in the following table were covered in the chapter.
  2855.  
  2856.  
  2857.           Key Binding             Keystroke                   Effect
  2858.           Execute-program         ^X-$            Execute an external program
  2859.                                                   directly
  2860.  
  2861.           Filter-command          ^X-#            Send the current buffer through
  2862.                                                   a shell filter
  2863.  
  2864.           I-shell                 ^X-C            Escape to a new shell
  2865.  
  2866.           Pipe-command            ^X-@            Send the results of an external
  2867.                                                   shell command to a buffer
  2868.  
  2869.           Shell-command           ^X-!            Execute one shell command
  2870.  
  2871.           Suspend-emacs           ^X-D            Place EMACS in the background
  2872.                                                   (some UNIX systems only)
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.                                                                          42
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.           Keyboard Macros                       MicroEMACS Reference Manual
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.                                      Chapter 11
  2918.  
  2919.                                    Keyboard Macros
  2920.  
  2921.  
  2922.                   In many applications, it may  be  necessary  to  repeat a
  2923.           series  of characters or commands frequently.    For  example,  a
  2924.           paper may require the frequent repetition of a complex formula or
  2925.           a long name.  You may also have a series  of  EMACS commands that
  2926.           you invoke frequently.  Keyboard macros offer a convenient method
  2927.           of recording and repeating these commands.
  2928.  
  2929.                   Imagine, for example, you are writing  a  scholarly paper
  2930.           on  Asplenium  platyneuron,  the  spleenwort  fern.     Even  the
  2931.           dedicated botanist would probably find it a task bordering on the
  2932.           agonizing to type Asplenium platyneuron frequently throughout the
  2933.           paper.  An alternative method is 'record' the name in  a keyboard
  2934.           macro.  Try it yourself.
  2935.  
  2936.                   The command ^X-( begin-macro starts recording the all the
  2937.           keystrokes and commands you input.   After you've typed it, enter
  2938.           Asplenium platyneuron.  To stop recording,  type  ^X-) end-macro.
  2939.           EMACS has stored all the keystrokes between the two commands.  To
  2940.           repeat the name you've stored, just enter ^X-E execute-macro, and
  2941.           the name "Asplenium platyneuron"  appears.    You can repeat this
  2942.           action as often  as  you  want,  and  of course as with any EMACS
  2943.           command, you may precede it with a numerical argument.
  2944.  
  2945.                   Because EMACS records keystrokes, you may freely intermix
  2946.           commands and text.  Unfortunately, you can only  store  one macro
  2947.           at  a  time.   Thus, if you begin to record  another  macro,  the
  2948.           previously  defined  macro  is lost. Be careful  to  ensure  that
  2949.           you've finished with one macro before defining another.    If you
  2950.           have a series  of  commands  that  you would like to 'record' for
  2951.           future use, use the macro  or  procedure  facilities  detailed in
  2952.           chapter <X>.
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.           43
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.           MicroEMACS Reference Manual                       Keyboard Macros
  2975.  
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.                                  Chapter 11 Summary
  2982.  
  2983.  
  2984.                   Chapter 11 covered  keyboard  macros.  You learned how to
  2985.           record keystrokes and how to repeat the stored sequence.
  2986.  
  2987.           Key Binding             Keystroke               Effect
  2988.  
  2989.           Start-Macro             ^X-(            Starts recording all keyboard input
  2990.  
  2991.           End-Macro               ^X-)            Stops recording keystrokes for
  2992.                                                   macro
  2993.  
  2994.           Execute-Macro           ^X-E            Entire sequence of recorded
  2995.                                                   keystrokes is replayed
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.                                                                          44
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.                                      Chapter 12
  3050.  
  3051.                                   MicroEMACS Macros
  3052.  
  3053.  
  3054.                   Macros are programs that are used to customize the editor
  3055.           and to perform complicated editing tasks.  They may be  stored in
  3056.           files  or  buffers  and  may  be  executed  using an  appropriate
  3057.           command, or bound to  a  particular  keystroke.   Portions of the
  3058.           standard start-up file are implemented via macros, as well as the
  3059.           example menu system.  The  execute-macro-<n>  commands  cause the
  3060.           macro, numbered from 1  to  40, to be executed.  The execute-file
  3061.           command allows you to execute a macro stored in a disk  file, and
  3062.           the execute-buffer command  allows  you to execute a macro stored
  3063.           in a buffer.   Macros  are stored for easy execution by executing
  3064.           files that contain the store-macro command.
  3065.  
  3066.                   If you need more  than  40  macros, named macroes, called
  3067.           procedures, can be used.   The  store-procedure  command  takes a
  3068.           string argument which is the name of a procedure to store.  These
  3069.           procedures than can be executed with  the  M-^E execute-procedure
  3070.           or the run commands.
  3071.  
  3072.                   There are many different aspects  to  the  macro language
  3073.           within MicroEMACS.  Editor commands are the various commands that
  3074.           manipulate  text,  buffers,  windows,  etc,  within  the  editor.
  3075.           Directives are commands which  control  what  lines  get executed
  3076.           within  a  macro.    Also  there are various types of  variables.
  3077.           Environmental  variables  both control and  report  on  different
  3078.           aspects of the editor.  User variables hold  string  values which
  3079.           may be changed and inspected.  Buffer variables allow text  to be
  3080.           placed into variables.  Interactive variable allow the program to
  3081.           prompt the user  for  information.    Functions  can  be  used to
  3082.           manipulate all these variables.
  3083.  
  3084.  
  3085.           12.1  Constants
  3086.  
  3087.  
  3088.                   All constants and variable contents in  EMACS  are stored
  3089.           as  strings  of  characters. Numbers are stored digit by digit as
  3090.           characters.  This  allows  EMACS  to  be  "typeless",  not having
  3091.           different variables types be legal  in  different  contexts. This
  3092.           has  the disadvantage of forcing the user  to  be  more  carefull
  3093.           about the context of the  statements variables are placed in, but
  3094.           in  turn  gives  them  more  flexibility in where they can  place
  3095.           variables. Needless to say, this also  allows  EMACS's expression
  3096.           evaluator to be both consice and quick.
  3097.  
  3098.  
  3099.           45
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3107.  
  3108.  
  3109.                   Wherever statements need to have arguments,  it  is legal
  3110.           to  place constants.  A constant is  a  double  quote  character,
  3111.           followed by a string of  characters,  and  terminated  by another
  3112.           double  quote character. To represent various special  characters
  3113.           within a constant, the tilde (~) character is used. The character
  3114.           following the tilde  is  interpeted  according  to  the following
  3115.           table:
  3116.  
  3117.           Sequence        Result
  3118.           ~n              ^J      linefeed/newline, (EMACS newline character)
  3119.           ~r              ^M      carraige return
  3120.           ~~              ~
  3121.           ~b              ^H      backspace
  3122.           ~f              ^L      formfeed
  3123.           ~t              ^I      tab
  3124.           ~"              "
  3125.  
  3126.                   Any character not in the table which follows a tilde will
  3127.           be passed unmodified.  This action is similar to  the  ^Q  quote-
  3128.           character command available from the keyboard.
  3129.  
  3130.                   The double  quotes around constants are not needed if the
  3131.           constant contains no internal whitespace  and  it  also  does not
  3132.           happen  to  meet   the   rules  for  any  other  EMACS  commands,
  3133.           directives, variables, or functions.  This  is  reasonable useful
  3134.           for numeric constants.
  3135.  
  3136.  
  3137.           12.2  Variables
  3138.  
  3139.  
  3140.                   Variables in MicroEMACS  can  be  used  to  return values
  3141.           within expressions, as  repeat  counts to editing commands, or as
  3142.           text  to be inserted into buffers and messages.    The  value  of
  3143.           these  variables  is  set using the  set  (^X-A)  command.    For
  3144.           example, to set the  current  fill  column  to 64 characters, the
  3145.           following macro line would be used:
  3146.  
  3147.                   set $fillcol 64
  3148.  
  3149.                   or to have the contents of %name inserted at the point in
  3150.           the current buffer, the command to use would be:
  3151.  
  3152.                   insert-string %name
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.                                                                          46
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3173.  
  3174.  
  3175.  
  3176.           12.2.1  Environmental Variables
  3177.  
  3178.  
  3179.                   "What good is a quote if you can't change it?"
  3180.  
  3181.                   These variables are used to change  different  aspects of
  3182.           the  way the editor works.  Also they  will  return  the  current
  3183.           settings if used as  part  of  an  expression.  All environmental
  3184.           variable  names begin with a dollar sign ($)  and  are  in  lower
  3185.           case.
  3186.  
  3187.           $acount        The countdown  of  inserted  characters  until the
  3188.                          next save-file.
  3189.  
  3190.           $asave         The   number   of  inserted   characters   between
  3191.                          automatic file-saves in ASAVE mode.
  3192.  
  3193.           $cbufname      Name of the current buffer
  3194.  
  3195.           $cfname        File name of the current buffer
  3196.  
  3197.           $cmode         Integer containing the mode of the current buffer.
  3198.                          (See Appendix F for values)
  3199.  
  3200.           $curchar       Character currently at the point
  3201.  
  3202.           $curcol        Current column of point in current buffer
  3203.  
  3204.           $curline       Current line of point in current buffer
  3205.  
  3206.           $curwidth      Number of columns used currently
  3207.  
  3208.           $cwline        Current display line in current window
  3209.  
  3210.           $debug         Flag to trigger  macro debugging (try it... you'll
  3211.                          like it!)
  3212.  
  3213.           $discmd        Flag to disable the  echoing  of  messages  on the
  3214.                          command line
  3215.  
  3216.           $disinp        Flag  to disable the echoing of characters  during
  3217.                          command line input
  3218.  
  3219.           $fillcol       Current fill column
  3220.  
  3221.           $flicker       Flicker Flag set to TRUE if IBM CGA  set  to FALSE
  3222.                          for most others
  3223.  
  3224.           $gflags        Global  flags  controlling  some  EMACS   internal
  3225.                          functions (See appendix G for details)
  3226.  
  3227.           $gmode         Global mode flags. (See Appendix F for values)
  3228.  
  3229.  
  3230.  
  3231.           47
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3239.  
  3240.  
  3241.           $lastkey       [READ ONLY]Last keyboard character typed
  3242.  
  3243.           $line          The current line  in  the  current  buffer  can be
  3244.                          retrieved and set with this environment variable
  3245.  
  3246.           $lwidth        [READ ONLY]Returns the number of characters in the
  3247.                          current line
  3248.  
  3249.           $match         [READ  ONLY]Last  string  matched  in a magic mode
  3250.                          search
  3251.  
  3252.           $pagelen       Number of screen lines used currently
  3253.  
  3254.           $palette       string  used  to  control  the   palette  register
  3255.                          settings  on graphics versions.  The usually  form
  3256.                          consists  of groups of three octal digits  setting
  3257.                          the red, green, and blue levels.
  3258.  
  3259.           $pending       [READ  ONLY]Flag  to  determine  if there are user
  3260.                          keystrokes waiting to be processed.
  3261.  
  3262.           $progname      [READ ONLY]Always contains the string "MicroEMACS"
  3263.                          for standard MicroEMACS.   Could be something else
  3264.                          if EMACS is incorporated as part of someone else's
  3265.                          program
  3266.  
  3267.           $replace       Current default replace string
  3268.  
  3269.           $rval          This contains  the  return  value  from  the  last
  3270.                          subprocess which was invoked from EMACS
  3271.  
  3272.           $search        Current default search string
  3273.  
  3274.           $seed          Integer seed of the random number generator
  3275.  
  3276.           $sres          Current screen resolution (CGA, MONO or EGA on the
  3277.                          IBM-PC driver.   LOW, MEDIUM, HIGH or DENSE on the
  3278.                          Atari ST1040, NORMAL on all others)
  3279.  
  3280.           $status        [READ ONLY]Status  of  the  success  of  the  last
  3281.                          command (TRUE or FALSE).    This  is  usually used
  3282.                          with !force to  check  on the success of a search,
  3283.                          or a file operation.
  3284.  
  3285.           $target        Current target for line moves (setting this fool's
  3286.                          EMACS into believing the last command  was  a line
  3287.                          move)
  3288.  
  3289.           $tpause        Controls the length  of  the  pause  to  display a
  3290.                          matched fence when the current buffer is  in CMODE
  3291.                          and a close fence has been typed
  3292.  
  3293.           $version       [READ ONLY]Contains the current MicroEMACS version
  3294.                          number
  3295.  
  3296.  
  3297.                                                                          48
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3305.  
  3306.  
  3307.           $wline         Number of display lines in current window
  3308.  
  3309.                   Obviously, many more of these variables will be availible
  3310.           in  future releases of MicroEMACS. (Yes, send  a  vote  for  your
  3311.           favorite new environmental variables today).
  3312.  
  3313.  
  3314.           12.2.2  User variables
  3315.  
  3316.  
  3317.                   User variables  allow you, the user, to store strings and
  3318.           manipulate  them.    These strings can be pieces of text, numbers
  3319.           (in  text form), or the logical values TRUE  and  FALSE.    These
  3320.           variables can be combined,  tested,  inserted  into  buffers, and
  3321.           otherwise used to control the way your macros execute.    At  the
  3322.           moment, up to 255 user variables may be  in  use  in  one editing
  3323.           session.  All users variable names must begin with a percent sign
  3324.           (%) and may contain  any  printing characters.  Only the first 10
  3325.           characters are  significant  (ie  differences  beyond  the  tenth
  3326.           character are  ignored).  Most operators will truncate strings to
  3327.           a length of 128 characters.
  3328.  
  3329.  
  3330.           12.2.3  Buffer Variables
  3331.  
  3332.  
  3333.                   Buffer variables are special in  that  they  can  only be
  3334.           queried and cannot be set.  What buffer variables are is a way to
  3335.           take text from a buffer and place it in a variable.  For example,
  3336.           if I  have  a  buffer  by the name of RIGEL2, and it contains the
  3337.           text:
  3338.  
  3339.                   Richmond
  3340.                   Lafayette
  3341.                   <*>Bloomington          (where <*> is the current point)
  3342.                   Indianapolis
  3343.                   Gary
  3344.                   =* MicroEMACS 3.9e (WRAP) == rigel2 == File: /data/rigel2.txt =====
  3345.  
  3346.                   and within a command I reference #rigel2, like:
  3347.  
  3348.                   insert-string #rigel2
  3349.  
  3350.                   MicroEMACS would start at the current point in the RIGEL2
  3351.           buffer and grab  all the text up to the end of that line and pass
  3352.           that back.  Then it would  advance  the point to the beginning of
  3353.           the next line. Thus, after  our last command executes, the string
  3354.           "Bloomington" gets inserted  into  the  current  buffer,  and the
  3355.           buffer RIGEL2 now looks like this:
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.           49
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3371.  
  3372.  
  3373.                   Richmond
  3374.                   Lafayette
  3375.                   Bloomington
  3376.                   <*>Indianapolis         (where <*> is the current point)
  3377.                   Gary
  3378.                   =* MicroEMACS 3.9e (WRAP) == rigel2 == File: /data/rigel2.txt =====
  3379.  
  3380.                   as you have probably noticed, a buffer  variable consists
  3381.           of the buffer name, preceded by a pound sign (#).
  3382.  
  3383.  
  3384.           12.2.4  Interactive variables
  3385.  
  3386.  
  3387.                   Interactive variables are actually a method to prompt the
  3388.           user for a string.  This is done by using an at sign (@) followed
  3389.           either with a quoted string, or a variable  containing  a string.
  3390.           The string is the placed on the bottom line, and the editor waits
  3391.           for the user to type in a string.  Then the  string  typed  in by
  3392.           the users is returned as the value of  the  interactive variable.
  3393.           For example:
  3394.  
  3395.                   set %quest "What file? "
  3396.                   find-file @%quest
  3397.  
  3398.                   will ask the user for a file name, and  then  attempt  to
  3399.           find it. Note also that complex expressions can be built  up with
  3400.           these operators, such as:
  3401.  
  3402.           @&cat &cat "File to decode[" %default "]: "
  3403.  
  3404.                   which prompts the user with the concatinated string.
  3405.  
  3406.  
  3407.           12.3  Functions
  3408.  
  3409.  
  3410.                   Functions can be used to manipulate variables  in various
  3411.           ways.  Functions can have one, two, or three  arguments.    These
  3412.           arguments will always be placed after the function on the current
  3413.           command line.  For example, if we wanted to increase  the current
  3414.           fill  column  by  two, using emacs's set (^X-A) command, we would
  3415.           write:
  3416.  
  3417.                   set $fillcol &add $fillcol 2
  3418.                    \      \      \      \     \____second operand
  3419.                     \      \      \      \_________first operand
  3420.                      \      \      \_______________function to execute
  3421.                       \      \_____________________variable to set
  3422.                        \___________________________set (^X-A) command
  3423.  
  3424.                   Function  names  always  begin  with  the  ampersand  (&)
  3425.           character, and are only significant to the first three characters
  3426.           after the ampersand.  Functions will normal expect  one  of three
  3427.  
  3428.  
  3429.                                                                          50
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3437.  
  3438.  
  3439.           types of arguments, and  will  automatically  convert  types when
  3440.           needed.
  3441.  
  3442.           <num>          an ascii string of digits which is interpeted as a
  3443.                          numeric value.  Any string  which  does  not start
  3444.                          with  a   digit  or  a  minus  sign  (-)  will  be
  3445.                          considered zero.
  3446.  
  3447.           <str>          An arbitrary string of characters.  At the moment,
  3448.                          strings are limited to 128 characters in length.
  3449.  
  3450.           <log>          A logical value consisting of the string "TRUE" or
  3451.                          "FALSE".  Numeric strings  will  also  evaluate to
  3452.                          "FALSE" if they  are  equal to zero, and "TRUE" if
  3453.                          they are non-zero.   Arbitrary  text  strings will
  3454.                          have the value of "FALSE".
  3455.  
  3456.                   A  list  of the currently  availible  functions  follows:
  3457.           (Once again, send in those votes on what kind  of  functions  you
  3458.           would  like to see added!) Functions are  always  used  in  lower
  3459.           case, the uppercase letters in the function table  are  the short
  3460.           form of the function (ie &div for ÷).
  3461.  
  3462.           Numeric Functions:      (returns <num>)
  3463.  
  3464.           &ADD            <num> <num>     Add two numbers
  3465.           &SUB            <num> <num>     Subtract the second number from the first
  3466.           &TIMes          <num> <num>     Multiply two numbers
  3467.           &DIVide         <num> <num>     Divide the first number by the second
  3468.                                           giving an integer result
  3469.           &MOD            <num> <num>     Return the reminder of dividing the
  3470.                                           first number by the second
  3471.           &NEGate         <neg>           Multiply the arg by -1
  3472.           &LENgth         <str>           Returns length of string
  3473.           &SINdex         <str1> <str2>   Finds the position of <str2> within
  3474.                                           <str1>. Returns zero if not found.
  3475.           &ASCii          <str>           Return the ascii code of the first
  3476.                                           character in <str>
  3477.           &RND            <num>           Returns a random integer between 1 and
  3478.                                           <num>
  3479.           &ABS            <num>           Returns the absolute value of <num>
  3480.           &BANd           <num> <num>     Bitwise AND function
  3481.           &BOR            <num> <num>     Bitwise OR function
  3482.           &BXOr           <num> <num>     Bitwise XOR function
  3483.           &BNOt           <num>           Bitwise NOT function
  3484.  
  3485.           String manipulation functions:  (returns <str>)
  3486.  
  3487.           &CAT            <str> <str>     Concatinate the two strings to form one
  3488.           &LEFt           <str> <num>     return the <num> leftmost characters
  3489.                                           from <str>
  3490.           &RIGht          <str> <num>     return the <num> rightmost characters
  3491.                                           from <str>
  3492.  
  3493.  
  3494.  
  3495.           51
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3503.  
  3504.  
  3505.           &MID            <str> <num1> <num2>
  3506.                                           Starting from <num1> position in <str>,
  3507.                                           return <num2> characters.
  3508.           &UPPer          <str>           Uppercase <str>
  3509.           &LOWer          <str>           lowercase <str>
  3510.           &CHR            <num>           return a string with the character
  3511.                                           represented by ascii code <num>
  3512.           >K                            return a string containing a single
  3513.                                           keystroke from the user
  3514.           &ENV            <str>           If the operating system is capable, this
  3515.                                           returns the environment string associated
  3516.                                           with <str>
  3517.           &BIND           <str>           return the function name bound to the
  3518.                                           keystroke <str>
  3519.           &ENV            <str>           Returns the operating system value
  3520.                                           attached to environmental variable <str>
  3521.           &FINd           <str>           Find the named file <str> along the
  3522.                                           path and return its full file specification
  3523.                                           or an empty string if none exists
  3524.  
  3525.           Logical Testing functions:      (returns <log>)
  3526.  
  3527.           &NOT            <log>           Return the opposite logical value
  3528.           &AND            <log1> <log2>   Returns TRUE if BOTH logical arguments
  3529.                                           are TRUE
  3530.           &OR             <log1> <log2>   Returns TRUE if either argument
  3531.                                           is TRUE
  3532.           &EQUal          <num> <num>     If <num> and <num> are numerically
  3533.                                           equal, return TRUE
  3534.           &LESs           <num1> <num2>   If <num1> is less than <num2>, return
  3535.                                           TRUE.
  3536.           &GREater        <num1> <num2>   If <num1> is greater than, or equal to
  3537.                                           <num2>, return TRUE.
  3538.           &SEQual         <str1> <str2>   If the two strings are the same, return
  3539.                                           TRUE.
  3540.           &SLEss          <str1> <str2>   If <str1> is less alphabetically than
  3541.                                           <str2>, return TRUE.
  3542.           &SGReater       <str1> <str2>   If <str1> is alphabetically greater than
  3543.                                           or equal to <str2>, return TRUE.
  3544.           &FINd           <str>           Does the named file <str> exist?
  3545.  
  3546.           Special Functions:
  3547.  
  3548.           &INDirect       <str>           Evaluate <str> as a variable.
  3549.  
  3550.                   This last function deserves  more  explanation.  The &IND
  3551.           function evaluates its argument, takes the resulting  string, and
  3552.           then  uses  it  as a variable  name.    For  example,  given  the
  3553.           following code sequence:
  3554.  
  3555.                   ; set up reference table
  3556.  
  3557.                   set %one        "elephant"
  3558.                   set %two        "giraffe"
  3559.  
  3560.  
  3561.                                                                          52
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3569.  
  3570.  
  3571.                   set %three      "donkey"
  3572.  
  3573.                   set %index "two"
  3574.                   insert-string &ind %index
  3575.  
  3576.                   the string "giraffe"  would  have  been  inserted  at the
  3577.           point  in the current buffer.  This  indirection  can  be  safely
  3578.           nested up to about 10 levels.
  3579.  
  3580.  
  3581.           12.4  Directives
  3582.  
  3583.  
  3584.                   Directives  are  commands which only  operate  within  an
  3585.           executing macro, ie they  do  not make sense as a single command.
  3586.           As such, they cannot  be  called up singly or bound to keystroke.
  3587.           Used within macros, they control what lines are  executed  and in
  3588.           what order.
  3589.  
  3590.                   Directives  always  start  with  the exclamation mark (!)
  3591.           character  and  must  be  the  first  thing  placed  on  a  line.
  3592.           Directives executed interactively  (via  the execute-command-line
  3593.           command) will be ignored.
  3594.  
  3595.  
  3596.           12.4.1  !ENDM Directive
  3597.  
  3598.  
  3599.                   This directive is used to terminate a macro being stored.
  3600.           For example, if a file is being executed contains the text:
  3601.  
  3602.                   ;       Read in a file in view mode, and make the window red
  3603.  
  3604.                   26      store-macro
  3605.                           find-file @"File to view: "
  3606.                           add-mode "view"
  3607.                           add-mode "red"
  3608.                   !endm
  3609.  
  3610.                   write-message "[Consult macro has been loaded]"
  3611.  
  3612.                   only the lines between the  store-macro  command  and the
  3613.           !ENDM  directive  are  stored in macro 26.  Both numbered macroes
  3614.           and named procedures (via the store-procedure command)  should be
  3615.           terminated with this directive.
  3616.  
  3617.  
  3618.           12.4.2  !FORCE Directive
  3619.  
  3620.  
  3621.                   When MicroEMACS executes a macro, if  any  command fails,
  3622.           the macro is terminated at that point. If a line is  preceeded by
  3623.           a !FORCE  directive,  execution  continues  weather  the  command
  3624.           succeeds or not. For example:
  3625.  
  3626.  
  3627.           53
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3635.  
  3636.  
  3637.                   ;       Merge the top two windows
  3638.  
  3639.                   save-window             ;remember what window we are at
  3640.                   1 next-window           ;go to the top window
  3641.                   delete-window           ;merge it with the second window
  3642.                   !force restore-window   ;This will continue regardless
  3643.                   add-mode "red"
  3644.  
  3645.  
  3646.           12.4.3  !IF, !ELSE, and !ENDIF Directives
  3647.  
  3648.  
  3649.                   This directive allows statements only to be executed if a
  3650.           condition  specified  in  the  directive  is  met.    Every  line
  3651.           following  the !IF directive, until the  first  !ELSE  or  !ENDIF
  3652.           directive, is only  executed  if the expression following the !IF
  3653.           directive evaluates to a TRUE  value.  For example, the following
  3654.           macro segment creates  the  portion of a text file automatically.
  3655.           (yes believe me, this will be easier to understand then that last
  3656.           explanation....)
  3657.  
  3658.                   !if &sequal %curplace "timespace vortex"
  3659.                           insert-string "First, rematerialize~n"
  3660.                   !endif
  3661.                   !if &sequal %planet "earth"     ;If we have landed on earth...
  3662.                           !if &sequal %time "late 20th century"  ;and we are then
  3663.                                   write-message "Contact U.N.I.T."
  3664.                           !else
  3665.                                   insert-string "Investigate the situation....~n"
  3666.                                   insert-string "(SAY 'stay here Sara')~n"
  3667.                           !endif
  3668.                   !else
  3669.                           set %conditions @"Atmosphere conditions outside? "
  3670.                           !if &sequal %conditions "safe"
  3671.                                   insert-string &cat "Go outside......" "~n"
  3672.                                   insert-string "lock the door~n"
  3673.                           !else
  3674.                                   insert-string "Dematerialize..try somewhen else"
  3675.                                   newline
  3676.                           !endif
  3677.                   !endif
  3678.  
  3679.  
  3680.           12.4.4  !GOTO Directive
  3681.  
  3682.  
  3683.                   Flow can be controlled within  a  MicroEMACS  macro using
  3684.           the !GOTO directive.  It  takes  as  an argument a label. A label
  3685.           consists  of a line starting with an asterisk  (*)  and  then  an
  3686.           alphanumeric label.  Only labels in the currently executing macro
  3687.           can  be jumped to, and trying to jump  to  a  non-existing  label
  3688.           terminates execution of a macro.  For example..
  3689.  
  3690.                   ;Create a block of DATA statements for a BASIC program
  3691.  
  3692.  
  3693.                                                                          54
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.           MicroEMACS Macros                     MicroEMACS Reference Manual
  3701.  
  3702.  
  3703.                           insert-string "1000 DATA "
  3704.                           set %linenum 1000
  3705.  
  3706.                   *nxtin
  3707.                           update-screen           ;make sure we see the changes
  3708.                           set %data @"Next number: "
  3709.                           !if &equal %data 0
  3710.                                   !goto finish
  3711.                           !endif
  3712.  
  3713.                           !if &greater $curcol 60
  3714.                                   2 delete-previous-character
  3715.                                   newline
  3716.                                   set %linenum &add %linenum 10
  3717.                                   insert-string &cat %linenum " DATA "
  3718.                           !endif
  3719.  
  3720.                           insert-string &cat %data ", "
  3721.                           !goto nxtin
  3722.  
  3723.                   *finish
  3724.  
  3725.                           2 delete-previous-character
  3726.                           newline
  3727.  
  3728.  
  3729.           12.4.5  !WHILE and !ENDWHILE Directives
  3730.  
  3731.  
  3732.                   This directive allows  you  to  set  up  repetitive tasks
  3733.           easily  and  efficiently.  If  a  group of statements need to  be
  3734.           executed while a certain condition is true, enclose  them  with a
  3735.           while loop. For example,
  3736.  
  3737.                   !while &less $curcol 70
  3738.                           insert-string &cat &cat "[" #stuff "]"
  3739.                   !endwhile
  3740.  
  3741.                   places items from buffer "item" in the current line until
  3742.           the cursor is at or past  column  70.   While loops may be nested
  3743.           and can contain and be the targets of !GOTOs with no ill effects.
  3744.           Using a  while  loop  to  enclose  a  repeated task will run much
  3745.           faster than the corresponding construct using !IFs.
  3746.  
  3747.  
  3748.           12.4.6  !BREAK Directive
  3749.  
  3750.  
  3751.                   This  directive  allows  the  user  to abort out  of  the
  3752.           currently most inner while loop, regardless of the condition.  It
  3753.           is  often used to abort processing for  error  conditions.    For
  3754.           example:
  3755.  
  3756.           ;       Read in files and substitute "begining" with "beginning"
  3757.  
  3758.  
  3759.           55
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.           MicroEMACS Reference Manual                     MicroEMACS Macros
  3767.  
  3768.  
  3769.                   set %filename #list
  3770.                   !while ¬ &seq %filename "<end>"
  3771.           !force          find-file %filename
  3772.                           !if &seq $status FALSE
  3773.                                   write-message "[File read error]"
  3774.                                   !break
  3775.                           !endif
  3776.                           beginning-of-file
  3777.                           replace-string "begining" "beginning"
  3778.                           save-file
  3779.                           set %filename #list
  3780.                   !endwhile
  3781.  
  3782.                   This  while loop will process files  until  the  list  is
  3783.           exhausted or there is an error while reading a file.
  3784.  
  3785.  
  3786.           12.4.7  !RETURN Directive
  3787.  
  3788.  
  3789.                   The !RETURN Directive causes the current  macro  to exit,
  3790.           either returning to the caller (if any) or  to  interactive mode.
  3791.           For example:
  3792.  
  3793.                   ;       Check the monitor type and set %mtyp
  3794.  
  3795.                   !if &sres "CGA"
  3796.                           set %mtyp 1
  3797.                           !return
  3798.                   !else
  3799.                           set %mtyp 2
  3800.                   !endif
  3801.  
  3802.                   insert-string "You are on a MONOCHROME machine!~n"
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.                                                                          56
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.           MicroEMACS Command Line Switches and Startup Files     MicroEMACS
  3833.                                                            Reference Manual
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.  
  3840.  
  3841.  
  3842.                                      Appendix A
  3843.  
  3844.                  MicroEMACS Command Line Switches and Startup Files
  3845.  
  3846.  
  3847.                   When EMACS first executes, it always searches for a file,
  3848.           called .emacsrc under most UNIX systems or emacs.rc on most other
  3849.           systems which it will execute as EMACS macros before it  reads in
  3850.           the named source files. This file normally contains EMACS macroes
  3851.           to  bind  the  function keys to useful functions and load various
  3852.           usefull macros.  The  contents  of  this  file will probably vary
  3853.           from system to system and can be modified by the user as desired.
  3854.  
  3855.                   When searching for this file,  EMACS looks for it in this
  3856.           order.  First, it attempts to find a definition for "HOME" in the
  3857.           environment.   It will look in that directory  first.    Then  it
  3858.           searches all the directories  listed  in  the  "PATH" environment
  3859.           variable.    Then  it looks through a list of predefined standard
  3860.           directories which vary  from  system to system.  Finally, failing
  3861.           all  of  these,  it looks in the current directory.  This is also
  3862.           the same method EMACS uses to  look  up any files to execute, and
  3863.           to find it's help file EMACS.HLP.
  3864.  
  3865.                   On  computers  that  call  up  EMACS via a  command  line
  3866.           process, such as MSDOS and  UNIX, there are different things that
  3867.           can  be  added  to  the  command  line  to  control the way EMACS
  3868.           operates. These can be switches,  which are a dash ('-') followed
  3869.           by a letter, and  possible  other  parameters,  or a startup file
  3870.           specifier, which is an at sign '@' followed by a file name.
  3871.  
  3872.           @<file>        This causes the named file to be  executed instead
  3873.                          of  the standard emacs.rc file before emacs  reads
  3874.                          in any other files.  More than one of these can be
  3875.                          placed on  the  command  line,  and  they  will be
  3876.                          executed in the order that they appear.
  3877.  
  3878.           -A             This flag causes emacs  to  automatically  run the
  3879.                          startup file "error.cmd" instead of emacs.rc. This
  3880.                          is  used  by  various   C   compilers   for  error
  3881.                          processing (for example, Mark Williams C).
  3882.  
  3883.           -E             The following source files on the command line can
  3884.                          be edited (as opposed to being in VIEW mode). This
  3885.                          is mainly used to cancel  the  effects  of  the -v
  3886.                          switch used previously in the same command line.
  3887.  
  3888.  
  3889.  
  3890.  
  3891.           57
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.           MicroEMACS Reference Manual  MicroEMACS Command Line Switches and
  3899.                                                               Startup Files
  3900.  
  3901.  
  3902.           -G<num>        Upon entering EMACS, position  the  cursor  at the
  3903.                          <num> line of the first file.
  3904.  
  3905.           -K<key>        This key  tells emacs to place the source files in
  3906.                          CRYPT  mode  and  read it in using  <key>  as  the
  3907.                          encryption key.  If no  key  is  listed immediatly
  3908.                          after the  -K switch, EMACS will prompt for a key,
  3909.                          and not echo it as it is typed.
  3910.  
  3911.           -R             This  places EMACS in "restricted mode" where  any
  3912.                          commands allowing the user to  read  or  write any
  3913.                          files other than the ones  listed  on  the command
  3914.                          line are disabled.  Also all commands allowing the
  3915.                          user access to  the operating system are disabled.
  3916.                          This  makes  EMACS  very   useful   as   a  "safe"
  3917.                          environment for use within other  applications and
  3918.                          especially used as a  remote  editor  for a BBS or
  3919.                          electronic bulletin board system.
  3920.  
  3921.           -S<string>     After EMACS is started, it  automatically searches
  3922.                          for <string> in the first source file.
  3923.  
  3924.           -V             This tells EMACS that  all  the  following sources
  3925.                          files on the  command  line should be in VIEW mode
  3926.                          to prevent any changes being made to them.
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.                                                                          58
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.           MicroEMACS commands                   MicroEMACS Reference Manual
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.                                      Appendix B
  3974.  
  3975.                                  MicroEMACS commands
  3976.  
  3977.  
  3978.                   Below  is  a  complete list of the commands in EMACS, the
  3979.           keys normally used to do the command, and what the  command does.
  3980.           Remember, on some computers there  may also be additional ways of
  3981.           using  a  command  (cursor  keys  and special function  keys  for
  3982.           example).
  3983.  
  3984.           Command                         Binding         Meaning
  3985.           abort-command            ^G     This allows the user to abort out of any
  3986.                                           command that is waiting for input
  3987.  
  3988.           add-mode                 ^X-M   Add a mode to the current buffer
  3989.  
  3990.           add-global-mode          M-M    Add a global mode for all new buffers
  3991.  
  3992.           apropos                  M-A    List out commands whose name contains
  3993.                                           the string specified
  3994.  
  3995.           backward-character       ^B     Move one character to the left
  3996.  
  3997.           begin-macro              ^X-(   Begin recording a keyboard macro
  3998.  
  3999.           beginning-of-file        M-<    Move to the beginning of the file in
  4000.                                           the current buffer
  4001.  
  4002.           beginning-of-line        ^A     Move to the beginning of the current line
  4003.  
  4004.           bind-to-key              M-K    Bind a key to a function
  4005.  
  4006.           buffer-position          ^X-=   List the position of the cursor in the
  4007.                                           current window on the command line
  4008.  
  4009.           case-region-lower        ^X-^L  Make a marked region all lower case
  4010.  
  4011.           case-region-upper        ^X-^U  Make a marked region all upper case
  4012.  
  4013.           case-word-capitalize     M-C    Capitalize the following word
  4014.  
  4015.           case-word-lower          M-L    Lower case the following word
  4016.  
  4017.           case-word-upper          M-U    Upper case the following word
  4018.  
  4019.           change-file-name         ^X-N   Change the name of the file in the
  4020.                                           current buffer
  4021.  
  4022.  
  4023.           59
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.  
  4030.           MicroEMACS Reference Manual                   MicroEMACS commands
  4031.  
  4032.  
  4033.           change-screen-size       M-^S   Change the number of lines of the screen
  4034.                                           currently being used
  4035.  
  4036.           change-screen-width      M-^T   Change the number of columns of the
  4037.                                           screen currently being used
  4038.  
  4039.           clear-and-redraw         ^L     Clear the physical screen and redraw it
  4040.  
  4041.           clear-message-line      (none)  Clear the command line
  4042.  
  4043.           copy-region              M-W    Copy the currently marked region into
  4044.                                           the kill buffer
  4045.  
  4046.           count-words              M-^C   Count how many words, lines and
  4047.                                           characters are in the current marked region
  4048.  
  4049.           ctlx-prefix              ^X     Change the key used as the ^X prefix
  4050.  
  4051.           delete-blank-lines       ^X-^O  Delete all blank lines around the cursor
  4052.  
  4053.           delete-buffer            ^X-K   Delete a buffer which is not being
  4054.                                           currently displayed in a window
  4055.  
  4056.           delete-mode              ^X-^M  Turn off a mode in the current buffer
  4057.  
  4058.           delete-global-mode       M-^M   Turn off a global mode
  4059.  
  4060.           delete-next-character    ^D     Delete the character following the cursor
  4061.  
  4062.           delete-next-word         M-D    Delete the word following the cursor
  4063.  
  4064.           delete-other-windows     ^X-1   Make the current window cover the entire
  4065.                                           screen
  4066.  
  4067.           delete-previous-character^H     Delete the character to the left of the
  4068.                                           cursor
  4069.  
  4070.           delete-previous-word     M-^H   Delete the word to the left of the cursor
  4071.  
  4072.           delete-window            ^X-0   Remove the current window from the screen
  4073.  
  4074.           describe-bindings       (none)  Make a list of all legal commands
  4075.  
  4076.           describe-key             ^X-?   Describe what command is bound to a
  4077.                                           keystroke sequence
  4078.  
  4079.           detab-line               ^X-^D  Change all tabs in a line to the
  4080.                                           equivelant spaces
  4081.  
  4082.           end-macro                ^X-)   stop recording a keyboard macro
  4083.  
  4084.           end-of-file              M->    Move cursor to the end of the current
  4085.                                           buffer
  4086.  
  4087.  
  4088.  
  4089.                                                                          60
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.  
  4096.           MicroEMACS commands                   MicroEMACS Reference Manual
  4097.  
  4098.  
  4099.           end-of-line              ^E     Move to the end of the current line
  4100.  
  4101.           entab-line               ^X-^E  Change multiple spaces to tabs where
  4102.                                           possible
  4103.  
  4104.           exchange-point-and-mark  ^X-^X  Move cursor to the last marked spot,
  4105.                                           make the original position be marked
  4106.  
  4107.           execute-buffer          (none)  Execute a buffer as a macro
  4108.  
  4109.           execute-command-line    (none)  Execute a line typed on the command
  4110.                                           line as a macro command
  4111.  
  4112.           execute-file             FNB    Execute a file as a macro
  4113.  
  4114.           execute-macro            ^X-E   Execute the keyboard macro (play back
  4115.                                           the recorded keystrokes)
  4116.           execute-macro-<n>       (none)  Execute numbered macro <N> where <N> is
  4117.                                           an integer from 1 to 40
  4118.  
  4119.           execute-named-command    M-X    Execute a command by name
  4120.  
  4121.           execute-procedure        M-^E   Execute a procedure by name
  4122.  
  4123.           execute-program         ^X-$    Execute a program directly (not through
  4124.                                           an intervening shell)
  4125.  
  4126.           exit-emacs               ^X-^C  Exit EMACS. If there are unwritten,
  4127.                                           changed buffers EMACS will ask to confirm
  4128.  
  4129.           fill-paragraph           M-Q    Fill the current paragraph
  4130.  
  4131.           filter-buffer            ^X-#   Filter the current buffer through an
  4132.                                           external filter
  4133.  
  4134.           find-file                ^X-^F  Find a file to edit in the current window
  4135.  
  4136.           forward-character        ^F     Move cursor one character to the right
  4137.  
  4138.           goto-line                M-G    Goto a numbered line
  4139.  
  4140.           goto-matching-fence      M-^F   Goto the matching fence
  4141.  
  4142.           grow-window              ^X-^   Make the current window larger
  4143.  
  4144.           handle-tab               ^I     Insert a tab or set tab stops
  4145.  
  4146.           hunt-forward             FN=    Hunt for the next match of the last
  4147.                                           search string
  4148.  
  4149.           hunt-backward            FN>    Hunt for the last match of the last
  4150.                                           search string
  4151.  
  4152.           help                     M-?    Read EMACS.HLP into a buffer and display it
  4153.  
  4154.  
  4155.           61
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.           MicroEMACS Reference Manual                   MicroEMACS commands
  4163.  
  4164.  
  4165.           i-shell                  ^X-C   Shell up to a new command processor
  4166.  
  4167.           incremental-search       ^X-S   Search for a string, incrementally
  4168.  
  4169.           insert-file              ^X-^I  insert a file at the cursor in the
  4170.                                           current file
  4171.  
  4172.           insert-space             ^C     Insert a space to the right of the cursor
  4173.  
  4174.           insert-string           (none)  Insert a string at the cursor
  4175.  
  4176.           kill-paragraph           M-^W   Delete the current paragraph
  4177.  
  4178.           kill-region              ^W     Delete the current marked region, moving
  4179.                                           it to the kill buffer
  4180.  
  4181.           kill-to-end-of-line      ^K     Delete the rest of the current line
  4182.  
  4183.           list-buffers             ^X-^B  List all existing buffers
  4184.  
  4185.           meta-prefix              <ESC>  Key used to precede all META commands
  4186.  
  4187.           move-window-down         ^X-^N  Move all the lines in the current window
  4188.                                           down
  4189.  
  4190.           move-window-up           ^X-^P  Move all the lines in the current window up
  4191.  
  4192.           name-buffer              M-^N   Change the name of the current buffer
  4193.  
  4194.           newline                  ^M     Insert a <NL> at the cursor
  4195.  
  4196.           newline-and-indent       ^J     Insert a <NL> at the cursor and indent
  4197.                                           the new line the same as the preceeding
  4198.           line
  4199.  
  4200.           next-buffer              ^X-X   Bring the next buffer in the list into
  4201.                                           the current window
  4202.  
  4203.           next-line                ^N     Move the cursor down one line
  4204.  
  4205.           next-page                ^V     Move the cursor down one page
  4206.  
  4207.           next-paragraph           M-N    Move cursor to the next paragraph
  4208.  
  4209.           next-window              ^X-O   Move cursor to the next window
  4210.  
  4211.           next-word                M-F    Move cursor to the beginning of the
  4212.                                           next word
  4213.  
  4214.           nop                      M-FNC  Does nothing
  4215.  
  4216.           open-line                ^O     Open a line at the cursor
  4217.  
  4218.           overwrite-string        (none)  Overwrite a string at the cursor
  4219.  
  4220.  
  4221.                                                                          62
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.           MicroEMACS commands                   MicroEMACS Reference Manual
  4229.  
  4230.  
  4231.           pipe-command             ^X-@   Execute an external command and place
  4232.                                           its output in a buffer
  4233.  
  4234.           previous-line            ^P     Move cursor up one line
  4235.  
  4236.           previous-page            ^Z     Move cursor up one page
  4237.  
  4238.           previous-paragraph       M-P    Move back one paragraph
  4239.  
  4240.           previous-window          ^X-P   Move the cursor to the last window
  4241.  
  4242.           previous-word            M-B    Move the cursor to the beginning of the
  4243.                                           word to the left of the cursor
  4244.  
  4245.           query-replace-string     M-^R   Replace all of one string with another
  4246.                                           string, interactively querying the user
  4247.  
  4248.           quick-exit               M-Z    Exit EMACS, writing out all changed buffers
  4249.  
  4250.           quote-character          ^Q     Insert the next character literally
  4251.  
  4252.           read-file                ^X-^R  Read a file into the current buffer
  4253.  
  4254.           redraw-display           M-^L   Redraw the display, centering the
  4255.                                           current line
  4256.  
  4257.           resize-window            ^X-W   Change the number of lines in the
  4258.                                           current window
  4259.  
  4260.           restore-window          (none)  Move cursor to the last saved window
  4261.  
  4262.           replace-string           M-R    Replace all occurences of one string
  4263.                                           with another string from the cursor
  4264.                                           to the end of the buffer
  4265.  
  4266.           reverse-incremental-search^X-R  Search backwards, incrementally
  4267.  
  4268.           run                      M-^E   Execute a named procedure
  4269.  
  4270.           save-file                ^X-^S  Save the current buffer if it is changed
  4271.  
  4272.           save-window             (none)  Remember current window (to restore later)
  4273.  
  4274.           scroll-next-up           M-^Z   Scroll the next window up
  4275.  
  4276.           scroll-next-down         M-^V   Scroll the next window down
  4277.  
  4278.           search-forward           ^S     Search for a string
  4279.  
  4280.           search-reverse           ^R     Search backwards for a string
  4281.  
  4282.           select-buffer            ^X-B   Select a buffer to display in the
  4283.                                           current window
  4284.  
  4285.  
  4286.  
  4287.           63
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.           MicroEMACS Reference Manual                   MicroEMACS commands
  4295.  
  4296.  
  4297.           set                      ^X-A   Set a variable to a value
  4298.  
  4299.           set-encryption-key       M-E    Set the encryption key of the current
  4300.                                           buffer
  4301.  
  4302.           set-fill-column          ^X-F   Set the current fill column
  4303.  
  4304.           set-mark                        Set the mark
  4305.  
  4306.           shell-command            ^X-!   Causes an external shell to execute
  4307.                                           a command
  4308.  
  4309.           shrink-window            ^X-^Z  Make the current window smaller
  4310.  
  4311.           split-current-window     ^X-2   Split the current window in two
  4312.  
  4313.           store-macro             (none)  Store the following macro lines to a
  4314.                                           numbered macro
  4315.  
  4316.           store-procedure         (none)  Store the following macro lines to a
  4317.                                           named procedure
  4318.  
  4319.           transpose-characters     ^T     Transpose the character at the cursor
  4320.                                           with the character to the left
  4321.  
  4322.           trim-line                ^X-^T  Trim any trailing whitespace from line
  4323.  
  4324.           unbind-key               M-^K   Unbind a key from a function
  4325.  
  4326.           universal-argument       ^U     Execute the following command 4 times
  4327.  
  4328.           unmark-buffer            M-~    Unmark the current buffer (so it is
  4329.                                           no longer changed)
  4330.  
  4331.           update-screen           (none)  Force a screen update during macro
  4332.                                           execution
  4333.  
  4334.           view-file                ^X-^V  Find a file,and put it in view mode
  4335.  
  4336.           wrap-word                M-FNW  Wrap the current word, this is an
  4337.                                           internal function
  4338.  
  4339.           write-file               ^X-^W  Write the current buffer under a new
  4340.                                           file name
  4341.  
  4342.           write-message           (none)  Display a string on the command line
  4343.  
  4344.           yank                     ^Y     yank the kill buffer into the current
  4345.                                           buffer at the cursor
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.                                                                          64
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.           MicroEMACS Bindings                   MicroEMACS Reference Manual
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.                                      Appendix C
  4370.  
  4371.                                  MicroEMACS Bindings
  4372.  
  4373.  
  4374.                   Below  is a complete list of the  key  bindings  used  in
  4375.           MicroEMACS. This can  be  used  as  a  wall  chart  reference for
  4376.           MicroEMACS commands.
  4377.  
  4378.                            Default Key Bindings for MicroEmacs 3.9e
  4379.  
  4380.            ^A   Move to start of line           ESC A   Apropos (list some commands)
  4381.            ^B   Move backward by characters     ESC B   Backup by words
  4382.            ^C   Insert space                    ESC C   Initial capitalize word
  4383.            ^D   Forward delete                  ESC D   Delete forward word
  4384.            ^E   Goto end of line                ESC E   Reset Encryption Key
  4385.            ^F   Move forward by characters      ESC F   Advance by words
  4386.            ^G   Abort out of things             ESC G   Go to a line
  4387.            ^H   Backward delete
  4388.            ^I   Insert tab/Set tab stops
  4389.            ^J   Insert <NL>, then indent
  4390.            ^K   Kill forward                    ESC K   Bind Key to function
  4391.            ^L   Refresh the screen              ESC L   Lower case word
  4392.            ^M   Insert <NL>                     ESC M   Add global mode
  4393.            ^N   Move forward by lines           ESC N   Goto End paragraph
  4394.            ^O   Open up a blank line
  4395.            ^P   Move backward by lines          ESC P   Goto Begining of paragraph
  4396.            ^Q   Insert literal                  ESC Q   Fill current paragraph
  4397.            ^R   Search backwards                ESC R   Search and replace
  4398.            ^S   Search forward
  4399.            ^T   Transpose characters
  4400.            ^U   Repeat command four times       ESC U   Upper case word
  4401.            ^V   Move forward by pages           ESC V   Move backward by pages
  4402.            ^W   Kill region                     ESC W   Copy region to kill buffer
  4403.            ^Y   Yank back from killbuffer       ESC X   Execute named command
  4404.            ^Z   Move backward by pages          ESC Z   Save all buffers and exit
  4405.  
  4406.            ESC ^C   Count words in region       ESC ~   Unmark current buffer
  4407.            ESC ^E   Execute named procedure
  4408.            ESC ^F   Goto matching fence         ESC !   Reposition window
  4409.            ESC ^H   Delete backward word        ESC <   Move to start of buffer
  4410.            ESC ^K   Unbind Key from function    ESC >   Move to end of buffer
  4411.            ESC ^L   Reposition window           ESC .   Set mark
  4412.            ESC ^M   Delete global mode          ESC space    Set mark
  4413.            ESC ^N   Rename current buffer       ESC rubout   Delete backward word
  4414.            ESC ^R   Search & replace w/query        rubout   Backward delete
  4415.            ESC ^S   Change screen rows
  4416.            ESC ^T   Change screen columns
  4417.  
  4418.  
  4419.           65
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.           MicroEMACS Reference Manual                   MicroEMACS Bindings
  4427.  
  4428.  
  4429.            ESC ^V   Scroll next window down
  4430.            ESC ^W   Delete Paragraph
  4431.            ESC ^Z   Scroll next window up
  4432.  
  4433.            ^X ?   Describe a key             ^X !   Run 1 command in a shell
  4434.            ^X =   Show the cursor position   ^X @    Pipe shell command to buffer
  4435.            ^X ^   Enlarge display window     ^X #   Filter buffer thru shell filter
  4436.            ^X 0   Delete current window      ^X $   Execute an external program
  4437.            ^X 1   Delete other windows       ^X (   Begin macro
  4438.            ^X 2   Split current window       ^X )   End macro
  4439.                                              ^X A   Set variable value
  4440.            ^X ^B   Display buffer list       ^X B   Switch a window to a buffer
  4441.            ^X ^C   Exit MicroEMACS           ^X C   Start a new command processor
  4442.            ^X ^D   Detab line                ^X D   Suspend MicroEMACS (BSD4.2 only)
  4443.            ^X ^E   Entab line                ^X E   Execute macro
  4444.            ^X ^F   Find file                 ^X F   Set fill column
  4445.            ^X ^I   Insert file
  4446.                                              ^X K   Delete buffer
  4447.            ^X ^L   Lower case region
  4448.            ^X ^M   Delete Mode               ^X M   Add a mode
  4449.            ^X ^N   Move window down          ^X N   Rename current filename
  4450.            ^X ^O   Delete blank lines        ^X O   Move to the next window
  4451.            ^X ^P   Move window up            ^X P   Move to the previous window
  4452.            ^X ^R   Get a file from disk      ^X R   Incremental reverse search
  4453.            ^X ^S   Save current file         ^X S   Incremental forward search
  4454.            ^X ^T   Trim line                 (Incremental search
  4455.            ^X ^U   Upper case region                not always availible)
  4456.            ^X ^V   View file
  4457.            ^X ^W   Write a file to disk      ^X W   resize Window
  4458.            ^X ^X   Swap "." and mark         ^X X   Use next buffer
  4459.            ^X ^Z   Shrink window             ^X Z   Enlarge display window
  4460.  
  4461.           Usable Modes
  4462.           WRAP     Lines going past right margin "wrap" to a new line
  4463.           VIEW     Read-Only mode where no modifications are allowed
  4464.           CMODE    Change behavior of some commands to work better with C
  4465.           EXACT    Exact case matching on search strings
  4466.           OVER     Overwrite typed characters instead of inserting them
  4467.           CRYPT    Current buffer will be encrypted on write, decrypted on read
  4468.           MAGIC    Use regular expression matching in searches
  4469.           ASAVE    Save the file every 256 inserted characters
  4470.  
  4471.           WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK  Sets foreground color
  4472.           white/cyan/magenta/yellow/blue/red/green/black  Sets background color
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.                                                                          66
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.           Supported machines                    MicroEMACS Reference Manual
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.                                      Appendix D
  4502.  
  4503.                                  Supported machines
  4504.  
  4505.  
  4506.                   The following table  lists all the hardware/compilers for
  4507.           which I currently support MicroEMACS.  This is  not  exclusive of
  4508.           all machines which MicroEMACS will run on, but I have  either run
  4509.           it myself, or had a first hand report of it running.
  4510.  
  4511.           Hardware        OS              Compiler        Comments
  4512.           VAX 780         UNIX V5         native
  4513.                           UNIX V7         native
  4514.                           BSD 4.2         native          job control supported
  4515.                           *VMS            native          only some terminals
  4516.                                                           supported
  4517.  
  4518.           NCR Tower       UNIX V5         native
  4519.  
  4520.           Fortune 32:16   UNIX V7         native
  4521.  
  4522.           IBM-PC          MSDOS           LATTICE 2.15    Large CODE/Large DATA
  4523.                            2.0 & 3.2      AZTEC 3.4e      Small CODE/Large DATA
  4524.                                           TURBO C v1.00   LARGE memory model
  4525.                                           *MSC 4.0
  4526.                                           *MWC 86
  4527.                           SCO XENIX       native
  4528.  
  4529.           HP150           MSDOS           Lattice 2.15    Function key labels
  4530.                                                           for the touch screen
  4531.  
  4532.           HP110           MSDOS           Lattice 2.15
  4533.                                           Aztec 3.4e
  4534.  
  4535.           *Data General 10
  4536.                           MSDOS           Lattice 2.15
  4537.  
  4538.           *Texas Instruments Professional
  4539.                           MSDOS           Lattice 2.15
  4540.  
  4541.           Amiga           Intuition       Lattice 3.03    no mouse or menus yet
  4542.                                           *Aztec 3
  4543.  
  4544.           ST520           TOS             Mark Williams C Spawns under MSH
  4545.                                           Lattice 3.10    (no shell commands)
  4546.  
  4547.           Systems to be supported (ie some code is already written:)
  4548.           Macintosh       Finder 5.0      Aztec
  4549.  
  4550.  
  4551.           67
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.           MicroEMACS Reference Manual                    Supported machines
  4559.  
  4560.  
  4561.           *means that I do not own or have access to the listed compiler and/or
  4562.            machine and must rely upon others to help support it.
  4563.  
  4564.  
  4565.  
  4566.  
  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.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.                                                                          68
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.  
  4624.           Machine Dependent Notes               MicroEMACS Reference Manual
  4625.  
  4626.  
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.                                      Appendix E
  4634.  
  4635.                                Machine Dependent Notes
  4636.  
  4637.  
  4638.                   This  appendix  lists  some  notes specific to individual
  4639.           implementations of MicroEMACS.   Every  attempt  has been made to
  4640.           allow EMACS to  be  identical  on  all machines, but we have also
  4641.           tried to take advantage of  function keys, cursor keys, mice, and
  4642.           special screen modes where possible.
  4643.  
  4644.  
  4645.           E.1  IBM-PC/XT/AT and its clones
  4646.  
  4647.  
  4648.                   The  IBM-PC  family  of  computers  is  supported  with a
  4649.           variety of different display adapters.    EMACS  will  attempt to
  4650.           discover what adapter is connected  and use the proper driver for
  4651.           it. Below is a list of the currently supported video adapters:
  4652.  
  4653.           Adapter                         $sres           Original mode used
  4654.           Monochrome Graphics Adapter     MONO            MONO
  4655.           Color Graphics Adapter          CGA             CGA
  4656.           Enhanced Graphics Adapter       EGA             CGA
  4657.  
  4658.                   EMACS also takes advantege of various  function  keys and
  4659.           the  keys  on  the keypad on an IBM-PC.  The  function  keys  are
  4660.           initially not bound to  any  particular  functions (except by the
  4661.           emacs.rc startup file), but  the  keypad  keys  do default to the
  4662.           following:
  4663.  
  4664.           Keypad key      Function
  4665.           Home            beginning-of-file
  4666.           CSRS UP         previous-line
  4667.           Pg Up           previous-page
  4668.           CSRS LEFT       backward-character
  4669.           CSRS RIGHT      forward-character
  4670.           End             end-of-file
  4671.           CSRS DOWN       next-line
  4672.           Pg Dn           Next-page
  4673.  
  4674.                   All these  special keys are indicated in EMACS macroes by
  4675.           use  of  the  FN prefix.  Below is a list of many of the keys and
  4676.           the  codes used to specify them.  Also the codes may be gotten by
  4677.           using the describe-key (^X ?) command on the suspect key.
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.           69
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.  
  4690.           MicroEMACS Reference Manual               Machine Dependent Notes
  4691.  
  4692.  
  4693.                                   IBM PC function keys in MicroEmacs
  4694.  
  4695.                   function        Function        ^function       Alt-function
  4696.            f1)      FN;             FNT             FN^             FNh
  4697.            f2)      FN<             FNU             FN_             FNi
  4698.            f3)      FN=             FNV             FN`             FNj
  4699.            f4)      FN>             FNW             FNa             FNk
  4700.            f5)      FN?             FNX             FNb             FNl
  4701.            f6)      FN@             FNY             FNc             FNm
  4702.            f7)      FNA             FNZ             FNd             FNn
  4703.            f8)      FNB             FN[             FNe             FNo
  4704.            f9)      FNC             FN\             FNf             FNp
  4705.           f10)      FND             FN]             FNg             FNq
  4706.  
  4707.           home)     FNG                             FNw
  4708.           CsUp)     FNH
  4709.           PgUp)     FNI                             FNa(umlaut) {Alt 132}
  4710.           CsLf)     FNK                             FNs
  4711.            5  )
  4712.           CsRt)     FNM                             FNt
  4713.            End)     FNO                             FNu
  4714.           CsDn)     FNP
  4715.           PgDn)     FNQ                             FNv
  4716.            Ins)     FNR
  4717.            Del)     FNS
  4718.  
  4719.  
  4720.  
  4721.  
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.                                                                          70
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.           Machine Dependent Notes               MicroEMACS Reference Manual
  4757.  
  4758.  
  4759.  
  4760.  
  4761.           E.2  HP 150
  4762.  
  4763.  
  4764.                   This machine  from Hewlett Packard is very unusual for an
  4765.           MSDOS  machine.    It has a touch screen and is very function key
  4766.           oriented.   An additional command, label-function-key allows  you
  4767.           to place labels on the on screen function key labels.   A numeric
  4768.           argument indicates  which  function  key  to  label  (one through
  4769.           eight) and then the  program  prompts  for  a 16 character label,
  4770.           which  will  be  used as two lines of eight characters.  To label
  4771.           function key three with "save file" from a macro, you would use:
  4772.  
  4773.           3 label-function-key "save              file"
  4774.  
  4775.                   Notice the 4 spaces after  "save".  This forces "file" to
  4776.           begin on the second line of the label.
  4777.  
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.  
  4792.  
  4793.  
  4794.  
  4795.  
  4796.  
  4797.  
  4798.  
  4799.  
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.           71
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.           MicroEMACS Reference Manual               Machine Dependent Notes
  4823.  
  4824.  
  4825.  
  4826.  
  4827.           E.3  Atari 520/1040ST
  4828.  
  4829.  
  4830.                   The ATARI ST family of computers have a dual personality.
  4831.           They  may  use  either a monochrome  or  a  color  screen.  EMACS
  4832.           supports two screen resolutions on each monitor.
  4833.  
  4834.           Monitor $sres size #color $palette format
  4835.           Color   LOW     40x25   16      000111222333444555666777
  4836.                   MEDIUM  80x25   4       000111222333
  4837.           Mono    HIGH    80x25   2       000
  4838.                   DENSE   80x50   2       000
  4839.  
  4840.                   The $palette environment variable can be  used  to change
  4841.           what  color is associated with each color name.    With  a  color
  4842.           monitor, each group of three  digits  indicates  an  octal number
  4843.           specifying the RED, GREEN and BLUE levels of that  color.    Each
  4844.           color  digit  can  vary from 0 to 7.  For  example,  the  initial
  4845.           setting of $palette in LOW resolution is:
  4846.  
  4847.                   000700070770007707077777
  4848.  
  4849.                   which broken up is:
  4850.  
  4851.                   000 700 070 770 007 707 077 777
  4852.  
  4853.                   which means:
  4854.  
  4855.                   000     Black
  4856.                   700     Red
  4857.                   070     Green
  4858.                   770     Yellow
  4859.                   007     Blue
  4860.                   707     Magenta
  4861.                   077     Cyan
  4862.                   777     White
  4863.  
  4864.                   Also the mouse  generates  FN prefix codes when moved, or
  4865.           when one of the two buttons is pressed. Initially the movement of
  4866.           the mouse is bound to movement of the cursor, and the  left mouse
  4867.           button generates a  set-mark  (M-space) command.  The cursor keys
  4868.           and the function keys are bound similarly to to IBM-PC.
  4869.  
  4870.                   Files  generated  by  EMACS on the ATARI ST have a single
  4871.           return  character at the end of each  line,  unlike  the  desktop
  4872.           files which want to have tow returns. This makes it display files
  4873.           strangly  from  GEM's  [SHOW] option, but makes the files port to
  4874.           other computers much nicer.
  4875.  
  4876.                   Currently,  when  operating  under  the Mark Williams MSH
  4877.           program, EMACS  can shell out and perform external commands. This
  4878.  
  4879.  
  4880.  
  4881.                                                                          72
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.           Machine Dependent Notes               MicroEMACS Reference Manual
  4889.  
  4890.  
  4891.           capability will be added later  for the Beckmeyer shell and under
  4892.           GEMDOS.
  4893.  
  4894.  
  4895.  
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.           73
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.  
  4954.           MicroEMACS Reference Manual               Machine Dependent Notes
  4955.  
  4956.  
  4957.  
  4958.  
  4959.           E.4  Amiga 1000
  4960.  
  4961.  
  4962.                   The Commodore AMIGA 1000 version of  MicroEMACS  does not
  4963.           have extensive support of the mouse  or  of pull down menus as of
  4964.           yet.  It  does however come up in a window, and it is possible to
  4965.           re-size it to run  in  different sized windows.  The M-^S change-
  4966.           screen-size takes its numeric argument as the new number of lines
  4967.           for EMACS to use.    The  M-^T change-screen-width command allows
  4968.           you to change the number of columns EMACS will use.  The defaults
  4969.           for these are 23 lines and 77 characters across for a full screen
  4970.           window.
  4971.  
  4972.                            Note about Compiling MicroEMACS
  4973.  
  4974.                        If you are compiling the sources  on  the AMIGA
  4975.                to produce an  executable  image, and you are using the
  4976.                Lattice compiler,  be  sure  to  give  the  CLI command
  4977.                'STACK  40000'  before   compiling  to  make  sure  the
  4978.                compiler has  sufficient  stack  space  to successfully
  4979.                complete compiliation.
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.                                                                          74
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.           Machine Dependent Notes               MicroEMACS Reference Manual
  5021.  
  5022.  
  5023.  
  5024.  
  5025.           E.5  UNIX V5, V7, and BSD4.[23]
  5026.  
  5027.  
  5028.                   MicroEMACS  under  UNIX  utilizes  the TERMCAP library to
  5029.           provide machine independent screen  functions.    Make  sure that
  5030.           termcap  is availible and properly set  on  your  account  before
  5031.           attempting to use MicroEMACS.
  5032.  
  5033.                   Under systems  which support job control, you can use the
  5034.           ^X-D suspend-emacs command to place  EMACS  into  the background.
  5035.           This carries a much smaller overhead than bringing up a new shell
  5036.           under  EMACS.  EMACS will properly redraw  the  screen  when  you
  5037.           bring it back to the foreground.
  5038.  
  5039.                   If the symbol VT100 has been set to 1  in  the  estruct.h
  5040.           options file, EMACS will recognize the key sequence <ESC>[ as the
  5041.           lead in sequence for the FN function key prefix.
  5042.  
  5043.                   With  the addition of some very machine/operating  system
  5044.           specific  code,  EMACS  can  prevent  two  or  more  people  from
  5045.           modifying  the  same  file at the same time. The upper level of a
  5046.           set of functions to provide file locking exist in the source file
  5047.           LOCK.C.  It  requires  two machine specific functions written and
  5048.           linked into EMACS for it to operate properly.
  5049.  
  5050.                   char *dolock(fname)
  5051.  
  5052.                   char *fname;
  5053.  
  5054.                   dolock() locks a file, preventing others from modifying it. If
  5055.                   it succeeds, it returns NULL, otherwise it returns a pointer to
  5056.                   a string in the form "LOCK ERROR: explaination".
  5057.  
  5058.                   char *undolock(fname)
  5059.  
  5060.                   char *fname;
  5061.  
  5062.                   undolock() unlocks a file, allowing others to modifying it. If
  5063.                   it succeeds, it returns NULL, otherwise it returns a pointer to
  5064.                   a string in the form "LOCK ERROR: explaination".
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.  
  5076.  
  5077.  
  5078.  
  5079.           75
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.           MicroEMACS Reference Manual                            Mode Flags
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095.                                      Appendix F
  5096.  
  5097.                                      Mode Flags
  5098.  
  5099.  
  5100.                   The two environment variables, $cmode and $gmode, contain
  5101.           a number the corresponds to the modes set for the  current buffer
  5102.           and  the editor as a whole.  These are encoded as the sum of  the
  5103.           following numbers for each of the possible modes:
  5104.  
  5105.           WRAP      1             Word wrap
  5106.           CMODE     2             C indentation and fence match
  5107.           SPELL     4             Interactive spell checking (Not Implemented Yet)
  5108.           EXACT     8             Exact matching for searches
  5109.           VIEW     16             Read-only buffer
  5110.           OVER     32             Overwrite mode
  5111.           MAGIC    64             Regular expressions in search
  5112.           CRYPT   128             Encrytion mode active
  5113.           ASAVE   256             Auto-save mode
  5114.  
  5115.                   So,  if  you  wished  to  set the current buffer to  have
  5116.           CMODE, EXACT, and MAGIC on, and all the others off, you would add
  5117.           up the values for those three, CMODE 2  +  EXACT 8  +  MAGIC 64 =
  5118.           74, and use a statement like:
  5119.  
  5120.                   set $cmode 74
  5121.  
  5122.                   or, use the  binary  or operator to combine the different
  5123.           modes:
  5124.  
  5125.                   set $cmode &bor &bor 2 8 64
  5126.  
  5127.           Internal Flags
  5128.  
  5129.                   Some of the ways EMACS  controls  its  internal functions
  5130.           can be modified by the value in the $gflags environment variable.
  5131.           Each bit in  this  variable  will  be used to control a different
  5132.           function.
  5133.  
  5134.           GFFLAG          1       If this bit is set to zero, EMACS will not
  5135.                                   automatically switch to the buffer of the
  5136.                                   first file after executing the startup macros.
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.                                                                          76
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.  
  5152.           Index                                 MicroEMACS Reference Manual
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.                                           Index
  5162.  
  5163.  
  5164.                   .emacsrc 57                 delete-mode 27
  5165.                   <NL> 14                     delete-next-
  5166.                                                    character 9
  5167.                   A                           delete-next-word 9
  5168.                   add-global-mode 27          delete-previous-
  5169.                   add-mode 3, 27                   character 8
  5170.                   ASAVE mode 27               delete-previous-word
  5171.                                                    9
  5172.                   B                           detab-line 38
  5173.                   backward-character 4
  5174.                   BBS 58                      E
  5175.                   begin-macro 43              emacs.rc 57
  5176.                   beginning-of-file 4,        encryption 28
  5177.                        9                      end-macro 43
  5178.                   beginning-of-line 4         end-of-file 4
  5179.                   buffer 5, 7, 24             end-of-line 4
  5180.                                               entab-lines 38
  5181.                   C                           error parsing 57
  5182.                   case-region-lower 37        EXACT mode 29
  5183.                   case-word-capitalize        execute-buffer 45
  5184.                        37                     execute-file 45
  5185.                   case-word-lower 37          execute-macro 43
  5186.                   case-word-upper 37          execute-macro-<n> 45
  5187.                   change-screen-size          execute-procedure 45
  5188.                        74                     execute-program 40
  5189.                   change-screen-width         exit-emacs 9
  5190.                        74
  5191.                   CMODE mode 28               F
  5192.                   color 27                    file locking 75
  5193.                   command.com 40              fill-paragraph 8, 36
  5194.                   command line 18             fill column 31
  5195.                   command processor 40        filter 40
  5196.                   control-x 1                 find-file 19, 24
  5197.                   control key 1               forward-character 4
  5198.                   copy-region 12
  5199.                   CRYPT mode 28, 58           G
  5200.                   cshell 40                   grow-window 20
  5201.                   cursor keys 4
  5202.                                               H
  5203.                   D                           handle-tab 38
  5204.                   default string 15           Help File 57
  5205.                   delete-blank-lines 9        HOME environment
  5206.                   delete-buffer 25                 variable 57
  5207.                   delete-global-mode
  5208.                        27
  5209.  
  5210.  
  5211.           77
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.  
  5218.           MicroEMACS Reference Manual                                 Index
  5219.  
  5220.  
  5221.                                               refresh-screen 21
  5222.                   I                           replace-string 16,
  5223.                   i-shell 41                       30
  5224.                                               resize-window 20
  5225.                   K                           restricted mode 58
  5226.                   kill-region 11              run 45
  5227.                   kill-to-end-of-line
  5228.                        9                      S
  5229.                   kill buffer 12              save-file 5
  5230.                                               screen 7
  5231.                   L                           scroll-next-down 19
  5232.                   label-function-key          scroll-next-up 19
  5233.                        71                     search-forward 14
  5234.                   list-buffers 25, 27         search-reverse 15
  5235.                                               select-buffer 24
  5236.                   M                           set-encryption-key
  5237.                   MAGIC mode 29                    28
  5238.                   mark 11                     set-fill-column 36
  5239.                   meta key 1                  set-mark 11
  5240.                   mode line 2, 7              shell 40
  5241.                   modes 3, 27                 shell-command 40
  5242.                   move-window-down 19         shrink-window 20
  5243.                   move-window-up 19           special keys 1
  5244.                                               split-window 18
  5245.                   N                           startup files 57
  5246.                   newline 1                   store-procedure 45
  5247.                   next-buffer 24              suspend-emacs 41, 75
  5248.                   next-line 4                 switches 57
  5249.                   next-paragraph 4
  5250.                                               T
  5251.                   O                           tab handling 38
  5252.                   open-line 8                 termcap 75
  5253.                   open-window 18              text window 2
  5254.                   OVER mode 30
  5255.                                               V
  5256.                   P                           VIEW mode 31
  5257.                   PATH environment
  5258.                        variable 57            W
  5259.                   pipe-command 40             window 7
  5260.                   point 11                    windows 2, 18
  5261.                   previous-line 4                Creating 18
  5262.                   previous-paragraph 4           Deleting 19
  5263.                   previous-window 18             Resizing 20
  5264.                   previous-word 4             wrap-word 31
  5265.                   procedures 45               WRAP mode 31
  5266.                                               wrapping text 36
  5267.                   Q                           write-file 5
  5268.                   query-replace 16
  5269.                   query-replace-string        Y
  5270.                        16, 30                 yank 12
  5271.  
  5272.                   R
  5273.                   redraw-display 20
  5274.  
  5275.  
  5276.  
  5277.                                                                          78
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.  
  5288.  
  5289.  
  5290.                                    Table of Contents
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.                Chapter 1  Basic Concepts                             1
  5297.                   1.1  Keys and the Keyboard . . . . . . . . . . . . 1
  5298.                   1.2  Getting Started . . . . . . . . . . . . . . . 1
  5299.                   1.3  Parts and Pieces  . . . . . . . . . . . . . . 2
  5300.                   1.4  Entering Text . . . . . . . . . . . . . . . . 3
  5301.                   1.5  Basic cursor movement . . . . . . . . . . . . 3
  5302.                   1.6  Saving your text  . . . . . . . . . . . . . . 5
  5303.  
  5304.                Chapter 2  Basic Editing--Simple Insertions and
  5305.                   Deletions                                          7
  5306.                   2.1  A Word About Windows, Buffers, Screens, and
  5307.                   Modes  . . . . . . . . . . . . . . . . . . . . . . 7
  5308.                   2.2  Insertions  . . . . . . . . . . . . . . . . . 8
  5309.                   2.3  Deletions . . . . . . . . . . . . . . . . . . 8
  5310.  
  5311.                Chapter 3  Using Regions                             11
  5312.                   3.1  Defining and Deleting a Region  . . . . . .  11
  5313.                   3.2  Yanking a Region  . . . . . . . . . . . . .  12
  5314.  
  5315.                Chapter 4  Search and Replace                        14
  5316.                   4.1  Forward Search  . . . . . . . . . . . . . .  14
  5317.                   4.2  Exact Searches  . . . . . . . . . . . . . .  15
  5318.                   4.3  Backward Search . . . . . . . . . . . . . .  15
  5319.                   4.4  Searching and Replacing . . . . . . . . . .  15
  5320.                   4.5  Query-Replace . . . . . . . . . . . . . . .  16
  5321.  
  5322.                Chapter 5  Windows                                   18
  5323.                   5.1  Creating Windows  . . . . . . . . . . . . .  18
  5324.                   5.2  Deleting Windows  . . . . . . . . . . . . .  19
  5325.                   5.3  Resizing Windows  . . . . . . . . . . . . .  20
  5326.                   5.4  Repositioning within a Window . . . . . . .  20
  5327.  
  5328.                Chapter 6  Buffers                                   24
  5329.  
  5330.                Chapter 7  Modes                                     27
  5331.                   7.1  ASAVE mode  . . . . . . . . . . . . . . . .  27
  5332.                   7.2  CMODE mode  . . . . . . . . . . . . . . . .  28
  5333.                   7.3  CRYPT mode  . . . . . . . . . . . . . . . .  28
  5334.                   7.4  EXACT mode  . . . . . . . . . . . . . . . .  29
  5335.                   7.5  MAGIC mode  . . . . . . . . . . . . . . . .  29
  5336.                   7.6  OVER mode . . . . . . . . . . . . . . . . .  30
  5337.                   7.7  WRAP mode . . . . . . . . . . . . . . . . .  31
  5338.                   7.8  VIEW mode . . . . . . . . . . . . . . . . .  31
  5339.  
  5340.  
  5341.  
  5342.  
  5343.                                           i
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.                Chapter 8  Files                                     33
  5354.  
  5355.                Chapter 9  Screen Formatting                         36
  5356.                   9.1  Wrapping Text . . . . . . . . . . . . . . .  36
  5357.                   9.2  Reformatting Paragraphs . . . . . . . . . .  36
  5358.                   9.3  Changing Case . . . . . . . . . . . . . . .  37
  5359.                   9.4  Tabs  . . . . . . . . . . . . . . . . . . .  37
  5360.  
  5361.                Chapter 10  Access to the Outside World              40
  5362.  
  5363.                Chapter 11  Keyboard Macros                          43
  5364.  
  5365.                Chapter 12  MicroEMACS Macros                        45
  5366.                   12.1  Constants  . . . . . . . . . . . . . . . .  45
  5367.                   12.2  Variables  . . . . . . . . . . . . . . . .  46
  5368.                      12.2.1  Environmental Variables . . . . . . .  47
  5369.                      12.2.2  User variables  . . . . . . . . . . .  49
  5370.                      12.2.3  Buffer Variables  . . . . . . . . . .  49
  5371.                      12.2.4  Interactive variables . . . . . . . .  50
  5372.                   12.3  Functions  . . . . . . . . . . . . . . . .  50
  5373.                   12.4  Directives . . . . . . . . . . . . . . . .  53
  5374.                      12.4.1  !ENDM Directive . . . . . . . . . . .  53
  5375.                      12.4.2  !FORCE Directive  . . . . . . . . . .  53
  5376.                      12.4.3  !IF, !ELSE, and !ENDIF Directives . .  54
  5377.                      12.4.4  !GOTO Directive . . . . . . . . . . .  54
  5378.                      12.4.5  !WHILE and !ENDWHILE Directives . . .  55
  5379.                      12.4.6  !BREAK Directive  . . . . . . . . . .  55
  5380.                      12.4.7  !RETURN Directive . . . . . . . . . .  56
  5381.  
  5382.                Appendix A  MicroEMACS Command Line Switches and
  5383.                   Startup Files                                     57
  5384.  
  5385.                Appendix B  MicroEMACS commands                      59
  5386.  
  5387.                Appendix C  MicroEMACS Bindings                      65
  5388.  
  5389.                Appendix D  Supported machines                       67
  5390.  
  5391.                Appendix E  Machine Dependent Notes                  69
  5392.                   E.1  IBM-PC/XT/AT and its clones . . . . . . . .  69
  5393.                   E.2  HP 150  . . . . . . . . . . . . . . . . . .  71
  5394.                   E.3  Atari 520/1040ST  . . . . . . . . . . . . .  72
  5395.                   E.4  Amiga 1000  . . . . . . . . . . . . . . . .  74
  5396.                   E.5  UNIX V5, V7, and BSD4.[23]  . . . . . . . .  75
  5397.  
  5398.                Appendix F  Mode Flags                               76
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.  
  5408.  
  5409.                                           ii
  5410.  
  5411.  
  5412.  
  5413. əəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəəə