annotate lisp/term/tvi970.el @ 882:bff32d8ecc5e

entered into RCS
author Richard M. Stallman <rms@gnu.org>
date Mon, 27 Jul 1992 08:52:26 +0000
parents 86f90c43ef3e
children 9bc89a98c002
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
530
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;;; Terminal support for the Televideo 970.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;;; Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 ;;; Define the escape codes sent by the function keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 (or (lookup-key function-key-map "\e[")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 (define-key function-key-map "\e[" (make-keymap)))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 (or (lookup-key function-key-map "\eO")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 (define-key function-key-map "\eO" (make-keymap)))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; Miscellaneous keys
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 (mapcar (function (lambda (key-binding)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 (car key-binding) (nth 1 key-binding))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 '(("\e[H" [home])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ("\e[Z" [backtab])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ("\e[i" [print])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ("\e[2J" [clear])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ("\e[@" [insert])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ("\e[P" [delete])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ("\e[L" [insertline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ("\e[M" [deleteline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ("\e[K" [eraseline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 ("\e[J" [erasepage])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 ("\e[U" [page])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 ("\e[g" [S-tab])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ("\e[2N" [clearentry])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ("\e[2K" [S-clearentry])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ("\e[E" [?\C-j])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ("\e[g" [S-backtab])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ("\e[?1i" [S-print])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ("\e[4h" [S-insert])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ("\e[4l" [S-delete])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ("\e[Q" [S-insertline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ("\e[1Q" [S-deleteline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ("\e[19l" [S-eraseline])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ("\e[19h" [S-erasepage])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ("\e[V" [S-page])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ("\eS" [send])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 ("\e5" [S-send])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ("\eOm" [kp-subtract])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ("\eOl" [kp-separator])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 ("\eOn" [kp-decimal])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ("\eOM" [enter])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 ("\eOP" [kp-f1])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ("\eOQ" [kp-f2])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ("\eOR" [kp-f3])
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ("\eOS" [kp-f4])))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;; The numeric keypad keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (let ((i 0))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (while (< i 10)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (format "\eO%c" (+ i ?p))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (vector (intern (format "kp-%d" i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (setq i (1+ i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 ;; The numbered function keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (let ((i 0))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (while (< i 16)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (format "\e?%c" (+ i ?a))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (vector (intern (format "f%d" (1+ i)))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (format "\e?%c" (+ i ?A))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (vector (intern (format "S-f%d" (1+ i)))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (setq i (1+ i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 ;;; Should keypad numbers send ordinary digits or distinct escape sequences?
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (defvar tvi970-keypad-numeric nil
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 "The terminal should be in numeric keypad mode iff this variable is non-nil.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 Do not set this variable! Call the function ``tvi970-set-keypad-mode''.")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 (defun tvi970-set-keypad-mode (&optional arg)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 "Set the current mode of the TVI 970 numeric keypad.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 In ``numeric keypad mode'', the number keys on the keypad act as
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 ordinary digits. In ``alternate keypad mode'', the keys send distinct
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 escape sequences, meaning that they can have their own bindings,
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 independent of the normal number keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 With no argument, toggle between the two possible modes.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 With a positive argument, select alternate keypad mode.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 With a negative argument, select numeric keypad mode."
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (interactive "P")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (setq tvi970-keypad-numeric
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (if (null arg)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (not tvi970-keypad-numeric)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (> (prefix-numeric-value arg) 0)))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (tvi970-set-keypad-mode 1)