diff options
| -rw-r--r-- | lisp/emulation/tpu-mapper.el | 426 |
1 files changed, 202 insertions, 224 deletions
diff --git a/lisp/emulation/tpu-mapper.el b/lisp/emulation/tpu-mapper.el index b3ad67ec4df..49d67f437f8 100644 --- a/lisp/emulation/tpu-mapper.el +++ b/lisp/emulation/tpu-mapper.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; tpu-mapper.el --- create a TPU-edt X-windows keymap file | 1 | ;;; tpu-mapper.el --- create a TPU-edt X-windows keymap file |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, | 3 | ;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004, |
| 4 | ;; 2005, 2006, 2007 Free Software Foundation, Inc. | 4 | ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Rob Riepel <riepel@networking.stanford.edu> | 6 | ;; Author: Rob Riepel <riepel@networking.stanford.edu> |
| 7 | ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> | 7 | ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu> |
| @@ -26,57 +26,11 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; This emacs lisp program can be used to create an emacs lisp file that | 29 | ;; This Emacs Lisp program can be used to create an Emacs Lisp file that |
| 30 | ;; defines the TPU-edt keypad for emacs running on x-windows. Please read | 30 | ;; defines the TPU-edt keypad for Emacs running on X-Windows. |
| 31 | ;; the "Usage" AND "Known Problems" sections before attempting to run this | ||
| 32 | ;; program. | ||
| 33 | |||
| 34 | ;;; Usage: | ||
| 35 | |||
| 36 | ;; Simply load this file into the X-windows version of emacs using the | ||
| 37 | ;; following command. | ||
| 38 | |||
| 39 | ;; emacs -q -l tpu-mapper | ||
| 40 | |||
| 41 | ;; The "-q" option prevents loading of your .emacs file (commands therein | ||
| 42 | ;; might confuse this program). | ||
| 43 | |||
| 44 | ;; An instruction screen showing the TPU-edt keypad will be displayed, and | ||
| 45 | ;; you will be prompted to press the TPU-edt editing keys. Tpu-mapper uses | ||
| 46 | ;; the keys you press to create an Emacs Lisp file that will define a | ||
| 47 | ;; TPU-edt keypad for your X server. You can even re-arrange the standard | ||
| 48 | ;; EDT keypad to suit your tastes (or to cope with those silly Sun and PC | ||
| 49 | ;; keypads). | ||
| 50 | |||
| 51 | ;; Finally, you will be prompted for the name of the file to store the key | ||
| 52 | ;; definitions. If you chose the default, TPU-edt will find it and load it | ||
| 53 | ;; automatically. If you specify a different file name, you will need to | ||
| 54 | ;; set the variable "tpu-xkeys-file" before starting TPU-edt. Here's how | ||
| 55 | ;; you might go about doing that in your .emacs file. | ||
| 56 | |||
| 57 | ;; (setq tpu-xkeys-file (expand-file-name "~/.my-emacs-x-keys")) | ||
| 58 | ;; (tpu-edt) | ||
| 59 | |||
| 60 | ;;; Known Problems: | ||
| 61 | |||
| 62 | ;; Sometimes, tpu-mapper will ignore a key you press, and just continue to | ||
| 63 | ;; prompt for the same key. This can happen when your window manager sucks | ||
| 64 | ;; up the key and doesn't pass it on to Emacs, or it could be an Emacs bug. | ||
| 65 | ;; Either way, there's nothing that tpu-mapper can do about it. You must | ||
| 66 | ;; press RETURN, to skip the current key and continue. Later, you and/or | ||
| 67 | ;; your local X guru can try to figure out why the key is being ignored. | ||
| 68 | 31 | ||
| 69 | ;;; Code: | 32 | ;;; Code: |
| 70 | 33 | ||
| 71 | |||
| 72 | ;;; | ||
| 73 | ;;; Make sure we're running X-windows and Emacs version 19 | ||
| 74 | ;;; | ||
| 75 | (cond | ||
| 76 | ((not (and window-system (not (string-lessp emacs-version "19")))) | ||
| 77 | (error "tpu-mapper requires running in Emacs 19, with an X display"))) | ||
| 78 | |||
| 79 | |||
| 80 | ;;; | 34 | ;;; |
| 81 | ;;; Key variables | 35 | ;;; Key variables |
| 82 | ;;; | 36 | ;;; |
| @@ -89,37 +43,89 @@ | |||
| 89 | (defvar tpu-enter-seq nil) | 43 | (defvar tpu-enter-seq nil) |
| 90 | (defvar tpu-return-seq nil) | 44 | (defvar tpu-return-seq nil) |
| 91 | 45 | ||
| 92 | |||
| 93 | ;;; | 46 | ;;; |
| 94 | ;;; Make sure the window is big enough to display the instructions | 47 | ;;; Key mapping function |
| 95 | ;;; | 48 | ;;; |
| 96 | (if (featurep 'xemacs) (set-screen-size (selected-screen) 80 36) | 49 | (defun tpu-map-key (ident descrip func gold-func) |
| 97 | (set-frame-size (selected-frame) 80 36)) | 50 | (interactive) |
| 51 | (if (featurep 'xemacs) | ||
| 52 | (progn | ||
| 53 | (setq tpu-key-seq (read-key-sequence | ||
| 54 | (format "Press %s%s: " ident descrip)) | ||
| 55 | tpu-key (format "[%s]" (event-key (aref tpu-key-seq 0)))) | ||
| 56 | (unless (equal tpu-key tpu-return) | ||
| 57 | (set-buffer "Keys") | ||
| 58 | (insert (format"(global-set-key %s %s)\n" tpu-key func)) | ||
| 59 | (set-buffer "Gold-Keys") | ||
| 60 | (insert (format "(define-key GOLD-map %s %s)\n" tpu-key gold-func)))) | ||
| 61 | (message "Press %s%s: " ident descrip) | ||
| 62 | (setq tpu-key-seq (read-event) | ||
| 63 | tpu-key (format "[%s]" tpu-key-seq)) | ||
| 64 | (unless (equal tpu-key tpu-return) | ||
| 65 | (set-buffer "Keys") | ||
| 66 | (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func)) | ||
| 67 | (set-buffer "Gold-Keys") | ||
| 68 | (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func)))) | ||
| 69 | (set-buffer "Directions") | ||
| 70 | tpu-key) | ||
| 98 | 71 | ||
| 72 | ;;;###autoload | ||
| 73 | (defun tpu-mapper () | ||
| 74 | "Create an Emacs lisp file defining the TPU-edt keypad for X-windows. | ||
| 75 | |||
| 76 | This command displays an instruction screen showing the TPU-edt keypad | ||
| 77 | and asks you to press the TPU-edt editing keys. It uses the keys you | ||
| 78 | press to create an Emacs Lisp file that will define a TPU-edt keypad | ||
| 79 | for your X server. You can even re-arrange the standard EDT keypad to | ||
| 80 | suit your tastes (or to cope with those silly Sun and PC keypads). | ||
| 81 | |||
| 82 | Finally, you will be prompted for the name of the file to store the key | ||
| 83 | definitions. If you chose the default, TPU-edt will find it and load it | ||
| 84 | automatically. If you specify a different file name, you will need to | ||
| 85 | set the variable ``tpu-xkeys-file'' before starting TPU-edt. Here's how | ||
| 86 | you might go about doing that in your .emacs file. | ||
| 87 | |||
| 88 | (setq tpu-xkeys-file (expand-file-name \"~/.my-emacs-x-keys\")) | ||
| 89 | (tpu-edt) | ||
| 90 | |||
| 91 | Known Problems: | ||
| 92 | |||
| 93 | Sometimes, tpu-mapper will ignore a key you press, and just continue to | ||
| 94 | prompt for the same key. This can happen when your window manager sucks | ||
| 95 | up the key and doesn't pass it on to Emacs, or it could be an Emacs bug. | ||
| 96 | Either way, there's nothing that tpu-mapper can do about it. You must | ||
| 97 | press RETURN, to skip the current key and continue. Later, you and/or | ||
| 98 | your local X guru can try to figure out why the key is being ignored." | ||
| 99 | (interactive) | ||
| 99 | 100 | ||
| 100 | ;;; | 101 | ;; Make sure we're running X-windows |
| 101 | ;;; Create buffers - Directions, Keys, Gold-Keys | ||
| 102 | ;;; | ||
| 103 | (if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) | ||
| 104 | (if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) | ||
| 105 | (if (not (get-buffer "Gold-Keys")) (generate-new-buffer "Gold-Keys")) | ||
| 106 | 102 | ||
| 103 | (if (not window-system) | ||
| 104 | (error "tpu-mapper requires running Emacs with an X display")) | ||
| 107 | 105 | ||
| 108 | ;;; | 106 | ;; Make sure the window is big enough to display the instructions |
| 109 | ;;; Put headers in the Keys buffer | 107 | |
| 110 | ;;; | 108 | (if (featurep 'xemacs) (set-screen-size (selected-screen) 80 36) |
| 111 | (set-buffer "Keys") | 109 | (set-frame-size (selected-frame) 80 36)) |
| 112 | (insert "\ | 110 | |
| 111 | ;; Create buffers - Directions, Keys, Gold-Keys | ||
| 112 | |||
| 113 | (if (not (get-buffer "Directions")) (generate-new-buffer "Directions")) | ||
| 114 | (if (not (get-buffer "Keys")) (generate-new-buffer "Keys")) | ||
| 115 | (if (not (get-buffer "Gold-Keys")) (generate-new-buffer "Gold-Keys")) | ||
| 116 | |||
| 117 | ;; Put headers in the Keys buffer | ||
| 118 | |||
| 119 | (set-buffer "Keys") | ||
| 120 | (insert "\ | ||
| 113 | ;; Key definitions for TPU-edt | 121 | ;; Key definitions for TPU-edt |
| 114 | ;; | 122 | ;; |
| 115 | ") | 123 | ") |
| 116 | 124 | ||
| 125 | ;; Display directions | ||
| 117 | 126 | ||
| 118 | ;;; | 127 | (switch-to-buffer "Directions") |
| 119 | ;;; Display directions | 128 | (insert " |
| 120 | ;;; | ||
| 121 | (switch-to-buffer "Directions") | ||
| 122 | (insert " | ||
| 123 | This program prompts you to press keys to create a custom keymap file | 129 | This program prompts you to press keys to create a custom keymap file |
| 124 | for use with the x-windows version of Emacs and TPU-edt. | 130 | for use with the x-windows version of Emacs and TPU-edt. |
| 125 | 131 | ||
| @@ -153,225 +159,197 @@ | |||
| 153 | 159 | ||
| 154 | 160 | ||
| 155 | ") | 161 | ") |
| 156 | (delete-other-windows) | 162 | (delete-other-windows) |
| 157 | (goto-char (point-min)) | 163 | (goto-char (point-min)) |
| 158 | 164 | ||
| 159 | ;;; | 165 | ;; Save <CR> for future reference |
| 160 | ;;; Save <CR> for future reference | ||
| 161 | ;;; | ||
| 162 | (cond | ||
| 163 | ((featurep 'xemacs) | ||
| 164 | (setq tpu-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) | ||
| 165 | (setq tpu-return (concat "[" (format "%s" (event-key (aref tpu-return-seq 0))) "]"))) | ||
| 166 | (t | ||
| 167 | (message "Hit carriage-return <CR> to continue ") | ||
| 168 | (setq tpu-return-seq (read-event)) | ||
| 169 | (setq tpu-return (concat "[" (format "%s" tpu-return-seq) "]")))) | ||
| 170 | 166 | ||
| 167 | (cond | ||
| 168 | ((featurep 'xemacs) | ||
| 169 | (setq tpu-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) | ||
| 170 | (setq tpu-return (concat "[" (format "%s" (event-key (aref tpu-return-seq 0))) "]"))) | ||
| 171 | (t | ||
| 172 | (message "Hit carriage-return <CR> to continue ") | ||
| 173 | (setq tpu-return-seq (read-event)) | ||
| 174 | (setq tpu-return (concat "[" (format "%s" tpu-return-seq) "]")))) | ||
| 171 | 175 | ||
| 172 | ;;; | 176 | ;; Build the keymap file |
| 173 | ;;; Key mapping functions | ||
| 174 | ;;; | ||
| 175 | (defun tpu-map-key (ident descrip func gold-func) | ||
| 176 | (interactive) | ||
| 177 | (if (featurep 'xemacs) | ||
| 178 | (progn | ||
| 179 | (setq tpu-key-seq (read-key-sequence | ||
| 180 | (format "Press %s%s: " ident descrip)) | ||
| 181 | tpu-key (format "[%s]" (event-key (aref tpu-key-seq 0)))) | ||
| 182 | (unless (equal tpu-key tpu-return) | ||
| 183 | (set-buffer "Keys") | ||
| 184 | (insert (format"(global-set-key %s %s)\n" tpu-key func)) | ||
| 185 | (set-buffer "Gold-Keys") | ||
| 186 | (insert (format "(define-key GOLD-map %s %s)\n" tpu-key gold-func)))) | ||
| 187 | (message "Press %s%s: " ident descrip) | ||
| 188 | (setq tpu-key-seq (read-event) | ||
| 189 | tpu-key (format "[%s]" tpu-key-seq)) | ||
| 190 | (unless (equal tpu-key tpu-return) | ||
| 191 | (set-buffer "Keys") | ||
| 192 | (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func)) | ||
| 193 | (set-buffer "Gold-Keys") | ||
| 194 | (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func)))) | ||
| 195 | (set-buffer "Directions") | ||
| 196 | tpu-key) | ||
| 197 | 177 | ||
| 198 | (set-buffer "Keys") | 178 | (set-buffer "Keys") |
| 199 | (insert " | 179 | (insert " |
| 200 | ;; Arrows | 180 | ;; Arrows |
| 201 | ;; | 181 | ;; |
| 202 | ") | 182 | ") |
| 203 | (set-buffer "Gold-Keys") | 183 | (set-buffer "Gold-Keys") |
| 204 | (insert " | 184 | (insert " |
| 205 | ;; GOLD Arrows | 185 | ;; GOLD Arrows |
| 206 | ;; | 186 | ;; |
| 207 | ") | 187 | ") |
| 208 | (set-buffer "Directions") | 188 | (set-buffer "Directions") |
| 209 | |||
| 210 | (tpu-map-key "Up-Arrow" "" "'tpu-previous-line" "'tpu-move-to-beginning") | ||
| 211 | (tpu-map-key "Down-arrow" "" "'tpu-next-line" "'tpu-move-to-end") | ||
| 212 | (tpu-map-key "Right-arrow" "" "'tpu-forward-char" "'end-of-line") | ||
| 213 | (tpu-map-key "Left-arrow" "" "'tpu-backward-char" "'beginning-of-line") | ||
| 214 | 189 | ||
| 190 | (tpu-map-key "Up-Arrow" "" "'tpu-previous-line" "'tpu-move-to-beginning") | ||
| 191 | (tpu-map-key "Down-arrow" "" "'tpu-next-line" "'tpu-move-to-end") | ||
| 192 | (tpu-map-key "Right-arrow" "" "'tpu-forward-char" "'end-of-line") | ||
| 193 | (tpu-map-key "Left-arrow" "" "'tpu-backward-char" "'beginning-of-line") | ||
| 215 | 194 | ||
| 216 | (set-buffer "Keys") | 195 | (set-buffer "Keys") |
| 217 | (insert " | 196 | (insert " |
| 218 | ;; PF keys | 197 | ;; PF keys |
| 219 | ;; | 198 | ;; |
| 220 | ") | 199 | ") |
| 221 | (set-buffer "Gold-Keys") | 200 | (set-buffer "Gold-Keys") |
| 222 | (insert " | 201 | (insert " |
| 223 | ;; GOLD PF keys | 202 | ;; GOLD PF keys |
| 224 | ;; | 203 | ;; |
| 225 | ") | 204 | ") |
| 226 | (set-buffer "Directions") | 205 | (set-buffer "Directions") |
| 227 | 206 | ||
| 228 | (tpu-map-key "PF1" " - The GOLD key" "GOLD-map" "'keyboard-quit") | 207 | (tpu-map-key "PF1" " - The GOLD key" "GOLD-map" "'keyboard-quit") |
| 229 | (tpu-map-key "PF2" " - The Keypad Help key" "'tpu-help" "'help-for-help") | 208 | (tpu-map-key "PF2" " - The Keypad Help key" "'tpu-help" "'help-for-help") |
| 230 | (tpu-map-key "PF3" " - The Find/Find-Next key" "'tpu-search-again" "'tpu-search") | 209 | (tpu-map-key "PF3" " - The Find/Find-Next key" "'tpu-search-again" "'tpu-search") |
| 231 | (tpu-map-key "PF4" " - The Del/Undelete Line key" "'tpu-delete-current-line" "'tpu-undelete-lines") | 210 | (tpu-map-key "PF4" " - The Del/Undelete Line key" "'tpu-delete-current-line" "'tpu-undelete-lines") |
| 232 | 211 | ||
| 233 | (set-buffer "Keys") | 212 | (set-buffer "Keys") |
| 234 | (insert " | 213 | (insert " |
| 235 | ;; KP0-9 KP- KP, KP. and KPenter | 214 | ;; KP0-9 KP- KP, KP. and KPenter |
| 236 | ;; | 215 | ;; |
| 237 | ") | 216 | ") |
| 238 | (set-buffer "Gold-Keys") | 217 | (set-buffer "Gold-Keys") |
| 239 | (insert " | 218 | (insert " |
| 240 | ;; GOLD KP0-9 KP- KP, and KPenter | 219 | ;; GOLD KP0-9 KP- KP, and KPenter |
| 241 | ;; | 220 | ;; |
| 242 | ") | 221 | ") |
| 243 | (set-buffer "Directions") | 222 | (set-buffer "Directions") |
| 244 | 223 | ||
| 245 | (tpu-map-key "KP-0" " - The Line/Open-Line key" "'tpu-line" "'open-line") | 224 | (tpu-map-key "KP-0" " - The Line/Open-Line key" "'tpu-line" "'open-line") |
| 246 | (tpu-map-key "KP-1" " - The Word/Change-Case key" "'tpu-word" "'tpu-change-case") | 225 | (tpu-map-key "KP-1" " - The Word/Change-Case key" "'tpu-word" "'tpu-change-case") |
| 247 | (tpu-map-key "KP-2" " - The EOL/Delete-EOL key" "'tpu-end-of-line" "'tpu-delete-to-eol") | 226 | (tpu-map-key "KP-2" " - The EOL/Delete-EOL key" "'tpu-end-of-line" "'tpu-delete-to-eol") |
| 248 | (tpu-map-key "KP-3" " - The Character/Special-Insert key" "'tpu-char" "'tpu-special-insert") | 227 | (tpu-map-key "KP-3" " - The Character/Special-Insert key" "'tpu-char" "'tpu-special-insert") |
| 249 | (setq tpu-kp4 (tpu-map-key "KP-4" " - The Forward/Bottom key" "'tpu-advance-direction" "'tpu-move-to-end")) | 228 | (setq tpu-kp4 (tpu-map-key "KP-4" " - The Forward/Bottom key" "'tpu-advance-direction" "'tpu-move-to-end")) |
| 250 | (setq tpu-kp5 (tpu-map-key "KP-5" " - The Reverse/Top key" "'tpu-backup-direction" "'tpu-move-to-beginning")) | 229 | (setq tpu-kp5 (tpu-map-key "KP-5" " - The Reverse/Top key" "'tpu-backup-direction" "'tpu-move-to-beginning")) |
| 251 | (tpu-map-key "KP-6" " - The Remove/Insert key" "'tpu-cut" "'tpu-paste") | 230 | (tpu-map-key "KP-6" " - The Remove/Insert key" "'tpu-cut" "'tpu-paste") |
| 252 | (tpu-map-key "KP-7" " - The Page/Do key" "'tpu-page" "'execute-extended-command") | 231 | (tpu-map-key "KP-7" " - The Page/Do key" "'tpu-page" "'execute-extended-command") |
| 253 | (tpu-map-key "KP-8" " - The Section/Fill key" "'tpu-scroll-window" "'tpu-fill") | 232 | (tpu-map-key "KP-8" " - The Section/Fill key" "'tpu-scroll-window" "'tpu-fill") |
| 254 | (tpu-map-key "KP-9" " - The Append/Replace key" "'tpu-append-region" "'tpu-replace") | 233 | (tpu-map-key "KP-9" " - The Append/Replace key" "'tpu-append-region" "'tpu-replace") |
| 255 | (tpu-map-key "KP--" " - The Delete/Undelete Word key" "'tpu-delete-current-word" "'tpu-undelete-words") | 234 | (tpu-map-key "KP--" " - The Delete/Undelete Word key" "'tpu-delete-current-word" "'tpu-undelete-words") |
| 256 | (tpu-map-key "KP-," " - The Delete/Undelete Character key" "'tpu-delete-current-char" "'tpu-undelete-char") | 235 | (tpu-map-key "KP-," " - The Delete/Undelete Character key" "'tpu-delete-current-char" "'tpu-undelete-char") |
| 257 | (tpu-map-key "KP-." " - The Select/Reset key" "'tpu-select" "'tpu-unselect") | 236 | (tpu-map-key "KP-." " - The Select/Reset key" "'tpu-select" "'tpu-unselect") |
| 258 | (tpu-map-key "KP-Enter" " - The Enter key on the numeric keypad" "'newline" "'tpu-substitute") | 237 | (tpu-map-key "KP-Enter" " - The Enter key on the numeric keypad" "'newline" "'tpu-substitute") |
| 259 | ;; Save the enter key | 238 | ;; Save the enter key |
| 260 | (setq tpu-enter tpu-key) | 239 | (setq tpu-enter tpu-key) |
| 261 | (setq tpu-enter-seq tpu-key-seq) | 240 | (setq tpu-enter-seq tpu-key-seq) |
| 262 | 241 | ||
| 263 | (set-buffer "Keys") | 242 | (set-buffer "Keys") |
| 264 | (insert " | 243 | (insert " |
| 265 | ;; Editing keypad (find, insert, remove) | 244 | ;; Editing keypad (find, insert, remove) |
| 266 | ;; (select, prev, next) | 245 | ;; (select, prev, next) |
| 267 | ;; | 246 | ;; |
| 268 | ") | 247 | ") |
| 269 | (set-buffer "Gold-Keys") | 248 | (set-buffer "Gold-Keys") |
| 270 | (insert " | 249 | (insert " |
| 271 | ;; GOLD Editing keypad (find, insert, remove) | 250 | ;; GOLD Editing keypad (find, insert, remove) |
| 272 | ;; (select, prev, next) | 251 | ;; (select, prev, next) |
| 273 | ;; | 252 | ;; |
| 274 | ") | 253 | ") |
| 275 | (set-buffer "Directions") | 254 | (set-buffer "Directions") |
| 276 | 255 | ||
| 277 | (tpu-map-key "Find" " - The Find key on the editing keypad" "'tpu-search" "'nil") | 256 | (tpu-map-key "Find" " - The Find key on the editing keypad" "'tpu-search" "'nil") |
| 278 | (tpu-map-key "Insert" " - The Insert key on the editing keypad" "'tpu-paste" "'nil") | 257 | (tpu-map-key "Insert" " - The Insert key on the editing keypad" "'tpu-paste" "'nil") |
| 279 | (tpu-map-key "Remove" " - The Remove key on the editing keypad" "'tpu-cut" "'tpu-store-text") | 258 | (tpu-map-key "Remove" " - The Remove key on the editing keypad" "'tpu-cut" "'tpu-store-text") |
| 280 | (tpu-map-key "Select" " - The Select key on the editing keypad" "'tpu-select" "'tpu-unselect") | 259 | (tpu-map-key "Select" " - The Select key on the editing keypad" "'tpu-select" "'tpu-unselect") |
| 281 | (tpu-map-key "Prev Scr" " - The Prev Scr key on the editing keypad" "'tpu-scroll-window-down" "'tpu-previous-window") | 260 | (tpu-map-key "Prev Scr" " - The Prev Scr key on the editing keypad" "'tpu-scroll-window-down" "'tpu-previous-window") |
| 282 | (tpu-map-key "Next Scr" " - The Next Scr key on the editing keypad" "'tpu-scroll-window-up" "'tpu-next-window") | 261 | (tpu-map-key "Next Scr" " - The Next Scr key on the editing keypad" "'tpu-scroll-window-up" "'tpu-next-window") |
| 283 | 262 | ||
| 284 | (set-buffer "Keys") | 263 | (set-buffer "Keys") |
| 285 | (insert " | 264 | (insert " |
| 286 | ;; F10-14 Help Do F17 | 265 | ;; F10-14 Help Do F17 |
| 287 | ;; | 266 | ;; |
| 288 | ") | 267 | ") |
| 289 | (set-buffer "Gold-Keys") | 268 | (set-buffer "Gold-Keys") |
| 290 | (insert " | 269 | (insert " |
| 291 | ;; GOLD F10-14 Help Do F17 | 270 | ;; GOLD F10-14 Help Do F17 |
| 292 | ;; | 271 | ;; |
| 293 | ") | 272 | ") |
| 294 | (set-buffer "Directions") | 273 | (set-buffer "Directions") |
| 295 | 274 | ||
| 296 | (tpu-map-key "F10" " - Invokes the Exit function on VT200+ terminals" "'tpu-exit" "'nil") | 275 | (tpu-map-key "F10" " - Invokes the Exit function on VT200+ terminals" "'tpu-exit" "'nil") |
| 297 | (tpu-map-key "F11" " - Inserts an Escape character into the text" "'tpu-insert-escape" "'nil") | 276 | (tpu-map-key "F11" " - Inserts an Escape character into the text" "'tpu-insert-escape" "'nil") |
| 298 | (tpu-map-key "Backspace" " - Not Delete nor ^H! Sometimes on the F12 key" "'tpu-next-beginning-of-line" "'nil") | 277 | (tpu-map-key "Backspace" " - Not Delete nor ^H! Sometimes on the F12 key" "'tpu-next-beginning-of-line" "'nil") |
| 299 | (tpu-map-key "F13" " - Invokes the delete previous word function" "'tpu-delete-previous-word" "'nil") | 278 | (tpu-map-key "F13" " - Invokes the delete previous word function" "'tpu-delete-previous-word" "'nil") |
| 300 | (tpu-map-key "F14" " - Toggles insert/overstrike modes" "'tpu-toggle-overwrite-mode" "'nil") | 279 | (tpu-map-key "F14" " - Toggles insert/overstrike modes" "'tpu-toggle-overwrite-mode" "'nil") |
| 301 | (tpu-map-key "Help" " - Brings up the help screen, same as PF2" "'tpu-help" "'describe-bindings") | 280 | (tpu-map-key "Help" " - Brings up the help screen, same as PF2" "'tpu-help" "'describe-bindings") |
| 302 | (tpu-map-key "Do" " - Invokes the COMMAND function" "'execute-extended-command" "'nil") | 281 | (tpu-map-key "Do" " - Invokes the COMMAND function" "'execute-extended-command" "'nil") |
| 303 | (tpu-map-key "F17" "" "'tpu-goto-breadcrumb" "'tpu-drop-breadcrumb") | 282 | (tpu-map-key "F17" "" "'tpu-goto-breadcrumb" "'tpu-drop-breadcrumb") |
| 304 | 283 | ||
| 305 | (set-buffer "Gold-Keys") | 284 | (set-buffer "Gold-Keys") |
| 306 | (cond | 285 | (cond |
| 307 | ((not (equal tpu-enter tpu-return)) | 286 | ((not (equal tpu-enter tpu-return)) |
| 308 | (insert " | 287 | (insert " |
| 309 | ;; Minibuffer map additions to make KP_enter = RET | 288 | ;; Minibuffer map additions to make KP_enter = RET |
| 310 | ;; | 289 | ;; |
| 311 | ") | 290 | ") |
| 312 | 291 | ||
| 313 | (insert (format "(define-key minibuffer-local-map %s 'exit-minibuffer)\n" tpu-enter)) | 292 | (insert (format "(define-key minibuffer-local-map %s 'exit-minibuffer)\n" tpu-enter)) |
| 314 | (insert (format "(define-key minibuffer-local-ns-map %s 'exit-minibuffer)\n" tpu-enter)) | 293 | ;; These are not necessary because they are inherited. |
| 315 | (insert (format "(define-key minibuffer-local-completion-map %s 'exit-minibuffer)\n" tpu-enter)) | 294 | ;; (insert (format "(define-key minibuffer-local-ns-map %s 'exit-minibuffer)\n" tpu-enter)) |
| 316 | (insert (format "(define-key minibuffer-local-must-match-map %s 'minibuffer-complete-and-exit)\n" tpu-enter)))) | 295 | ;; (insert (format "(define-key minibuffer-local-completion-map %s 'exit-minibuffer)\n" tpu-enter)) |
| 296 | (insert (format "(define-key minibuffer-local-must-match-map %s 'minibuffer-complete-and-exit)\n" tpu-enter)))) | ||
| 317 | 297 | ||
| 318 | (cond | 298 | (cond |
| 319 | ((not (or (equal tpu-kp4 tpu-return) (equal tpu-kp5 tpu-return))) | 299 | ((not (or (equal tpu-kp4 tpu-return) (equal tpu-kp5 tpu-return))) |
| 320 | (insert " | 300 | (insert " |
| 321 | ;; Minibuffer map additions to allow KP-4/5 termination of search strings. | 301 | ;; Minibuffer map additions to allow KP-4/5 termination of search strings. |
| 322 | ;; | 302 | ;; |
| 323 | ") | 303 | ") |
| 324 | 304 | ||
| 325 | (insert (format "(define-key minibuffer-local-map %s 'tpu-search-forward-exit)\n" tpu-kp4)) | 305 | (insert (format "(define-key minibuffer-local-map %s 'tpu-search-forward-exit)\n" tpu-kp4)) |
| 326 | (insert (format "(define-key minibuffer-local-map %s 'tpu-search-backward-exit)\n" tpu-kp5)))) | 306 | (insert (format "(define-key minibuffer-local-map %s 'tpu-search-backward-exit)\n" tpu-kp5)))) |
| 327 | 307 | ||
| 328 | (insert " | 308 | (insert " |
| 329 | ;; Define the tpu-help-enter/return symbols | 309 | ;; Define the tpu-help-enter/return symbols |
| 330 | ;; | 310 | ;; |
| 331 | ") | 311 | ") |
| 332 | 312 | ||
| 333 | (cond ((featurep 'xemacs) | 313 | (cond ((featurep 'xemacs) |
| 334 | (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter-seq)) | 314 | (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter-seq)) |
| 335 | (insert (format "(setq tpu-help-return \"%s\")\n" tpu-return-seq)) | 315 | (insert (format "(setq tpu-help-return \"%s\")\n" tpu-return-seq)) |
| 336 | (insert "(setq tpu-help-N \"[#<keypress-event N>]\")\n") | 316 | (insert "(setq tpu-help-N \"[#<keypress-event N>]\")\n") |
| 337 | (insert "(setq tpu-help-n \"[#<keypress-event n>]\")\n") | 317 | (insert "(setq tpu-help-n \"[#<keypress-event n>]\")\n") |
| 338 | (insert "(setq tpu-help-P \"[#<keypress-event P>]\")\n") | 318 | (insert "(setq tpu-help-P \"[#<keypress-event P>]\")\n") |
| 339 | (insert "(setq tpu-help-p \"[#<keypress-event p>]\")\n")) | 319 | (insert "(setq tpu-help-p \"[#<keypress-event p>]\")\n")) |
| 340 | (t | 320 | (t |
| 341 | (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter)))) | 321 | (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter)))) |
| 342 | 322 | ||
| 343 | (append-to-buffer "Keys" 1 (point)) | 323 | (append-to-buffer "Keys" 1 (point)) |
| 344 | (set-buffer "Keys") | 324 | (set-buffer "Keys") |
| 345 | 325 | ||
| 346 | ;;; | 326 | ;; Save the key mapping program |
| 347 | ;;; Save the key mapping program | ||
| 348 | ;;; | ||
| 349 | (let ((file | ||
| 350 | (convert-standard-filename | ||
| 351 | (if (featurep 'xemacs) "~/.tpu-lucid-keys" "~/.tpu-keys")))) | ||
| 352 | (set-visited-file-name | ||
| 353 | (read-file-name (format "Save key mapping to file (default %s): " file) "" file))) | ||
| 354 | (save-buffer) | ||
| 355 | 327 | ||
| 356 | ;;; | 328 | (let ((file |
| 357 | ;;; Load the newly defined keys and clean up | 329 | (convert-standard-filename |
| 358 | ;;; | 330 | (if (featurep 'xemacs) "~/.tpu-lucid-keys" "~/.tpu-keys")))) |
| 359 | (eval-buffer) | 331 | (set-visited-file-name |
| 360 | (kill-buffer (current-buffer)) | 332 | (read-file-name (format "Save key mapping to file (default %s): " file) "" file))) |
| 361 | (kill-buffer "*scratch*") | 333 | (save-buffer) |
| 362 | (kill-buffer "Gold-Keys") | ||
| 363 | 334 | ||
| 364 | ;;; | 335 | ;; Load the newly defined keys and clean up |
| 365 | ;;; Let them know it worked. | 336 | |
| 366 | ;;; | 337 | (require 'tpu-edt) |
| 367 | (switch-to-buffer "Directions") | 338 | (eval-buffer) |
| 368 | (erase-buffer) | 339 | (kill-buffer (current-buffer)) |
| 369 | (insert " | 340 | (kill-buffer "*scratch*") |
| 341 | (kill-buffer "Gold-Keys") | ||
| 342 | |||
| 343 | ;; Let them know it worked. | ||
| 344 | |||
| 345 | (switch-to-buffer "Directions") | ||
| 346 | (erase-buffer) | ||
| 347 | (insert " | ||
| 370 | A custom TPU-edt keymap file has been created. | 348 | A custom TPU-edt keymap file has been created. |
| 371 | 349 | ||
| 372 | Press GOLD-k to remove this buffer and continue editing. | 350 | Press GOLD-k to remove this buffer and continue editing. |
| 373 | ") | 351 | ") |
| 374 | (goto-char (point-min)) | 352 | (goto-char (point-min))) |
| 375 | 353 | ||
| 376 | ;; arch-tag: bab5872f-cd3a-4c1c-aedb-047b67646f6c | 354 | ;; arch-tag: bab5872f-cd3a-4c1c-aedb-047b67646f6c |
| 377 | ;;; tpu-mapper.el ends here | 355 | ;;; tpu-mapper.el ends here |