
; JED-STARTUP
;
; 15-Jan-93

(addsym
    `STF_GCOM' 1 2
    `STF_GVAR' 2 2
    `STF_LCOM' 3 2
    `STF_LVAR' 4 2

    `VTF_NONE' 0 2
    `VTF_STR'  1 2
    `VTF_NUM'  2 2
)

(addsym `macro' {
    (addsym (arg 1 `s') (arg 2 `s') STF_GCOM)
} STF_GCOM)

(macro `local' {
    (addsym `__i' 0 STF_LVAR)
    (while {(>= (- nargs __i) 2)} {
	(addsym (arg (+ __i 1) `s') (arg (+ __i 2) `e') STF_LVAR)
	(export (arg (+ __i 1) `s') 2)
	(= `__i' (+ __i 2))
    })
})

(macro `global' {
    (local `__i' 0)
    (while {(>= (- nargs __i) 2)} {
	(addsym (arg (+ __i 1) `s') (arg (+ __i 2) `e') STF_GVAR)
	(= `__i' (+ __i 2))
    })
})

; Lots of keybindings.
(bind
    `esc'               { (cli) }
    `help'              { (if (info `asleep') {(unsleep)} {(sleep)}) }
    `control \\'        { (close) }
    `control tab'       { (insert `a' ~\t) }
    `shift tab'         { (move `lt' 1) }
    `tab'               { (move `rt' 1) }
    `return'            { (split) }
    `backspace'         { (delete `p') }
    `del'               { (delete `c') }
    `shift backspace'   { (delete `sl') }
    `shift del'         { (delete `el') }
    `control del'       { (delete `l') }
    `control backspace' { (delete `w') }

    `control b'         { (block `t') }
    `alt b'             { (block `s') }
    `alt B'             { (block `e') }
    `control alt b'     { (block `k') }
    `control i'         { (insert `b') }
    `control z'         { (delete `b') }
    `control x'         { (cut `b' 0) }
    `control c'         { (copy `b' 0) }
    `control v'         { (insert `cb' 0) }
    `control q'         { (cut `el' -1) }
    `control y'         { (cut `l' -1) }
    `control u'         { (insert `cb' -1) }

    `control l'         { (undo `l') }
    `control L'         { (undo `L') }

    `control o'         { (openfile (getstr `file> ')) }
    `alt control o'     { (openfile (freq `r' `file...' (info `fullname'))) }
    `control I'         { (insert `f' (getstr `file> ')) }
    `alt control I'     { (insert `f' (freq `r' `include file...' (info `dirname'))) }
    `control O'         { (newfile (getstr `new file> ')) }
    `alt control O'     { (newfile (freq `r' `new file...' (info `dirname'))) }
    `control n'         { (newview) }
    `control W'         { (savefileas (getstr `file> ')) }
    `alt control W'     { (savefileas (freq `w' `save as...' (info `fullname'))) }
    `control w'         { (savefile) }
    `control N'         { (rename (getstr `new name> ')) }
    `control d'         { (cd (getstr `cd> ')) }
    `control k'         { (clear) }

    `control F'         { (if (find `s' (getstr `find> ')) {(find `n')}) }
    `control f'         { (find `n') }
    `control alt f'     { (find `p') }
    `control R'         { (replace `s' (getstr `replace> ')) }
    `control r'         { (if (replace `r') {(find `n')}) }
    `control g'         { (getref) }
    `control G'         { (getref (getstr `reference> ')) }
    `control h'         { (move `mb') }
    `control j'         { (move `ln' (getnum `line> ')) }

    `control .'         { (nextwind `a') }
    `control ,'         { (prevwind `a') }

    `control s'         { (script `x' (getstr `script file> ')) }
    `alt control s'     { (script `l') }
    `control S'         { (script `b') }
    `alt control S'     { (script `f') }

    `f1'                { (move `bm' 1) }
    `f2'                { (move `bm' 2) }
    `f3'                { (move `bm' 3) }
    `f4'                { (move `am') }
    `shift f1'          { (move `sm' 1) }
    `shift f2'          { (move `sm' 2) }
    `shift f3'          { (move `sm' 3) }

    `alt d'             { (insert `s' (info `date')) }
    `control e'         { (system (getstr `system> ')) }
)

; Create the menus, comment out the next line if you don't want menus.
(setmenu `s:jed/jed-menus')

; Path for references.
(addpath `')

