home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / UE311P01.ZIP / EMACS.RC next >
Text File  |  1991-11-20  |  6KB  |  270 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. add-global-mode "LYELLOW"
  20.  
  21. ; Set "smooth" (single-line) scrolling instead of half-screen "jump" scrolling
  22.     set $sscroll TRUE
  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 "red"
  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.         set $hardtab 4
  102.     !endif
  103.     !if &or &seq %rctmp "CPP" &seq %rctmp "HPP"
  104.         add-mode "cmode"
  105.         set $hardtab 4
  106.     !endif
  107.     !if &or &seq %rctmp "C" &seq %rctmp "H"
  108.         add-mode "cmode"
  109.         set $hardtab 4
  110.     !endif
  111.     !if &or &seq %rctmp "cpp" &seq %rctmp "hpp"
  112.         add-mode "cmode"
  113.         set $hardtab 4
  114.     !endif
  115.     !if &seq %rctmp "mss"
  116.         add-mode "wrap"
  117.     !endif
  118.     !if &seq %rctmp "doc"
  119.         add-mode "wrap"
  120.     !endif
  121. !endm
  122. set $readhook set-default-mode
  123.  
  124. ;    This function activates the function key window as
  125. ;    a legitimate place to call up function keys using the mouse
  126.  
  127. store-procedure mouse-clicks
  128.  
  129.     ;remember where we started, and do the mouse movement
  130.     save-window
  131.     !force mouse-move-down
  132.  
  133.     ;If not in the function key window... leave
  134.     !if ¬ &sequal $cbufname "Function Keys"
  135.         !return
  136.     !endif
  137.  
  138.     ;First pos is a screen reposition, let it through
  139.     !if &and &equ $xpos 0 &equ $ypos 0
  140.         restore-window
  141.         !return
  142.     !endif
  143.  
  144.     ;Find out what function key were gonna do
  145.     add-mode magic
  146.     2 forward-character
  147.     set %rctmp $search
  148.     !force search-reverse "[fF][0-9]"
  149.     !if &seq $status FALSE
  150.         delete-mode magic
  151.         set $search %rctmp
  152.         !return
  153.     !endif
  154.  
  155.     ;we are on the "f" or "F".  Get the function key type and number now
  156.     set $search %rctmp
  157.     set %fcase lower
  158.     !if &equ $curchar 70
  159.         set %fcase upper
  160.     !endif
  161.     1 forward-character
  162.     set %fnum &chr $curchar
  163.     1 forward-character
  164.     set %fnum &cat %fnum &chr $curchar
  165.     set %fnum &add %fnum 0
  166.     !if &equ %fnum 10
  167.         set %fnum "0"
  168.     !endif
  169.     set %fname &cat "FN" %fnum
  170.     !if &seq %fcase upper
  171.         set %fname &cat "S-" %fname
  172.     !endif
  173.  
  174.     ;save the function
  175.     set %rccmd &bind %fname
  176.     delete-mode MAGIC
  177.  
  178.     ;swallow the up-button
  179.     set %rctmp >c
  180.  
  181.     ;restore the window and exit
  182.     restore-window
  183.  
  184.     ;procedures don't need the square brackets
  185.     !if &seq &left %rccmd 1 "["
  186.         set %rccmd &mid %rccmd 2 &sub &len %rccmd 2
  187.         %rccmd
  188.         !return
  189.     !endif
  190.  
  191.     ;and then execute it
  192.     !force execute-named-command %rccmd
  193. !endm    
  194. macro-to-key mouse-clicks MSa
  195.  
  196. ;    ***** Rebind the Function key group
  197.  
  198. bind-to-key search-forward        FN1
  199. bind-to-key search-reverse        FN2
  200. bind-to-key hunt-forward        FN3
  201. bind-to-key hunt-backward        FN4
  202. macro-to-key toggle-fkeys        FN5
  203. macro-to-key get-help            FN6
  204. bind-to-key next-window            FN7
  205. macro-to-key get-page-loader        FN8
  206. bind-to-key save-file            FN9
  207. bind-to-key exit-emacs            FN0
  208.  
  209. bind-to-key execute-macro-10        S-FN1
  210. bind-to-key execute-macro-11        S-FN2
  211. bind-to-key execute-macro-12        S-FN3
  212. bind-to-key execute-macro-13        S-FN4
  213. bind-to-key execute-macro-14        S-FN5
  214. bind-to-key execute-macro-15        S-FN6
  215. bind-to-key execute-macro-16        S-FN7
  216. bind-to-key execute-macro-17        S-FN8
  217. bind-to-key execute-macro-18        S-FN9
  218. bind-to-key execute-macro-19        S-FN0
  219.  
  220. bind-to-key previous-word        FNd
  221. bind-to-key next-word            FNf
  222.  
  223. bind-to-key ctlx-prefix            FNL
  224. bind-to-key next-buffer            FNc
  225. bind-to-key find-file            FNi
  226.  
  227. bind-to-key beginning-of-line        FN<
  228. bind-to-key end-of-line            FN>
  229.  
  230. bind-to-key execute-macro-32        FN-
  231. bind-to-key execute-macro-33        FN=
  232. bind-to-key execute-macro-34        S-FN-
  233. bind-to-key execute-macro-35        S-FN=
  234.  
  235. ;Decrement character value
  236.  
  237. 32    store-macro
  238.     set $curchar &band &sub $curchar 1 255
  239. !endm
  240.  
  241. ;Increment character value
  242.  
  243. 33    store-macro
  244.     set $curchar &band &add $curchar 1 255
  245. !endm
  246.  
  247. 34  store-macro
  248.     set $hardtab 4
  249. !endm
  250.  
  251. 35  store-macro
  252.     set $hardtab 8
  253. !endm
  254.  
  255. ;    bring up the function key window
  256.  
  257.     1 split-current-window
  258.     select-buffer "Function Keys"
  259.     insert-string "f1 search-> f2 <-search █    MicroEMACS:  Text Editor~n"
  260.     insert-string "f3 hunt->   f4 <-hunt   █ ~n"
  261.     insert-string "f5 fkeys    f6 help     █  Available function key Pages include:~n"
  262.     insert-string "f7 nxt wind f8 pg[    ] █    Word  Box  Emacs  Pascal  C  cObal Lisp~n"
  263.     insert-string "f9 save     f10 exit    █  [use the f8 key to load Pages]~n"
  264.     unmark-buffer
  265.     delete-window
  266.     set %rcfkeys FALSE
  267.     toggle-fkeys
  268.     set $discmd TRUE
  269.     toggle-fkeys
  270.