annotate lisp/term/tvi970.el @ 10976:354c9e79de15

(hexl-mode-old-local-map, hexl-mode-old-mode-name) (hexl-mode-old-major-mode): Add defvars.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 Mar 1995 17:14:54 +0000
parents f1324e61f9fd
children 23cc3f54e536
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
1 ;;; tvi970.el --- terminal support for the Televideo 970
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
2
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
3 ;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
4 ;; Keywords: terminals
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
5
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
6 ;; Copyright (C) 1992 Free Software Foundation, Inc.
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
7
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
8 ;; This file is part of GNU Emacs.
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
9
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
13 ;; any later version.
530
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
18 ;; GNU General Public License for more details.
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
19
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
20 ;; You should have received a copy of the GNU General Public License
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
23
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
24 ;;; Commentary:
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
25
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
26 ;;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
27
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
28 ;;; Code:
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
29
530
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 (or (lookup-key function-key-map "\e[")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 (define-key function-key-map "\e[" (make-keymap)))
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
32 ;; (or (lookup-key function-key-map "\eO")
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
33 ;; (define-key function-key-map "\eO" (make-keymap)))
530
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; Miscellaneous keys
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 (mapcar (function (lambda (key-binding)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (car key-binding) (nth 1 key-binding))))
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
39 '(
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
40 ;; These are set up by termcap or terminfo
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
41 ;; ("\eOP" [kp-f1])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
42 ;; ("\eOQ" [kp-f2])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
43 ;; ("\eOR" [kp-f3])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
44 ;; ("\eOS" [kp-f4])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
45
2241
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
46 ;; These might br set by terminfo
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
47 ("\e[H" [home])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
48 ("\e[Z" [backtab])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
49 ("\e[i" [print])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
50 ("\e[@" [insert])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
51 ("\e[L" [insertline])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
52 ("\e[M" [deleteline])
2241
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
53 ("\e[U" [next]) ;; actually the `page' key
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
54
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
55 ;; These won't be set up by either
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
56 ("\eOm" [kp-subtract])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
57 ("\eOl" [kp-separator])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
58 ("\eOn" [kp-decimal])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
59 ("\eOM" [kp-enter])
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
60
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
61 ;; These won't be set up by either either
2241
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
62 ("\e[K" [key_eol]) ;; Not an X keysym
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
63 ("\e[J" [key_eos]) ;; Not an X keysym
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
64 ("\e[2J" [key_clear]) ;; Not an X keysym
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
65 ("\e[P" [key_dc]) ;; Not an X keysym
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
66 ("\e[g" [S-tab]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
67 ("\e[2N" [clearentry]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
68 ("\e[2K" [S-clearentry]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
69 ("\e[E" [?\C-j]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
70 ("\e[g" [S-backtab]) ;; Not an X keysym
2241
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
71 ("\e[?1i" [key_sprint]) ;; Not an X keysym
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
72 ("\e[4h" [key_sic]) ;; Not an X keysym
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
73 ("\e[4l" [S-delete]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
74 ("\e[Q" [S-insertline]) ;; Not an X keysym
2241
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
75 ("\e[1Q" [key_sdl]) ;; Not an X keysym
f1324e61f9fd As many key cookies as possible renamed to fit the new conventions
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2141
diff changeset
76 ("\e[19l" [key_seol]) ;; Not an X keysym
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
77 ("\e[19h" [S-erasepage]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
78 ("\e[V" [S-page]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
79 ("\eS" [send]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
80 ("\e5" [S-send]) ;; Not an X keysym
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
81 ))
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
82
530
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 ;; The numeric keypad keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (let ((i 0))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (while (< i 10)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (format "\eO%c" (+ i ?p))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (vector (intern (format "kp-%d" i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (setq i (1+ i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 ;; The numbered function keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (let ((i 0))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (while (< i 16)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (format "\e?%c" (+ i ?a))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (vector (intern (format "f%d" (1+ i)))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (define-key function-key-map
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (format "\e?%c" (+ i ?A))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (vector (intern (format "S-f%d" (1+ i)))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (setq i (1+ i))))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 ;;; Should keypad numbers send ordinary digits or distinct escape sequences?
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (defvar tvi970-keypad-numeric nil
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 "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
105 Do not set this variable! Call the function ``tvi970-set-keypad-mode''.")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (defun tvi970-set-keypad-mode (&optional arg)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 "Set the current mode of the TVI 970 numeric keypad.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 In ``numeric keypad mode'', the number keys on the keypad act as
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 ordinary digits. In ``alternate keypad mode'', the keys send distinct
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 escape sequences, meaning that they can have their own bindings,
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 independent of the normal number keys.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 With no argument, toggle between the two possible modes.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 With a positive argument, select alternate keypad mode.
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 With a negative argument, select numeric keypad mode."
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (interactive "P")
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (setq tvi970-keypad-numeric
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (if (null arg)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (not tvi970-keypad-numeric)
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (> (prefix-numeric-value arg) 0)))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122
86f90c43ef3e Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 (tvi970-set-keypad-mode 1)
2141
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
124
9bc89a98c002 Added headers, changes some keycap names.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 530
diff changeset
125 ;;; tv970 ends here