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