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