annotate lisp/emulation/tpu-mapper.el @ 112230:c1e8771a1716

Update md5 checksums
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 14 Jan 2011 13:06:07 -0500
parents 417b1e4d63cd
children ef719132ddfa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 14228
diff changeset
1 ;;; tpu-mapper.el --- create a TPU-edt X-windows keymap file
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
74466
1d4b1a32fd66 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68648
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995, 2001, 2002, 2003, 2004,
112218
376148b31b5e Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
5140
9cde7d7fea1f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 4548
diff changeset
8 ;; Keywords: emulations
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
9 ;; Package: tpu-edt
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
4450
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
11 ;; This file is part of GNU Emacs.
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
12
94658
eb7b2376cae5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87568
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
4450
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94658
eb7b2376cae5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87568
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
eb7b2376cae5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87568
diff changeset
16 ;; (at your option) any later version.
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
4450
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
21 ;; GNU General Public License for more details.
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
22
325bc5407213 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 4421
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94658
eb7b2376cae5 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 87568
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
28 ;; This Emacs Lisp program can be used to create an Emacs Lisp file that
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
29 ;; defines the TPU-edt keypad for Emacs running on X-Windows.
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; Code:
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;; Key variables
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;;
7980
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
36 (defvar tpu-kp4 nil)
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
37 (defvar tpu-kp5 nil)
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (defvar tpu-key nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (defvar tpu-enter nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 (defvar tpu-return nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (defvar tpu-key-seq nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 (defvar tpu-enter-seq nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 (defvar tpu-return-seq nil)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;;;
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
46 ;;; Key mapping function
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;;;
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
48 (defun tpu-map-key (ident descrip func gold-func)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
49 (interactive)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
50 (if (featurep 'xemacs)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
51 (progn
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
52 (setq tpu-key-seq (read-key-sequence
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
53 (format "Press %s%s: " ident descrip))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
54 tpu-key (format "[%s]" (event-key (aref tpu-key-seq 0))))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
55 (unless (equal tpu-key tpu-return)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
56 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
57 (insert (format"(global-set-key %s %s)\n" tpu-key func))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
58 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
59 (insert (format "(define-key GOLD-map %s %s)\n" tpu-key gold-func))))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
60 (message "Press %s%s: " ident descrip)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
61 (setq tpu-key-seq (read-event)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
62 tpu-key (format "[%s]" tpu-key-seq))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
63 (unless (equal tpu-key tpu-return)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
64 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
65 (insert (format"(define-key tpu-global-map %s %s)\n" tpu-key func))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
66 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
67 (insert (format "(define-key tpu-gold-map %s %s)\n" tpu-key gold-func))))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
68 (set-buffer "Directions")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
69 tpu-key)
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
71 ;;;###autoload
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
72 (defun tpu-mapper ()
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
73 "Create an Emacs lisp file defining the TPU-edt keypad for X-windows.
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
74
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
75 This command displays an instruction screen showing the TPU-edt keypad
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
76 and asks you to press the TPU-edt editing keys. It uses the keys you
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
77 press to create an Emacs Lisp file that will define a TPU-edt keypad
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
78 for your X server. You can even re-arrange the standard EDT keypad to
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
79 suit your tastes (or to cope with those silly Sun and PC keypads).
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
81 Finally, you will be prompted for the name of the file to store the key
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
82 definitions. If you chose the default, TPU-edt will find it and load it
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
83 automatically. If you specify a different file name, you will need to
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
84 set the variable ``tpu-xkeys-file'' before starting TPU-edt. Here's how
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
85 you might go about doing that in your .emacs file.
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
86
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
87 (setq tpu-xkeys-file (expand-file-name \"~/.my-emacs-x-keys\"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
88 (tpu-edt)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
89
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
90 Known Problems:
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
91
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
92 Sometimes, tpu-mapper will ignore a key you press, and just continue to
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
93 prompt for the same key. This can happen when your window manager sucks
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
94 up the key and doesn't pass it on to Emacs, or it could be an Emacs bug.
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
95 Either way, there's nothing that tpu-mapper can do about it. You must
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
96 press RETURN, to skip the current key and continue. Later, you and/or
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
97 your local X guru can try to figure out why the key is being ignored."
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
98 (interactive)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
99
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
100 ;; Make sure we're running X-windows
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
101
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
102 (if (not window-system)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
103 (error "tpu-mapper requires running Emacs with an X display"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
104
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
105 ;; Make sure the window is big enough to display the instructions
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
106
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
107 (if (featurep 'xemacs) (set-screen-size (selected-screen) 80 36)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
108 (set-frame-size (selected-frame) 80 36))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
109
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
110 ;; Create buffers - Directions, Keys, Gold-Keys
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
111
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
112 (if (not (get-buffer "Directions")) (generate-new-buffer "Directions"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
113 (if (not (get-buffer "Keys")) (generate-new-buffer "Keys"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
114 (if (not (get-buffer "Gold-Keys")) (generate-new-buffer "Gold-Keys"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
115
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
116 ;; Put headers in the Keys buffer
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
117
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
118 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
119 (insert "\
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 ;; Key definitions for TPU-edt
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ")
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
124 ;; Display directions
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
126 (switch-to-buffer "Directions")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
127 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 This program prompts you to press keys to create a custom keymap file
11547
a39d8ae4ed2e At end, use default file name .tpu-keys.
Richard M. Stallman <rms@gnu.org>
parents: 7980
diff changeset
129 for use with the x-windows version of Emacs and TPU-edt.
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 Start by pressing the RETURN key, and continue by pressing the keys
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 specified in the mini-buffer. You can re-arrange the TPU-edt keypad
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 by pressing any key you want at any prompt. If you want to entirely
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 omit a key, just press RETURN at the prompt.
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 Here's a picture of the standard TPU/edt keypad for reference:
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 _______________________ _______________________________
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 | HELP | Do | | | | | |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 |KeyDefs| | | | | | |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 |_______|_______________| |_______|_______|_______|_______|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 _______________________ _______________________________
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 | Find |Insert |Remove | | Gold | HELP |FndNxt | Del L |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 | | |Sto Tex| | key |E-Help | Find |Undel L|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 |_______|_______|_______| |_______|_______|_______|_______|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 |Select |Pre Scr|Nex Scr| | Page | Sect |Append | Del W |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 | Reset |Pre Win|Nex Win| | Do | Fill |Replace|Undel W|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 |_______|_______|_______| |_______|_______|_______|_______|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 |Move up| |Forward|Reverse|Remove | Del C |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 | Top | |Bottom | Top |Insert |Undel C|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 _______|_______|_______ |_______|_______|_______|_______|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 |Mov Lef|Mov Dow|Mov Rig| | Word | EOL | Char | |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 |StaOfLi|Bottom |EndOfLi| |ChngCas|Del EOL|SpecIns| Enter |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 |_______|_______|_______| |_______|_______|_______| |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 | Line |Select | Subs |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 | Open Line | Reset | |
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 |_______________|_______|_______|
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
161 (delete-other-windows)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
162 (goto-char (point-min))
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
164 ;; Save <CR> for future reference
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
166 (cond
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
167 ((featurep 'xemacs)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
168 (setq tpu-return-seq (read-key-sequence "Hit carriage-return <CR> to continue "))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
169 (setq tpu-return (concat "[" (format "%s" (event-key (aref tpu-return-seq 0))) "]")))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
170 (t
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
171 (message "Hit carriage-return <CR> to continue ")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
172 (setq tpu-return-seq (read-event))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
173 (setq tpu-return (concat "[" (format "%s" tpu-return-seq) "]"))))
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
175 ;; Build the keymap file
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
176
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
177 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
178 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;; Arrows
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
182 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
183 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 ;; GOLD Arrows
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
187 (set-buffer "Directions")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
189 (tpu-map-key "Up-Arrow" "" "'tpu-previous-line" "'tpu-move-to-beginning")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
190 (tpu-map-key "Down-arrow" "" "'tpu-next-line" "'tpu-move-to-end")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
191 (tpu-map-key "Right-arrow" "" "'tpu-forward-char" "'end-of-line")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
192 (tpu-map-key "Left-arrow" "" "'tpu-backward-char" "'beginning-of-line")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
194 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
195 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 ;; PF keys
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
199 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
200 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 ;; GOLD PF keys
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
204 (set-buffer "Directions")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
206 (tpu-map-key "PF1" " - The GOLD key" "GOLD-map" "'keyboard-quit")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
207 (tpu-map-key "PF2" " - The Keypad Help key" "'tpu-help" "'help-for-help")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
208 (tpu-map-key "PF3" " - The Find/Find-Next key" "'tpu-search-again" "'tpu-search")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
209 (tpu-map-key "PF4" " - The Del/Undelete Line key" "'tpu-delete-current-line" "'tpu-undelete-lines")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
211 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
212 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ;; KP0-9 KP- KP, KP. and KPenter
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
216 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
217 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 ;; GOLD KP0-9 KP- KP, and KPenter
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
221 (set-buffer "Directions")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
223 (tpu-map-key "KP-0" " - The Line/Open-Line key" "'tpu-line" "'open-line")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
224 (tpu-map-key "KP-1" " - The Word/Change-Case key" "'tpu-word" "'tpu-change-case")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
225 (tpu-map-key "KP-2" " - The EOL/Delete-EOL key" "'tpu-end-of-line" "'tpu-delete-to-eol")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
226 (tpu-map-key "KP-3" " - The Character/Special-Insert key" "'tpu-char" "'tpu-special-insert")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
227 (setq tpu-kp4 (tpu-map-key "KP-4" " - The Forward/Bottom key" "'tpu-advance-direction" "'tpu-move-to-end"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
228 (setq tpu-kp5 (tpu-map-key "KP-5" " - The Reverse/Top key" "'tpu-backup-direction" "'tpu-move-to-beginning"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
229 (tpu-map-key "KP-6" " - The Remove/Insert key" "'tpu-cut" "'tpu-paste")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
230 (tpu-map-key "KP-7" " - The Page/Do key" "'tpu-page" "'execute-extended-command")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
231 (tpu-map-key "KP-8" " - The Section/Fill key" "'tpu-scroll-window" "'tpu-fill")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
232 (tpu-map-key "KP-9" " - The Append/Replace key" "'tpu-append-region" "'tpu-replace")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
233 (tpu-map-key "KP--" " - The Delete/Undelete Word key" "'tpu-delete-current-word" "'tpu-undelete-words")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
234 (tpu-map-key "KP-," " - The Delete/Undelete Character key" "'tpu-delete-current-char" "'tpu-undelete-char")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
235 (tpu-map-key "KP-." " - The Select/Reset key" "'tpu-select" "'tpu-unselect")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
236 (tpu-map-key "KP-Enter" " - The Enter key on the numeric keypad" "'newline" "'tpu-substitute")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
237 ;; Save the enter key
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
238 (setq tpu-enter tpu-key)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
239 (setq tpu-enter-seq tpu-key-seq)
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
241 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
242 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;; Editing keypad (find, insert, remove)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;; (select, prev, next)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
247 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
248 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;; GOLD Editing keypad (find, insert, remove)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;; (select, prev, next)
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
253 (set-buffer "Directions")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
255 (tpu-map-key "Find" " - The Find key on the editing keypad" "'tpu-search" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
256 (tpu-map-key "Insert" " - The Insert key on the editing keypad" "'tpu-paste" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
257 (tpu-map-key "Remove" " - The Remove key on the editing keypad" "'tpu-cut" "'tpu-store-text")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
258 (tpu-map-key "Select" " - The Select key on the editing keypad" "'tpu-select" "'tpu-unselect")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
259 (tpu-map-key "Prev Scr" " - The Prev Scr key on the editing keypad" "'tpu-scroll-window-down" "'tpu-previous-window")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
260 (tpu-map-key "Next Scr" " - The Next Scr key on the editing keypad" "'tpu-scroll-window-up" "'tpu-next-window")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
262 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
263 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 ;; F10-14 Help Do F17
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
267 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
268 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 ;; GOLD F10-14 Help Do F17
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
272 (set-buffer "Directions")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
274 (tpu-map-key "F10" " - Invokes the Exit function on VT200+ terminals" "'tpu-exit" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
275 (tpu-map-key "F11" " - Inserts an Escape character into the text" "'tpu-insert-escape" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
276 (tpu-map-key "Backspace" " - Not Delete nor ^H! Sometimes on the F12 key" "'tpu-next-beginning-of-line" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
277 (tpu-map-key "F13" " - Invokes the delete previous word function" "'tpu-delete-previous-word" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
278 (tpu-map-key "F14" " - Toggles insert/overstrike modes" "'tpu-toggle-overwrite-mode" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
279 (tpu-map-key "Help" " - Brings up the help screen, same as PF2" "'tpu-help" "'describe-bindings")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
280 (tpu-map-key "Do" " - Invokes the COMMAND function" "'execute-extended-command" "'nil")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
281 (tpu-map-key "F17" "" "'tpu-goto-breadcrumb" "'tpu-drop-breadcrumb")
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
283 (set-buffer "Gold-Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
284 (cond
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
285 ((not (equal tpu-enter tpu-return))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
286 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 ;; Minibuffer map additions to make KP_enter = RET
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 ")
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
291 (insert (format "(define-key minibuffer-local-map %s 'exit-minibuffer)\n" tpu-enter))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
292 ;; These are not necessary because they are inherited.
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
293 ;; (insert (format "(define-key minibuffer-local-ns-map %s 'exit-minibuffer)\n" tpu-enter))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
294 ;; (insert (format "(define-key minibuffer-local-completion-map %s 'exit-minibuffer)\n" tpu-enter))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
295 (insert (format "(define-key minibuffer-local-must-match-map %s 'minibuffer-complete-and-exit)\n" tpu-enter))))
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
297 (cond
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
298 ((not (or (equal tpu-kp4 tpu-return) (equal tpu-kp5 tpu-return)))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
299 (insert "
7980
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
300 ;; Minibuffer map additions to allow KP-4/5 termination of search strings.
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
301 ;;
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
302 ")
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
303
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
304 (insert (format "(define-key minibuffer-local-map %s 'tpu-search-forward-exit)\n" tpu-kp4))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
305 (insert (format "(define-key minibuffer-local-map %s 'tpu-search-backward-exit)\n" tpu-kp5))))
7980
0e9eddc5d598 Change size of selected screen. Reposition after
Richard M. Stallman <rms@gnu.org>
parents: 5140
diff changeset
306
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
307 (insert "
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 ;; Define the tpu-help-enter/return symbols
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 ;;
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 ")
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
312 (cond ((featurep 'xemacs)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
313 (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter-seq))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
314 (insert (format "(setq tpu-help-return \"%s\")\n" tpu-return-seq))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
315 (insert "(setq tpu-help-N \"[#<keypress-event N>]\")\n")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
316 (insert "(setq tpu-help-n \"[#<keypress-event n>]\")\n")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
317 (insert "(setq tpu-help-P \"[#<keypress-event P>]\")\n")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
318 (insert "(setq tpu-help-p \"[#<keypress-event p>]\")\n"))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
319 (t
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
320 (insert (format "(setq tpu-help-enter \"%s\")\n" tpu-enter))))
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
322 (append-to-buffer "Keys" 1 (point))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
323 (set-buffer "Keys")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
324
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
325 ;; Save the key mapping program
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
327 (let ((file
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
328 (convert-standard-filename
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
329 (if (featurep 'xemacs) "~/.tpu-lucid-keys" "~/.tpu-keys"))))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
330 (set-visited-file-name
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
331 (read-file-name (format "Save key mapping to file (default %s): " file) "" file)))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
332 (save-buffer)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
333
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
334 ;; Load the newly defined keys and clean up
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
336 (require 'tpu-edt)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
337 (eval-buffer)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
338 (kill-buffer (current-buffer))
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
339 (kill-buffer "*scratch*")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
340 (kill-buffer "Gold-Keys")
11595
74168f918db7 Eval key definitions and clean up upon completion.
Richard M. Stallman <rms@gnu.org>
parents: 11547
diff changeset
341
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
342 ;; Let them know it worked.
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
343
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
344 (switch-to-buffer "Directions")
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
345 (erase-buffer)
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
346 (insert "
11595
74168f918db7 Eval key definitions and clean up upon completion.
Richard M. Stallman <rms@gnu.org>
parents: 11547
diff changeset
347 A custom TPU-edt keymap file has been created.
74168f918db7 Eval key definitions and clean up upon completion.
Richard M. Stallman <rms@gnu.org>
parents: 11547
diff changeset
348
74168f918db7 Eval key definitions and clean up upon completion.
Richard M. Stallman <rms@gnu.org>
parents: 11547
diff changeset
349 Press GOLD-k to remove this buffer and continue editing.
74168f918db7 Eval key definitions and clean up upon completion.
Richard M. Stallman <rms@gnu.org>
parents: 11547
diff changeset
350 ")
87568
a7f6615bcf7f (tpu-mapper): New command. Contains all the code previously at top-level.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 85951
diff changeset
351 (goto-char (point-min)))
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352
81315
19cac94ab3b0 (tpu-emacs-map-key): Use new keymap names.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 75346
diff changeset
353 ;; arch-tag: bab5872f-cd3a-4c1c-aedb-047b67646f6c
4421
95bb7e28d761 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 ;;; tpu-mapper.el ends here