!* -*- TECO -*- ! !~Filename~:! !A library for hacking EMACS on VT2xx's! VT2XX !& Setup VT2XX Library:! !Things to do when this library loads Define keypad handler, Redefine ^X), etc... ! [0 [1 0fo..q Exit_to_Inferior_hook u1 fq1"l :i1' @:i*`1wm(m.m VT2xx_Normal_Keypad)`m.v Exit_to_Inferior_Hook 0fo..q Exit_to_Superior_Hooku1 fq1"l :i1' @:i*`1wm(m.m VT2xx_Normal_Keypad)`m.v Exit_to_superior_hook 0fo..q Return_From_Superior_hooku1 fq1"l :i1' @:i*`1wm(m.m VT2xx_Alternate_Keypad)`m.vReturn_From_Superior_hook 0fo..q Return_From_Inferior_hooku1 fq1"l :i1' @:i*`1wm(m.m VT2xx_Alternate_Keypad)`m.vReturn_From_Inferior_Hook m(m.m VT2xx_Alternate_Keypad) !* Put terminal in alt keypad mode! m.m ^R_VT2xx_Function_Key u..[ !* M-[ ! m.v VT2xx_Dispatch_Table 128m(m.m Make_Prefix_Char)VT2xx_Dispatch_Tableu..O qVT2xx_Dispatch_Table[0 qPrefix_Char_List[3 :iPrefix_Char_List3 Keypad__qVT2xx_Dispatch_Table  @:i*/ f m.m ^R_VT2xx_Uparrow_Key / u:0(A) @:i*/ f m.m ^R_VT2xx_Downarrow_Key / u:0(B) @:i*/ f m.m ^R_VT2xx_Leftarrow_Key / u:0(C) @:i*/ f m.m ^R_VT2xx_Rightarrow_Key/ u:0(D) @:i*/ f m.m ^R_VT2xx_PF1_Key/ u:0(P) @:i*/ f m.m ^R_VT2xx_PF2_Key/ u:0(Q) @:i*/ f m.m ^R_VT2xx_PF3_Key/ u:0(R) @:i*/ f m.m ^R_VT2xx_PF4_Key/ u:0(S) @:i*/ f m.m ^R_VT2xx_Enter_Key / u:0(M) @:i*/ f m.m ^R_VT2xx_Comma_Key / u:0(l) @:i*/ f m.m ^R_VT2xx_Minus_Key / u:0(m) @:i*/ f m.m ^R_VT2xx_Dot_key / u:0(n) @:i*/ f m.m ^R_VT2xx_Keypad_0 / u:0(p) @:i*/ f m.m ^R_VT2xx_Keypad_1 / u:0(q) @:i*/ f m.m ^R_VT2xx_Keypad_2 / u:0(r) @:i*/ f m.m ^R_VT2xx_Keypad_3 / u:0(s) @:i*/ f m.m ^R_VT2xx_Keypad_4 / u:0(t) @:i*/ f m.m ^R_VT2xx_Keypad_5 / u:0(u) @:i*/ f m.m ^R_VT2xx_Keypad_6 / u:0(v) @:i*/ f m.m ^R_VT2xx_Keypad_7 / u:0(w) @:i*/ f m.m ^R_VT2xx_Keypad_8 / u:0(x) @:i*/ f m.m ^R_VT2xx_Keypad_9 / u:0(y) 0fo..q VT2xx_Setup_Hook u1 q1"n m1 '  !^R VT2xx Function Key:! !C Interpreter for VTxxx function keys Reads and dispatches sequence.! fs o speed [0 !* get output speed, or 0! q0"N 300 / q0 + 1 : "E !* wait some, if nothing, error ! ft ESC_[_is_the_VT2xx_prefix_sequence  '' fi u0 !* get first char into q0! 0[1 !* q1 integer accumulator ! q0"D o middle ' !* was digit! q0"U !* was upper (normal cursor mode)! q0-A"E f m(m.m ^R_VT2xx_Uparrow_Key) ' q0-B"E f m(m.m ^R_VT2xx_Downarrow_Key) ' q0-C"E f m(m.m ^R_VT2xx_Leftarrow_Key) ' q0-D"E f m(m.m ^R_VT2xx_Rightarrow_Key) ' ' o bad !iloop! fi u0 !* get a char! !middle! q0"D !* is digit?! 10 * q1 + q0 - 0 u1 !* add in new digit ! oiloop' !* and loop! "# !* else! q0-~"N !* Not twiddle? ! o bad'' q1- 1"E f m(m.m ^R_VT2xx_Find_Key) ' q1- 2"E f m(m.m ^R_VT2xx_Insert-Here_Key) ' q1- 3"E f m(m.m ^R_VT2xx_Remove_Key) ' q1- 4"E f m(m.m ^R_VT2xx_Select_Key) ' q1- 5"E f m(m.m ^R_VT2xx_Prev-Screen_Key) ' q1- 6"E f m(m.m ^R_VT2xx_Next-Screen_Key) ' q1- 17"E f m(m.m ^R_VT2xx_F6_Key) ' q1- 18"E f m(m.m ^R_VT2xx_F7_Key) ' q1- 19"E f m(m.m ^R_VT2xx_F8_Key) ' q1- 20"E f m(m.m ^R_VT2xx_F9_Key) ' q1- 21"E f m(m.m ^R_VT2xx_F10_Key) ' q1- 23"E f m(m.m ^R_VT2xx_F11_Key) ' q1- 24"E f m(m.m ^R_VT2xx_F12_Key) ' q1- 25"E f m(m.m ^R_VT2xx_F13_Key) ' q1- 26"E f m(m.m ^R_VT2xx_F14_Key) ' q1- 28"E f m(m.m ^R_VT2xx_Help_Key) ' !* (F15)! q1- 29"E f m(m.m ^R_VT2xx_Do_Key) ' !* (F16)! q1- 31"E f m(m.m ^R_VT2xx_F17_Key) ' q1- 32"E f m(m.m ^R_VT2xx_F18_Key) ' q1- 33"E f m(m.m ^R_VT2xx_F19_Key) ' q1- 34"E f m(m.m ^R_VT2xx_F20_Key) ' !bad! ft Bad_VT2xx_escape_sequence!! q1\  !VT2xx Alternate Keypad:! !C Sets alternate keypad mode for VT2xx's When this command is executed, the numeric keypad can be used to enter arguments for the following function. Numbers are entered as themselves, dot and "enter" key on the pad are also changed.! :I*=[?1hFS IMAGE OUT !* Put VT2xx in application mode ! !VT2xx Normal Keypad:! !C Undos alternate keypad mode for VT2xx's When this command is executed from a VT2xx, the keys on the keypad become functionally identical to the standard digit keys. See VT2xx Alternate Keypad for a description of the alternative.! :I*[?1l>FS IMAGE OUT !^R VT2xx Define Kbd Macro:! !^R Start or Stop defining kbd macro. When stopping, we ask for a key to to place the kbd macro on.! fs tyi sink"e !* If not defining something, ! F@:m(m.m ^R_Start_Kbd_Macro)' !* Start definition ! "# 1m(m.m ^R_End_Kbd_Macro) !* Else stop defining! m(m.mName_Kbd_Macro)' !* and put the definition somewhere.!  !^R VT2xx Negate Arg:! !^R Negate numeric argument.! -u..1 :m(q..1+200.@fs^R Init) !^R VT2xx Keypad 0:! !^R VT2xx Keypad 1:! !^R VT2xx Keypad 2:! !^R VT2xx Keypad 3:! !^R VT2xx Keypad 4:! !^R VT2xx Keypad 5:! !^R VT2xx Keypad 6:! !^R VT2xx Keypad 7:! !^R VT2xx Keypad 8:! !^R VT2xx Keypad 9:! !^R VT2xx Arg Digit:! !^R Digit of numeric argument.! q..1-p+0u..0 :m(q..0+200.@fs^R Init) !^R VT2xx Run precomma arg:! !^R Run precomma arg Have VT2xx keypad comma turn previous argument into a precomma argument.! 0fs^RArg 0fs^RArgp !* Zero argument ! ,@m(@fif(f(fs^Rlastw)u..0)@fs^RCmacro)@v !* Call first char specially ! q0(]0)'( )')@m(@fif(f(fs^Rlastw)u..0)@fs^RCmacro)@v> 0 !C132 Mode:! !C Put VT2xx in 132 column mode and change ^S/^Q ^R Incremental search becomes ^\. ^Q inside search becomes ^^. Outside of searches, you must use ^^Q to quote a character.! m(m.mVT2xx_Page_Mode) !* Set new incremental search cmds! :i*[?3hfs image out !* Set 132 column mode! 131fs width -1fs pjatyf+ !* Need to refresh whole screen! !C80 Mode:! !C Put VT2xx in 80 column mode (see C132 Mode)! -1m(m.mVT2xx_Page_Mode) !* Set new incremental search cmds! :i*[?3lfs image out !* Set 80 column mode! 79fs width -1 fs pjatyf+ !* Refresh screen! !VT2xx Page Mode:! !C Set Page Mode and change incremental search cmds. C-X C-S becomes C-X S C-X C-Q becomes C-X ~ C-S becomes C-\ C-Q within a search becomes C-^ C-Q outside a search becomes C-^ Q (or C-` Q on VT2xx kbd). To insert a bare ^Q type M-*. A negative arg turns this lossage off.! fsrunt&1"E !"! :FT You_poor_loser! Haven't_you_learned_YET_never_to_buy_DEC_terminals?' "# :FT You_should_sell_this_piece_of_junk and_buy_an_Ann_Arbor_Ambassador!' FT  90 0U..H "L Q.S FO..Q Search_CommandU.S M.V Search_Quote m.m^R_Quoted_InsertU.Q Q.B U 1fstt pag wfsttyinit ' -1fstt pag mode !* Disable Xon/Xoff processing! :i*-1fstt pag modeU.S !* If EMACS drops page mode - this will! :i*-1fstt pag modeU.Q !* re-init it (I hope).! 0fo..qSearch_Command"e m.vSearch_Command' 0fo..qSearch_Quote"e m.vSearch_Quote' !* C-^ becomes search quote.! QSearch_CommandU.\ !* C-\ is search command.! Q:.X()U:.X(S) !* C-X C-S becomes C-X S! Q:.X()U:.X(~) !* C-X C-Q becomes C-X ~! :i*21.iU..* !* M-* inserts bare ^Q! m.m^R_Quoted_Insert,8fs^R CMAC !* Backspace becomes C-Q!