home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 197_01 / emacs.txt < prev    next >
Text File  |  1979-12-31  |  124KB  |  4,555 lines

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