|
|
1.1 root 1: ;; Map VT100 function key escape sequences
2: ;; into the standard slots in function-keymap.
3:
4: (require 'keypad)
5:
6: (defvar CSI-map nil
7: "The CSI-map maps the CSI function keys on the VT100 keyboard.
8: The CSI keys are the arrow keys.")
9:
10: (if (not CSI-map)
11: (progn
12: (setq CSI-map (lookup-key global-map "\e["))
13: (if (not (keymapp CSI-map))
14: (setq CSI-map (make-sparse-keymap))) ;; <ESC>[ commands
15:
16: (setup-terminal-keymap CSI-map
17: '(("A" . ?u) ; up arrow
18: ("B" . ?d) ; down-arrow
19: ("C" . ?r) ; right-arrow
20: ("D" . ?l))))) ; left-arrow
21:
22: (defun enable-arrow-keys ()
23: "Enable the use of the VT100 arrow keys for cursor motion.
24: Because of the nature of the VT100, this unavoidably breaks
25: the standard Emacs command ESC [; therefore, it is not done by default,
26: but only if you give this command."
27: (interactive)
28: (global-set-key "\e[" CSI-map))
29:
30: (defvar SS3-map nil
31: "SS3-map maps the SS3 function keys on the VT100 keyboard.
32: The SS3 keys are the numeric keypad keys in keypad application mode
33: \(DECKPAM). SS3 is DEC's name for the sequence <ESC>O which is
34: the common prefix of what these keys transmit.")
35:
36: (if (not SS3-map)
37: (progn
38:
39: (setq SS3-map (lookup-key global-map "\eO"))
40: (if (not (keymapp SS3-map))
41: (setq SS3-map (make-keymap))) ;; <ESC>O commands
42: (setup-terminal-keymap SS3-map
43: '(("A" . ?u) ; up arrow
44: ("B" . ?d) ; down-arrow
45: ("C" . ?r) ; right-arrow
46: ("D" . ?l) ; left-arrow
47: ("M" . ?e) ; Enter
48: ("P" . ?\C-a) ; PF1
49: ("Q" . ?\C-b) ; PF2
50: ("R" . ?\C-c) ; PF3
51: ("S" . ?\C-d) ; PF4
52: ("l" . ?,) ; ,
53: ("m" . ?-) ; -
54: ("n" . ?.) ; .
55: ("p" . ?0) ; 0
56: ("q" . ?1) ; 1
57: ("r" . ?2) ; 2
58: ("s" . ?3) ; 3
59: ("t" . ?4) ; 4
60: ("u" . ?5) ; 5
61: ("v" . ?6) ; 6
62: ("w" . ?7) ; 7
63: ("x" . ?8) ; 8
64: ("y" . ?9))) ; 9
65:
66: (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.