annotate lisp/term/tvi970.el @ 52:461c7ba8286a r19-16-pre1

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