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