Commit | Line | Data |
---|---|---|
7f94bc9f ER |
1 | ;;; wyse50.el --- terminal support code for Wyse 50 |
2 | ||
8f1204db | 3 | ;; Copyright (C) 1989, 1993, 1994 Free Software Foundation, Inc. |
cbc336a2 | 4 | |
7f94bc9f ER |
5 | ;; Author: Daniel Pfieffer <pfieffer@cix.cict.fr> January 1991 |
6 | ;; Jim Blandy <jimb@occs.cs.oberlin.edu> | |
7 | ;; Keywords: terminals | |
8 | ||
2fe590dc EN |
9 | ;; This file is part of GNU Emacs. |
10 | ||
11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 | ;; it under the terms of the GNU General Public License as published by | |
13 | ;; the Free Software Foundation; either version 2, or (at your option) | |
14 | ;; any later version. | |
15 | ||
16 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;; GNU General Public License for more details. | |
20 | ||
21 | ;; You should have received a copy of the GNU General Public License | |
22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 | ;; Boston, MA 02111-1307, USA. | |
7f94bc9f ER |
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 | |
eb8c3be9 | 30 | ;; Cleaned up for new terminal package conventions by esr, March 1993 |
7f94bc9f ER |
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: | |
c11e5bbd | 39 | |
2447c626 JB |
40 | (define-key function-key-map "\C-a" (make-keymap)) |
41 | (mapcar (function (lambda (key-definition) | |
42 | (define-key function-key-map | |
43 | (car key-definition) (nth 1 key-definition)))) | |
7f94bc9f ER |
44 | '( |
45 | ;; These might be set up by termcap and terminfo | |
46 | ("\C-k" [up]) | |
47 | ("\C-j" [down]) | |
48 | ("\C-l" [right]) | |
49 | ("\C-h" [left]) | |
50 | ("\^a@\^m" [f1]) | |
51 | ("\^aA\^m" [f2]) | |
52 | ("\^aB\^m" [f3]) | |
53 | ("\^aC\^m" [f4]) | |
54 | ("\^aD\^m" [f5]) | |
55 | ("\^aE\^m" [f6]) | |
56 | ("\^aF\^m" [f7]) | |
57 | ("\^aG\^m" [f8]) | |
58 | ("\^aH\^m" [f9]) | |
2447c626 | 59 | |
7f94bc9f ER |
60 | ;; These might be set up by terminfo |
61 | ("\eK" [next]) | |
62 | ("\eT" [clearline]) | |
63 | ("\^^" [home]) | |
64 | ("\e\^^" [end]) | |
65 | ("\eQ" [insert]) | |
66 | ("\eE" [insertline]) | |
67 | ("\eR" [deleteline]) | |
68 | ("\eP" [print]) | |
69 | ("\er" [replace]) | |
70 | ("\^aI\^m" [f10]) | |
71 | ("\^aJ\^m" [f11]) | |
72 | ("\^aK\^m" [f12]) | |
73 | ("\^aL\^m" [f13]) | |
74 | ("\^aM\^m" [f14]) | |
75 | ("\^aN\^m" [f15]) | |
76 | ("\^aO\^m" [f16]) | |
77 | ("\^a`\^m" [f17]) | |
78 | ("\^aa\^m" [f18]) | |
79 | ("\^ab\^m" [f19]) | |
80 | ("\^ac\^m" [f20]) | |
81 | ("\^ad\^m" [f21]) | |
82 | ("\^ae\^m" [f22]) | |
83 | ("\^af\^m" [f23]) | |
84 | ("\^ag\^m" [f24]) | |
85 | ("\^ah\^m" [f25]) | |
86 | ("\^ai\^m" [f26]) | |
87 | ("\^aj\^m" [f27]) | |
88 | ("\^ak\^m" [f28]) | |
89 | ("\^al\^m" [f29]) | |
90 | ("\^am\^m" [f30]) | |
91 | ("\^an\^m" [f31]) | |
92 | ("\^ao\^m" [f32]) | |
2447c626 | 93 | |
7f94bc9f ER |
94 | ;; Terminfo may know about these, but X won't |
95 | ("\eI" [key-stab]) ;; Not an X keysym | |
96 | ("\eJ" [key-snext]) ;; Not an X keysym | |
97 | ("\eY" [key-clear]) ;; Not an X keysym | |
2447c626 | 98 | |
7f94bc9f ER |
99 | ;; These are totally strange :-) |
100 | ("\eW" [?\C-?]) ;; Not an X keysym | |
101 | ("\^a\^k\^m" [funct-up]) ;; Not an X keysym | |
102 | ("\^a\^j\^m" [funct-down]) ;; Not an X keysym | |
103 | ("\^a\^l\^m" [funct-right]) ;; Not an X keysym | |
104 | ("\^a\^h\^m" [funct-left]) ;; Not an X keysym | |
105 | ("\^a\^m\^m" [funct-return]) ;; Not an X keysym | |
106 | ("\^a\^i\^m" [funct-tab]) ;; Not an X keysym | |
107 | )) | |
38a04374 | 108 | |
38a04374 JB |
109 | (defun enable-arrow-keys () |
110 | "To be called by term-setup-hook. Overrides 6 Emacs standard keys | |
111 | whose functions are then typed as follows: | |
2447c626 | 112 | C-a Funct Left-arrow |
38a04374 JB |
113 | C-h M-? |
114 | LFD Funct Return, some modes override down-arrow via LFD | |
115 | C-k CLR Line | |
2447c626 | 116 | C-l Scrn CLR |
38a04374 | 117 | M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar |
7f94bc9f | 118 | " |
38a04374 | 119 | (interactive) |
2447c626 JB |
120 | (mapcar (function (lambda (key-definition) |
121 | (global-set-key (car key-definition) | |
122 | (nth 1 key-definition)))) | |
123 | ;; By unsetting C-a and then binding it to a prefix, we | |
124 | ;; allow the rest of the function keys which start with C-a | |
125 | ;; to be recognized. | |
126 | '(("\C-a" nil) | |
2447c626 JB |
127 | ("\C-k" nil) |
128 | ("\C-j" nil) | |
129 | ("\C-l" nil) | |
130 | ("\C-h" nil) | |
131 | ("\er" nil))) | |
132 | (fset 'enable-arrow-keys nil)) | |
7f94bc9f ER |
133 | |
134 | \f | |
135 | ;;; Miscellaneous hacks | |
136 | ||
137 | ;;; This is an ugly hack for a nasty problem: | |
138 | ;;; Wyse 50 takes one character cell to store video attributes (which seems to | |
139 | ;;; explain width 79 rather than 80, column 1 is not used!!!). | |
140 | ;;; On killing (C-x C-c) the end inverse code (on column 1 of line 24) | |
141 | ;;; of the mode line is overwritten AFTER all the y-or-n questions. | |
142 | ;;; This causes the attribute to remain in effect until the mode line has | |
143 | ;;; scrolled of the screen. Suspending (C-z) does not cause this problem. | |
144 | ;;; On such terminals, Emacs should sacrifice the first and last character of | |
145 | ;;; each mode line, rather than a whole screen column! | |
67ec7a68 RS |
146 | (add-hook 'kill-emacs-hook |
147 | (function (lambda () (interactive) | |
148 | (send-string-to-terminal | |
149 | (concat "\ea23R" (1+ (frame-width)) "C\eG0"))))) | |
7f94bc9f ER |
150 | |
151 | ;;; wyse50.el ends here |