home *** CD-ROM | disk | FTP | other *** search
- ; Startup program for Micro-EMACS 3.11c for Windows (update 1.0)
- ;
- ; Pierr Perret - April 1992
-
- set $discmd FALSE
- write-message "[Setting up....]"
-
- !if &seq $sres "MSWIN"
- ; running under MS Windows
-
- ; setup some cool colors
- add-mode lcyan ; background
- add-global-mode lcyan
- add-mode BLACK ; foreground
- add-global-mode BLACK
-
- ; resize the screen for 100 columns
- 100 change-screen-width
-
- ; this macro calls up the SDK help on the curent topic
- ; note that it modifies mark0 and mark7
- store-procedure Win-API-Help
- 7 set-mark
- forward-character
- !force previous-word
- 0 set-mark
- end-of-word
- set %Keyword $region
- 7 goto-mark
- !if &sequal %Keyword &upper %Keyword
- ; keyword is all uppercase
- set %tmp &sindex %Keyword "_"
- !if ¬ &equal %tmp 0
- ; there is an underscore in there...
- !if &or &equal %tmp 3 &sequal &mid %Keyword 2 3 "BN_"
- ; the underscore is the 3rd character or
- ; the second to 4th characters are "BN_"
- set %KeywordType " message"
- !else
- set %tmp 0
- !endif
- !endif
- !if &equal %tmp 0
- *GetAdvice
- write-message "What is it ? (S=data Structure, M=utility Macro, P=Printer escape)"
- set %tmp &upper >k
- !if &equal &sindex "SMP" %tmp
- !goto GetAdvice
- !endif
- !if &sequal %tmp "S"
- set %KeywordType " data structure"
- !else
- !if &sequal %tmp "M"
- set %KeywordType " utility macro"
- !else
- set %KeywordType " printer escape"
- !endif
- !endif
- !endif
- !else
- ; keyword contains lower case characters
- set %KeywordType " function"
- !endif
- write-message &cat "Looking for: " &cat %Keyword %KeywordType
- help-engine "SDKWIN.HLP" &cat %Keyword %KeywordType
- !endm
-
- ; this macro calls up the TCW help on the curent topic
- ; note that it modifies mark0 and mark7
- store-procedure TCW-Help
- 7 set-mark
- forward-character
- !force previous-word
- 0 set-mark
- end-of-word
- set %Keyword $region
- 7 goto-mark
- write-message &cat "Looking for: " &cat %Keyword
- help-engine "TCWHELP.HLP" &cat %Keyword
- !endm
-
- ; this macro allows easy resizing of the current screen
- store-procedure Set-Screen-Size
- set %tmp @&cat &cat "Screen width (" $curwidth "): "
- !if ¬ &sequal %tmp ""
- set $curwidth %tmp
- !endif
- set %tmp @&cat &cat "Screen height (" $pagelen "): "
- !if ¬ &sequal %tmp ""
- set $pagelen %tmp
- !endif
- !endm
-
- ; this macro allows easy setting of the fill column
- store-procedure Set-Fill-Column
- set %tmp @&cat &cat "Fill column (" $fillcol "): "
- !if ¬ &sequal %tmp ""
- set $fillcol %tmp
- !endif
- !endm
-
- ; create/modify a few menu entries
- ;
- ; add the SDK help menu items at position 5 in the Help menu
- ; ("@" positions start at 0)
- macro-to-menu Win-API-Help ">&Help>&Windows API@5"
- macro-to-menu TCW-Help "&Turbo C++ help"
- ; follow by a separator (note that nop is used as a placeholder)
- bind-to-menu nop "-"
- ; get rid of some menu entries
- ; to replace them by a nicer macro that actually prompts the user
- unbind-menu ">S&creen>Si&ze>= &Width"
- unbind-menu "= &Height"
- macro-to-menu Set-Screen-Size "&Set:"
- unbind-menu ">&Edit>= &Fill column"
- macro-to-menu Set-Fill-Column "&Fill column:"
-
- write-message "[Loading MDI macros...]"
- execute-file "mdi.cmd"
- !endif
- ; end of the MS-Windows stuff
-
- !if &seq &left $version 4 "3.11"
- write-message "[Loading CUA-feel macros...]"
- execute-file "cua.cmd"
- write-message "[Still setting up...]"
- !endif
-
- store-procedure extension
- ; figure out the filename extension. returns lowercase result in %ext
- ; if no extension, returns ""
- set %tmp &rig $cfname 4
- set %ext &sin %tmp "."
- !if &equ %ext 0
- set %ext ""
- !else
- set %ext &low &mid %tmp &add %ext 1 3
- !endif
- !endm
-
- store-procedure readhook-proc
- run extension
- !if &sin "|c|h|cpp|hpp|dlg|def|rc|cmd|" &cat &cat "|" %ext "|"
- add-mode cmode
- !else
- !if &sin "||me|1st|doc|txt|" &cat &cat "|" %ext "|"
- add-mode wrap
- !endif
- !endif
- !endm
- set $readhook readhook-proc
-
- set $ssave FALSE
- 4 handle-tab
- bind-to-key end-of-word M-F ; I personally prefer this over next-word
- bind-to-key end-of-word FN^F
-
- clear-message-line
- set $discmd TRUE
-