Mercurial > emacs
comparison lisp/emulation/tpu-mapper.el @ 11547:a39d8ae4ed2e
At end, use default file name .tpu-keys.
Do not kill Emacs.
(tpu-emacs-map-key): Renamed from tpu-gnu-map-key.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 25 Apr 1995 00:42:22 +0000 |
parents | 0e9eddc5d598 |
children | 74168f918db7 |
comparison
equal
deleted
inserted
replaced
11546:66db15ec8ad8 | 11547:a39d8ae4ed2e |
---|---|
39 ;; The "-q" option prevents loading of your .emacs file (commands therein | 39 ;; The "-q" option prevents loading of your .emacs file (commands therein |
40 ;; might confuse this program). | 40 ;; might confuse this program). |
41 | 41 |
42 ;; An instruction screen showing the TPU-edt keypad will be displayed, and | 42 ;; An instruction screen showing the TPU-edt keypad will be displayed, and |
43 ;; you will be prompted to press the TPU-edt editing keys. Tpu-mapper uses | 43 ;; you will be prompted to press the TPU-edt editing keys. Tpu-mapper uses |
44 ;; the keys you press to create an emacs lisp file that will define a | 44 ;; the keys you press to create an Emacs Lisp file that will define a |
45 ;; TPU-edt keypad for your X server. You can even re-arrange the standard | 45 ;; TPU-edt keypad for your X server. You can even re-arrange the standard |
46 ;; EDT keypad to suit your tastes (or to cope with those silly Sun and PC | 46 ;; EDT keypad to suit your tastes (or to cope with those silly Sun and PC |
47 ;; keypads). | 47 ;; keypads). |
48 | 48 |
49 ;; Finally, you will be prompted for the name of the file to store the key | 49 ;; Finally, you will be prompted for the name of the file to store the key |
57 | 57 |
58 ;;; Known Problems: | 58 ;;; Known Problems: |
59 | 59 |
60 ;; Sometimes, tpu-mapper will ignore a key you press, and just continue to | 60 ;; Sometimes, tpu-mapper will ignore a key you press, and just continue to |
61 ;; prompt for the same key. This can happen when your window manager sucks | 61 ;; prompt for the same key. This can happen when your window manager sucks |
62 ;; up the key and doesn't pass it on to emacs, or it could be an emacs bug. | 62 ;; up the key and doesn't pass it on to Emacs, or it could be an Emacs bug. |
63 ;; Either way, there's nothing that tpu-mapper can do about it. You must | 63 ;; Either way, there's nothing that tpu-mapper can do about it. You must |
64 ;; press RETURN, to skip the current key and continue. Later, you and/or | 64 ;; press RETURN, to skip the current key and continue. Later, you and/or |
65 ;; your local X guru can try to figure out why the key is being ignored. | 65 ;; your local X guru can try to figure out why the key is being ignored. |
66 | 66 |
67 ;;; Code: | 67 ;;; Code: |
69 ;;; | 69 ;;; |
70 ;;; Make sure we're running X-windows and Emacs version 19 | 70 ;;; Make sure we're running X-windows and Emacs version 19 |
71 ;;; | 71 ;;; |
72 (cond | 72 (cond |
73 ((not (and window-system (not (string-lessp emacs-version "19")))) | 73 ((not (and window-system (not (string-lessp emacs-version "19")))) |
74 (insert " | 74 (error "tpu-mapper requires running in Emacs 19, with an X display"))) |
75 | 75 |
76 Whoa! This isn't going to work... | 76 |
77 | 77 ;;; |
78 You must run tpu-mapper.el under X-windows and Emacs version 19. | 78 ;;; Decide whether we're running Lucid Emacs or Emacs itself. |
79 | |
80 Press any key to exit. ") | |
81 (sit-for 600) | |
82 (kill-emacs t))) | |
83 | |
84 | |
85 ;;; | |
86 ;;; Decide whether we're running GNU or Lucid emacs. | |
87 ;;; | 79 ;;; |
88 (defconst tpu-lucid-emacs19-p (string-match "Lucid" emacs-version) | 80 (defconst tpu-lucid-emacs19-p (string-match "Lucid" emacs-version) |
89 "Non-NIL if we are running Lucid Emacs version 19.") | 81 "Non-NIL if we are running Lucid Emacs version 19.") |
90 | 82 |
91 | 83 |
131 ;;; Display directions | 123 ;;; Display directions |
132 ;;; | 124 ;;; |
133 (switch-to-buffer "Directions") | 125 (switch-to-buffer "Directions") |
134 (insert " | 126 (insert " |
135 This program prompts you to press keys to create a custom keymap file | 127 This program prompts you to press keys to create a custom keymap file |
136 for use with the x-windows version of emacs and TPU-edt. | 128 for use with the x-windows version of Emacs and TPU-edt. |
137 | 129 |
138 Start by pressing the RETURN key, and continue by pressing the keys | 130 Start by pressing the RETURN key, and continue by pressing the keys |
139 specified in the mini-buffer. You can re-arrange the TPU-edt keypad | 131 specified in the mini-buffer. You can re-arrange the TPU-edt keypad |
140 by pressing any key you want at any prompt. If you want to entirely | 132 by pressing any key you want at any prompt. If you want to entirely |
141 omit a key, just press RETURN at the prompt. | 133 omit a key, just press RETURN at the prompt. |
198 ;; check periodically to see if this is still needed... | 190 ;; check periodically to see if this is still needed... |
199 (t | 191 (t |
200 (format "%s" tpu-key))) | 192 (format "%s" tpu-key))) |
201 tpu-key) | 193 tpu-key) |
202 | 194 |
203 (defun tpu-gnu-map-key (ident descrip func gold-func) | 195 (defun tpu-emacs-map-key (ident descrip func gold-func) |
204 (interactive) | 196 (interactive) |
205 (message "Press %s%s: " ident descrip) | 197 (message "Press %s%s: " ident descrip) |
206 (setq tpu-key-seq (read-event)) | 198 (setq tpu-key-seq (read-event)) |
207 (setq tpu-key (concat "[" (format "%s" tpu-key-seq) "]")) | 199 (setq tpu-key (concat "[" (format "%s" tpu-key-seq) "]")) |
208 (cond ((not (equal tpu-key tpu-return)) | 200 (cond ((not (equal tpu-key tpu-return)) |
215 ;; check periodically to see if this is still needed... | 207 ;; check periodically to see if this is still needed... |
216 (t | 208 (t |
217 (format "%s" tpu-key))) | 209 (format "%s" tpu-key))) |
218 tpu-key) | 210 tpu-key) |
219 | 211 |
220 (fset 'tpu-map-key (if tpu-lucid-emacs19-p 'tpu-lucid-map-key 'tpu-gnu-map-key)) | 212 (fset 'tpu-map-key (if tpu-lucid-emacs19-p 'tpu-lucid-map-key 'tpu-emacs-map-key)) |
221 | 213 |
222 | 214 |
223 (set-buffer "Keys") | 215 (set-buffer "Keys") |
224 (insert " | 216 (insert " |
225 ;; Arrows | 217 ;; Arrows |
369 (set-buffer "Keys") | 361 (set-buffer "Keys") |
370 | 362 |
371 ;;; | 363 ;;; |
372 ;;; Save the key mapping program and blow this pop stand | 364 ;;; Save the key mapping program and blow this pop stand |
373 ;;; | 365 ;;; |
374 (let ((file (if tpu-lucid-emacs19-p "~/.tpu-lucid-keys" "~/.tpu-gnu-keys"))) | 366 (let ((file (if tpu-lucid-emacs19-p "~/.tpu-lucid-keys" "~/.tpu-keys"))) |
375 (set-visited-file-name | 367 (set-visited-file-name |
376 (read-file-name (format "Save key mapping to file (default %s): " file) "" file))) | 368 (read-file-name (format "Save key mapping to file (default %s): " file) "" file))) |
377 (save-buffer) | 369 (save-buffer) |
378 | 370 |
379 (message "That's it! Press any key to exit") | 371 (message "tpu-mapper done") |
380 (sit-for 600) | |
381 (kill-emacs t) | |
382 | 372 |
383 ;;; tpu-mapper.el ends here | 373 ;;; tpu-mapper.el ends here |