home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311CMD.ZIP / EMACS.RC < prev    next >
Text File  |  1991-10-30  |  5KB  |  215 lines

  1. ;    EMACS.RC:    Standard micro Startup program
  2. ;            for MicroEMACS 3.9d and above
  3. ;            (C)opyright 1987 by Daniel M Lawrence
  4. ;            Last Update: 10/20/87
  5.  
  6. set $discmd FALSE
  7. write-message "[Setting up....]"
  8.  
  9. ; If you screen "SNOWS", comment this line
  10.     set $flicker "FALSE"
  11.  
  12. ; To use an IBM-PC EGA card, uncomment the following line
  13. ;    set $sres "EGA"
  14.  
  15. ;    Set Default Global modes
  16.  
  17. add-global-mode "blue"
  18. add-global-mode "WHITE"
  19. ;bind-to-key meta-prefix `    ;for annoying keyboards with ` at the top left
  20.  
  21. ;    Toggle function key window display
  22.  
  23. store-procedure    toggle-fkeys
  24.     !if %rcfkeys
  25.         !goto rcfoff
  26.     !endif
  27.  
  28. ;    toggle function key window on
  29.     save-window
  30.     1 next-window
  31.     !if &sequal $cbufname "emacs.hlp"
  32.         delete-window
  33.     !endif
  34.     !if ¬ &sequal $cbufname "Function Keys"
  35.         1 split-current-window
  36.         1 select-buffer "Function Keys"
  37.         add-mode "red"
  38.         !force 5 resize-window
  39.         1 goto-line
  40.     !endif
  41.     set %rcfkeys TRUE
  42.     !force restore-window
  43.     !if &sequal $cbufname "Function Keys"
  44.         next-window
  45.     !endif
  46.     write-message "[Function key window ON]"
  47.     !return
  48.  
  49.     ;Toggle the function key window off
  50. *rcfoff
  51.     save-window
  52.     1 next-window
  53.     !if &sequal "Function Keys" $cbufname
  54.         delete-window
  55.     !endif
  56.     !force restore-window
  57.     write-message "[Function key window OFF]"
  58.     set %rcfkeys FALSE
  59. !endm
  60.  
  61. ;    Bring up Online-help system
  62.  
  63. store-procedure get-help
  64.     set $discmd FALSE
  65.     source ehelp.cmd
  66.     set $discmd TRUE
  67. !endm
  68.  
  69. ;    Load a new page
  70.  
  71. store-procedure get-page-loader
  72.     !if &seq &find newpage.cmd ""
  73.         write-message "[Can not find NEWPAGE.CMD]"
  74.         !return
  75.     !endif
  76.     execute-file newpage.cmd
  77. !endm
  78.  
  79. ;procedure to clean out the current page (which is nothing right now)
  80.  
  81. store-procedure    clean
  82.     ; nothing by default
  83. !endm
  84.  
  85. ;    Set up auto CMODE
  86.  
  87. store-procedure set-default-mode
  88.     set %rctmp &sin $cfname "."
  89.     !if &equ %rctmp 0
  90.         !return
  91.     !endif
  92.     set %rctmp &mid $cfname &add %rctmp 1 5
  93.     !if &or &seq %rctmp "c" &seq %rctmp "h"
  94.         add-mode "cmode"
  95.     !endif
  96.     !if &or &seq %rctmp "cpp" &seq %rctmp "hpp"
  97.         add-mode "cmode"
  98.     !endif
  99.     !if &seq %rctmp "mss"
  100.         add-mode "wrap"
  101.     !endif
  102. !endm
  103. set $readhook set-default-mode
  104.  
  105. ;    This function activates the function key window as
  106. ;    a legitimate place to call up function keys using the mouse
  107.  
  108. store-procedure mouse-clicks
  109.  
  110.     ;remember where we started, and do the mouse movement
  111.     save-window
  112.     !force mouse-move-down
  113.  
  114.     ;If not in the function key window... leave
  115.     !if ¬ &sequal $cbufname "Function Keys"
  116.         !return
  117.     !endif
  118.  
  119.     ;First pos is a screen reposition, let it through
  120.     !if &and &equ $xpos 0 &equ $ypos 0
  121.         restore-window
  122.         !return
  123.     !endif
  124.  
  125.     ;Find out what function key were gonna do
  126.     add-mode magic
  127.     2 forward-character
  128.     set %rctmp $search
  129.     !force search-reverse "[fF][0-9]"
  130.     !if &seq $status FALSE
  131.         delete-mode magic
  132.         set $search %rctmp
  133.         !return
  134.     !endif
  135.  
  136.     ;we are on the "f" or "F".  Get the function key type and number now
  137.     set $search %rctmp
  138.     set %fcase lower
  139.     !if &equ $curchar 70
  140.         set %fcase upper
  141.     !endif
  142.     1 forward-character
  143.     set %fnum &chr $curchar
  144.     1 forward-character
  145.     set %fnum &cat %fnum &chr $curchar
  146.     set %fnum &add %fnum 0
  147.     !if &equ %fnum 10
  148.         set %fnum "0"
  149.     !endif
  150.     set %fname &cat "FN" %fnum
  151.     !if &seq %fcase upper
  152.         set %fname &cat "S-" %fname
  153.     !endif
  154.  
  155.     ;save the function
  156.     set %rccmd &bind %fname
  157.     delete-mode MAGIC
  158.  
  159.     ;swallow the up-button
  160.     set %rctmp >c
  161.  
  162.     ;restore the window and exit
  163.     restore-window
  164.  
  165.     ;procedures don't need the square brackets
  166.     !if &seq &left %rccmd 1 "["
  167.         set %rccmd &mid %rccmd 2 &sub &len %rccmd 2
  168.         %rccmd
  169.         !return
  170.     !endif
  171.  
  172.     ;and then execute it
  173.     !force execute-named-command %rccmd
  174. !endm    
  175. macro-to-key mouse-clicks MSa
  176.  
  177. ;    ***** Rebind the Function key group
  178.  
  179. bind-to-key search-forward        FN1
  180. bind-to-key search-reverse        FN2
  181. bind-to-key hunt-forward        FN3
  182. bind-to-key hunt-backward        FN4
  183. macro-to-key toggle-fkeys        FN5
  184. macro-to-key get-help            FN6
  185. bind-to-key next-window            FN7
  186. macro-to-key get-page-loader        FN8
  187. bind-to-key save-file            FN9
  188. bind-to-key exit-emacs            FN0
  189.  
  190. bind-to-key execute-macro-10        S-FN1
  191. bind-to-key execute-macro-11        S-FN2
  192. bind-to-key execute-macro-12        S-FN3
  193. bind-to-key execute-macro-13        S-FN4
  194. bind-to-key execute-macro-14        S-FN5
  195. bind-to-key execute-macro-15        S-FN6
  196. bind-to-key execute-macro-16        S-FN7
  197. bind-to-key execute-macro-17        S-FN8
  198. bind-to-key execute-macro-18        S-FN9
  199. bind-to-key execute-macro-19        S-FN0
  200.  
  201. ;    bring up the function key window
  202.  
  203.     1 split-current-window
  204.     select-buffer "Function Keys"
  205.     insert-string "f1 search-> f2 <-search █    MicroEMACS:  Text Editor~n"
  206.     insert-string "f3 hunt->   f4 <-hunt   █ ~n"
  207.     insert-string "f5 fkeys    f6 help     █  Available function key Pages include:~n"
  208.     insert-string "f7 nxt wind f8 pg[    ] █    Word  Box  Emacs  Pascal  C  cObal Lisp~n"
  209.     insert-string "f9 save     f10 exit    █  [use the f8 key to load Pages]~n"
  210.     unmark-buffer
  211.     delete-window
  212.     set %rcfkeys FALSE
  213.     toggle-fkeys
  214.     set $discmd TRUE
  215.