Macro Definitions
Macro Keys
Macro Programming
:A
MACRO (ESC-M) -  A "macro" is a string of VDE commands and text that, once 
    defined, can be repeated automatically.  When you type ESC-M you will be 
    asked for the string, then a "Repeat count".  Usually you will simply type 
    a number for the repeat count (0-9, or "*" for "indefinitely").  You will 
    see the results as the macro executes, and you can abort it at any time by 
    pressing ESC.
         (If you are sure you know what you're doing, you can speed up Macro 
    execution by specifying "Quiet" mode: press "Q" before the repeat count.  
    Only the header will be updated as the Macro runs.)
         Macros also stop any time an error occurs; the error message will be 
    visible, and can be cleared by pressing ESC.  Many commands (like Find or 
    Reformat) are designed to generate errors at the end of the file so that 
    an indefinite ("*") Macro containing them will halt there.  Other 
    indefinite Macros may need to be aborted manually.
         VDE turns INSERT OFF before running a macro, so that the same key 
    sequence will always have the same effect.  The INSERT status is restored 
    when the macro terminates.
         In order to include any input line editing characters (BS, CR etc) in 
    a macro, you must prefix them with ^P.  (NOTE:  To make them easier to 
    read and understand, Macro listings will be given here as they function, 
    not as they are typed in.  ^P prefixes as needed are NOT shown.  Key- 
    strokes are separated by dashes or commas for clarity, and "_" means a 
    space or blank.)  Here are some sample Macros:
         1.  View a file by scrolling slowly through it:
                             ESC-;,^C
    This will pause, then scroll down.  (Use a repeat count of "*".)
         2.  Can you figure out what this one does?  (Answer:  .elif eht fo 
    dne eht ta meht fo tsil a gnikam elif a fo tuo sesehtnerap ni stnemmoc 
    ekat lliw tI)
           ^QR,^QF,(,CR,^G,^KB,^QF,),CR,^G,^KK,^QC,CR,^KV
         VDE Macros are very powerful tools, particularly given their program- 
    mability and storage on function keys.
:B
MACRO KEY (ESC-#,0..9) -  Up to 10 Macros can be stored (0..9), by entering 
    them with the ESC-M command, then using ESC-# to save them.  They can then 
    be recalled and used simply by typing ESC-number.  Example: typing ESC-#-0 
    will store the last Macro used as Key 0, and it can be recalled and reused 
    at any future time simply by typing ESC-0.
         Ordinarily, Keys operate just like the original Macro:  they will ask 
    for "Repeat count" when executed.  If you want to suppress this (giving 
    something more like a "function key", that only executes once) you can 
    type "N" (for No repeat) before storing the key number.  Example:  ESC-#-N- 
    0 stores a Macro in Key 0 as a no-repeat key sequence.  If you also don't 
    need to see the Key work, and want to make it faster, you can make it 
    QUIET as well by typing "Q" instead (for Quiet) before the key number.  
    Example:  ESC-#-Q-0 stores to Key 0 as a quiet no-repeat key sequence.
         If the Macro (ESC-M) string is empty, using ESC-# will delete a Key 
    definition.  Using a defined Key brings its definition into the Macro 
    buffer (whence it can be stored again if desired).  Trying to use an 
    undefined Key results in an error.
         There are 500 bytes total available for all 10 keys, and a 128 byte 
    limit for any one Key.  (VDE's own input line will only accept 65 bytes, 
    but VINSTALL can handle up to the full 128.)
         USAGE HINT: If you want to re-use a macro without having to type it 
    in again, use ESC-# to assign it to a key, then call it up by number.
         Besides simply storing Macros, here are some useful function Keys:
       1.  Storing different sets of margins (eg for quotes): for example,
                             ^OL,12,CR,^OR,66,CR
       2.  Typing any frequently repeated phrase; "ESC-6" is much more 
    convenient than "^PSWorld Wide Widgets Ltd. (N.A.)^PS".
          [VINSTALL allows you to install a default set of macro Keys.  Thus 
    VDE can be customized for any task, such as the formatting requirements 
    of specialized writing or programming languages.]
:C
MACRO PROGRAMMING (ESC-0..9, ESC-!,=,~,+,;) -  VDE has several commands which 
    function only in a Macro string, and give you control over the execution 
    of a macro, allowing real programming.
         ESC-0..9, when in a Macro, function simply as "labels" 0..9.  They 
    have no effect, but can be "jumped" to by other commands.
         ESC-! followed by 0..9 is a simple "jump" instruction, causing macro 
    execution to resume with the command following the label ESC-0..9.  
    Example: ESC!2 jumps to label 2.  As two epecial cases, ESC-![ jumps to 
    the beginning of the Macro, and ESC-!] jumps to the end (aborts).
         ESC-= and ESC-~, followed by a character and then a label 0..9 (or 
    "[","]"), are conditional jumps: they jump to that label IF the character 
    at the cursor position does (or for "~", doesn't) match that specified.  
    Example: ESC~^M2 jumps to ESC-2 if the current character is NOT a CR.
         ESC-= and ESC-~, followed by a character and then ">" or "<", are 
    search loops.  They will continue to move the cursor right (or for "<", 
    left) as long as the character at the cursor does (or for "~", doesn't) 
    match, or until the beginning or end of the file.  Example: ESC=_> moves 
    right as long as the current character is a space.
         ESC-+, followed by 0..9, is used to "chain" to another macro key.  In 
    this way you can build up strings longer than the 65/128-byte limit on any 
    one key.  It does not "call" the key; there is no returning.  Example: 
    ESC+9 chains to Key 9.
         ESC-; (semicolon) gives a brief pause, presumably so the user can see 
    what's happening on screen.
         Macro programs are stored just like any other macro string (usually 
    with "N"o repeat count).  If you program in an endless loop, you will at 
    some point have to abort with ESC.  Don't make macro programs "Q"uiet 
    until you're sure they work.
         Example: here is a good macro program (best stored as a Quiet Key) to 
    move the cursor to the start of the current sentence:
              ESC~.1, ^S, ESC1, ESC~.<, ESC2, ^D, ESC=_2, ESC=^M2
    You could write this out in programmer's pseudo-code as:
              If not "." goto label1
              Move left                 ;move left if already on period
     label1:  While not "." move Left   ;move left to previous period
     label2:  Move right                ;now move back right
              If " " goto label2        ;  as long as you see a space
              If "^M" goto label2       ;  or a Return
              (all done)
