466
|
1 ;;;; Define VT100 function key escape sequences in function-key-map.
|
|
2
|
|
3
|
|
4 ;;; CSI sequences - those that start with "\e[".
|
494
|
5 (define-prefix-command 'vt100-CSI-prefix)
|
466
|
6 (define-key function-key-map "\e[" 'vt100-CSI-prefix)
|
|
7
|
494
|
8 (define-key vt100-CSI-prefix "A" [up])
|
|
9 (define-key vt100-CSI-prefix "B" [down])
|
|
10 (define-key vt100-CSI-prefix "C" [right])
|
|
11 (define-key vt100-CSI-prefix "D" [left])
|
466
|
12
|
|
13 (defun enable-arrow-keys ()
|
|
14 "Enable the use of the VT100 arrow keys for cursor motion.
|
|
15 Because of the nature of the VT100, this unavoidably breaks
|
|
16 the standard Emacs command ESC [; therefore, it is not done by default,
|
|
17 but only if you give this command."
|
|
18 (interactive)
|
|
19 (global-unset-key "\e["))
|
|
20
|
|
21
|
|
22
|
|
23 ;;; SS3 sequences - those that start with "\eO".
|
494
|
24 (define-prefix-command 'vt100-SS3-prefix)
|
466
|
25 (define-key function-key-map "\eO" 'vt100-SS3-prefix)
|
|
26
|
494
|
27 (define-key vt100-SS3-prefix "A" [up])
|
|
28 (define-key vt100-SS3-prefix "B" [down]) ; down-arrow
|
|
29 (define-key vt100-SS3-prefix "C" [right]) ; right-arrow
|
|
30 (define-key vt100-SS3-prefix "D" [left]) ; left-arrow
|
|
31 (define-key vt100-SS3-prefix "M" [kp-enter]) ; Enter
|
|
32 (define-key vt100-SS3-prefix "P" [kp-f1]) ; PF1
|
|
33 (define-key vt100-SS3-prefix "Q" [kp-f2]) ; PF2
|
|
34 (define-key vt100-SS3-prefix "R" [kp-f3]) ; PF3
|
|
35 (define-key vt100-SS3-prefix "S" [kp-f4]) ; PF4
|
|
36 (define-key vt100-SS3-prefix "l" [kp-separator]) ; ,
|
|
37 (define-key vt100-SS3-prefix "m" [kp-subtract]) ; -
|
|
38 (define-key vt100-SS3-prefix "n" [kp-period]) ; .
|
|
39 (define-key vt100-SS3-prefix "p" [kp-0]) ; 0
|
|
40 (define-key vt100-SS3-prefix "q" [kp-1]) ; 1
|
|
41 (define-key vt100-SS3-prefix "r" [kp-2]) ; 2
|
|
42 (define-key vt100-SS3-prefix "s" [kp-3]) ; 3
|
|
43 (define-key vt100-SS3-prefix "t" [kp-4]) ; 4
|
|
44 (define-key vt100-SS3-prefix "u" [kp-5]) ; 5
|
|
45 (define-key vt100-SS3-prefix "v" [kp-6]) ; 6
|
|
46 (define-key vt100-SS3-prefix "w" [kp-7]) ; 7
|
|
47 (define-key vt100-SS3-prefix "x" [kp-8]) ; 8
|
|
48 (define-key vt100-SS3-prefix "y" [kp-9]) ; 9
|
466
|
49
|
|
50
|
|
51 ;;; Controlling the screen width.
|
779
|
52 (defconst vt100-wide-mode (= (frame-width) 132)
|
466
|
53 "t if vt100 is in 132-column mode.")
|
|
54
|
|
55 (defun vt100-wide-mode (&optional arg)
|
|
56 "Toggle 132/80 column mode for vt100s."
|
|
57 (interactive "P")
|
|
58 (setq vt100-wide-mode
|
|
59 (if (null arg) (not vt100-wide-mode)
|
|
60 (> (prefix-numeric-value arg) 0)))
|
|
61 (send-string-to-terminal (if vt100-wide-mode "\e[?3h" "\e[?3l"))
|
779
|
62 (set-frame-width (if vt100-wide-mode 132 80)))
|