502
|
1 ;;;; Terminal mode for Wyse 50
|
|
2 ;;;; Should work well for Televideo TVI 925 although it's overkill
|
|
3 ;;;; Author Daniel Pfieffer (pfieffer@cix.cict.fr) January 1991
|
|
4 ;;;; Rewritten for Emacs 19 by Jim Blandy (jimb@occs.cs.oberlin.edu)
|
|
5 ;;;; January 1992
|
166
|
6
|
502
|
7
|
|
8 ;;; Functions especially for this terminal.
|
166
|
9
|
502
|
10 (defun wyse-50-insert-line ()
|
|
11 "Insert an empty line."
|
|
12 (interactive)
|
|
13 (beginning-of-line)
|
|
14 (open-line 1))
|
166
|
15
|
502
|
16 (defun wyse-50-delete-line ()
|
|
17 "Delete all of the current line."
|
|
18 (interactive)
|
|
19 (beginning-of-line)
|
|
20 (kill-line 1))
|
166
|
21
|
502
|
22 (defun wyse-50-insert-char ()
|
|
23 "Insert a space, even in overwrite mode."
|
|
24 (interactive)
|
|
25 (insert ? ))
|
166
|
26
|
502
|
27 (defun wyse-50-print-buffer ()
|
|
28 "Like ``print-buffer'', but verifies before printing.
|
|
29 The `print' key is easy to hit on a Wyse 50."
|
166
|
30 (interactive)
|
502
|
31 (if (y-or-n-p
|
|
32 (concat "Print buffer "
|
|
33 (buffer-name) "? "))
|
|
34 (print-buffer)))
|
166
|
35
|
502
|
36 (defun wyse-50-top-of-window (n)
|
|
37 "Move point to the top line of the current window.
|
|
38 With an argument N, move to the Nth line of the window."
|
|
39 (interactive "p")
|
|
40 (move-to-window-line (1- n)))
|
166
|
41
|
502
|
42 (defun wyse-50-bottom-of-window (n)
|
|
43 "Move point to the last line of the current window.
|
|
44 With an argument N, move to the Nth line from the bottom of the window."
|
|
45 (interactive "p")
|
|
46 (move-to-window-line (- n)))
|
166
|
47
|
502
|
48 (defun wyse-50-toggle-screen-width ()
|
166
|
49 "Alternate between 80 and 132 columns."
|
|
50 (interactive)
|
779
|
51 (if (<= (frame-width) 80)
|
166
|
52 (progn
|
|
53 (send-string-to-terminal "\e`;")
|
779
|
54 (set-frame-width 131))
|
166
|
55 (send-string-to-terminal "\e`:")
|
779
|
56 (set-frame-width 79)))
|
166
|
57
|
502
|
58
|
|
59 ;;; Define the escape sequences for the function keys.
|
|
60 (define-key function-key-map "\C-a" (make-keymap))
|
|
61 (mapcar (function (lambda (key-definition)
|
|
62 (define-key function-key-map
|
|
63 (car key-definition) (nth 1 key-definition))))
|
|
64 '(("\eI" [S-tab])
|
|
65 ("\eJ" [S-prior])
|
|
66 ("\eK" [next])
|
|
67 ("\eY" [clear])
|
|
68 ("\eT" [clear-eol])
|
|
69 ("\^^" [home])
|
|
70 ("\e\^^" [home-down])
|
|
71 ("\eQ" [insert])
|
|
72 ("\eE" [insertline])
|
|
73 ("\eW" [?\C-?])
|
|
74 ("\eR" [deleteline])
|
|
75 ("\eP" [print])
|
|
76 ("\C-k" [up])
|
|
77 ("\C-j" [down])
|
|
78 ("\C-l" [right])
|
|
79 ("\C-h" [left])
|
|
80 ("\C-a\C-k\C-m" [funct-up])
|
|
81 ("\C-a\C-j\C-m" [funct-down])
|
|
82 ("\C-a\C-l\C-m" [funct-right])
|
|
83 ("\C-a\C-h\C-m" [funct-left])
|
|
84 ("\er" [replace])
|
|
85 ("\^a\^m\^m" [funct-return])
|
|
86 ("\^a\^i\^m" [funct-tab])
|
|
87 ("\^a@\^m" [f1])
|
|
88 ("\^a`\^m" [S-f1])
|
|
89 ("\^aA\^m" [f2])
|
|
90 ("\^aa\^m" [S-f2])
|
|
91 ("\^aB\^m" [f3])
|
|
92 ("\^ab\^m" [S-f3])
|
|
93 ("\^aC\^m" [f4])
|
|
94 ("\^ac\^m" [S-f4])
|
|
95 ("\^aD\^m" [f5])
|
|
96 ("\^ad\^m" [S-f5])
|
|
97 ("\^aE\^m" [f6])
|
|
98 ("\^ae\^m" [S-f6])
|
|
99 ("\^aF\^m" [f7])
|
|
100 ("\^af\^m" [S-f7])
|
|
101 ("\^aG\^m" [f8])
|
|
102 ("\^ag\^m" [S-f8])
|
|
103 ("\^aH\^m" [f9])
|
|
104 ("\^ah\^m" [S-f9])
|
|
105 ("\^aI\^m" [f10])
|
|
106 ("\^ai\^m" [S-f10])
|
|
107 ("\^aJ\^m" [f11])
|
|
108 ("\^aj\^m" [S-f11])
|
|
109 ("\^aK\^m" [f12])
|
|
110 ("\^ak\^m" [S-f12])
|
|
111 ("\^aL\^m" [f13])
|
|
112 ("\^al\^m" [S-f13])
|
|
113 ("\^aM\^m" [f14])
|
|
114 ("\^am\^m" [S-f14])
|
|
115 ("\^aN\^m" [f15])
|
|
116 ("\^an\^m" [S-f15])
|
|
117 ("\^aO\^m" [f16])
|
|
118 ("\^ao\^m" [S-f16])))
|
166
|
119
|
502
|
120
|
|
121 ;;; Define some of the function keys.
|
|
122 (mapcar (function (lambda (key-definition)
|
|
123 (global-set-key (car key-definition)
|
|
124 (nth 1 key-definition))))
|
|
125 '(([insertline] wyse-50-insert-line)
|
|
126 ([clear] recenter)
|
|
127 ([clear-eol] kill-line)
|
|
128 ([home] execute-extended-command)
|
|
129 ([home-down] shell-command)
|
|
130 ([insert] wyse-50-insert-char)
|
|
131 ([deleteline] wyse-50-delete-line)
|
|
132 ([replace] overwrite-mode)
|
|
133 ([print] wyse-50-print-buffer)
|
|
134 ([funct-up] wyse-50-top-of-window)
|
|
135 ([funct-down] wyse-50-bottom-of-window)
|
|
136 ([funct-left] beginning-of-line)
|
|
137 ([funct-right] end-of-line)
|
|
138 ([f5] shell)
|
|
139 ([f6] dired)
|
|
140 ([f7] rnews)
|
|
141 ([f8] rmail)
|
|
142 ([f9] delete-othe-windows)
|
|
143 ([f10] other-window)
|
|
144 ([f11] split-window-vertically)
|
|
145 ([f13] help-for-help)
|
|
146 ([f14] wyse-50-toggle-screen-width)
|
|
147 ([f15] global-set-key)
|
|
148 ("\M-?" help-for-help)))
|
|
149
|
|
150
|
|
151 ;;; Miscellaneous hacks
|
166
|
152
|
502
|
153 ;;; This is an ugly hack for a nasty problem:
|
|
154 ;;; Wyse 50 takes one character cell to store video attributes (which seems to
|
|
155 ;;; explain width 79 rather than 80, column 1 is not used!!!).
|
|
156 ;;; On killing (C-x C-c) the end inverse code (on column 1 of line 24)
|
|
157 ;;; of the mode line is overwritten AFTER all the y-or-n questions.
|
|
158 ;;; This causes the attribute to remain in effect until the mode line has
|
|
159 ;;; scrolled of the screen. Suspending (C-z) does not cause this problem.
|
|
160 ;;; On such terminals, Emacs should sacrifice the first and last character of
|
|
161 ;;; each mode line, rather than a whole screen column!
|
|
162 (setq kill-emacs-hook
|
|
163 (function (lambda () (interactive)
|
|
164 (send-string-to-terminal
|
779
|
165 (concat "\ea23R" (1+ (frame-width)) "C\eG0")))))
|
166
|
166
|
502
|
167 (defun enable-arrow-keys ()
|
|
168 "To be called by term-setup-hook. Overrides 6 Emacs standard keys
|
|
169 whose functions are then typed as follows:
|
|
170 C-a Funct Left-arrow
|
|
171 C-h M-?
|
|
172 LFD Funct Return, some modes override down-arrow via LFD
|
|
173 C-k CLR Line
|
|
174 C-l Scrn CLR
|
|
175 M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar
|
|
176 All special keys except Send, Shift Ins, Shift Home and shifted functions keys
|
|
177 are assigned some hopefully useful meaning."
|
|
178 (interactive)
|
|
179 (mapcar (function (lambda (key-definition)
|
|
180 (global-set-key (car key-definition)
|
|
181 (nth 1 key-definition))))
|
|
182 ;; By unsetting C-a and then binding it to a prefix, we
|
|
183 ;; allow the rest of the function keys which start with C-a
|
|
184 ;; to be recognized.
|
|
185 '(("\C-a" nil)
|
|
186 ("\C-a\C-a" beginning-of-line)
|
|
187 ("\C-k" nil)
|
|
188 ("\C-j" nil)
|
|
189 ("\C-l" nil)
|
|
190 ("\C-h" nil)
|
|
191 ("\er" nil)))
|
|
192 (fset 'enable-arrow-keys nil))
|