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