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