home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / memacs32.zip / emacs.rc < prev    next >
Text File  |  1993-08-24  |  8KB  |  272 lines

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