|
|
1.1 root 1: ;; vt200 series terminal stuff.
2: ;; April 1985, Joe Kelsey
3:
4: (require 'keypad)
5:
6: (defvar CSI-map nil
7: "The CSI-map maps the CSI function keys on the VT200 keyboard.
8: The CSI keys are the dark function keys, and are only active in
9: VT200-mode, except for the arrow keys.")
10:
11: (defun enable-arrow-keys ()
12: "Enable the use of the VT200 arrow keys and dark function keys.
13: Because of the nature of the VT200, this unavoidably breaks
14: the standard Emacs command ESC [; therefore, it is not done by default,
15: but only if you give this command."
16: (interactive)
17: (global-set-key "\e[" CSI-map))
18:
19: ;; I suggest that someone establish standard mappings for all of
20: ;; the VT200 CSI function keys into the function-keymap.
21:
22: (if CSI-map
23: nil
24: (setq CSI-map (make-keymap)) ; <ESC>[ commands
25: (setup-terminal-keymap CSI-map
26: '(("A" . ?u) ; up arrow
27: ("B" . ?d) ; down-arrow
28: ("C" . ?r) ; right-arrow
29: ("D" . ?l) ; left-arrow
30: ("1~" . ?f) ; Find
31: ("2~" . ?I) ; Insert Here
32: ("3~" . ?k) ; Re-move
33: ("4~" . ?s) ; Select
34: ("5~" . ?P) ; Prev Screen
35: ("6~" . ?N) ; Next Screen
36: ("17~" . ?\C-f) ; F6
37: ("18~" . ?\C-g) ; F7
38: ("19~" . ?\C-h) ; F8
39: ("20~" . ?\C-i) ; F9
40: ("21~" . ?\C-j) ; F10
41: ("23~" . ESC-prefix) ; F11 (ESC)
42: ("24~" . ?\C-l) ; F12
43: ("25~" . ?\C-m) ; F13
44: ("26~" . ?\C-n) ; F14
45: ("31~" . ?\C-q) ; F17
46: ("32~" . ?\C-r) ; F18
47: ("33~" . ?\C-s) ; F19
48: ("34~" . ?\C-t) ; F20
49: ("28~" . ??) ; Help
50: ("29~" . ?x)))) ; Do
51:
52: (defvar SS3-map nil
53: "SS3-map maps the SS3 function keys on the VT200 keyboard.
54: The SS3 keys are the numeric keypad keys in keypad application mode
55: \(DECKPAM). SS3 is DEC's name for the sequence <ESC>O which is
56: the common prefix of what these keys transmit.")
57:
58: (if SS3-map
59: nil
60: (setq SS3-map (make-keymap)) ; <ESC>O commands
61: (setup-terminal-keymap SS3-map
62: '(("A" . ?u) ; up arrow
63: ("B" . ?d) ; down-arrow
64: ("C" . ?r) ; right-arrow
65: ("D" . ?l) ; left-arrow
66: ("M" . ?e) ; Enter
67: ("P" . ?\C-a) ; PF1
68: ("Q" . ?\C-b) ; PF2
69: ("R" . ?\C-c) ; PF3
70: ("S" . ?\C-d) ; PF4
71: ("l" . ?,) ; ,
72: ("m" . ?-) ; -
73: ("n" . ?.) ; .
74: ("p" . ?0) ; 0
75: ("q" . ?1) ; 1
76: ("r" . ?2) ; 2
77: ("s" . ?3) ; 3
78: ("t" . ?4) ; 4
79: ("u" . ?5) ; 5
80: ("v" . ?6) ; 6
81: ("w" . ?7) ; 7
82: ("x" . ?8) ; 8
83: ("y" . ?9))) ; 9
84:
85: (define-key global-map "\eO" SS3-map))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.