1 ;;; tvi970.el --- terminal support for the Televideo 970
3 ;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992
6 ;; Copyright (C) 1992 Free Software Foundation, Inc.
8 ;; This file is part of SXEmacs.
10 ;; SXEmacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; SXEmacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ;;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
29 (or (lookup-key function-key-map "\e[")
30 (define-key function-key-map "\e[" (make-keymap)))
31 ;; (or (lookup-key function-key-map "\eO")
32 ;; (define-key function-key-map "\eO" (make-keymap)))
35 (mapcar (function (lambda (key-binding)
36 (define-key function-key-map
37 (car key-binding) (nth 1 key-binding))))
39 ;; These are set up by termcap or terminfo
45 ;; These might br set by terminfo
52 ("\e[U" [next]) ;; actually the `page' key
54 ;; These won't be set up by either
55 ("\eOm" [kp-subtract])
56 ("\eOl" [kp-separator])
60 ;; These won't be set up by either either
61 ("\e[K" [key-eol]) ;; Not an X keysym
62 ("\e[J" [key-eos]) ;; Not an X keysym
63 ("\e[2J" [key-clear]) ;; Not an X keysym
64 ("\e[P" [key-dc]) ;; Not an X keysym
65 ("\e[g" [(shift tab)]) ;; Not an X keysym
66 ("\e[2N" [clearentry]) ;; Not an X keysym
67 ("\e[2K" [(shift clearentry)]) ;; Not an X keysym
68 ("\e[E" [?\C-j]) ;; Not an X keysym
69 ("\e[g" [(shift backtab)]) ;; Not an X keysym
70 ("\e[?1i" [key-sprint]) ;; Not an X keysym
71 ("\e[4h" [key-sic]) ;; Not an X keysym
72 ("\e[4l" [(shift delete)]) ;; Not an X keysym
73 ("\e[Q" [(shift insertline)]) ;; Not an X keysym
74 ("\e[1Q" [key-sdl]) ;; Not an X keysym
75 ("\e[19l" [key-seol]) ;; Not an X keysym
76 ("\e[19h" [(shift erasepage)]) ;; Not an X keysym
77 ("\e[V" [(shift page)]) ;; Not an X keysym
78 ("\eS" [send]) ;; Not an X keysym
79 ("\e5" [(shift send)]) ;; Not an X keysym
82 ;; The numeric keypad keys.
85 (define-key function-key-map
86 (format "\eO%c" (+ i ?p))
87 (vector (intern (format "kp-%d" i))))
89 ;; The numbered function keys.
92 (define-key function-key-map
93 (format "\e?%c" (+ i ?a))
94 (vector (intern (format "f%d" (1+ i)))))
95 (define-key function-key-map
96 (format "\e?%c" (+ i ?A))
97 (vector (list 'shift (intern (format "f%d" (1+ i))))))
101 ;;; Should keypad numbers send ordinary digits or distinct escape sequences?
102 (defvar tvi970-keypad-numeric nil
103 "The terminal should be in numeric keypad mode iff this variable is non-nil.
104 Do not set this variable! Call the function ``tvi970-set-keypad-mode''.")
106 (defun tvi970-set-keypad-mode (&optional arg)
107 "Set the current mode of the TVI 970 numeric keypad.
108 In ``numeric keypad mode'', the number keys on the keypad act as
109 ordinary digits. In ``alternate keypad mode'', the keys send distinct
110 escape sequences, meaning that they can have their own bindings,
111 independent of the normal number keys.
112 With no argument, toggle between the two possible modes.
113 With a positive argument, select alternate keypad mode.
114 With a negative argument, select numeric keypad mode."
116 (setq tvi970-keypad-numeric
118 (not tvi970-keypad-numeric)
119 (> (prefix-numeric-value arg) 0)))
120 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))
122 (tvi970-set-keypad-mode 1)