comparison lisp/term/wyse50.el @ 2142:67773a6ede4e

Added headers, changed some keycap names.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Thu, 11 Mar 1993 08:52:30 +0000
parents c2dbf1fe0506
children ce068246b4d7
comparison
equal deleted inserted replaced
2141:9bc89a98c002 2142:67773a6ede4e
1 ;;;; Terminal mode for Wyse 50 1 ;;; wyse50.el --- terminal support code for Wyse 50
2 ;;;; Should work well for Televideo TVI 925 although it's overkill 2
3 ;;;; Author Daniel Pfieffer (pfieffer@cix.cict.fr) January 1991 3 ;; Author: Daniel Pfieffer <pfieffer@cix.cict.fr> January 1991
4 ;;;; Rewritten for Emacs 19 by Jim Blandy (jimb@occs.cs.oberlin.edu) 4 ;; Jim Blandy <jimb@occs.cs.oberlin.edu>
5 ;;;; January 1992 5 ;; Keywords: terminals
6 6
7 7 ;; Copyright (C) 1989 Free Software Foundation, Inc.
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY. No author or distributor
13 ;; accepts responsibility to anyone for the consequences of using it
14 ;; or for whether it serves any particular purpose or works at all,
15 ;; unless he says so in writing. Refer to the GNU Emacs General Public
16 ;; License for full details.
17
18 ;; Everyone is granted permission to copy, modify and redistribute
19 ;; GNU Emacs, but only under the conditions described in the
20 ;; GNU Emacs General Public License. A copy of this license is
21 ;; supposed to have been given to you along with GNU Emacs so you
22 ;; can know your rights and responsibilities. It should be in a
23 ;; file named COPYING. Among other things, the copyright notice
24 ;; and this notice must be preserved on all copies.
25
26 ;;; Commentary:
27
28 ;; Uses the Emacs 19 terminal initialization features --- won't work with 18.
29 ;; Rewritten for Emacs 19 by jimb, January 1992
30 ;; Cleaned up for new terminal package cinventions by esr, March 1993
31 ;; Should work well for Televideo TVI 925 although it's overkill.
32 ;;
33 ;; The Wyse50 is ergonomically wonderful, but its escape-sequence design sucks
34 ;; rocks. The left-arrow key emits a backspace (!) and the down-arrow a line
35 ;; feed (!!). Thus, you have to unbind some commonly-used Emacs keys to
36 ;; enable the arrows.
37
38 ;;; Code:
39
8 ;;; Functions especially for this terminal. 40 ;;; Functions especially for this terminal.
9 41
10 (defun wyse-50-insert-line () 42 (defun wyse-50-insert-line ()
11 "Insert an empty line." 43 "Insert an empty line."
12 (interactive) 44 (interactive)
59 ;;; Define the escape sequences for the function keys. 91 ;;; Define the escape sequences for the function keys.
60 (define-key function-key-map "\C-a" (make-keymap)) 92 (define-key function-key-map "\C-a" (make-keymap))
61 (mapcar (function (lambda (key-definition) 93 (mapcar (function (lambda (key-definition)
62 (define-key function-key-map 94 (define-key function-key-map
63 (car key-definition) (nth 1 key-definition)))) 95 (car key-definition) (nth 1 key-definition))))
64 '(("\eI" [S-tab]) 96 '(
65 ("\eJ" [S-prior]) 97 ;; These might be set up by termcap and terminfo
66 ("\eK" [next]) 98 ("\C-k" [up])
67 ("\eY" [clear]) 99 ("\C-j" [down])
68 ("\eT" [clear-eol]) 100 ("\C-l" [right])
69 ("\^^" [home]) 101 ("\C-h" [left])
70 ("\e\^^" [home-down]) 102 ("\^a@\^m" [f1])
71 ("\eQ" [insert]) 103 ("\^aA\^m" [f2])
72 ("\eE" [insertline]) 104 ("\^aB\^m" [f3])
73 ("\eW" [?\C-?]) 105 ("\^aC\^m" [f4])
74 ("\eR" [deleteline]) 106 ("\^aD\^m" [f5])
75 ("\eP" [print]) 107 ("\^aE\^m" [f6])
76 ("\C-k" [up]) 108 ("\^aF\^m" [f7])
77 ("\C-j" [down]) 109 ("\^aG\^m" [f8])
78 ("\C-l" [right]) 110 ("\^aH\^m" [f9])
79 ("\C-h" [left]) 111
80 ("\C-a\C-k\C-m" [funct-up]) 112 ;; These might be set up by terminfo
81 ("\C-a\C-j\C-m" [funct-down]) 113 ("\eK" [next])
82 ("\C-a\C-l\C-m" [funct-right]) 114 ("\eT" [clearline])
83 ("\C-a\C-h\C-m" [funct-left]) 115 ("\^^" [home])
84 ("\er" [replace]) 116 ("\e\^^" [end])
85 ("\^a\^m\^m" [funct-return]) 117 ("\eQ" [insert])
86 ("\^a\^i\^m" [funct-tab]) 118 ("\eE" [insertline])
87 ("\^a@\^m" [f1]) 119 ("\eR" [deleteline])
88 ("\^a`\^m" [S-f1]) 120 ("\eP" [print])
89 ("\^aA\^m" [f2]) 121 ("\er" [replace])
90 ("\^aa\^m" [S-f2]) 122 ("\^aI\^m" [f10])
91 ("\^aB\^m" [f3]) 123 ("\^aJ\^m" [f11])
92 ("\^ab\^m" [S-f3]) 124 ("\^aK\^m" [f12])
93 ("\^aC\^m" [f4]) 125 ("\^aL\^m" [f13])
94 ("\^ac\^m" [S-f4]) 126 ("\^aM\^m" [f14])
95 ("\^aD\^m" [f5]) 127 ("\^aN\^m" [f15])
96 ("\^ad\^m" [S-f5]) 128 ("\^aO\^m" [f16])
97 ("\^aE\^m" [f6]) 129 ("\^a`\^m" [f17])
98 ("\^ae\^m" [S-f6]) 130 ("\^aa\^m" [f18])
99 ("\^aF\^m" [f7]) 131 ("\^ab\^m" [f19])
100 ("\^af\^m" [S-f7]) 132 ("\^ac\^m" [f20])
101 ("\^aG\^m" [f8]) 133 ("\^ad\^m" [f21])
102 ("\^ag\^m" [S-f8]) 134 ("\^ae\^m" [f22])
103 ("\^aH\^m" [f9]) 135 ("\^af\^m" [f23])
104 ("\^ah\^m" [S-f9]) 136 ("\^ag\^m" [f24])
105 ("\^aI\^m" [f10]) 137 ("\^ah\^m" [f25])
106 ("\^ai\^m" [S-f10]) 138 ("\^ai\^m" [f26])
107 ("\^aJ\^m" [f11]) 139 ("\^aj\^m" [f27])
108 ("\^aj\^m" [S-f11]) 140 ("\^ak\^m" [f28])
109 ("\^aK\^m" [f12]) 141 ("\^al\^m" [f29])
110 ("\^ak\^m" [S-f12]) 142 ("\^am\^m" [f30])
111 ("\^aL\^m" [f13]) 143 ("\^an\^m" [f31])
112 ("\^al\^m" [S-f13]) 144 ("\^ao\^m" [f32])
113 ("\^aM\^m" [f14]) 145
114 ("\^am\^m" [S-f14]) 146 ;; Terminfo may know about these, but X won't
115 ("\^aN\^m" [f15]) 147 ("\eI" [key-stab]) ;; Not an X keysym
116 ("\^an\^m" [S-f15]) 148 ("\eJ" [key-snext]) ;; Not an X keysym
117 ("\^aO\^m" [f16]) 149 ("\eY" [key-clear]) ;; Not an X keysym
118 ("\^ao\^m" [S-f16]))) 150
119 151 ;; These are totally strange :-)
120 152 ("\eW" [?\C-?]) ;; Not an X keysym
121 ;;; Define some of the function keys. 153 ("\^a\^k\^m" [funct-up]) ;; Not an X keysym
122 (mapcar (function (lambda (key-definition) 154 ("\^a\^j\^m" [funct-down]) ;; Not an X keysym
123 (global-set-key (car key-definition) 155 ("\^a\^l\^m" [funct-right]) ;; Not an X keysym
124 (nth 1 key-definition)))) 156 ("\^a\^h\^m" [funct-left]) ;; Not an X keysym
125 '(([insertline] wyse-50-insert-line) 157 ("\^a\^m\^m" [funct-return]) ;; Not an X keysym
126 ([clear] recenter) 158 ("\^a\^i\^m" [funct-tab]) ;; Not an X keysym
127 ([clear-eol] kill-line) 159 ))
128 ([home] execute-extended-command) 160
129 ([home-down] shell-command) 161 (defun enable-arrow-keys ()
130 ([insert] wyse-50-insert-char) 162 "To be called by term-setup-hook. Overrides 6 Emacs standard keys
131 ([deleteline] wyse-50-delete-line) 163 whose functions are then typed as follows:
132 ([replace] overwrite-mode) 164 C-a Funct Left-arrow
133 ([print] wyse-50-print-buffer) 165 C-h M-?
134 ([funct-up] wyse-50-top-of-window) 166 LFD Funct Return, some modes override down-arrow via LFD
135 ([funct-down] wyse-50-bottom-of-window) 167 C-k CLR Line
136 ([funct-left] beginning-of-line) 168 C-l Scrn CLR
137 ([funct-right] end-of-line) 169 M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar
138 ([f5] shell) 170 "
139 ([f6] dired) 171 (interactive)
140 ([f7] rnews) 172 (mapcar (function (lambda (key-definition)
141 ([f8] rmail) 173 (global-set-key (car key-definition)
142 ([f9] delete-othe-windows) 174 (nth 1 key-definition))))
143 ([f10] other-window) 175 ;; By unsetting C-a and then binding it to a prefix, we
144 ([f11] split-window-vertically) 176 ;; allow the rest of the function keys which start with C-a
145 ([f13] help-for-help) 177 ;; to be recognized.
146 ([f14] wyse-50-toggle-screen-width) 178 '(("\C-a" nil)
147 ([f15] global-set-key) 179 ("\C-k" nil)
148 ("\M-?" help-for-help))) 180 ("\C-j" nil)
181 ("\C-l" nil)
182 ("\C-h" nil)
183 ("\er" nil)))
184 (fset 'enable-arrow-keys nil))
149 185
150 186
151 ;;; Miscellaneous hacks 187 ;;; Miscellaneous hacks
152 188
153 ;;; This is an ugly hack for a nasty problem: 189 ;;; This is an ugly hack for a nasty problem:
162 (setq kill-emacs-hook 198 (setq kill-emacs-hook
163 (function (lambda () (interactive) 199 (function (lambda () (interactive)
164 (send-string-to-terminal 200 (send-string-to-terminal
165 (concat "\ea23R" (1+ (frame-width)) "C\eG0"))))) 201 (concat "\ea23R" (1+ (frame-width)) "C\eG0")))))
166 202
167 (defun enable-arrow-keys () 203 ;;; wyse50.el ends here
168 "To be called by term-setup-hook. Overrides 6 Emacs standard keys
169 whose functions are then typed as follows:
170 C-a Funct Left-arrow
171 C-h M-?
172 LFD Funct Return, some modes override down-arrow via LFD
173 C-k CLR Line
174 C-l Scrn CLR
175 M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar
176 All special keys except Send, Shift Ins, Shift Home and shifted functions keys
177 are assigned some hopefully useful meaning."
178 (interactive)
179 (mapcar (function (lambda (key-definition)
180 (global-set-key (car key-definition)
181 (nth 1 key-definition))))
182 ;; By unsetting C-a and then binding it to a prefix, we
183 ;; allow the rest of the function keys which start with C-a
184 ;; to be recognized.
185 '(("\C-a" nil)
186 ("\C-a\C-a" beginning-of-line)
187 ("\C-k" nil)
188 ("\C-j" nil)
189 ("\C-l" nil)
190 ("\C-h" nil)
191 ("\er" nil)))
192 (fset 'enable-arrow-keys nil))