Commit | Line | Data |
---|---|---|
e8af40ee | 1 | ;;; edt-mapper.el --- create an EDT LK-201 map file for X-Windows Emacs |
c0e42a4d | 2 | |
ba318903 | 3 | ;; Copyright (C) 1994-1995, 2000-2014 Free Software Foundation, Inc. |
c0e42a4d | 4 | |
6687ffc7 EZ |
5 | ;; Author: Kevin Gallagher <Kevin.Gallagher@boeing.com> |
6 | ;; Maintainer: Kevin Gallagher <Kevin.Gallagher@boeing.com> | |
c0e42a4d | 7 | ;; Keywords: emulations |
bd78fa1d | 8 | ;; Package: edt |
c0e42a4d | 9 | |
e9f722ee | 10 | ;; This file is part of GNU Emacs. |
c0e42a4d | 11 | |
ed0f493f | 12 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
c0e42a4d | 13 | ;; it under the terms of the GNU General Public License as published by |
ed0f493f GM |
14 | ;; the Free Software Foundation, either version 3 of the License, or |
15 | ;; (at your option) any later version. | |
c0e42a4d KH |
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 | |
ed0f493f | 23 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
c0e42a4d KH |
24 | |
25 | ;;; Commentary: | |
90b6fe58 | 26 | ;; |
c0e42a4d | 27 | |
90b6fe58 | 28 | ;; [Part of the GNU Emacs EDT Emulation.] |
c0e42a4d | 29 | |
90b6fe58 GM |
30 | ;; This emacs lisp program can be used to create an emacs lisp file |
31 | ;; that defines the mapping of the user's keyboard to the LK-201 | |
32 | ;; keyboard function keys and keypad keys (around which EDT has been | |
33 | ;; designed). Please read the "Usage" AND "Known Problems" sections | |
34 | ;; below before attempting to run this program. (The design of this | |
35 | ;; file, edt-mapper.el, was heavily influenced by tpu-mapper.el.) | |
36 | ||
37 | ;; Version 4.0 contains the following enhancements: | |
38 | ||
39 | ;; 1. If you access a workstation using an X Server, note that the | |
40 | ;; initialization file generated by edt-mapper.el will now | |
41 | ;; contain the name of the X Server vendor. This is a | |
42 | ;; convenience for those who have access to their Unix account | |
43 | ;; from more than one type of X Server. Since different X | |
44 | ;; Servers typically require different EDT emulation | |
45 | ;; initialization files, edt-mapper.el will now generate these | |
46 | ;; different initialization files and save them with different | |
47 | ;; names. | |
48 | ||
49 | ;; 2. Also, edt-mapper.el is now capable of binding an ASCII key | |
50 | ;; sequence, providing the ASCII key sequence prefix is already | |
51 | ;; known by Emacs to be a prefix. As a result, some | |
52 | ;; terminal/keyboard/window system configurations, which don't | |
53 | ;; have a complete set of sensible function key map bindings, can | |
54 | ;; still be configured for EDT Emulation. | |
55 | ||
56 | ||
57 | ;; Usage: | |
58 | ||
59 | ;; Simply load this file into emacs (version 19 or higher) | |
c0e42a4d KH |
60 | ;; using the following command. |
61 | ||
62 | ;; emacs -q -l edt-mapper.el | |
63 | ||
865fe16f | 64 | ;; The "-q" option prevents loading of your init file (commands |
90b6fe58 | 65 | ;; therein might confuse this program). |
c0e42a4d | 66 | |
90b6fe58 GM |
67 | ;; An instruction screen showing the typical LK-201 terminal |
68 | ;; functions keys will be displayed, and you will be prompted to | |
69 | ;; press the keys on your keyboard which you want to emulate the | |
70 | ;; corresponding LK-201 keys. | |
c0e42a4d KH |
71 | |
72 | ;; Finally, you will be prompted for the name of the file to store | |
73 | ;; the key definitions. If you chose the default, it will be found | |
74 | ;; and loaded automatically when the EDT emulation is started. If | |
75 | ;; you specify a different file name, you will need to set the | |
90b6fe58 | 76 | ;; variable "edt-keys-file" before starting the EDT emulation. |
865fe16f | 77 | ;; Here's how you might go about doing that in your init file: |
c0e42a4d | 78 | |
90b6fe58 GM |
79 | ;; (setq edt-keys-file (expand-file-name "~/.my-emacs-keys")) |
80 | ||
81 | ||
82 | ;; Known Problems: | |
83 | ||
84 | ;; Sometimes, edt-mapper will ignore a key you press, and just | |
85 | ;; continue to prompt for the same key. This can happen when your | |
86 | ;; window manager sucks up the key and doesn't pass it on to emacs, | |
87 | ;; or it could be an emacs bug. Either way, there's nothing that | |
88 | ;; edt-mapper can do about it. You must press RETURN, to skip the | |
89 | ;; current key and continue. Later, you and/or your local Emacs guru | |
90 | ;; can try to figure out why the key is being ignored. | |
c0e42a4d | 91 | |
90b6fe58 | 92 | ;;; History: |
79ef886b | 93 | ;; |
c0e42a4d | 94 | |
90b6fe58 | 95 | ;; Version 4.0 2000 Added 2 New Features |
c0e42a4d | 96 | |
90b6fe58 | 97 | ;;; Code: |
c0e42a4d | 98 | |
0da7ad96 GM |
99 | ;; Otherwise it just hangs. This seems preferable. |
100 | (if noninteractive | |
101 | (error "edt-mapper cannot be loaded in batch mode")) | |
102 | ||
c0e42a4d | 103 | ;;; |
90b6fe58 GM |
104 | ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). |
105 | ;;; Determine Window System, and X Server Vendor (if appropriate). | |
c0e42a4d | 106 | ;;; |
f8246027 | 107 | (defconst edt-window-system (if (featurep 'xemacs) (console-type) window-system) |
90b6fe58 GM |
108 | "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).") |
109 | ||
a2697346 GM |
110 | (declare-function x-server-vendor "xfns.c" (&optional terminal)) |
111 | ||
112 | (defconst edt-xserver (when (eq edt-window-system 'x) | |
113 | ;; The Cygwin window manager has a `/' in its | |
114 | ;; name, which breaks the generated file name of | |
115 | ;; the custom key map file. Replace `/' with a | |
116 | ;; `-' to work around that. | |
117 | (if (featurep 'xemacs) | |
118 | (replace-in-string (x-server-vendor) "[ /]" "-") | |
119 | (replace-regexp-in-string "[ /]" "-" | |
120 | (x-server-vendor)))) | |
90b6fe58 | 121 | "Indicates X server vendor name, if applicable.") |
c0e42a4d KH |
122 | |
123 | ||
124 | ;;; | |
125 | ;;; Key variables | |
126 | ;;; | |
127 | (defvar edt-key nil) | |
128 | (defvar edt-enter nil) | |
129 | (defvar edt-return nil) | |
130 | (defvar edt-key-seq nil) | |
131 | (defvar edt-enter-seq nil) | |
132 | (defvar edt-return-seq nil) | |
90b6fe58 | 133 | (defvar edt-term nil) |
c0e42a4d | 134 | |
1324d580 | 135 | ;; To silence the byte-compiler |
afe5ac58 GM |
136 | (defvar EDT-key-name) |
137 | (defvar edt-save-function-key-map) | |
1324d580 | 138 | |
79ef886b | 139 | ;;; |
90b6fe58 | 140 | ;;; Determine Terminal Type (if appropriate). |
c0e42a4d | 141 | ;;; |
90b6fe58 GM |
142 | |
143 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | |
144 | (setq edt-term nil) | |
145 | (setq edt-term (getenv "TERM"))) | |
146 | ||
c8cbbe27 KG |
147 | ;;; |
148 | ;;; Implements a workaround for a feature that was added to simple.el. | |
149 | ;;; | |
150 | ;;; Many function keys have no Emacs functions assigned to them by | |
151 | ;;; default. A subset of these are typically assigned functions in the | |
152 | ;;; EDT emulation. This includes all the keypad keys and a some others | |
153 | ;;; like Delete. | |
154 | ;;; | |
155 | ;;; Logic in simple.el maps some of these unassigned function keys to | |
156 | ;;; ordinary typing keys. Where this is the case, a call to | |
157 | ;;; read-key-sequence, below, does not return the name of the function | |
e1dbe924 | 158 | ;;; key pressed by the user but, instead, it returns the name of the |
c8cbbe27 KG |
159 | ;;; key to which it has been mapped. It needs to know the name of the |
160 | ;;; key pressed by the user. As a workaround, we assign a function to | |
161 | ;;; each of the unassigned function keys of interest, here. These | |
162 | ;;; assignments override the mapping to other keys and are only | |
163 | ;;; temporary since, when edt-mapper is finished executing, it causes | |
164 | ;;; Emacs to exit. | |
165 | ;;; | |
166 | ||
167 | (mapc | |
168 | (lambda (function-key) | |
ac8055b3 CY |
169 | (if (not (lookup-key (current-global-map) function-key)) |
170 | (define-key (current-global-map) function-key 'forward-char))) | |
c8cbbe27 KG |
171 | '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4] |
172 | [kp-5] [kp-6] [kp-7] [kp-8] [kp-9] | |
ac8055b3 CY |
173 | [kp-space] |
174 | [kp-tab] | |
c8cbbe27 KG |
175 | [kp-enter] |
176 | [kp-multiply] | |
177 | [kp-add] | |
178 | [kp-separator] | |
179 | [kp-subtract] | |
180 | [kp-decimal] | |
181 | [kp-divide] | |
182 | [kp-equal] | |
183 | [backspace] | |
184 | [delete] | |
185 | [tab] | |
186 | [linefeed] | |
187 | [clear])) | |
188 | ||
c0e42a4d | 189 | ;;; |
90b6fe58 GM |
190 | ;;; Make sure the window is big enough to display the instructions, |
191 | ;;; except where window cannot be re-sized. | |
79ef886b | 192 | ;;; |
c0e42a4d | 193 | |
90b6fe58 GM |
194 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
195 | (set-frame-size (selected-frame) 80 36)) | |
c0e42a4d KH |
196 | |
197 | ;;; | |
198 | ;;; Create buffers - Directions and Keys | |
199 | ;;; | |
200 | (if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) | |
201 | (if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) | |
202 | ||
203 | ;;; | |
204 | ;;; Put header in the Keys buffer | |
205 | ;;; | |
206 | (set-buffer "Keys") | |
207 | (insert "\ | |
208 | ;; | |
209 | ;; Key definitions for the EDT emulation within GNU Emacs | |
210 | ;; | |
211 | ||
212 | (defconst *EDT-keys* | |
213 | '( | |
214 | ") | |
215 | ||
216 | ;;; | |
217 | ;;; Display directions | |
218 | ;;; | |
219 | (switch-to-buffer "Directions") | |
90b6fe58 GM |
220 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
221 | (insert " | |
c0e42a4d KH |
222 | EDT MAPPER |
223 | ||
90b6fe58 GM |
224 | You will be asked to press keys to create a custom mapping (under a |
225 | Window Manager) of your keypad keys and function keys so that they can | |
226 | emulate the LK-201 keypad and function keys or the subset of keys found | |
227 | on a VT-100 series terminal keyboard. (The LK-201 keyboard is the | |
228 | standard keyboard attached to VT-200 series terminals, and above.) | |
c0e42a4d KH |
229 | |
230 | Sometimes, edt-mapper will ignore a key you press, and just continue to | |
231 | prompt for the same key. This can happen when your window manager sucks | |
a3c473b2 | 232 | up the key and doesn't pass it on to Emacs, or it could be an Emacs bug. |
c0e42a4d KH |
233 | Either way, there's nothing that edt-mapper can do about it. You must |
234 | press RETURN, to skip the current key and continue. Later, you and/or | |
90b6fe58 | 235 | your local system guru can try to figure out why the key is being ignored. |
c0e42a4d KH |
236 | |
237 | Start by pressing the RETURN key, and continue by pressing the keys | |
90b6fe58 GM |
238 | specified in the mini-buffer. If you want to entirely omit a key, |
239 | because your keyboard does not have a corresponding key, for example, | |
c0e42a4d KH |
240 | just press RETURN at the prompt. |
241 | ||
242 | ") | |
90b6fe58 GM |
243 | (insert " |
244 | EDT MAPPER | |
245 | ||
246 | You will be asked to press keys to create a custom mapping of your | |
247 | keypad keys and function keys so that they can emulate the LK-201 | |
248 | keypad and function keys or the subset of keys found on a VT-100 | |
249 | series terminal keyboard. (The LK-201 keyboard is the standard | |
250 | keyboard attached to VT-200 series terminals, and above.) | |
251 | ||
79ef886b | 252 | If you are using a real LK-201 keyboard, you should map the keys |
90b6fe58 GM |
253 | exactly as they are on the keyboard. |
254 | ||
255 | Start by pressing the RETURN key, and continue by pressing the keys | |
256 | specified in the mini-buffer. If you want to entirely omit a key, | |
257 | because your keyboard does not have a corresponding key, for example, | |
258 | just press RETURN at the prompt. | |
259 | ||
260 | ")) | |
261 | ||
c0e42a4d KH |
262 | (delete-other-windows) |
263 | ||
264 | ;;; | |
90b6fe58 | 265 | ;;; Save <CR> for future reference. |
c0e42a4d | 266 | ;;; |
90b6fe58 GM |
267 | ;;; For GNU Emacs, running in a Window System, first hide bindings in |
268 | ;;; function-key-map. | |
79ef886b | 269 | ;;; |
c0e42a4d | 270 | (cond |
f8246027 | 271 | ((featurep 'xemacs) |
c0e42a4d KH |
272 | (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) |
273 | (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) | |
274 | (t | |
90b6fe58 GM |
275 | (if edt-window-system |
276 | (progn | |
277 | (setq edt-save-function-key-map function-key-map) | |
278 | (setq function-key-map (make-sparse-keymap)))) | |
279 | (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")))) | |
c0e42a4d | 280 | |
90b6fe58 GM |
281 | ;;; |
282 | ;;; Remove prefix-key bindings to F1 and F2 in global-map so they can be | |
283 | ;;; bound in the EDT Emulation mode. | |
284 | ;;; | |
285 | (global-unset-key [f1]) | |
286 | (global-unset-key [f2]) | |
79ef886b | 287 | |
c0e42a4d KH |
288 | ;;; |
289 | ;;; Display Keypad Diagram and Begin Prompting for Keys | |
290 | ;;; | |
291 | (set-buffer "Directions") | |
292 | (delete-region (point-min) (point-max)) | |
90b6fe58 GM |
293 | (if (and edt-window-system (not (eq edt-window-system 'tty))) |
294 | (insert " | |
c0e42a4d KH |
295 | |
296 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. | |
297 | ||
c0e42a4d KH |
298 | Here's a picture of the standard LK-201 keypad for reference: |
299 | ||
c91c771d PE |
300 | ________________________ _______________________________ |
301 | | HELP | DO | | F17 | F18 | F19 | F20 | | |
302 | | | | | | | | | | |
303 | |_______|________________| |_______|_______|_______|_______| | |
304 | ________________________ _______________________________ | |
305 | | FIND |INSERT |REMOVE | | PF1 | PF2 | PF3 | PF4 | | |
306 | | | | | | | | | | | |
307 | |_______|________|_______| |_______|_______|_______|_______| | |
308 | |SELECT |PREVIOUS|NEXT | | KP7 | KP8 | KP9 | KP- | | |
309 | | | | | | | | | | | |
310 | |_______|________|_______| |_______|_______|_______|_______| | |
311 | | UP | | KP4 | KP5 | KP6 | KP, | | |
312 | | | | | | | | | |
313 | _______|________|_______ |_______|_______|_______|_______| | |
314 | | LEFT | DOWN | RIGHT | | KP1 | KP2 | KP3 | | | |
315 | | | | | | | | | | | |
316 | |_______|________|_______| |_______|_______|_______| KPE | | |
317 | | KP0 | KPP | | | |
318 | | | | | | |
319 | |_______________|_______|_______| | |
c0e42a4d | 320 | |
90b6fe58 GM |
321 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY. |
322 | ||
c0e42a4d | 323 | ") |
90b6fe58 GM |
324 | (progn |
325 | (insert " | |
326 | GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE: ") | |
327 | (insert (format "%s." edt-term)) | |
328 | (insert " | |
329 | ||
330 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. | |
331 | ||
c91c771d PE |
332 | ________________________ _______________________________ |
333 | | HELP | DO | | F17 | F18 | F19 | F20 | | |
334 | |_______|________________| |_______|_______|_______|_______| | |
335 | ________________________ _______________________________ | |
336 | | FIND |INSERT |REMOVE | | PF1 | PF2 | PF3 | PF4 | | |
337 | |_______|________|_______| |_______|_______|_______|_______| | |
338 | |SELECT |PREVIOUS| NEXT | | KP7 | KP8 | KP9 | KP- | | |
339 | |_______|________|_______| |_______|_______|_______|_______| | |
340 | | UP | | KP4 | KP5 | KP6 | KP, | | |
341 | _______|________|_______ |_______|_______|_______|_______| | |
342 | | LEFT | DOWN | RIGHT | | KP1 | KP2 | KP3 | | | |
343 | |_______|________|_______| |_______|_______|_______| KPE | | |
344 | | KP0 | KPP | | | |
345 | |_______________|_______|_______| | |
90b6fe58 GM |
346 | |
347 | REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY."))) | |
348 | ||
c0e42a4d KH |
349 | |
350 | ;;; | |
351 | ;;; Key mapping functions | |
352 | ;;; | |
f8246027 | 353 | (defun edt-map-key (ident descrip) |
c0e42a4d | 354 | (interactive) |
f8246027 | 355 | (if (featurep 'xemacs) |
c91c771d | 356 | (progn |
f8246027 DN |
357 | (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) |
358 | (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) | |
359 | (cond ((not (equal edt-key edt-return)) | |
360 | (set-buffer "Keys") | |
361 | (insert (format " (\"%s\" . %s)\n" ident edt-key)) | |
362 | (set-buffer "Directions")) | |
363 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | |
364 | ;; check periodically to see if this is still needed... | |
365 | (t | |
366 | (set-buffer "Keys") | |
367 | (insert (format " (\"%s\" . \"\" )\n" ident)) | |
368 | (set-buffer "Directions")))) | |
369 | (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | |
370 | (cond ((not (equal edt-key edt-return)) | |
371 | (set-buffer "Keys") | |
372 | (insert (if (vectorp edt-key) | |
373 | (format " (\"%s\" . %s)\n" ident edt-key) | |
374 | (format " (\"%s\" . \"%s\")\n" ident edt-key))) | |
375 | (set-buffer "Directions")) | |
376 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | |
377 | ;; check periodically to see if this is still needed... | |
378 | (t | |
379 | (set-buffer "Keys") | |
380 | (insert (format " (\"%s\" . \"\" )\n" ident)) | |
381 | (set-buffer "Directions")))) | |
c0e42a4d KH |
382 | edt-key) |
383 | ||
c0e42a4d KH |
384 | (set-buffer "Keys") |
385 | (insert " | |
386 | ;; | |
387 | ;; Arrows | |
388 | ;; | |
389 | ") | |
390 | (set-buffer "Directions") | |
391 | ||
392 | (edt-map-key "UP" " - The Up Arrow Key") | |
393 | (edt-map-key "DOWN" " - The Down Arrow Key") | |
394 | (edt-map-key "LEFT" " - The Left Arrow Key") | |
395 | (edt-map-key "RIGHT" " - The Right Arrow Key") | |
396 | ||
397 | ||
398 | (set-buffer "Keys") | |
399 | (insert " | |
400 | ;; | |
401 | ;; PF keys | |
402 | ;; | |
403 | ") | |
404 | (set-buffer "Directions") | |
405 | ||
406 | (edt-map-key "PF1" " - The PF1 (GOLD) Key") | |
407 | (edt-map-key "PF2" " - The Keypad PF2 Key") | |
408 | (edt-map-key "PF3" " - The Keypad PF3 Key") | |
409 | (edt-map-key "PF4" " - The Keypad PF4 Key") | |
410 | ||
411 | (set-buffer "Keys") | |
412 | (insert " | |
413 | ;; | |
414 | ;; KP0-9 KP- KP, KPP and KPE | |
415 | ;; | |
416 | ") | |
417 | (set-buffer "Directions") | |
418 | ||
419 | (edt-map-key "KP0" " - The Keypad 0 Key") | |
420 | (edt-map-key "KP1" " - The Keypad 1 Key") | |
421 | (edt-map-key "KP2" " - The Keypad 2 Key") | |
422 | (edt-map-key "KP3" " - The Keypad 3 Key") | |
423 | (edt-map-key "KP4" " - The Keypad 4 Key") | |
424 | (edt-map-key "KP5" " - The Keypad 5 Key") | |
425 | (edt-map-key "KP6" " - The Keypad 6 Key") | |
426 | (edt-map-key "KP7" " - The Keypad 7 Key") | |
427 | (edt-map-key "KP8" " - The Keypad 8 Key") | |
428 | (edt-map-key "KP9" " - The Keypad 9 Key") | |
429 | (edt-map-key "KP-" " - The Keypad - Key") | |
430 | (edt-map-key "KP," " - The Keypad , Key") | |
431 | (edt-map-key "KPP" " - The Keypad . Key") | |
432 | (edt-map-key "KPE" " - The Keypad Enter Key") | |
433 | ;; Save the enter key | |
434 | (setq edt-enter edt-key) | |
435 | (setq edt-enter-seq edt-key-seq) | |
436 | ||
437 | ||
438 | (set-buffer "Keys") | |
439 | (insert " | |
440 | ;; | |
441 | ;; Editing keypad (FIND, INSERT, REMOVE) | |
442 | ;; (SELECT, PREVIOUS, NEXT) | |
443 | ;; | |
444 | ") | |
445 | (set-buffer "Directions") | |
446 | ||
447 | (edt-map-key "FIND" " - The Find key on the editing keypad") | |
448 | (edt-map-key "INSERT" " - The Insert key on the editing keypad") | |
449 | (edt-map-key "REMOVE" " - The Remove key on the editing keypad") | |
450 | (edt-map-key "SELECT" " - The Select key on the editing keypad") | |
451 | (edt-map-key "PREVIOUS" " - The Prev Scr key on the editing keypad") | |
452 | (edt-map-key "NEXT" " - The Next Scr key on the editing keypad") | |
453 | ||
454 | (set-buffer "Keys") | |
455 | (insert " | |
456 | ;; | |
457 | ;; F1-14 Help Do F17-F20 | |
458 | ;; | |
459 | ") | |
460 | (set-buffer "Directions") | |
461 | ||
462 | (edt-map-key "F1" " - F1 Function Key") | |
463 | (edt-map-key "F2" " - F2 Function Key") | |
464 | (edt-map-key "F3" " - F3 Function Key") | |
465 | (edt-map-key "F4" " - F4 Function Key") | |
466 | (edt-map-key "F5" " - F5 Function Key") | |
467 | (edt-map-key "F6" " - F6 Function Key") | |
468 | (edt-map-key "F7" " - F7 Function Key") | |
469 | (edt-map-key "F8" " - F8 Function Key") | |
470 | (edt-map-key "F9" " - F9 Function Key") | |
471 | (edt-map-key "F10" " - F10 Function Key") | |
472 | (edt-map-key "F11" " - F11 Function Key") | |
473 | (edt-map-key "F12" " - F12 Function Key") | |
474 | (edt-map-key "F13" " - F13 Function Key") | |
475 | (edt-map-key "F14" " - F14 Function Key") | |
476 | (edt-map-key "HELP" " - HELP Function Key") | |
477 | (edt-map-key "DO" " - DO Function Key") | |
478 | (edt-map-key "F17" " - F17 Function Key") | |
479 | (edt-map-key "F18" " - F18 Function Key") | |
480 | (edt-map-key "F19" " - F19 Function Key") | |
481 | (edt-map-key "F20" " - F20 Function Key") | |
482 | ||
483 | (set-buffer "Directions") | |
484 | (delete-region (point-min) (point-max)) | |
485 | (insert " | |
90b6fe58 | 486 | ADDITIONAL FUNCTION KEYS |
c0e42a4d | 487 | |
90b6fe58 GM |
488 | Your keyboard may have additional function keys which do not correspond |
489 | to any LK-201 keys. The EDT Emulation can be configured to recognize | |
490 | those keys, since you may wish to add your own key bindings to those keys. | |
79ef886b | 491 | |
90b6fe58 GM |
492 | For example, suppose your keyboard has a keycap marked \"Line Del\" and |
493 | you wish to add it to the list of keys which can be customized by the EDT | |
494 | Emulation. First, assign a unique single-word name to the key for use by | |
495 | the EDT Emulation, for example, \"linedel\". Then, at the \"EDT Key | |
496 | Name:\" prompt, enter \"linedel\", followed by a press of the RETURN key. | |
497 | Finally, when prompted, press the \"Line Del\" key. You now will be able | |
498 | to bind functions to \"linedel\" and \"Gold-linedel\" in edt-user.el in | |
499 | just the same way you can customize bindings of the LK-201 function and | |
500 | keypad keys. | |
501 | ||
502 | When you are done, just press RETURN at the \"EDT Key Name:\" prompt. | |
c0e42a4d KH |
503 | ") |
504 | (switch-to-buffer "Directions") | |
505 | ;;; | |
506 | ;;; Add support for extras keys | |
507 | ;;; | |
508 | (set-buffer "Keys") | |
509 | (insert "\ | |
510 | ;; | |
90b6fe58 | 511 | ;; Extra Keys |
c0e42a4d KH |
512 | ;; |
513 | ") | |
90b6fe58 GM |
514 | ;;; |
515 | ;;; Restore function-key-map. | |
79ef886b | 516 | ;;; |
f8246027 | 517 | (if (and edt-window-system (not (featurep 'xemacs))) |
90b6fe58 | 518 | (setq function-key-map edt-save-function-key-map)) |
c0e42a4d | 519 | (setq EDT-key-name "") |
90b6fe58 GM |
520 | (while (not |
521 | (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) | |
c0e42a4d KH |
522 | (edt-map-key EDT-key-name "")) |
523 | ||
524 | ; | |
525 | ; No more keys to add, so wrap up. | |
526 | ; | |
527 | (set-buffer "Keys") | |
528 | (insert "\ | |
529 | ) | |
530 | ) | |
531 | ") | |
532 | ||
533 | ;;; | |
90b6fe58 GM |
534 | ;;; Save the key mapping program |
535 | ;;; | |
536 | ;;; | |
537 | ;;; Save the key mapping file | |
c0e42a4d | 538 | ;;; |
90b6fe58 | 539 | (let ((file (concat |
0bde6a03 | 540 | "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") |
90b6fe58 GM |
541 | (if edt-term (concat "-" edt-term)) |
542 | (if edt-xserver (concat "-" edt-xserver)) | |
543 | (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) | |
544 | "-keys"))) | |
c0e42a4d KH |
545 | (set-visited-file-name |
546 | (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) | |
547 | (save-buffer) | |
548 | ||
549 | (message "That's it! Press any key to exit") | |
550 | (sit-for 600) | |
551 | (kill-emacs t) | |
552 | ||
553 | ;;; edt-mapper.el ends here |