root/trunk/lisp/emulation/tpu-edt.el

Revision 4220, 89.8 kB (checked in by miyoshi, 9 months ago)

Sync up with Emacs22.2.

  • Property svn:eol-style set to LF
Line 
1 ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT
2
3 ;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2004,
4 ;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5
6 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
7 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
8 ;; Version: 4.5
9 ;; Keywords: emulations
10
11 ;; This file is part of GNU Emacs.
12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; any later version.
17
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;; GNU General Public License for more details.
22
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
27
28 ;; TPU-edt is based on tpu.el by Jeff Kowalski and Bob Covey.
29
30 ;;; Commentary:
31
32 ;; %% TPU-edt -- Emacs emulating TPU emulating EDT
33
34 ;; %% Contents
35
36 ;;  % Introduction
37 ;;  % Differences Between TPU-edt and DEC TPU/edt
38 ;;  % Starting TPU-edt
39 ;;  % Customizing TPU-edt using the Emacs Initialization File
40 ;;  % Regular Expressions in TPU-edt
41
42
43 ;; %% Introduction
44
45 ;;    TPU-edt emulates the popular DEC VMS editor EDT (actually, it emulates
46 ;;    DEC TPU's EDT emulation, hence the name TPU-edt).  TPU-edt features the
47 ;;    following TPU/edt functionality:
48
49 ;;     .  EDT keypad
50 ;;     .  On-line help
51 ;;     .  Repeat counts
52 ;;     .  Scroll margins
53 ;;     .  Learn sequences
54 ;;     .  Free cursor mode
55 ;;     .  Rectangular cut and paste
56 ;;     .  Multiple windows and buffers
57 ;;     .  TPU line-mode REPLACE command
58 ;;     .  Wild card search and substitution
59 ;;     .  Configurable through an initialization file
60 ;;     .  History recall of search strings, file names, and commands
61
62 ;;    Please note that TPU-edt does NOT emulate TPU.  It emulates TPU's EDT
63 ;;    emulation.  Very few TPU line-mode commands are supported.
64
65 ;;    TPU-edt, like its VMS cousin, works on VT-series terminals with DEC
66 ;;    style keyboards.  VT terminal emulators, including xterm with the
67 ;;    appropriate key translations, work just fine too.
68
69 ;;    TPU-edt works with X-windows.  This is accomplished through a TPU-edt X
70 ;;    key map.  The TPU-edt module tpu-mapper creates this map and stores it
71 ;;    in a file.  Tpu-mapper will be run automatically the first time you
72 ;;    invoke the X-windows version of emacs, or you can run it by hand.  See
73 ;;    the commentary in tpu-mapper.el for details.
74
75
76 ;; %% Differences Between TPU-edt and DEC TPU/edt
77
78 ;;    In some cases, Emacs doesn't support text highlighting, so selected
79 ;;    regions are not shown in inverse video.  Emacs uses the concept of "the
80 ;;    mark".  The mark is set at one end of a selected region; the cursor is
81 ;;    at the other.  In cases where the selected region cannot be shown in
82 ;;    inverse video an at sign (@) appears in the mode line when mark is set.
83 ;;    The native emacs command ^X^X (Control-X twice) exchanges the cursor
84 ;;    with the mark; this provides a handy way to find the location of the
85 ;;    mark.
86
87 ;;    In TPU the cursor can be either bound or free.  Bound means the cursor
88 ;;    cannot wander outside the text of the file being edited.  Free means
89 ;;    the arrow keys can move the cursor past the ends of lines.  Free is the
90 ;;    default mode in TPU; bound is the only mode in EDT.  Bound is the only
91 ;;    mode in the base version of TPU-edt; optional extensions add an
92 ;;    approximation of free mode, see the commentary in tpu-extras.el for
93 ;;    details.
94
95 ;;    Like TPU, emacs uses multiple buffers.  Some buffers are used to hold
96 ;;    files you are editing; other "internal" buffers are used for emacs' own
97 ;;    purposes (like showing you help).  Here are some commands for dealing
98 ;;    with buffers.
99
100 ;;       Gold-B   moves to next buffer, including internal buffers
101 ;;       Gold-N   moves to next buffer containing a file
102 ;;       Gold-M   brings up a buffer menu (like TPU "show buffers")
103
104 ;;    Emacs is very fond of throwing up new windows.  Dealing with all these
105 ;;    windows can be a little confusing at first, so here are a few commands
106 ;;    to that may help:
107
108 ;;       Gold-Next_Scr  moves to the next window on the screen
109 ;;       Gold-Prev_Scr  moves to the previous window on the screen
110 ;;       Gold-TAB       also moves to the next window on the screen
111
112 ;;       Control-x 1    deletes all but the current window
113 ;;       Control-x 0    deletes the current window
114
115 ;;    Note that the buffers associated with deleted windows still exist!
116
117 ;;    Like TPU, TPU-edt has a "command" function, invoked with Gold-KP7 or
118 ;;    Do.  Most of the commands available are emacs commands.  Some TPU
119 ;;    commands are available, they are: replace, exit, quit, include, and
120 ;;    Get (unfortunately, "get" is an internal emacs function, so we are
121 ;;    stuck with "Get" - to make life easier, Get is available as Gold-g).
122
123 ;;    TPU-edt supports the recall of commands, file names, and search
124 ;;    strings.  The history of strings recalled differs slightly from
125 ;;    TPU/edt, but it is still very convenient.
126
127 ;;    Help is available!  The traditional help keys (Help and PF2) display
128 ;;    a small help file showing the default keypad layout, control key
129 ;;    functions, and Gold key functions.  Pressing any key inside of help
130 ;;    splits the screen and prints a description of the function of the
131 ;;    pressed key.  Gold-PF2 invokes the native emacs help, with its
132 ;;    zillions of options.
133
134 ;;    Thanks to emacs, TPU-edt has some extensions that may make your life
135 ;;    easier, or at least more interesting.  For example, Gold-r toggles
136 ;;    TPU-edt rectangular mode.  In rectangular mode, Remove and Insert work
137 ;;    on rectangles.  Likewise, Gold-* toggles TPU-edt regular expression
138 ;;    mode.  In regular expression mode Find, Find Next, and the line-mode
139 ;;    replace command work with regular expressions.  [A regular expression
140 ;;    is a pattern that denotes a set of strings; like VMS wildcards.]
141
142 ;;    Emacs also gives TPU-edt the undo and occur functions.  Undo does
143 ;;    what it says; it undoes the last change.  Multiple undos in a row
144 ;;    undo multiple changes.  For your convenience, undo is available on
145 ;;    Gold-u.  Occur shows all the lines containing a specific string in
146 ;;    another window.  Moving to that window, and typing ^C^C (Control-C
147 ;;    twice) on a particular line moves you back to the original window
148 ;;    at that line.  Occur is on Gold-o.
149
150 ;;    Finally, as you edit, remember that all the power of emacs is at
151 ;;    your disposal.  It really is a fantastic tool.  You may even want to
152 ;;    take some time and read the emacs tutorial; perhaps not to learn the
153 ;;    native emacs key bindings, but to get a feel for all the things
154 ;;    emacs can do for you.  The emacs tutorial is available from the
155 ;;    emacs help function: "Gold-PF2 t"
156
157
158 ;; %% Starting TPU-edt
159
160 ;;    All you have to do to start TPU-edt, is turn it on.  This can be
161 ;;    done from the command line when running emacs.
162
163 ;;        prompt> emacs -f tpu-edt
164
165 ;;    If you've already started emacs, turn on TPU-edt using the tpu-edt
166 ;;    command.  First press `M-x' (that's usually `ESC' followed by `x')
167 ;;    and type `tpu-edt' followed by a carriage return.
168
169 ;;    If you like TPU-edt and want to use it all the time, you can start
170 ;;    TPU-edt using the emacs initialization file, .emacs.  Simply create
171 ;;    a .emacs file in your home directory containing the line:
172
173 ;;        (tpu-edt)
174
175 ;;    That's all you need to do to start TPU-edt.
176
177
178 ;; %% Customizing TPU-edt using the Emacs Initialization File
179
180 ;;    The following is a sample emacs initialization file.  It shows how to
181 ;;    invoke TPU-edt, and how to customize it.
182
183 ;;    ; .emacs - a sample emacs initialization file
184
185 ;;    ; Turn on TPU-edt
186 ;;    (tpu-edt)
187
188 ;;    ; Set scroll margins 10% (top) and 15% (bottom).
189 ;;    (tpu-set-scroll-margins "10%" "15%")
190
191 ;;    ; Load the vtxxx terminal control functions.
192 ;;    (load "vt-control" t)
193
194 ;;    ; TPU-edt treats words like EDT; here's how to add word separators.
195 ;;    ; Note that backslash (\) and double quote (") are quoted with '\'.
196 ;;    (tpu-add-word-separators "]\\[-_,.\"=+()'/*#:!&;$")
197
198 ;;    ; Emacs is happy to save files without a final newline; other Unix
199 ;;    ; programs hate that!  Here we make sure that files end with newlines.
200 ;;    (setq require-final-newline t)
201
202 ;;    ; Emacs uses Control-s and Control-q.  Problems can occur when using
203 ;;    ; emacs on terminals that use these codes for flow control (Xon/Xoff
204 ;;    ; flow control).  These lines disable emacs' use of these characters.
205 ;;    (global-unset-key "\C-s")
206 ;;    (global-unset-key "\C-q")
207
208 ;;    ; The emacs universal-argument function is very useful.
209 ;;    ; This line maps universal-argument to Gold-PF1.
210 ;;    (define-key GOLD-SS3-map "P" 'universal-argument)          ; Gold-PF1
211
212 ;;    ; Make KP7 move by paragraphs, instead of pages.
213 ;;    (define-key SS3-map "w" 'tpu-paragraph)                    ; KP7
214
215 ;;    ; Repeat the preceding mappings for X-windows.
216 ;;    (cond
217 ;;     (window-system
218 ;;      (global-set-key [kp_7] 'tpu-paragraph)                   ; KP7
219 ;;      (define-key GOLD-map [kp_f1] 'universal-argument)))      ; GOLD-PF1
220
221 ;;    ; Display the TPU-edt version.
222 ;;    (tpu-version)
223
224
225 ;; %% Regular Expressions in TPU-edt
226
227 ;;    Gold-* toggles TPU-edt regular expression mode.  In regular expression
228 ;;    mode, find, find next, replace, and substitute accept emacs regular
229 ;;    expressions.  A complete list of emacs regular expressions can be found
230 ;;    using the emacs "info" command (it's somewhat like the VMS help
231 ;;    command).  Try the following sequence of commands:
232
233 ;;        DO info             <enter info mode>
234 ;;        m emacs             <select the "emacs" topic>
235 ;;        m regexs            <select the "regular expression" topic>
236
237 ;;    Type "q" to quit out of info mode.
238
239 ;;    There is a problem in regular expression mode when searching for empty
240 ;;    strings, like beginning-of-line (^) and end-of-line ($).  When searching
241 ;;    for these strings, find-next may find the current string, instead of the
242 ;;    next one.  This can cause global replace and substitute commands to loop
243 ;;    forever in the same location.  For this reason, commands like
244
245 ;;        replace "^" "> "       <add "> " to beginning of line>
246 ;;        replace "$" "00711"    <add "00711" to end of line>
247
248 ;;    may not work properly.
249
250 ;;    Commands like those above are very useful for adding text to the
251 ;;    beginning or end of lines.  They might work on a line-by-line basis, but
252 ;;    go into an infinite loop if the "all" response is specified.  If the
253 ;;    goal is to add a string to the beginning or end of a particular set of
254 ;;    lines TPU-edt provides functions to do this.
255
256 ;;        Gold-^  Add a string at BOL in region or buffer
257 ;;        Gold-$  Add a string at EOL in region or buffer
258
259 ;;    There is also a TPU-edt interface to the native emacs string replacement
260 ;;    commands.  Gold-/ invokes this command.  It accepts regular expressions
261 ;;    if TPU-edt is in regular expression mode.  Given a repeat count, it will
262 ;;    perform the replacement without prompting for confirmation.
263
264 ;;    This command replaces empty strings correctly, however, it has its
265 ;;    drawbacks.  As a native emacs command, it has a different interface
266 ;;    than the emulated TPU commands.  Also, it works only in the forward
267 ;;    direction, regardless of the current TPU-edt direction.
268
269 ;;; Todo/Bugs:
270
271 ;; We shouldn't use vt100 ESC sequences since it is uselessly fighting
272 ;; against function-key-map.  Better use real key names.
273
274 ;;; Code:
275
276 (eval-when-compile (require 'cl))
277 ;; we use picture-mode functions
278 (require 'picture)
279
280 (defgroup tpu nil
281   "Emacs emulating TPU emulating EDT."
282   :prefix "tpu-"
283   :group 'emulations)
284
285
286 ;;;
287 ;;;  Version Information
288 ;;;
289 (defconst tpu-version "4.5" "TPU-edt version number.")
290
291
292 ;;;
293 ;;;  User Configurable Variables
294 ;;;
295 (defcustom tpu-have-ispell t
296   "*If non-nil (default), TPU-edt uses ispell for spell checking."
297   :type 'boolean
298   :group 'tpu)
299
300 (defcustom tpu-kill-buffers-silently nil
301   "*If non-nil, TPU-edt kills modified buffers without asking."
302   :type 'boolean
303   :group 'tpu)
304
305 (defcustom tpu-percent-scroll 75
306   "*Percentage of the screen to scroll for next/previous screen commands."
307   :type 'integer
308   :group 'tpu)
309
310 (defcustom tpu-pan-columns 16
311   "*Number of columns the tpu-pan functions scroll left or right."
312   :type 'integer
313   :group 'tpu)
314
315
316 ;;;
317 ;;;  Emacs version identifiers - currently referenced by
318 ;;;
319 ;;;     o tpu-mark              o tpu-set-mark
320 ;;;     o mode line section     o tpu-load-xkeys
321 ;;;
322 (defconst tpu-lucid-emacs-p
323   (string-match "Lucid" emacs-version)
324   "Non-nil if we are running Lucid Emacs.")
325
326 ;;;
327 ;;;  Global Keymaps
328 ;;;
329 (defvar CSI-map
330   (let ((map (make-sparse-keymap)))
331     (define-key map "A" 'tpu-previous-line)               ; up
332     (define-key map "B" 'tpu-next-line)                   ; down
333     (define-key map "D" 'tpu-backward-char)               ; left
334     (define-key map "C" 'tpu-forward-char)                ; right
335
336     (define-key map "1~" 'tpu-search)                     ; Find
337     (define-key map "2~" 'tpu-paste)                      ; Insert Here
338     (define-key map "3~" 'tpu-cut)                        ; Remove
339     (define-key map "4~" 'tpu-select)                     ; Select
340     (define-key map "5~" 'tpu-scroll-window-down)         ; Prev Screen
341     (define-key map "6~" 'tpu-scroll-window-up)           ; Next Screen
342
343     (define-key map "11~" 'nil)                           ; F1
344     (define-key map "12~" 'nil)                           ; F2
345     (define-key map "13~" 'nil)                           ; F3
346     (define-key map "14~" 'nil)                           ; F4
347     (define-key map "15~" 'nil)                           ; F5
348     (define-key map "17~" 'nil)                           ; F6
349     (define-key map "18~" 'nil)                           ; F7
350     (define-key map "19~" 'nil)                           ; F8
351     (define-key map "20~" 'nil)                           ; F9
352     (define-key map "21~" 'tpu-exit)                      ; F10
353     (define-key map "23~" 'tpu-insert-escape)             ; F11 (ESC)
354     (define-key map "24~" 'tpu-next-beginning-of-line)    ; F12 (BS)
355     (define-key map "25~" 'tpu-delete-previous-word)      ; F13 (LF)
356     (define-key map "26~" 'tpu-toggle-overwrite-mode)     ; F14
357     (define-key map "28~" 'tpu-help)                      ; HELP
358     (define-key map "29~" 'execute-extended-command)      ; DO
359     (define-key map "31~" 'tpu-goto-breadcrumb)           ; F17
360     (define-key map "32~" 'nil)                           ; F18
361     (define-key map "33~" 'nil)                           ; F19
362     (define-key map "34~" 'nil)                           ; F20
363     map)
364   "Maps the CSI function keys on the VT100 keyboard.
365 CSI is DEC's name for the sequence <ESC>[.")
366
367 (defvar GOLD-CSI-map
368   (let ((map (make-sparse-keymap)))
369     (define-key map "A" 'tpu-move-to-beginning)      ; up-arrow
370     (define-key map "B" 'tpu-move-to-end)            ; down-arrow
371     (define-key map "C" 'end-of-line)                ; right-arrow
372     (define-key map "D" 'beginning-of-line)          ; left-arrow
373
374     (define-key map "1~" 'nil)                       ; Find
375     (define-key map "2~" 'nil)                       ; Insert Here
376     (define-key map "3~" 'tpu-store-text)            ; Remove
377     (define-key map "4~" 'tpu-unselect)              ; Select
378     (define-key map "5~" 'tpu-previous-window)       ; Prev Screen
379     (define-key map "6~" 'tpu-next-window)           ; Next Screen
380
381     (define-key map "11~" 'nil)                      ; F1
382     (define-key map "12~" 'nil)                      ; F2
383     (define-key map "13~" 'nil)                      ; F3
384     (define-key map "14~" 'nil)                      ; F4
385     (define-key map "16~" 'nil)                      ; F5
386     (define-key map "17~" 'nil)                      ; F6
387     (define-key map "18~" 'nil)                      ; F7
388     (define-key map "19~" 'nil)                      ; F8
389     (define-key map "20~" 'nil)                      ; F9
390     (define-key map "21~" 'nil)                      ; F10
391     (define-key map "23~" 'nil)                      ; F11
392     (define-key map "24~" 'nil)                      ; F12
393     (define-key map "25~" 'nil)                      ; F13
394     (define-key map "26~" 'nil)                      ; F14
395     (define-key map "28~" 'describe-bindings)        ; HELP
396     (define-key map "29~" 'nil)                      ; DO
397     (define-key map "31~" 'tpu-drop-breadcrumb)      ; F17
398     (define-key map "32~" 'nil)                      ; F18
399     (define-key map "33~" 'nil)                      ; F19
400     (define-key map "34~" 'nil)                      ; F20
401     map)
402   "Maps the function keys on the VT100 keyboard preceded by GOLD-CSI.")
403
404 (defvar GOLD-SS3-map
405   (let ((map (make-sparse-keymap)))
406     (define-key map "A" 'tpu-move-to-beginning)      ; up-arrow
407     (define-key map "B" 'tpu-move-to-end)            ; down-arrow
408     (define-key map "C" 'end-of-line)                ; right-arrow
409     (define-key map "D" 'beginning-of-line)          ; left-arrow
410
411     (define-key map "P" 'keyboard-quit)              ; PF1
412     (define-key map "Q" 'help-for-help)              ; PF2
413     (define-key map "R" 'tpu-search)                 ; PF3
414     (define-key map "S" 'tpu-undelete-lines)         ; PF4
415     (define-key map "p" 'open-line)                  ; KP0
416     (define-key map "q" 'tpu-change-case)            ; KP1
417     (define-key map "r" 'tpu-delete-to-eol)          ; KP2
418     (define-key map "s" 'tpu-special-insert)         ; KP3
419     (define-key map "t" 'tpu-move-to-end)            ; KP4
420     (define-key map "u" 'tpu-move-to-beginning)      ; KP5
421     (define-key map "v" 'tpu-paste)                  ; KP6
422     (define-key map "w" 'execute-extended-command)   ; KP7
423     (define-key map "x" 'tpu-fill)                   ; KP8
424     (define-key map "y" 'tpu-replace)                ; KP9
425     (define-key map "m" 'tpu-undelete-words)         ; KP-
426     (define-key map "l" 'tpu-undelete-char)          ; KP,
427     (define-key map "n" 'tpu-unselect)               ; KP.
428     (define-key map "M" 'tpu-substitute)             ; KPenter
429     map)
430   "Maps the function keys on the VT100 keyboard preceded by GOLD-SS3.")
431
432 (defvar GOLD-map
433   (let ((map (make-keymap)))
434     (define-key map "\e[" GOLD-CSI-map)                  ; GOLD-CSI map
435     (define-key map "\eO" GOLD-SS3-map)                  ; GOLD-SS3 map
436     ;;
437     (define-key map "\C-A" 'tpu-toggle-overwrite-mode)   ; ^A
438     (define-key map "\C-B" 'nil)                         ; ^B
439     (define-key map "\C-C" 'nil)                         ; ^C
440     (define-key map "\C-D" 'nil)                         ; ^D
441     (define-key map "\C-E" 'nil)                         ; ^E
442     (define-key map "\C-F" 'set-visited-file-name)       ; ^F
443     (define-key map "\C-g" 'keyboard-quit)               ; safety first
444     (define-key map "\C-h" 'delete-other-windows)        ; BS
445     (define-key map "\C-i" 'other-window)                ; TAB
446     (define-key map "\C-J" 'nil)                         ; ^J
447     (define-key map "\C-K" 'tpu-define-macro-key)        ; ^K
448     (define-key map "\C-l" 'downcase-region)             ; ^L
449     (define-key map "\C-M" 'nil)                         ; ^M
450     (define-key map "\C-N" 'nil)                         ; ^N
451     (define-key map "\C-O" 'nil)                         ; ^O
452     (define-key map "\C-P" 'nil)                         ; ^P
453     (define-key map "\C-Q" 'nil)                         ; ^Q
454     (define-key map "\C-R" 'nil)                         ; ^R
455     (define-key map "\C-S" 'nil)                         ; ^S
456     (define-key map "\C-T" 'tpu-toggle-control-keys)     ; ^T
457     (define-key map "\C-u" 'upcase-region)               ; ^U
458     (define-key map "\C-V" 'nil)                         ; ^V
459     (define-key map "\C-w" 'tpu-write-current-buffers)   ; ^W
460     (define-key map "\C-X" 'nil)                         ; ^X
461     (define-key map "\C-Y" 'nil)                         ; ^Y
462     (define-key map "\C-Z" 'nil)                         ; ^Z
463     (define-key map " " 'undo)                           ; SPC
464     (define-key map "!" 'nil)                            ; !
465     (define-key map "#" 'nil)                            ; #
466     (define-key map "$" 'tpu-add-at-eol)                 ; $
467     (define-key map "%" 'tpu-goto-percent)               ; %
468     (define-key map "&" 'nil)                            ; &
469     (define-key map "(" 'nil)                            ; (
470     (define-key map ")" 'nil)                            ; )
471     (define-key map "*" 'tpu-toggle-regexp)              ; *
472     (define-key map "+" 'nil)                            ; +
473     (define-key map "," 'tpu-goto-breadcrumb)            ; ,
474     (define-key map "-" 'negative-argument)              ; -
475     (define-key map "." 'tpu-drop-breadcrumb)            ; .
476     (define-key map "/" 'tpu-emacs-replace)              ; /
477     (define-key map "0" 'digit-argument)                 ; 0
478     (define-key map "1" 'digit-argument)                 ; 1
479     (define-key map "2" 'digit-argument)                 ; 2
480     (define-key map "3" 'digit-argument)                 ; 3
481     (define-key map "4" 'digit-argument)                 ; 4
482     (define-key map "5" 'digit-argument)                 ; 5
483     (define-key map "6" 'digit-argument)                 ; 6
484     (define-key map "7" 'digit-argument)                 ; 7
485     (define-key map "8" 'digit-argument)                 ; 8
486     (define-key map "9" 'digit-argument)                 ; 9
487     (define-key map ":" 'nil)                            ; :
488     (define-key map ";" 'tpu-trim-line-ends)             ; ;
489     (define-key map "<" 'nil)                            ; <
490     (define-key map "=" 'nil)                            ; =
491     (define-key map ">" 'nil)                            ; >
492     (define-key map "?" 'tpu-spell-check)                ; ?
493     (define-key map "A" 'tpu-toggle-newline-and-indent)  ; A
494     (define-key map "B" 'tpu-next-buffer)                ; B
495     (define-key map "C" 'repeat-complex-command)         ; C
496     (define-key map "D" 'shell-command)                  ; D
497     (define-key map "E" 'tpu-exit)                       ; E
498     (define-key map "F" 'tpu-set-cursor-free)            ; F
499     (define-key map "G" 'tpu-get)                        ; G
500     (define-key map "H" 'nil)                            ; H
501     (define-key map "I" 'tpu-include)                    ; I
502     (define-key map "K" 'tpu-kill-buffer)                ; K
503     (define-key map "L" 'tpu-what-line)                  ; L
504     (define-key map "M" 'buffer-menu)                    ; M
505     (define-key map "N" 'tpu-next-file-buffer)           ; N
506     (define-key map "O" 'occur)                          ; O
507     (define-key map "P" 'lpr-buffer)                     ; P
508     (define-key map "Q" 'tpu-quit)                       ; Q
509     (define-key map "R" 'tpu-toggle-rectangle)           ; R
510     (define-key map "S" 'replace)                        ; S
511     (define-key map "T" 'tpu-line-to-top-of-window)      ; T
512     (define-key map "U" 'undo)                           ; U
513     (define-key map "V" 'tpu-version)                    ; V
514     (define-key map "W" 'save-buffer)                    ; W
515     (define-key map "X" 'tpu-save-all-buffers-kill-emacs) ; X
516     (define-key map "Y" 'copy-region-as-kill)             ; Y
517     (define-key map "Z" 'suspend-emacs)                   ; Z
518     (define-key map "[" 'blink-matching-open)             ; [
519     (define-key map "\\" 'nil)                            ; \
520     (define-key map "]" 'blink-matching-open)             ; ]
521     (define-key map "^" 'tpu-add-at-bol)                  ; ^
522     (define-key map "_" 'split-window-vertically)         ; -
523     (define-key map "`" 'what-line)                       ; `
524     (define-key map "a" 'tpu-toggle-newline-and-indent)   ; a
525     (define-key map "b" 'tpu-next-buffer)                 ; b
526     (define-key map "c" 'repeat-complex-command)          ; c
527     (define-key map "d" 'shell-command)                   ; d
528     (define-key map "e" 'tpu-exit)                        ; e
529     (define-key map "f" 'tpu-set-cursor-free)             ; f
530     (define-key map "g" 'tpu-get)                         ; g
531     (define-key map "h" 'nil)                             ; h
532     (define-key map "i" 'tpu-include)                     ; i
533     (define-key map "k" 'tpu-kill-buffer)                 ; k
534     (define-key map "l" 'goto-line)                       ; l
535     (define-key map "m" 'buffer-menu)                     ; m
536     (define-key map "n" 'tpu-next-file-buffer)            ; n
537     (define-key map "o" 'occur)                           ; o
538     (define-key map "p" 'lpr-region)                      ; p
539     (define-key map "q" 'tpu-quit)                        ; q
540     (define-key map "r" 'tpu-toggle-rectangle)            ; r
541     (define-key map "s" 'replace)                         ; s
542     (define-key map "t" 'tpu-line-to-top-of-window)       ; t
543     (define-key map "u" 'undo)                            ; u
544     (define-key map "v" 'tpu-version)                     ; v
545     (define-key map "w" 'save-buffer)                     ; w
546     (define-key map "x" 'tpu-save-all-buffers-kill-emacs) ; x
547     (define-key map "y" 'copy-region-as-kill)             ; y
548     (define-key map "z" 'suspend-emacs)                   ; z
549     (define-key map "{" 'nil)                             ; {
550     (define-key map "|" 'split-window-horizontally)       ; |
551     (define-key map "}" 'nil)                             ; }
552     (define-key map "~" 'exchange-point-and-mark)         ; ~
553     (define-key map "\177" 'delete-window)                ; <X]
554     map)
555   "Maps the function keys on the VT100 keyboard preceded by PF1.
556 GOLD is the ASCII 7-bit escape sequence <ESC>OP.")
557
558 (defvar SS3-map
559   (let ((map (make-sparse-keymap)))
560     (define-key map "P" GOLD-map)                         ; GOLD map
561     ;;
562     (define-key map "A" 'tpu-previous-line)               ; up
563     (define-key map "B" 'tpu-next-line)                   ; down
564     (define-key map "C" 'tpu-forward-char)                ; right
565     (define-key map "D" 'tpu-backward-char)               ; left
566
567     (define-key map "Q" 'tpu-help)                        ; PF2
568     (define-key map "R" 'tpu-search-again)                ; PF3
569     (define-key map "S" 'tpu-delete-current-line)