aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorAlan Mackenzie2017-02-12 10:59:03 +0000
committerAlan Mackenzie2017-02-12 10:59:03 +0000
commitf4d5b687150810129b7a1d5b006e31ccf82b691b (patch)
tree4229b13800349032697daae3904dc3773e6b7a80 /lisp/emulation
parentd5514332d4a6092673ce1f78fadcae0c57f7be64 (diff)
parent148100d98319499f0ac6f57b8be08cbd14884a5c (diff)
downloademacs-comment-cache.tar.gz
emacs-comment-cache.zip
Merge branch 'master' into comment-cachecomment-cache
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/edt-mapper.el525
-rw-r--r--lisp/emulation/edt.el8
2 files changed, 265 insertions, 268 deletions
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 24a8f039fa5..457ad55dd6c 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -57,9 +57,9 @@
57;; Usage: 57;; Usage:
58 58
59;; Simply load this file into emacs (version 19 or higher) 59;; Simply load this file into emacs (version 19 or higher)
60;; using the following command. 60;; and run the function edt-mapper, using the following command.
61 61
62;; emacs -q -l edt-mapper.el 62;; emacs -q -l edt-mapper -f edt-mapper
63 63
64;; The "-q" option prevents loading of your init file (commands 64;; The "-q" option prevents loading of your init file (commands
65;; therein might confuse this program). 65;; therein might confuse this program).
@@ -96,10 +96,6 @@
96 96
97;;; Code: 97;;; Code:
98 98
99;; Otherwise it just hangs. This seems preferable.
100(if noninteractive
101 (error "edt-mapper cannot be loaded in batch mode"))
102
103;;; 99;;;
104;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). 100;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs).
105;;; Determine Window System, and X Server Vendor (if appropriate). 101;;; Determine Window System, and X Server Vendor (if appropriate).
@@ -124,6 +120,8 @@
124;;; 120;;;
125;;; Key variables 121;;; Key variables
126;;; 122;;;
123
124;; FIXME some/all of these should be let-bound, not global.
127(defvar edt-key nil) 125(defvar edt-key nil)
128(defvar edt-enter nil) 126(defvar edt-enter nil)
129(defvar edt-return nil) 127(defvar edt-return nil)
@@ -137,88 +135,116 @@
137(defvar edt-save-function-key-map) 135(defvar edt-save-function-key-map)
138 136
139;;; 137;;;
140;;; Determine Terminal Type (if appropriate). 138;;; Key mapping functions
141;;;
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
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
158;;; key pressed by the user but, instead, it returns the name of the
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)
169 (if (not (lookup-key (current-global-map) function-key))
170 (define-key (current-global-map) function-key 'forward-char)))
171 '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4]
172 [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]
173 [kp-space]
174 [kp-tab]
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
189;;;
190;;; Make sure the window is big enough to display the instructions,
191;;; except where window cannot be re-sized.
192;;;
193
194(if (and edt-window-system (not (eq edt-window-system 'tty)))
195 (set-frame-size (selected-frame) 80 36))
196
197;;;
198;;; Create buffers - Directions and Keys
199;;; 139;;;
200(if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) 140(defun edt-map-key (ident descrip)
201(if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) 141 (interactive)
142 (if (featurep 'xemacs)
143 (progn
144 (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip)))
145 (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]"))
146 (cond ((not (equal edt-key edt-return))
147 (set-buffer "Keys")
148 (insert (format " (\"%s\" . %s)\n" ident edt-key))
149 (set-buffer "Directions"))
150 ;; bogosity to get next prompt to come up, if the user hits <CR>!
151 ;; check periodically to see if this is still needed...
152 (t
153 (set-buffer "Keys")
154 (insert (format " (\"%s\" . \"\" )\n" ident))
155 (set-buffer "Directions"))))
156 (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip)))
157 (cond ((not (equal edt-key edt-return))
158 (set-buffer "Keys")
159 (insert (if (vectorp edt-key)
160 (format " (\"%s\" . %s)\n" ident edt-key)
161 (format " (\"%s\" . \"%s\")\n" ident edt-key)))
162 (set-buffer "Directions"))
163 ;; bogosity to get next prompt to come up, if the user hits <CR>!
164 ;; check periodically to see if this is still needed...
165 (t
166 (set-buffer "Keys")
167 (insert (format " (\"%s\" . \"\" )\n" ident))
168 (set-buffer "Directions"))))
169 edt-key)
202 170
203;;; 171(defun edt-mapper ()
204;;; Put header in the Keys buffer 172 (if noninteractive
205;;; 173 (user-error "edt-mapper cannot be loaded in batch mode"))
206(set-buffer "Keys") 174 ;; Determine Terminal Type (if appropriate).
207(insert "\ 175 (if (and edt-window-system (not (eq edt-window-system 'tty)))
176 (setq edt-term nil)
177 (setq edt-term (getenv "TERM")))
178 ;;
179 ;; Implements a workaround for a feature that was added to simple.el.
180 ;;
181 ;; Many function keys have no Emacs functions assigned to them by
182 ;; default. A subset of these are typically assigned functions in the
183 ;; EDT emulation. This includes all the keypad keys and a some others
184 ;; like Delete.
185 ;;
186 ;; Logic in simple.el maps some of these unassigned function keys to
187 ;; ordinary typing keys. Where this is the case, a call to
188 ;; read-key-sequence, below, does not return the name of the function
189 ;; key pressed by the user but, instead, it returns the name of the
190 ;; key to which it has been mapped. It needs to know the name of the
191 ;; key pressed by the user. As a workaround, we assign a function to
192 ;; each of the unassigned function keys of interest, here. These
193 ;; assignments override the mapping to other keys and are only
194 ;; temporary since, when edt-mapper is finished executing, it causes
195 ;; Emacs to exit.
196 ;;
197 (mapc
198 (lambda (function-key)
199 (if (not (lookup-key (current-global-map) function-key))
200 (define-key (current-global-map) function-key 'forward-char)))
201 '([kp-0] [kp-1] [kp-2] [kp-3] [kp-4]
202 [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]
203 [kp-space]
204 [kp-tab]
205 [kp-enter]
206 [kp-multiply]
207 [kp-add]
208 [kp-separator]
209 [kp-subtract]
210 [kp-decimal]
211 [kp-divide]
212 [kp-equal]
213 [backspace]
214 [delete]
215 [tab]
216 [linefeed]
217 [clear]))
218 ;;
219 ;; Make sure the window is big enough to display the instructions,
220 ;; except where window cannot be re-sized.
221 ;;
222 (if (and edt-window-system (not (eq edt-window-system 'tty)))
223 (set-frame-size (selected-frame) 80 36))
224 ;;
225 ;; Create buffers - Directions and Keys
226 ;;
227 (if (not (get-buffer "Directions")) (generate-new-buffer "Directions"))
228 (if (not (get-buffer "Keys")) (generate-new-buffer "Keys"))
229 ;;
230 ;; Put header in the Keys buffer
231 ;;
232 (set-buffer "Keys")
233 (insert "\
208;; 234;;
209;; Key definitions for the EDT emulation within GNU Emacs 235;; Key definitions for the EDT emulation within GNU Emacs
210;; 236;;
211 237
212(defconst *EDT-keys* 238\(defconst *EDT-keys*
213 '( 239 '(
214") 240 ")
215 241
216;;; 242 ;;
217;;; Display directions 243 ;; Display directions
218;;; 244 ;;
219(switch-to-buffer "Directions") 245 (switch-to-buffer "Directions")
220(if (and edt-window-system (not (eq edt-window-system 'tty))) 246 (if (and edt-window-system (not (eq edt-window-system 'tty)))
221 (insert " 247 (insert "
222 EDT MAPPER 248 EDT MAPPER
223 249
224 You will be asked to press keys to create a custom mapping (under a 250 You will be asked to press keys to create a custom mapping (under a
@@ -240,7 +266,7 @@
240 just press RETURN at the prompt. 266 just press RETURN at the prompt.
241 267
242") 268")
243 (insert " 269 (insert "
244 EDT MAPPER 270 EDT MAPPER
245 271
246 You will be asked to press keys to create a custom mapping of your 272 You will be asked to press keys to create a custom mapping of your
@@ -259,39 +285,39 @@
259 285
260")) 286"))
261 287
262(delete-other-windows) 288 (delete-other-windows)
263 289
264;;; 290 ;;
265;;; Save <CR> for future reference. 291 ;; Save <CR> for future reference.
266;;; 292 ;;
267;;; For GNU Emacs, running in a Window System, first hide bindings in 293 ;; For GNU Emacs, running in a Window System, first hide bindings in
268;;; function-key-map. 294 ;; function-key-map.
269;;; 295 ;;
270(cond 296 (cond
271 ((featurep 'xemacs) 297 ((featurep 'xemacs)
272 (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) 298 (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))) "]"))) 299 (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]")))
274 (t 300 (t
275 (if edt-window-system 301 (if edt-window-system
276 (progn 302 (progn
277 (setq edt-save-function-key-map function-key-map) 303 (setq edt-save-function-key-map function-key-map)
278 (setq function-key-map (make-sparse-keymap)))) 304 (setq function-key-map (make-sparse-keymap))))
279 (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")))) 305 (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue "))))
280 306
281;;; 307 ;;
282;;; Remove prefix-key bindings to F1 and F2 in global-map so they can be 308 ;; Remove prefix-key bindings to F1 and F2 in global-map so they can be
283;;; bound in the EDT Emulation mode. 309 ;; bound in the EDT Emulation mode.
284;;; 310 ;;
285(global-unset-key [f1]) 311 (global-unset-key [f1])
286(global-unset-key [f2]) 312 (global-unset-key [f2])
287 313
288;;; 314 ;;
289;;; Display Keypad Diagram and Begin Prompting for Keys 315 ;; Display Keypad Diagram and Begin Prompting for Keys
290;;; 316 ;;
291(set-buffer "Directions") 317 (set-buffer "Directions")
292(delete-region (point-min) (point-max)) 318 (delete-region (point-min) (point-max))
293(if (and edt-window-system (not (eq edt-window-system 'tty))) 319 (if (and edt-window-system (not (eq edt-window-system 'tty)))
294 (insert " 320 (insert "
295 321
296 PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. 322 PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
297 323
@@ -321,11 +347,11 @@
321 REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY. 347 REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY.
322 348
323") 349")
324 (progn 350 (progn
325 (insert " 351 (insert "
326 GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE: ") 352 GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE: ")
327 (insert (format "%s." edt-term)) 353 (insert (format "%s." edt-term))
328 (insert " 354 (insert "
329 355
330 PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. 356 PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
331 357
@@ -347,142 +373,109 @@
347 REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY."))) 373 REMEMBER: JUST PRESS RETURN TO SKIP MAPPING A KEY.")))
348 374
349 375
350;;;
351;;; Key mapping functions
352;;;
353(defun edt-map-key (ident descrip)
354 (interactive)
355 (if (featurep 'xemacs)
356 (progn
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"))))
382 edt-key)
383 376
384(set-buffer "Keys") 377 (set-buffer "Keys")
385(insert " 378 (insert "
386;; 379;;
387;; Arrows 380;; Arrows
388;; 381;;
389") 382")
390(set-buffer "Directions") 383 (set-buffer "Directions")
391 384
392(edt-map-key "UP" " - The Up Arrow Key") 385 (edt-map-key "UP" " - The Up Arrow Key")
393(edt-map-key "DOWN" " - The Down Arrow Key") 386 (edt-map-key "DOWN" " - The Down Arrow Key")
394(edt-map-key "LEFT" " - The Left Arrow Key") 387 (edt-map-key "LEFT" " - The Left Arrow Key")
395(edt-map-key "RIGHT" " - The Right Arrow Key") 388 (edt-map-key "RIGHT" " - The Right Arrow Key")
396 389
397 390
398(set-buffer "Keys") 391 (set-buffer "Keys")
399(insert " 392 (insert "
400;; 393;;
401;; PF keys 394;; PF keys
402;; 395;;
403") 396")
404(set-buffer "Directions") 397 (set-buffer "Directions")
405 398
406(edt-map-key "PF1" " - The PF1 (GOLD) Key") 399 (edt-map-key "PF1" " - The PF1 (GOLD) Key")
407(edt-map-key "PF2" " - The Keypad PF2 Key") 400 (edt-map-key "PF2" " - The Keypad PF2 Key")
408(edt-map-key "PF3" " - The Keypad PF3 Key") 401 (edt-map-key "PF3" " - The Keypad PF3 Key")
409(edt-map-key "PF4" " - The Keypad PF4 Key") 402 (edt-map-key "PF4" " - The Keypad PF4 Key")
410 403
411(set-buffer "Keys") 404 (set-buffer "Keys")
412(insert " 405 (insert "
413;; 406;;
414;; KP0-9 KP- KP, KPP and KPE 407;; KP0-9 KP- KP, KPP and KPE
415;; 408;;
416") 409")
417(set-buffer "Directions") 410 (set-buffer "Directions")
418 411
419(edt-map-key "KP0" " - The Keypad 0 Key") 412 (edt-map-key "KP0" " - The Keypad 0 Key")
420(edt-map-key "KP1" " - The Keypad 1 Key") 413 (edt-map-key "KP1" " - The Keypad 1 Key")
421(edt-map-key "KP2" " - The Keypad 2 Key") 414 (edt-map-key "KP2" " - The Keypad 2 Key")
422(edt-map-key "KP3" " - The Keypad 3 Key") 415 (edt-map-key "KP3" " - The Keypad 3 Key")
423(edt-map-key "KP4" " - The Keypad 4 Key") 416 (edt-map-key "KP4" " - The Keypad 4 Key")
424(edt-map-key "KP5" " - The Keypad 5 Key") 417 (edt-map-key "KP5" " - The Keypad 5 Key")
425(edt-map-key "KP6" " - The Keypad 6 Key") 418 (edt-map-key "KP6" " - The Keypad 6 Key")
426(edt-map-key "KP7" " - The Keypad 7 Key") 419 (edt-map-key "KP7" " - The Keypad 7 Key")
427(edt-map-key "KP8" " - The Keypad 8 Key") 420 (edt-map-key "KP8" " - The Keypad 8 Key")
428(edt-map-key "KP9" " - The Keypad 9 Key") 421 (edt-map-key "KP9" " - The Keypad 9 Key")
429(edt-map-key "KP-" " - The Keypad - Key") 422 (edt-map-key "KP-" " - The Keypad - Key")
430(edt-map-key "KP," " - The Keypad , Key") 423 (edt-map-key "KP," " - The Keypad , Key")
431(edt-map-key "KPP" " - The Keypad . Key") 424 (edt-map-key "KPP" " - The Keypad . Key")
432(edt-map-key "KPE" " - The Keypad Enter Key") 425 (edt-map-key "KPE" " - The Keypad Enter Key")
433;; Save the enter key 426 ;; Save the enter key
434(setq edt-enter edt-key) 427 (setq edt-enter edt-key)
435(setq edt-enter-seq edt-key-seq) 428 (setq edt-enter-seq edt-key-seq)
436 429
437 430
438(set-buffer "Keys") 431 (set-buffer "Keys")
439(insert " 432 (insert "
440;; 433;;
441;; Editing keypad (FIND, INSERT, REMOVE) 434;; Editing keypad (FIND, INSERT, REMOVE)
442;; (SELECT, PREVIOUS, NEXT) 435;; (SELECT, PREVIOUS, NEXT)
443;; 436;;
444") 437")
445(set-buffer "Directions") 438 (set-buffer "Directions")
446 439
447(edt-map-key "FIND" " - The Find key on the editing keypad") 440 (edt-map-key "FIND" " - The Find key on the editing keypad")
448(edt-map-key "INSERT" " - The Insert key on the editing keypad") 441 (edt-map-key "INSERT" " - The Insert key on the editing keypad")
449(edt-map-key "REMOVE" " - The Remove key on the editing keypad") 442 (edt-map-key "REMOVE" " - The Remove key on the editing keypad")
450(edt-map-key "SELECT" " - The Select key on the editing keypad") 443 (edt-map-key "SELECT" " - The Select key on the editing keypad")
451(edt-map-key "PREVIOUS" " - The Prev Scr key on the editing keypad") 444 (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") 445 (edt-map-key "NEXT" " - The Next Scr key on the editing keypad")
453 446
454(set-buffer "Keys") 447 (set-buffer "Keys")
455(insert " 448 (insert "
456;; 449;;
457;; F1-14 Help Do F17-F20 450;; F1-14 Help Do F17-F20
458;; 451;;
459") 452")
460(set-buffer "Directions") 453 (set-buffer "Directions")
461 454
462(edt-map-key "F1" " - F1 Function Key") 455 (edt-map-key "F1" " - F1 Function Key")
463(edt-map-key "F2" " - F2 Function Key") 456 (edt-map-key "F2" " - F2 Function Key")
464(edt-map-key "F3" " - F3 Function Key") 457 (edt-map-key "F3" " - F3 Function Key")
465(edt-map-key "F4" " - F4 Function Key") 458 (edt-map-key "F4" " - F4 Function Key")
466(edt-map-key "F5" " - F5 Function Key") 459 (edt-map-key "F5" " - F5 Function Key")
467(edt-map-key "F6" " - F6 Function Key") 460 (edt-map-key "F6" " - F6 Function Key")
468(edt-map-key "F7" " - F7 Function Key") 461 (edt-map-key "F7" " - F7 Function Key")
469(edt-map-key "F8" " - F8 Function Key") 462 (edt-map-key "F8" " - F8 Function Key")
470(edt-map-key "F9" " - F9 Function Key") 463 (edt-map-key "F9" " - F9 Function Key")
471(edt-map-key "F10" " - F10 Function Key") 464 (edt-map-key "F10" " - F10 Function Key")
472(edt-map-key "F11" " - F11 Function Key") 465 (edt-map-key "F11" " - F11 Function Key")
473(edt-map-key "F12" " - F12 Function Key") 466 (edt-map-key "F12" " - F12 Function Key")
474(edt-map-key "F13" " - F13 Function Key") 467 (edt-map-key "F13" " - F13 Function Key")
475(edt-map-key "F14" " - F14 Function Key") 468 (edt-map-key "F14" " - F14 Function Key")
476(edt-map-key "HELP" " - HELP Function Key") 469 (edt-map-key "HELP" " - HELP Function Key")
477(edt-map-key "DO" " - DO Function Key") 470 (edt-map-key "DO" " - DO Function Key")
478(edt-map-key "F17" " - F17 Function Key") 471 (edt-map-key "F17" " - F17 Function Key")
479(edt-map-key "F18" " - F18 Function Key") 472 (edt-map-key "F18" " - F18 Function Key")
480(edt-map-key "F19" " - F19 Function Key") 473 (edt-map-key "F19" " - F19 Function Key")
481(edt-map-key "F20" " - F20 Function Key") 474 (edt-map-key "F20" " - F20 Function Key")
482 475
483(set-buffer "Directions") 476 (set-buffer "Directions")
484(delete-region (point-min) (point-max)) 477 (delete-region (point-min) (point-max))
485(insert " 478 (insert "
486 ADDITIONAL FUNCTION KEYS 479 ADDITIONAL FUNCTION KEYS
487 480
488 Your keyboard may have additional function keys which do not correspond 481 Your keyboard may have additional function keys which do not correspond
@@ -501,53 +494,53 @@
501 494
502 When you are done, just press RETURN at the \"EDT Key Name:\" prompt. 495 When you are done, just press RETURN at the \"EDT Key Name:\" prompt.
503") 496")
504(switch-to-buffer "Directions") 497 (switch-to-buffer "Directions")
505;;; 498 ;;
506;;; Add support for extras keys 499 ;; Add support for extras keys
507;;; 500 ;;
508(set-buffer "Keys") 501 (set-buffer "Keys")
509(insert "\ 502 (insert "\
510;; 503;;
511;; Extra Keys 504;; Extra Keys
512;; 505;;
513") 506")
514;;; 507 ;;
515;;; Restore function-key-map. 508 ;; Restore function-key-map.
516;;; 509 ;;
517(if (and edt-window-system (not (featurep 'xemacs))) 510 (if (and edt-window-system (not (featurep 'xemacs)))
518 (setq function-key-map edt-save-function-key-map)) 511 (setq function-key-map edt-save-function-key-map))
519(setq EDT-key-name "") 512 (setq EDT-key-name "")
520(while (not 513 (while (not
521 (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) "")) 514 (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) ""))
522 (edt-map-key EDT-key-name "")) 515 (edt-map-key EDT-key-name ""))
523 516
524; 517 ;;
525; No more keys to add, so wrap up. 518 ;; No more keys to add, so wrap up.
526; 519 ;;
527(set-buffer "Keys") 520 (set-buffer "Keys")
528(insert "\ 521 (insert "\
529 ) 522 )
530 ) 523 )
531") 524")
532 525
533;;; 526 ;;
534;;; Save the key mapping program 527 ;; Save the key mapping program
535;;; 528 ;;
536;;; 529 ;;
537;;; Save the key mapping file 530 ;; Save the key mapping file
538;;; 531 ;;
539(let ((file (concat 532 (let ((file (concat
540 "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") 533 "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu")
541 (if edt-term (concat "-" edt-term)) 534 (if edt-term (concat "-" edt-term))
542 (if edt-xserver (concat "-" edt-xserver)) 535 (if edt-xserver (concat "-" edt-xserver))
543 (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) 536 (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system))))
544 "-keys"))) 537 "-keys")))
545 (set-visited-file-name 538 (set-visited-file-name
546 (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) 539 (read-file-name (format "Save key mapping to file (default %s): " file) nil file)))
547(save-buffer) 540 (save-buffer)
548 541
549(message "That's it! Press any key to exit") 542 (message "That's it! Press any key to exit")
550(sit-for 600) 543 (sit-for 600)
551(kill-emacs t) 544 (kill-emacs t))
552 545
553;;; edt-mapper.el ends here 546;;; edt-mapper.el ends here
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index 31f555b0326..a6b2d785ac5 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -1928,6 +1928,8 @@ Optional argument NOT-YES changes the default to negative."
1928;;; INITIALIZATION COMMANDS. 1928;;; INITIALIZATION COMMANDS.
1929;;; 1929;;;
1930 1930
1931(declare-function edt-mapper "edt-mapper" ())
1932
1931;;; 1933;;;
1932;;; Function used to load LK-201 key mapping file generated by edt-mapper.el. 1934;;; Function used to load LK-201 key mapping file generated by edt-mapper.el.
1933;;; 1935;;;
@@ -1968,7 +1970,7 @@ created."
1968 You can do this by quitting Emacs and then invoking Emacs again as 1970 You can do this by quitting Emacs and then invoking Emacs again as
1969 follows: 1971 follows:
1970 1972
1971 emacs -q -l edt-mapper 1973 emacs -q -l edt-mapper -f edt-mapper
1972 1974
1973 [NOTE: If you do nothing out of the ordinary in your init file, and 1975 [NOTE: If you do nothing out of the ordinary in your init file, and
1974 the search for edt-mapper is successful, you can try running it now.] 1976 the search for edt-mapper is successful, you can try running it now.]
@@ -1983,7 +1985,9 @@ created."
1983 (insert (format 1985 (insert (format
1984 "Ah yes, there it is, in \n\n %s \n\n" path)) 1986 "Ah yes, there it is, in \n\n %s \n\n" path))
1985 (if (edt-y-or-n-p "Do you want to run it now? ") 1987 (if (edt-y-or-n-p "Do you want to run it now? ")
1986 (load-file path) 1988 (progn
1989 (load-file path)
1990 (edt-mapper))
1987 (error "EDT Emulation not configured"))) 1991 (error "EDT Emulation not configured")))
1988 (insert (substitute-command-keys 1992 (insert (substitute-command-keys
1989 "Nope, I can't seem to find it. :-(\n\n")) 1993 "Nope, I can't seem to find it. :-(\n\n"))