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