home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 411b.lha / dme_1.42 / macros / DMEMacros
Text File  |  1990-09-08  |  7KB  |  222 lines

  1. # My own settings for DME
  2. # © Mikael Karlsson
  3. # Distribute as you wish but don't claim them for your own creation.
  4.  
  5. topedge 4
  6. leftedge 3
  7. addpath s:
  8.  
  9. #Proper arrow keys
  10.  
  11. map `left'      `ifelse l `ifelse t `left' `up last'' `left''
  12. map `right'     `ifelse r `ifelse b `right' `down first'' `right''
  13. map `s-up'      `pageup'
  14. map `s-down'    `pagedown'
  15. map `s-left'    `-left while !ca `-left' while ca `-left' -right'
  16. map `s-right'   `while ca `-right' if !r `while !ca `-right'''
  17. map `a-up'      `top'
  18. map `a-down'    `bottom'
  19. map `a-left'    `first'
  20. map `a-right'   `last'
  21. map `c-up'      `top'
  22. map `c-down'    `bottom'
  23. map `c-left'    `first'
  24. map `c-right'   `last'
  25.  
  26.  
  27. #Block commands
  28.  
  29. map `c-ret'     `block'
  30. map `c-del'     `bdelete'
  31.  
  32. #Extra stuff
  33.  
  34. map `s-help'    (newwindow)
  35. map `csa-del'   (escimm `unblock top first block bottom block bdelete')
  36. map `a-c'       (wright wleft while !ca (right) while cn (right) if cl (tlate -32) right while ca (if cu (tlate +32) right) wright)
  37. map `a-l'       (wright wleft while !ca (right) while cn (right) while ca (if cu (tlate +32) right) wright)
  38. map `a-u'       (wright wleft while !ca (right) while cn (right) while ca (if cl (tlate -32) right) wright)
  39. map `a-t'       (block block down down bmove up)
  40. map `c-t'       (scanf %1s del right `\$scanf' left)
  41. map `s-bs'      (left while c=32 (del left) ifelse ca (while ca (right bs left)) (while !ca (right bs left)) right)
  42. map `c-bs'      (left ifelse c=32 (del) (right))
  43. map `s-del'     (ifelse r join remeol)
  44. map `tab'       (ifelse t (tab) (up s-right down))
  45. map `a-f'       (wright wleft while !ca (right) ` ' while ca right ` ' wleft scanf %s bs while ca (right) del find $scanf)
  46. map `a-n'       (next)
  47. map `bs'        (ifelse l (up last join if !l (del)) (bs))
  48. map `return'    (split first while c=32 (down ` ' up) if c=123 (down ` ' up) while c=32 (down ` ' up) down)
  49.  
  50. #C-Style
  51.  
  52. map `a-9'       (settoggle 40 while 40 (-left if c=41 (a-9 -left) ifelse c=40 (resettoggle 40) (settoggle 40)))
  53. map `cs-b'      (tlate 128 tlate 128 tlate 128 tlate 128 tlate 128 tlate 128)
  54.  
  55. map `('         (`()' left)
  56. map `)'         `ifelse c=41 `ping 9 a-9 repeat 12 `cs-b' tlate 40 pong 9 right' ``)'''
  57.  
  58. map `{'         (`{ }' left)
  59. map `}'         (ifelse c=125 (c-bs c-bs right) (`}'))
  60. map `['         (`[]' left)
  61. map `]'         (ifelse c=93 (right) (`]'))
  62. map `"'         (ifelse c=34 (right) (`""' left))
  63. map `;'         (ifelse c=125 (`;' -return) (`;'))
  64.  
  65. map `a-del'     (if c=123 (block while c<>125 (down) block bdelete))
  66.  
  67. map `a-/'       (ifelse c=42 (` ' right right) (`/* */' left left))
  68.  
  69. #XDE Style
  70.  
  71. map `f9' `first scanf %s block block bdelete newfile \$scanf'
  72. map `f8' `saveold iconify'
  73.  
  74.  
  75.  
  76.  
  77.  
  78. ------------------------cut this-------------------------
  79. #######################################################################
  80.  
  81. My .edrc file for DME.
  82. Features:
  83.   Blinking of matching parentheses
  84.   Automatic C indentation (My own style, of course)
  85.   Automatic level matching of {}, [], "" and ()
  86.   Fast 'newfile'
  87.  
  88.  
  89. Blinking of matching parentheses
  90.  
  91.   Matching parentheses are accomplished by the use of a recursive
  92.   DME macro. Unfortunately DME isn't very quick at executing it's
  93.   macros so I don't recommend using it for Lisp, Scheme and other
  94.   parentheses-intensive languages. I think it's adequate for C or
  95.   Modula etc. It works like this:
  96.  
  97.   * When you type a left parentheses, both the left and the matching
  98.     right one is inserted and the cursor is placed on the right one.
  99.  
  100.   * As you type your expression the right parentheses is moved ahead.
  101.  
  102.   * When you type the closing parentheses DME sees that the character
  103.     under the cursor is the needed closing parantheses and therefore
  104.     blinks the matching one and moves the cursor to the right.
  105.  
  106.  
  107. Automatic C indentation
  108.  
  109.   C code is automatically indented. If you don't like my particular
  110.   style, too bad. Here's an example of what it looks like:
  111.  
  112.   int function(x, y)      /* Pretty stupid function actually */
  113.   int x, y;
  114.   { int temp;
  115.     if (x<y)
  116.     { temp = x;
  117.       x = y;
  118.       y = temp;
  119.     }
  120.   }
  121.  
  122. ******** NOTE FROM MATT:    I don't like his indenting scheme, but I have
  123.      not the time to modify the macros so they remain as-is.
  124.  
  125.  
  126.   Here's how it works:
  127.  
  128.   * When you type a left bracket '{' a space and a closing bracket
  129.     is automatically inserted and the cursor is placed on the
  130.     closing bracket.
  131.  
  132.   * Now you type your line. The closing bracket is moved to the right.
  133.  
  134.   * When the line is finished you type a semicolon. Now DME sees
  135.     that the cursor is placed on a right bracket. DME supposes
  136.     that this line is finished, inserts a newline and indents the
  137.     next line to the same level as the previous line.
  138.  
  139.   * When you're about to finish a block with a right bracket the
  140.     cursor should be placed on the closing bracket of this block.
  141.     Therefore, when you type a right bracket it is ignored and
  142.     the closing bracket that already exists is moved two steps to
  143.     the left, thereby closing the current block.
  144.  
  145.  
  146. Automatic level matching of {}, [], "" and ()
  147.  
  148.   {} and () are described above. [] and "" works the same way but
  149.   without blinking or automatic formatting. That is, when the
  150.   opening character is typed the closing one is inserted immediately.
  151.   If the closing character is typed when the cursor is standing on
  152.   that same character the cursor is just moved one step to the right.
  153.   If you for some reason want to override the special interpretation
  154.   of these characters I recommend typing them with Alt held down.
  155.  
  156.  
  157. Fast 'newfile'
  158.  
  159.   This is a ripoff from XDE (Xerox Development Environment) found
  160.   on the Xerox machines.
  161.   To load a file:
  162.  
  163.   1. Open a new DME window
  164.   2. Type the filename
  165.   3. Press f9
  166.  
  167.   That's it. When you press f9, DME scans the filename, removes it
  168.   from the document and loads the file.
  169.   On the Xerox the f9 button is labelled "DO".
  170.  
  171.  
  172. Other features
  173.  
  174.   To remember things one can think of the functions keys f9, f8 an
  175.   f10 (Yes, in that order) as DO, DID and DONE.
  176.   The actions performed by these keys are:
  177.  
  178.   f9  DO this file. See "Fast 'newfile'".
  179.  
  180.   f8  DID this file. Executes 'saveold iconify'.
  181.  
  182.   f10 DONE. Executes 'saveold quit'
  183.  
  184.   For inserting comments type alt-/. This inserts "/* */" and places
  185.   the cursor on the second "*" ready for typing the comment. When
  186.   you're finished type alt-/ again and the cursor is moved after the
  187.   closing "/".
  188.  
  189.   Shift-Help opens a new DME window.
  190.  
  191.   Ctrl-Return executes 'block'
  192.   Ctrl-Delete executes 'bdelete'
  193.  
  194.   Tab moves the cursor to line up with a word on the row above the
  195.   current one. Actually if performs 'up word-right down'.
  196.  
  197.   Shift-left and shift-right moves a word at a time.
  198.   Shift-up and shift-down moves a page up or down.
  199.  
  200.   Alt-left and alt-right moves to the start or end of the line.
  201.   Alt-up and Alt-down moves to the top or bottom of the document.
  202.   Ctrl-"arrow" works as alt-"arrow".
  203.  
  204.   Ctrl-t swaps two characters.
  205.   Alt-t swaps two lines.
  206.  
  207.   Shift-Delete deletes from the cursor to end of line. If the cursor
  208.   already is at the end of the line the "newline" is deleted.
  209.  
  210.  
  211.  
  212. Well, that's it. Have fun.
  213.  
  214. Mikael Karlsson
  215. Lövsättersvägen 10
  216. S-585 98  LINKÖPING
  217. SWEDEN
  218.  
  219. C86.M-KARLSSON@LINUS.Liuida.Seismo
  220.  
  221.  
  222.