Anonymous avatar Anonymous committed 922dca3

Created

Comments (0)

Files changed (9)

+1998-01-03  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Update to newer package interface.
+
+1997-12-24  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile: Created.
+# Makefile for EDT emulation lisp code
+
+# This file is part of XEmacs.
+
+# XEmacs is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2, or (at your option) any
+# later version.
+
+# XEmacs is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with XEmacs; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+VERSION = 1.02
+PACKAGE = edt
+PKG_TYPE = regular
+REQUIRES = xemacs-base
+CATEGORY = wp
+
+ELCS = edt-lk201.elc edt-mapper.elc edt-pc.elc edt-vt100.elc edt.elc
+
+include ../../XEmacs.rules
+
+all:: $(ELCS) auto-autoloads.elc
+
+srckit: srckit-std
+
+binkit: all
+	-rm -rf $(STAGING)/lisp/$(PACKAGE)
+	-mkdir -p $(STAGING)/lisp/$(PACKAGE)
+	-rm -rf $(STAGING)/etc/edt-user.doc
+	cp -a ChangeLog *.el* $(STAGING)/lisp/$(PACKAGE)
+	cp -a edt-user.doc $(STAGING)/etc
+	(cd $(STAGING); \
+	rm -f $(PACKAGE)-$(VERSION)-pkg.tar*; \
+	tar cf $(PACKAGE)-$(VERSION)-pkg.tar lisp/$(PACKAGE) \
+		etc/edt-user.doc; \
+	gzip -v9 $(PACKAGE)-$(VERSION)-pkg.tar)
+;;; edt-lk201.el --- Enhanced EDT Keypad Mode Emulation for LK-201 Keyboards
+
+;; Copyright (C) 1986, 1992, 1993, 1995 Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: FSF 19.34
+
+;;; Usage:
+
+;;  See edt-user.doc in the Emacs etc directory.
+
+;; ====================================================================
+
+;;;;
+;;;; KEY TRANSLATIONS
+;;;;
+
+;; Associate EDT keynames with Emacs terminal function vector names.
+;; (Function key vector names for LK-201 are found in lisp/term/lk201.el.)
+;;
+;; F1 - F5 are not available on many DEC VT series terminals.
+;; However, this is not always the case.  So support for F1 - F5 is
+;; provided here and in lisp/term/lk201.el.
+(defconst *EDT-keys*
+  '(("KP0" . [kp-0]) ("KP1" . [kp-1]) ("KP2" . [kp-2]) ("KP3" . [kp-3]) 
+    ("KP4" . [kp-4]) ("KP5" . [kp-5]) ("KP6" . [kp-6]) ("KP7" . [kp-7])
+    ("KP8" . [kp-8]) ("KP9" . [kp-9]) ("KP," . [kp-separator])
+    ("KP-" . [kp-subtract]) ("KPP" . [kp-decimal]) ("KPE" . [kp-enter])
+    ("PF1" . [kp-f1]) ("PF2" . [kp-f2]) ("PF3" . [kp-f3]) ("PF4" . [kp-f4])
+    ("UP" . [up]) ("DOWN" . [down]) ("RIGHT" . [right]) ("LEFT" . [left])
+    ("FIND" . [find]) ("INSERT" . [insert]) ("REMOVE" . [delete])
+    ("SELECT" . [select]) ("PREVIOUS" . [prior]) ("NEXT" . [next])
+    ("F1" . [f1]) ("F2" . [f2]) ("F3" . [f3]) ("F4" . [f4]) ("F5" . [f5])
+    ("F6" . [f6]) ("F7" . [f7]) ("F8" . [f8]) ("F9" . [f9]) ("F10" . [f10])
+    ("F11" . [f11]) ("F12" . [f12]) ("F13" . [f13]) ("F14" . [f14])
+    ("HELP" . [help]) ("DO" . [menu]) ("F17" . [f17]) ("F18" . [f18])
+    ("F19" . [f19]) ("F20" . [f20])))
+;;; edt-mapper.el --- Create an EDT LK-201 Map File for X-Windows Emacs
+
+;; Copyright (C) 1994, 1995  Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: FSF 19.34
+
+;;; Commentary:
+
+;;  This emacs lisp program can be used to create an emacs lisp file
+;;  that defines the mapping of the user's keyboard under X-Windows to
+;;  the LK-201 keyboard function keys and keypad keys (around which
+;;  EDT has been designed).  Please read the "Usage" AND "Known
+;;  Problems" sections before attempting to run this program.  (The
+;;  design of this file, edt-mapper.el, was heavily influenced by
+;;  tpu-mapper.el.) 
+
+;;; Usage:
+
+;;  Simply load this file into the X-Windows version of emacs (version 19)
+;;  using the following command.
+
+;;    emacs -q -l edt-mapper.el
+
+;;  The "-q" option prevents loading of your .emacs file (commands therein
+;;  might confuse this program).
+
+;;  An instruction screen showing the typical LK-201 terminal functions keys
+;;  will be displayed, and you will be prompted to press the keys on your
+;;  keyboard which you want to emulate the corresponding LK-201 keys.
+
+;;  Finally, you will be prompted for the name of the file to store
+;;  the key definitions.  If you chose the default, it will be found
+;;  and loaded automatically when the EDT emulation is started.  If
+;;  you specify a different file name, you will need to set the
+;;  variable "edt-xkeys-file" before starting the EDT emulation.
+;;  Here's how you might go about doing that in your .emacs file.
+
+;;    (setq edt-xkeys-file (expand-file-name "~/.my-emacs-x-keys"))
+
+;;; Known Problems:
+
+;;  Sometimes, edt-mapper will ignore a key you press, and just continue to
+;;  prompt for the same key.  This can happen when your window manager sucks
+;;  up the key and doesn't pass it on to emacs, or it could be an emacs bug.
+;;  Either way, there's nothing that edt-mapper can do about it.  You must
+;;  press RETURN, to skip the current key and continue.  Later, you and/or
+;;  your local X guru can try to figure out why the key is being ignored.
+
+;; ====================================================================
+
+;;;
+;;;  Make sure we're running X-windows and Emacs version 19
+;;;
+(cond
+ ((not (and window-system (not (string-lessp emacs-version "19"))))
+  (insert "
+
+    Whoa!  This isn't going to work...
+
+    You must run edt-mapper.el under X-windows and Emacs version 19.
+
+    Press any key to exit.  ")
+  (sit-for 600)
+  (kill-emacs t)))
+
+
+;;;
+;;;  Decide whether we're running GNU or Lucid emacs.
+;;;
+(defconst edt-lucid-emacs19-p (string-match "XEmacs" emacs-version)
+  "Non-NIL if we are running XEmacs.")
+
+
+;;;
+;;;  Key variables
+;;;
+(defvar edt-key nil)
+(defvar edt-enter nil)
+(defvar edt-return nil)
+(defvar edt-key-seq nil)
+(defvar edt-enter-seq nil)
+(defvar edt-return-seq nil)
+
+
+;;;
+;;;  Make sure the window is big enough to display the instructions
+;;;
+(if edt-lucid-emacs19-p (set-screen-size nil 80 36)
+  (set-frame-size (selected-frame) 80 36))
+
+
+;;;
+;;;  Create buffers - Directions and Keys
+;;;
+(if (not (get-buffer "Directions")) (generate-new-buffer "Directions"))
+(if (not (get-buffer "Keys")) (generate-new-buffer "Keys"))
+
+;;;
+;;;  Put header in the Keys buffer
+;;;
+(set-buffer "Keys")
+(insert "\
+;;
+;;  Key definitions for the EDT emulation within GNU Emacs
+;;
+
+(defconst *EDT-keys*
+  '(
+")
+
+;;;
+;;;   Display directions
+;;;
+(switch-to-buffer "Directions")
+(insert "
+                                  EDT MAPPER
+
+    You will be asked to press keys to create a custom mapping (under
+    X-Windows) of your keypad keys and function keys so that they can emulate
+    the LK-201 keypad and function keys or the subset of keys found on a 
+    VT-100 series terminal keyboard.  (The LK-201 keyboard is the standard
+    keyboard attached to VT-200 series terminals, and above.)  
+
+    Sometimes, edt-mapper will ignore a key you press, and just continue to
+    prompt for the same key.  This can happen when your window manager sucks
+    up the key and doesn't pass it on to emacs, or it could be an emacs bug.
+    Either way, there's nothing that edt-mapper can do about it.  You must
+    press RETURN, to skip the current key and continue.  Later, you and/or
+    your local X guru can try to figure out why the key is being ignored.
+
+    Start by pressing the RETURN key, and continue by pressing the keys
+    specified in the mini-buffer.  If you want to entirely omit a key, 
+    because your keyboard does not have a corresponding key, for example, 
+    just press RETURN at the prompt.
+
+")
+(delete-other-windows)
+
+;;;
+;;;  Save <CR> for future reference
+;;;
+(cond
+ (edt-lucid-emacs19-p
+  (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue "))
+  (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]")))
+ (t
+  (message "Hit carriage-return <CR> to continue ")
+  (setq edt-return-seq (read-event))
+  (setq edt-return (concat "[" (format "%s" edt-return-seq) "]")))) 
+
+;;;
+;;;   Display Keypad Diagram and Begin Prompting for Keys
+;;;
+(set-buffer "Directions")
+(delete-region (point-min) (point-max))
+(insert "
+
+
+
+          PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
+
+
+
+
+    Here's a picture of the standard LK-201 keypad for reference:
+
+          _______________________    _______________________________
+         | HELP  |      DO       |  |  F17  |  F18  |  F19  |  F20  |
+         |       |               |  |       |       |       |       |
+         |_______|_______________|  |_______|_______|_______|_______|
+          _______________________    _______________________________
+         | FIND  |INSERT |REMOVE |  |  PF1  |  PF2  |  PF3  |  PF4  |
+         |       |       |       |  |       |       |       |       |
+         |_______|_______|_______|  |_______|_______|_______|_______|
+         |SELECT |PREVIOU| NEXT  |  |  KP7  |  KP8  |  KP9  |  KP-  |
+         |       |       |       |  |       |       |       |       |
+         |_______|_______|_______|  |_______|_______|_______|_______|
+                 |   UP  |          |  KP4  |  KP5  |  KP6  |  KP,  |
+                 |       |          |       |       |       |       |
+          _______|_______|_______   |_______|_______|_______|_______|
+         |  LEFT |  DOWN | RIGHT |  |  KP1  |  KP2  |  KP3  |       |
+         |       |       |       |  |       |       |       |       |
+         |_______|_______|_______|  |_______|_______|_______|  KPE  |
+                                    |      KP0      |  KPP  |       |
+                                    |               |       |       |
+                                    |_______________|_______|_______|
+
+")
+
+;;;
+;;;  Key mapping functions
+;;;
+(defun edt-lucid-map-key (ident descrip)
+  (interactive)
+  (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip)))
+  (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]"))
+  (cond ((not (equal edt-key edt-return))
+	 (set-buffer "Keys")
+	 (insert (format "    (\"%s\" . %s)\n" ident edt-key))
+	 (set-buffer "Directions"))
+	;; bogosity to get next prompt to come up, if the user hits <CR>!
+	;; check periodically to see if this is still needed...
+	(t
+	 (format "%s" edt-key)))
+  edt-key)
+
+(defun edt-gnu-map-key (ident descrip)
+  (interactive)
+  (message "Press %s%s: " ident descrip)
+  (setq edt-key-seq (read-event))
+  (setq edt-key (concat "[" (format "%s" edt-key-seq) "]"))
+  (cond ((not (equal edt-key edt-return))
+	 (set-buffer "Keys")
+	 (insert (format "    (\"%s\" . %s)\n" ident edt-key))
+	 (set-buffer "Directions"))
+	;; bogosity to get next prompt to come up, if the user hits <CR>!
+	;; check periodically to see if this is still needed...
+	(t
+	 (set-buffer "Keys")
+	 (insert (format "    (\"%s\" . \"\" )\n" ident))
+	 (set-buffer "Directions")))
+  edt-key)
+
+(fset 'edt-map-key (if edt-lucid-emacs19-p 'edt-lucid-map-key 'edt-gnu-map-key))
+(set-buffer "Keys")
+(insert "
+;;
+;;  Arrows
+;;
+")
+(set-buffer "Directions")
+
+(edt-map-key "UP"     " - The Up Arrow Key")
+(edt-map-key "DOWN"   " - The Down Arrow Key")
+(edt-map-key "LEFT"   " - The Left Arrow Key")
+(edt-map-key "RIGHT"  " - The Right Arrow Key")
+
+
+(set-buffer "Keys")
+(insert "
+;;
+;;  PF keys
+;;
+")
+(set-buffer "Directions")
+
+(edt-map-key "PF1"  " - The PF1 (GOLD) Key")
+(edt-map-key "PF2"  " - The Keypad PF2 Key")
+(edt-map-key "PF3"  " - The Keypad PF3 Key")
+(edt-map-key "PF4"  " - The Keypad PF4 Key")
+
+(set-buffer "Keys")
+(insert "
+;;
+;;  KP0-9 KP- KP, KPP and KPE
+;;
+")
+(set-buffer "Directions")
+
+(edt-map-key "KP0"      " - The Keypad 0 Key")
+(edt-map-key "KP1"      " - The Keypad 1 Key")
+(edt-map-key "KP2"      " - The Keypad 2 Key")
+(edt-map-key "KP3"      " - The Keypad 3 Key")
+(edt-map-key "KP4"      " - The Keypad 4 Key")
+(edt-map-key "KP5"      " - The Keypad 5 Key")
+(edt-map-key "KP6"      " - The Keypad 6 Key")
+(edt-map-key "KP7"      " - The Keypad 7 Key")
+(edt-map-key "KP8"      " - The Keypad 8 Key")
+(edt-map-key "KP9"      " - The Keypad 9 Key")
+(edt-map-key "KP-"      " - The Keypad - Key")
+(edt-map-key "KP,"      " - The Keypad , Key")
+(edt-map-key "KPP"      " - The Keypad . Key")
+(edt-map-key "KPE"      " - The Keypad Enter Key")
+;; Save the enter key
+(setq edt-enter edt-key)
+(setq edt-enter-seq edt-key-seq)
+
+
+(set-buffer "Keys")
+(insert "
+;;
+;;  Editing keypad (FIND, INSERT, REMOVE)
+;;                 (SELECT, PREVIOUS, NEXT)
+;;
+")
+(set-buffer "Directions")
+
+(edt-map-key "FIND"      " - The Find key on the editing keypad")
+(edt-map-key "INSERT"    " - The Insert key on the editing keypad")
+(edt-map-key "REMOVE"    " - The Remove key on the editing keypad")
+(edt-map-key "SELECT"    " - The Select key on the editing keypad")
+(edt-map-key "PREVIOUS"  " - The Prev Scr key on the editing keypad")
+(edt-map-key "NEXT"      " - The Next Scr key on the editing keypad")
+
+(set-buffer "Keys")
+(insert "
+;;
+;;  F1-14 Help Do F17-F20
+;;
+")
+(set-buffer "Directions")
+
+(edt-map-key "F1"        " - F1 Function Key")
+(edt-map-key "F2"        " - F2 Function Key")
+(edt-map-key "F3"        " - F3 Function Key")
+(edt-map-key "F4"        " - F4 Function Key")
+(edt-map-key "F5"        " - F5 Function Key")
+(edt-map-key "F6"        " - F6 Function Key")
+(edt-map-key "F7"        " - F7 Function Key")
+(edt-map-key "F8"        " - F8 Function Key")
+(edt-map-key "F9"        " - F9 Function Key")
+(edt-map-key "F10"       " - F10 Function Key")
+(edt-map-key "F11"       " - F11 Function Key")
+(edt-map-key "F12"       " - F12 Function Key")
+(edt-map-key "F13"       " - F13 Function Key")
+(edt-map-key "F14"       " - F14 Function Key")
+(edt-map-key "HELP"      " - HELP Function Key")
+(edt-map-key "DO"        " - DO Function Key")
+(edt-map-key "F17"       " - F17 Function Key")
+(edt-map-key "F18"       " - F18 Function Key")
+(edt-map-key "F19"       " - F19 Function Key")
+(edt-map-key "F20"       " - F20 Function Key")
+
+(set-buffer "Directions")
+(delete-region (point-min) (point-max))
+(insert "
+		       ADDITIONAL FUNCTION KEYS
+
+    Your keyboard may have additional function keys which do not
+    correspond to any LK-201 keys.  The EDT Emulation can be
+    configured to recognize those keys, since you may wish to add your
+    own key bindings to those keys.
+    
+    For example, suppose your keyboard has a keycap marked \"Line Del\"
+    and you wish to add it to the list of keys which can be customized
+    by the EDT Emulation.  First, assign a unique single-word name to
+    the key for use by the EDT Emulation, let's say \"linedel\", in this
+    example.  Then, at the \"EDT Key Name:\" prompt, enter \"linedel\",
+    followed by a press of the RETURN key.  Finally, when prompted,
+    press the \"Line Del\" key.  You now will be able to bind functions
+    to \"linedel\" and \"Gold-linedel\" in edt-user.el in just the same way
+    you can customize bindings of the standard LK-201 keys.
+
+    When you have no additional function keys to specify, just press
+    RETURN at the \"EDT Key Name:\" prompt.  (If you change your mind
+    AFTER you enter an EDT Key Name and before you press a key at the
+    \"Press\" prompt, you may omit the key by simply pressing RETURN at
+    the prompt.)
+")
+(switch-to-buffer "Directions")
+;;;
+;;;  Add support for extras keys
+;;;
+(set-buffer "Keys")
+(insert "\
+;;
+;;  Extra Keys 
+;;
+")
+(setq EDT-key-name "")
+(while (not 
+	(string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) ""))
+  (edt-map-key EDT-key-name ""))
+
+;
+; No more keys to add, so wrap up.
+;
+(set-buffer "Keys")
+(insert "\
+    )
+  )
+")
+
+;;;
+;;;  Save the key mapping program and blow this pop stand
+;;;
+(let ((file (if edt-lucid-emacs19-p "~/.edt-lucid-keys" "~/.edt-gnu-keys")))
+  (set-visited-file-name
+   (read-file-name (format "Save key mapping to file (default %s): " file) nil file)))
+(save-buffer)
+
+(message "That's it!  Press any key to exit")
+(sit-for 600)
+(kill-emacs t)
+
+;;; edt-mapper.el ends here
+;;; edt-pc.el --- Enhanced EDT Keypad Mode Emulation for PC 101 Keyboards
+
+;; Copyright (C) 1986, 1994, 1995 Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: FSF 19.34
+
+;;; Usage:
+
+;;  See edt-user.doc in the Emacs etc directory.
+
+;; ====================================================================
+
+;;;;
+;;;; KEY TRANSLATIONS
+;;;;
+
+;; Associate EDT keynames with Emacs terminal function vector names.
+;;
+;; To emulate the DEC LK-201 keypad keys on the PC 101 keyboard,
+;; NumLock must be ON.
+;;
+;; The PC keypad keys are mapped to the corresponding DEC LK-201
+;; keypad keys according to the corresponding physical position on
+;; the keyboard.  Thus, the physical position of the PC keypad key
+;; determines its function, not the PC keycap name.
+;;
+;; There are two LK-201 keypad keys needing special handling: PF1 and
+;; the keypad comma key.
+;;
+;; PF1:
+;;  Most PC software does not see a press of the NumLock key.  A TSR
+;;  program distributed with MS-Kermit to support its VT-100 emulation
+;;  solves this problem.  The TSR, called GOLD, causes a press of the
+;;  keypad NumLock key to look as if the PC F1 key were pressed.  So
+;;  the PC F1 key is mapped here to behave as the PF1 (GOLD) key.
+;;  Then with GOLD loaded, the NumLock key will behave as the GOLD key.
+;;
+;;  By the way, with GOLD loaded, you can still toggle numlock on/off.
+;;  GOLD binds this to Shift-NumLock.
+;;
+;; Keypad Comma:
+;;  There is no physical PC keypad key to correspond to the LK-201
+;;  keypad comma key.  So, the EDT Emulation is configured below to
+;;  ignore attempts to bind functions to the keypad comma key.
+;;
+;; Finally, F2 through F12 are also available for making key bindings
+;; in the EDT Emulation on the PC.  F1 is reserved for the GOLD key,
+;; so don't attempt to bind anything to it.  Also, F13, F14, HELP, DO,
+;; and F17 through F20 do not exist on the PC, so the EDT emulation is
+;; configured below to ignore attempts to bind functions to those keys.
+;;
+(defconst *EDT-keys*
+  '(("KP0" . [kp-0]) ("KP1" . [kp-1]) ("KP2" . [kp-2]) ("KP3" . [kp-3]) 
+    ("KP4" . [kp-4]) ("KP5" . [kp-5]) ("KP6" . [kp-6]) ("KP7" . [kp-7])
+    ("KP8" . [kp-8]) ("KP9" . [kp-9]) ("KP," . "" )
+    ("KP-" . [kp-add]) ("KPP" . [kp-decimal]) ("KPE" . [kp-enter])
+    ("PF1" . [f1]) ("PF2" . [kp-divide]) ("PF3" . [kp-multiply])
+    ("PF4" . [kp-subtract])
+    ("UP" . [up]) ("DOWN" . [down]) ("RIGHT" . [right]) ("LEFT" . [left])
+    ("FIND" . [insert]) ("INSERT" . [home]) ("REMOVE" . [prior])
+    ("SELECT" . [delete]) ("PREVIOUS" . [end]) ("NEXT" . [next])
+    ("F1" . "" ) ("F2" . [f2]) ("F3" . [f3]) ("F4" . [f4]) ("F5" . [f5])
+    ("F6" . [f6]) ("F7" . [f7]) ("F8" . [f8]) ("F9" . [f9]) ("F10" . [f10])
+    ("F11" . [f11]) ("F12" . [f12]) ("F13" . "" ) ("F14" . "" )
+    ("HELP" . "" ) ("DO" . "" ) ("F17" . "" ) ("F18" . "" )
+    ("F19" . "" ) ("F20" . "" )))
+File:  edt-user.doc  ---  EDT Emulation User Instructions
+
+                                For GNU Emacs 19
+
+Copyright (C) 1986, 1992, 1994, 1995 Free Software Foundation, Inc.
+
+Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+Keywords: emulations
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+
+============================================================================
+
+I.    OVERVIEW:
+
+This version of the EDT emulation package for GNU Emacs is a substantially
+enhanced version of the original.  A large part of the original can still be
+found here, of course, but much of it has been modified and quite a bit is
+new.  Many of the ideas found here are borrowed from others.  In particular,
+some of the code found here was drawn from an earlier re-write of the EDT
+package done at DSC in 1989 by Matthew Frohman.
+   
+Send bug fixes, suggestions for enhancements, and corrections to this
+documentation to Kevin Gallagher (kgallagh@spd.dsccc.com).
+
+The EDT emulation consists of the following files:
+
+edt-user.doc          - User instructions (which you are reading now)
+edt.el                - EDT Emulation Functions and Default Configuration
+edt-lk201.el          - Support for DEC LK-201 Keyboards
+edt-vt100.el          - Support for DEC VT-100 (and above) terminals
+edt-mapper.el         - Support for Keyboards used under X Windows
+edt-pc.el             - Support for the PC AT Keyboard under MS-DOS
+
+Several goals were kept in mind when making this version:
+     
+        1.  Emulate EDT Keypad Mode commands closely so that current
+            EDT users will find that it easy and comfortable to use
+            GNU Emacs with a small learning curve;
+   
+        2.  Make it easy for a user to customize EDT emulation key
+            bindings without knowing much about Emacs Lisp;
+
+        3.  Make it easy to switch between the original EDT default bindings
+            and the user's customized bindings, without having to exit Emacs.
+
+        4.  Provide support for some TPU/EVE functions not supported in
+            EDT. 
+
+        5.  Provide an easy way to restore ALL original Emacs key bindings,
+            just as they existed before the EDT emulation was first invoked.
+   
+        6.  Support GNU Emacs 19.  (Support for GNU Emacs 18 has been dropped.
+            Also, although there is some code designed to support Xemacs 19
+            (formerly Lucid Emacs), this is not fully implemented at this
+            time. 
+
+        7.  When running under X, support highlighting of marked text.
+
+        8.  Handle terminal configuration under X interactively when the
+            emulation is invoked for the first time.
+
+        9.  Support a PC AT keyboard under MS-DOS.
+
+II.   TERMINALS/KEYBOARDS SUPPORTED:
+
+Keyboards used under X Windows are supported via the edt-mapper function.  The
+first time you invoke the emulation under X, the edt-mapper function is run
+automatically and the user is prompted to identify which keys the emulation is
+to use for the standard keypad and function keys EDT expects (e.g., PF1, PF2,
+etc.).  This configuration is saved to disk read each time the emulation is
+invoked.
+
+In character oriented connections not running a window manager, the following
+terminals/keyboards are supported.  (1) DEC VT-100 series and higher.  This
+includes well behaved VT clones and emulators.  If you are using a VT series
+terminal, be sure that the term environment variable is set properly before
+invoking emacs. (2) PC AT keyboard under MS-DOS.
+
+Be sure to read the SPECIAL NOTES FOR SOME PLATFORMS sections to see if those
+notes apply to you.
+
+
+III.  STARTING THE EDT EMULATION:
+
+Start up GNU Emacs and enter "M-x edt-emulation-on" to begin the emulation.
+After initialization is complete, the following message will appear below the
+status line informing you that the emulation has been enabled:
+
+                         Default EDT keymap active
+
+You can have the EDT Emulation start up automatically, each time you initiate
+a GNU Emacs session, by adding the following line to your .emacs file:
+
+                  (setq term-setup-hook 'edt-emulation-on)
+
+A reference sheet is included (later on) listing the default EDT Emulation key
+bindings.  This sheet is also accessible on line from within Emacs by pressing
+PF2, GOLD H, or HELP (when in the EDT Default Mode).
+
+It is easy to customize key bindings in the EDT Emulation.  (See CUSTOMIZING
+section, below.)  Customizations are placed in a file called edt-user.el.  (A
+sample edt-user.el file can be found in the CUSTOMIZING section.)  If
+edt-user.el is found in your GNU Emacs load path during EDT Emulation
+initialization, then the following message will appear below the status line
+indicating that the emulation has been enabled, enhanced by your own
+customizations:
+
+                       User EDT custom keymap active
+
+Once enabled, it is easy to switch back and forth between your customized EDT
+Emulation key bindings and the default EDT Emulation key bindings.  It is also
+easy to turn off the emulation.  Doing so completely restores the original key
+bindings in effect just prior to invoking the emulation.
+
+Where EDT key bindings and GNU Emacs key bindings conflict, the default GNU
+Emacs key bindings are retained by the EDT emulation by default.  If you are a
+diehard EDT user you may not like this.  The CUSTOMIZING section explains how
+to change this default.
+
+
+IV.   SPECIAL NOTES FOR SOME PLATFORMS:
+
+  Sun Workstations running X:
+
+     Some earlier Sun keyboards do not have arrow keys separate from the
+     keypad keys.  It is difficult to emulate the full EDT keypad and still
+     retain use of the arrow keys on such keyboards.  
+
+     The Sun Type 5 keyboard, however, does have separate arrow keys.  This
+     makes it a candidate for setting up a reasonable EDT keypad emulation.
+     Unfortunately, Sun's default X keynames for the keypad keys don't permit
+     GNU Emacs to interpret the keypad 2, 4, 6, and 8 keys as something other
+     than arrow keys, nor use all the top row of keys for PF1 thru PF4 keys.
+     Here's the contents of an .xmodmaprc file which corrects this problem for
+     Sun Type 5 keyboards:
+
+         ! File:  .xmodmaprc
+         !
+         ! Set up Sun Type 5 keypad for use with the GNU Emacs EDT Emulation
+         !
+         keycode  53 = KP_Divide
+         keycode  54 = KP_Multiply
+         keycode  57 = KP_Decimal
+         keycode  75 = KP_7
+         keycode  76 = KP_8
+         keycode  77 = KP_9
+         keycode  78 = KP_Subtract
+         keycode  97 = KP_Enter
+         keycode  98 = KP_4
+         keycode  99 = KP_5
+         keycode 100 = KP_6
+         keycode 101 = KP_0
+         keycode 105 = F24
+         keycode 119 = KP_1
+         keycode 120 = KP_2
+         keycode 121 = KP_3
+         keycode 132 = KP_Add
+
+     Feed .xmodmaprc to the xmodmap command and all the Sun Type 5 keypad keys
+     will now be configurable for the emulation of an LK-201 keypad (less the
+     comma key).  The line
+
+         keycode 105 = F24
+
+     modifies the NumLock key to be the F24 key which can then be configured
+     to behave as the PF1 key.  In doing so, you will no longer have a NumLock
+     key.  If you are using other software under X which requires a NumLock
+     key, then examine your keyboard and look for one you don't use and
+     redefine it to be the NumLock key.  (See the man page on xmodmap for for
+     further help on how to do this.)
+
+  PC users running MS-DOS:
+
+     By default, F1 is configured to emulate the PF1 (GOLD) key.  But NumLock
+     can be used instead if you load a freeware TSR distributed with
+     MS-Kermit, call gold.com.  It is distributed in a file called gold22.zip
+     and comes with the source code as well as a loadable binary image. 
+     (See edt-pc.el for more information.)
+
+  PC users running Linux:
+
+     The default X server configuration of three keys PC AT keyboard keys
+     needs to be modified to permit the PC keyboard to emulate an LK-201
+     keyboard properly.  Here's the contents of an .xmodmaprc file which makes
+     these changes for your:
+
+         ! File:  .xmodmaprc
+         !
+         ! Set up PC keypad under Linux for the GNU Emacs EDT Emulation 
+         !
+         keycode  22 = BackSpace
+         keycode  77 = F12
+         keycode  96 = Num_Lock
+
+     Feed the file to the xmodmap command and all the PC keypad keys will now
+     be configurable for the emulation of an LK-201 keypad (less the comma
+     key), the standard keyboard supplied with DEC terminals VT-200 and above.
+     This file switches the role of the F12 and NumLock keys.  It also
+     modifies the definition of the Delete key above the arrow keys so that it
+     can be assigned a keybinding independently of the the BackSpace key.
+
+     NOTE: It is necessary to have NumLock ON for the PC keypad to emulate the
+     LK-201 keypad properly.
+
+
+V.    HOW DOES THIS EDT EMULATION DIFFER FROM REAL EDT?:
+
+In general, you will find that this emulation of EDT replicates most, but not
+all, of EDT's most used Keypad Mode editing functions and behavior.  It is not
+perfect, but most EDT users who have tried the emulation agree that it is
+quite good enough to make it easy for die-hard EDT users to move over to using
+GNU Emacs.  
+
+Here's a list of the most important differences between EDT and this GNU Emacs
+EDT Emulation.  The list is short but you must be aware of these differences
+if you are to use the EDT Emulation effectively.
+
+1.  Entering repeat counts works a little differently than in EDT.
+
+    EDT allows users to enter a repeat count before entering a command that
+    accepts repeat counts.  For example, when in EDT, pressing these three
+    keys in sequence, GOLD 5 KP1, will move the cursor in the current
+    direction 5 words.
+
+    Emacs provides two ways to enter repeat counts, though neither involves
+    using the GOLD key.  In Emacs, repeat counts can be entered by using the 
+    ESC key.  For example, pressing these keys in sequence, ESC 1 0 KP1, will
+    move the cursor in the current direction 10 words. 
+
+    Emacs provides another command called universal-argument that can do the
+    same thing, plus a few other things.  Normally, Emacs has this bound to
+    C-u.  
+
+2.  The EDT SUBS command, bound to GOLD ENTER, is NOT supported.  The built-in
+    Emacs query-replace command has been bound to GOLD ENTER, instead.  It is
+    much more convenient to use than SUBS.
+
+3.  EDT's line mode commands and nokeypad mode commands are NOT supported
+    (with one important exception; see item 8 in the Highlights section
+    below).  Although, at first, this may seem like a big omission, the set of
+    built-in Emacs commands provides a much richer set of capabilities which
+    more than make up for this omission.
+
+    To enter Emacs commands not bound to keys, you can press GOLD KP7 or the
+    DO key.  Emacs will display it's own command prompt called Meta-x (M-x).
+    You can also invoke this prompt the normal Emacs way by entering ESC x.
+
+4.  Selected text is highlighted ONLY when running under X Windows.  Gnu Emacs
+    19 does not support highlighting of text on VT series terminals, at this
+    time. 
+
+5.  Just like TPU/EVE, The ENTER key is NOT used to terminate input when the
+    editor prompts you for input.  The RETURN key is used, instead.  (KP4 and
+    KP5 do terminate input for the FIND command, just like in EDT, however.)
+
+
+
+
+VI.   SOME HIGHLIGHTS IN THIS EDT EMULATION, AND SOME COMPARISONS TO THE
+      ORIGINAL GNU EMACS EDT EMULATION:
+
+1.  The EDT define key command is supported (edt-define-key) and is bound to
+    C-k in the default EDT mode when EDT control sequence bindings are enabled
+    or one of the sample edt-user.el customization files is used.  The TPU/EVE
+    learn command is supported but not bound to a key in the default EDT mode
+    but is bound in the sample edt-user.el files.
+
+    Unlike the TPU/EVE learn command, which uses one key to begin the learn
+    sequence, C-l, and another command to remember the sequence, C-r, this
+    version of the learn command (edt-learn) serves as a toggle to both begin
+    and to remember the learn sequence.
+
+    Many users who change the meaning of a key with the define key and the
+    learn commands, would like to be able to restore the original key binding
+    without having to quit and restart emacs.  So a restore key command is
+    provided to do just that.  When invoked, it prompts you to press the key
+    to which you wish the last replaced key definition restored.  It is bound
+    to GOLD C-k in the default EDT mode when EDT control sequence bindings are
+    enabled or one of the sample edt-user.el customization files is used.
+
+2.  Direction support is fully supported.  It is no longer accomplished by
+    re-defining keys each time the direction is changed.  Thus, commands
+    sensitive to the current direction setting may be bound easily to any key.
+
+3.  All original emacs bindings are fully restored when EDT emulation is
+    turned off.
+
+4.  User custom EDT bindings are kept separate from the default EDT bindings.
+    One can toggle back and forth between the custom EDT bindings and default
+    EDT bindings.
+
+5.  The Emacs functions in edt.el attempt to emulate, where practical, the
+    exact behavior of the corresponding EDT keypad mode commands.  In a few
+    cases, the emulation is not exact, but we hope you will agree it is close
+    enough.  In a very few cases, we chose to use the Emacs way of handling
+    things.  As mentioned earlier, we do not emulate the EDT SUBS command.
+    Instead, we chose to use the Emacs query-replace function, which we find
+    to be easier to use.
+
+6.  Emacs uses the regexp assigned to page-delimiter to determine what marks a
+    page break.  This is normally "^\f", which causes the edt-page command to
+    ignore form feeds not located at the beginning of a line.  To emulate the
+    EDT PAGE command exactly, page-delimiter is set to "\f" when EDT emulation
+    is turned on, and restored to "^\f" when EDT emulation is turned off.
+    But, since some users prefer the Emacs definition of a page break, or may
+    wish to preserve a customized definition of page break, one can override
+    the EDT definition by placing
+
+            (setq edt-keep-current-page-delimiter t)
+
+    in your .emacs file.
+
+7.  The EDT definition of a section of a terminal window is hardwired to be 16
+    lines of its one-and-only 24-line window (the EDT SECT command bound to
+    KP8).  That's two-thirds of the window at a time.  Since Emacs, like
+    TPU/EVE, can handle multiple windows of sizes of other than 24 lines, the
+    definition of section used here has been modified to two-thirds of the
+    current window.  (There is also an edt-scroll-window function which you
+    may prefer over the SECT emulation.)
+
+8.  Cursor movement and deletion involving word entities is identical to EDT.
+    This, above all else, gives the die-hard EDT user a sense of being at
+    home.  Also, an emulation of EDT's SET ENTITY WORD command is provided,
+    for those users who like to customize movement by a word at a time to
+    their own liking.
+
+9.  EDT's FIND and FNDNXT are supported.
+
+10. EDT's APPEND and REPLACE commands are supported.
+
+11. CHNGCASE is supported.  It works on individual characters or selected
+    text, if SELECT is active.  In addition, two new commands are provided:
+    edt-lowercase and edt-uppercase.  They work on individual WORDS or
+    selected text, if SELECT is active.
+
+12. Form feed and tab insert commands are supported.
+
+13. A new command, edt-duplicate-word, is provided.  If you experiment with
+    it, you might find it to be surprisingly useful and may wonder how you
+    ever got along without it!  It is assigned to C-j in the sample
+    edt-user.el customization files.
+
+14. TPU/EVE's Rectangular Cut and Paste functions (originally from the EVE-Plus
+    package) are supported.  But unlike the TPU/EVE versions, these here
+    support both insert and overwrite modes.  The seven rectangular functions
+    are bound to F7, F8, GOLD-F8, F9, GOLD-F9, F10, and GOLD-F10 in the
+    default EDT mode.
+
+15. The original EDT emulation package set up many default regular and GOLD
+    bindings.  We tried to preserve most (but not all!) of these, so users of
+    the original emulation package will feel more at home.  
+
+    Nevertheless, there are still many GOLD key sequences which are not bound
+    to any functions.  These are prime candidates to use for your own 
+    customizations.  
+    
+    Also, there are several commands in edt.el not bound to any key.  So, you
+    will find it worthwhile to look through edt.el for functions you may wish
+    to add to your personal customized bindings.
+
+16. The VT200/VT300 series terminals steal the function keys F1 to F5 for
+    their own use.  These do not generate signals which are sent to the host.
+    So, edt.el does not assign any default bindings to F1 through F5.
+
+    In addition, our VT220 terminals generate an interrupt when the F6 key is
+    pressed (^C or ^Y, can't remember which) and not the character sequence
+    documented in the manual.  So, binding emacs commands to F6 will not work
+    if your terminal behaves the same way.
+
+17. The VT220 terminal has no ESC, BS, nor LF keys, as does a VT100.  So the
+    default EDT bindings adopt the standard DEC convention of having the F11,
+    F12, and F13 keys, on a VT200 series (and above) terminal, assigned to the
+    same EDT functions that are bound to ESC, BS, and LF on a VT100 terminal.
+
+18. Each user, through the use of a private edt-user.el file, can customize,
+    very easily, personal EDT emulation bindings.
+
+19. The EDT SELECT and RESET functions are supported.  However, unlike EDT,
+    pressing RESET to cancel text selection does NOT reset the existing
+    setting of the current direction.
+
+    We also provide a TPU/EVE like version of the single SELECT/RESET
+    function, called edt-toggle-select, which makes the EDT SELECT function
+    into a toggle on/off switch.  That is, if selection is ON, pressing SELECT
+    again turns selection off (cancels selection).  This function is used in
+    the sample edt-user.el customization files.
+
+
+VII.  CUSTOMIZING:
+
+Most EDT users, at one time or another, make some custom key bindings, or
+use someone else's custom key bindings, which they come to depend upon just as
+if they were built-in bindings.  This EDT Emulation for GNU Emacs is designed
+to make it easy to customize bindings.
+
+If you wish to customize the EDT Emulation to use some of your own key
+bindings, you need to make a private version of edt-user.el in your own
+private lisp directory.  There are two sample files edt-user.el1 and
+edt-user.el2 for you to use as templates and for ideas.  Look at
+edt-user.el1 first.  Unless you will be using two or more very different
+types of terminals on the same system, you need not look at edt-user.el2.
+
+First, you need to have your own private lisp directory, say ~/lisp, and
+you should add it to the GNU Emacs load path.
+
+NOTE:  A few sites have different load-path requirements, so the above
+       directions may need some modification if your site has such special
+       needs. 
+
+
+Creating your own edt-user.el file:
+
+A sample edt-user.el file is attached to the end of this user documentation.
+You should use it as a guide to learn how you can customize EDT emulation
+bindings to your own liking.  Names used to identify the set of LK-201
+keypad and function keys are:
+
+Keypad Keys:   
+                PF1 PF2 PF3 PF4
+                KP7 KP8 KP9 KP-
+                KP4 KP5 KP6 KP,
+                KP1 KP2 KP3 
+                KP0     KPP KPE
+
+Arrow Keys:
+                LEFT RIGHT DOWN UP
+
+Function Keys:
+                F1 F2 F3 F4 F5  F6 F7 F8 F9 F10  F11 F12 F13 F14
+                HELP DO  F17 F18 F19 F20
+
+                FIND   INSERT   REMOVE 
+                SELECT PREVIOUS NEXT
+
+Note:
+                Many VT-200 terminals, and above, steal function keys F1 thru
+                F5 for terminal setup control and don't send anything to the
+                host if pressed.  So customizing bindings to these keys may
+                not work for you.
+
+There are three basic functions that do the EDT emulation bindings:
+edt-bind-standard-key, edt-bind-gold-key, and edt-bind-function-key.
+
+The first two are for binding functions to keys which are standard across most
+keyboards.  This makes them keyboard independent, making it possible to define
+these key bindings for all terminals in the file edt.el.
+
+The first, edt-bind-standard-key, is used typically to bind emacs commands to
+control keys, although some people use it to bind commands to other keys, as
+well.  (For example, some people use it to bind the VT200 seldom used
+back-tick key (`) to the function "ESC-prefix" so it will behave like an ESC
+key.)  The second function, edt-bind-gold-key, is used to bind emacs commands
+to gold key sequences involving alpha-numeric keys, special character keys,
+and control keys.
+
+The third function, edt-bind-function-key, is terminal dependent and is
+defined in a terminal specific file (see edt-vt100.el for example).  It is
+used to bind emacs commands to function keys, to keypad keys, and to gold
+sequences of those keys.
+
+WARNING: Each of the three functions, edt-bind-function-key,
+         edt-bind-gold-key, and edt-bind-standard-key, has an optional
+         last argument.  The optional argument should NOT be used in
+         edt-user.el!  When the optional argument is missing, each
+         function knows to make the key binding part of the user's EDT
+         custom bindings, which is what you want to do in edt-user.el!
+
+         The EDT default bindings are set up in edt.el by calling these
+         same functions with the optional last argument set to "t".  So, if
+         you decide to copy such function calls from edt.el to edt-user.el
+         for subsequent modification, BE SURE TO DELETE THE "t" AT THE END
+         OF EACH PARAMETER LIST!
+
+
+SPECIFYING WORD ENTITIES:
+
+The variable edt-word-entities is used to emulate EDT's SET ENTITY WORD
+command.  It contains a list of characters to be treated as words in
+themselves.  If the user does not define edt-word-entities in his/her .emacs
+file, then it is set up with the EDT default containing only TAB.
+
+The characters are stored in the list by their numerical values, not as
+strings.  Emacs supports several ways to specify the numerical value of a
+character.  One method is to use the question mark: ?A means the numerical
+value for A, ?/ means the numerical value for /, and so on.  Several
+unprintable characters have special representations:
+
+            ?\b  specifies  BS, C-h
+            ?\t  specifies  TAB, C-i
+            ?\n  specifies  LFD, C-j
+            ?\v  specifies  VTAB, C-k
+            ?\f  specifies  FF, C-l
+            ?\r  specifies  CR, C-m
+            ?\e  specifies  ESC, C-[
+            ?\\  specifies  \
+
+Here are some examples:
+
+     (setq edt-word-entities '(?\t ?- ?/)) ;; Specifies TAB, - , and /
+     (setq edt-word-entities '(?\t)        ;; Specifies TAB, the default
+
+You can also specify characters by their decimal ascii values:
+
+     (setq edt-word-entities '(9 45 47))   ;; Specifies TAB, - , and /
+
+
+ENABLING EDT CONTROL KEY SEQUENCE BINDINGS:
+
+Where EDT key bindings and GNU Emacs key bindings conflict, the default GNU
+Emacs key bindings are retained by default.  Some diehard EDT users may not
+like this.  So, if the variable edt-use-EDT-control-key-bindings is set to
+true in a user's .emacs file, then the default EDT Emulation mode will enable
+most of the original EDT control key sequence bindings.  If you wish to do
+this, add the following line to your .emacs file:
+
+        (setq edt-use-EDT-control-key-bindings t)
+
+
+                              DEFAULT EDT Keypad
+
+   F7: Copy Rectangle             +----------+----------+----------+----------+
+   F8: Cut Rect Overstrike        |Prev Line |Next Line |Bkwd Char |Frwd Char |
+ G-F8: Paste Rect Overstrike      |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
+   F9: Cut Rect Insert            |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
+ G-F9: Paste Rect Insert          +----------+----------+----------+----------+
+  F10: Cut Rectangle
+G-F10: Paste Rectangle
+  F11: ESC                       
+  F12: Begining of Line           +----------+----------+----------+----------+
+G-F12: Delete Other Windows       |   GOLD   |   HELP   |  FNDNXT  |  DEL L   |
+  F13: Delete to Begin of Word    |   (PF1)  |   (PF2)  |   (PF3)  |  (PF4)   |
+ HELP: Keypad Help                |Mark Wisel|Desc Funct|   FIND   |  UND L   |
+   DO: Execute extended command   +----------+----------+----------+----------+
+                                  |   PAGE   |   SECT   |  APPEND  |  DEL W   |
+  C-g: Keyboard Quit              |    (7)   |    (8)   |    (9)   |   (-)    |
+G-C-g: Keyboard Quit              |Ex Ext Cmd|Fill Regio| REPLACE  |  UND W   |
+  C-h: Beginning of Line          +----------+----------+----------+----------+
+G-C-h: Emacs Help                 |  ADVANCE |  BACKUP  |   CUT    |  DEL C   |
+  C-i: Tab Insert                 |    (4)   |    (5)   |    (6)   |   (,)    |
+  C-j: Delete to Begin of Word    |   BOTTOM |    TOP   |   Yank   |  UND C   |
+  C-k: Define Key                 +----------+----------+----------+----------+
+G-C-k: Restore Key                |   WORD   |    EOL   |   CHAR   |   Next   |
+  C-l: Form Feed Insert           |    (1)   |    (2)   |    (3)   |  Window  |
+  C-n: Set Screen Width 80        | CHNGCASE |  DEL EOL |Quoted Ins|          !
+  C-r: Isearch Backward           +---------------------+----------+  (ENTER) |
+  C-s: Isearch Forward            |         LINE        |  SELECT  |          !
+  C-t: Display the Time           |         (0)         |    (.)   |   Query  |
+  C-u: Delete to Begin of Line    |      Open Line      |  RESET   |  Replace |
+  C-v: Redraw Display             +---------------------+----------+----------+
+  C-w: Set Screen Width 132       
+  C-z: Suspend Emacs                    +----------+----------+----------+
+G-C-\: Split Window                     |  FNDNXT  |   Yank   |   CUT    |
+                                        |  (FIND)  | (INSERT) | (REMOVE) |
+  G-b: Buffer Menu                      |   FIND   |          |   COPY   |
+  G-c: Compile                          +----------+----------+----------+
+  G-d: Delete Window                    |SELECT/RES|SECT BACKW|SECT FORWA|
+  G-e: Exit                             | (SELECT) |(PREVIOUS)|  (NEXT)  |
+  G-f: Find File                        |          |          |          |
+  G-g: Find File Other Window           +----------+----------+----------+
+  G-h: Keypad Help
+  G-i: Insert File
+  G-k: Toggle Capitalization Word
+  G-l: Lowercase Word or Region
+  G-m: Save Some Buffers
+  G-n: Next Error
+  G-o: Switch to Next Window
+  G-q: Quit
+  G-r: Revert File
+  G-s: Save Buffer
+  G-u: Uppercase Word or Region
+  G-v: Find File Other Window
+  G-w: Write file
+  G-y: EDT Emulation OFF
+  G-z: Switch to User EDT Key Bindings
+  G-1: Delete Other Windows
+  G-2: Split Window
+  G-%: Go to Percentage
+  G- : Undo  (GOLD Spacebar)
+  G-=: Go to Line
+  G-`: What line
+
+;;; File:  edt-user.el   ---  Sample User Customizations for the Enhanced 
+;;;                             EDT Keypad Mode Emulation 
+;;;                             
+;;;                          For GNU Emacs 19
+;;;
+;; Copyright (C) 1986, 1992, 1993 Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; This file contains GNU Emacs User Custom EDT bindings and functions.  In
+;; this example file, there is no special test for the type of terminal being
+;; used.  The assumption is that all key bindings here apply to all terminals
+;; that may be used.  (In fact, it was written by an individual who uses only
+;; VT series terminals when logging into a VAX.)
+;;
+;; WARNING: Each of the three functions, edt-bind-function-key,
+;;          edt-bind-gold-key, and edt-bind-standard-key, has an optional
+;;          last argument.  The optional argument should NOT be used in
+;;          edt-user.el!  When the optional argument is missing, each
+;;          function knows to make the key binding part of the user's EDT
+;;          custom bindings, which is what you want to do in edt-user.el!
+;;
+;;          The EDT default bindings are set up in edt.el by calling these
+;;          same functions with the optional last argument set to "t".  So, if
+;;          you decide to copy such function calls from edt.el to edt-user.el
+;;          for subsequent modification, BE SURE TO DELETE THE "t" AT THE END
+;;          OF EACH PARAMETER LIST!
+;;
+
+;;; Usage:
+
+;;  See edt-user.doc in the emacs etc directory.
+
+;; ====================================================================
+
+;;;;
+;;;; Setup user custom EDT key bindings.
+;;;;
+
+(defun edt-setup-user-bindings ()
+  "Assigns user custom EDT Emulation keyboard bindings."
+
+  ;; PF1 (GOLD), PF2, PF3, PF4
+  ;;
+  ;; This file MUST contain a binding of PF1 to edt-user-gold-map.  So
+  ;; DON'T CHANGE OR DELETE THE REGULAR KEY BINDING OF PF1 BELOW!
+  ;; (However, you may change the GOLD-PF1 binding, if you wish.)
+  (edt-bind-function-key "PF1" 'edt-user-gold-map 'edt-mark-section-wisely)
+  (edt-bind-function-key "PF2" 'query-replace 'other-window)
+  (edt-bind-function-key "PF4" 'edt-delete-entire-line 'edt-undelete-line)
+
+  ;; EDT Keypad Keys
+  (edt-bind-function-key "KP1" 'edt-word-forward 'edt-change-case)
+  (edt-bind-function-key "KP3" 'edt-word-backward 'edt-copy)
+  (edt-bind-function-key "KP6" 'edt-cut-or-copy 'yank)
+  (edt-bind-function-key "KP8" 'edt-scroll-window 'fill-paragraph)
+  (edt-bind-function-key "KP9" 'open-line 'edt-eliminate-all-tabs)
+  (edt-bind-function-key "KPP" 
+			 'edt-toggle-select 'edt-line-to-middle-of-window)
+  (edt-bind-function-key "KPE" 'edt-change-direction 'overwrite-mode)
+
+  ;; GOLD bindings for regular keys.
+  (edt-bind-gold-key "a" 'edt-append)
+  (edt-bind-gold-key "A" 'edt-append)
+  (edt-bind-gold-key "h" 'edt-electric-user-keypad-help)
+  (edt-bind-gold-key "H" 'edt-electric-user-keypad-help)
+
+  ;; Control bindings for regular keys.
+  ;;; Leave binding of C-c as original prefix key.
+  (edt-bind-standard-key "\C-j" 'edt-duplicate-word)
+  (edt-bind-standard-key "\C-k" 'edt-define-key)
+  (edt-bind-gold-key  "\C-k" 'edt-restore-key)
+  (edt-bind-standard-key "\C-l" 'edt-learn)
+  ;;; Leave binding of C-m to newline.
+  (edt-bind-standard-key "\C-n" 'edt-set-screen-width-80)
+  (edt-bind-standard-key "\C-o" 'open-line)
+  (edt-bind-standard-key "\C-p" 'fill-paragraph)
+  ;;; Leave binding of C-r to isearch-backward.
+  ;;; Leave binding of C-s to isearch-forward.
+  (edt-bind-standard-key "\C-t" 'edt-display-the-time)
+  (edt-bind-standard-key "\C-v" 'redraw-display)
+  (edt-bind-standard-key "\C-w" 'edt-set-screen-width-132)
+  ;;; Leave binding of C-x as original prefix key.
+)
+
+;;;
+;;; LK-201 KEYBOARD USER EDT KEYPAD HELP
+;;;
+
+(defun edt-user-keypad-help ()
+  "
+                                USER EDT Keypad Active
+
+                                  +----------+----------+----------+----------+
+   F7: Copy Rectangle             |Prev Line |Next Line |Bkwd Char |Frwd Char |
+   F8: Cut Rect Overstrike        |   (UP)   |  (DOWN)  |  (LEFT)  | (RIGHT)  |
+ G-F8: Paste Rect Overstrike      |Window Top|Window Bot|Bkwd Sent |Frwd Sent |
+   F9: Cut Rect Insert            +----------+----------+----------+----------+
+ G-F9: Paste Rect Insert         
+  F10: Cut Rectangle
+G-F10: Paste Rectangle
+  F11: ESC                        +----------+----------+----------+----------+
+  F12: Begining of Line           |   GOLD   |Query Repl|  FNDNXT  |Del Ent L |
+G-F12: Delete Other Windows       |   (PF1)  |   (PF2)  |   (PF3)  |   (PF4)  |
+  F13: Delete to Begin of Word    |Mark Wisel|Other Wind|   FIND   |  UND L   |
+ HELP: Keypad Help                +----------+----------+----------+----------+
+   DO: Execute extended command   |   PAGE   |Scroll Win|Open Line |  DEL W   |
+                                  |    (7)   |    (8)   |    (9)   |   (-)    |
+  C-a: Beginning of Line          |Ex Ext Cmd|Fill Parag|Elim Tabs |  UND W   |
+  C-b: Switch to Buffer           +----------+----------+----------+----------+
+  C-d: Delete Character           |  ADVANCE |  BACKUP  | CUT/COPY |  DEL C   |
+  C-e: End of Line                |    (4)   |    (5)   |    (6)   |   (,)    |
+  C-f: Forward Character          |   BOTTOM |    TOP   |   Yank   |  UND C   |
+  C-g: Keyboard Quit              +----------+----------+----------+----------+
+G-C-g: Keyboard Quit              | Fwd Word |    EOL   | Bwd Word |  Change  |
+  C-h: Electric Emacs Help        |    (1)   |    (2)   |    (3)   | Direction|
+G-C-h: Emacs Help                 | CHNGCASE |  DEL EOL |   COPY   |          |
+  C-i: Indent for Tab             +---------------------+----------+  (ENTER) |
+  C-j: Duplicate Word             |         LINE        |SELECT/RES|          |
+  C-k: Define Key                 |         (0)         |    (.)   |  Toggle  |
+G-C-k: Restore Key                |      Open Line      |Center Lin|Insrt/Over|
+  C-l: Learn                      +---------------------+----------+----------+
+  C-n: Set Screen Width 80       
+  C-o: Open Line                       +----------+----------+----------+
+  C-p: Fill Paragraph                  |  FNDNXT  |   Yank   |    CUT   |
+  C-q: Quoted Insert                   |  (FIND)) | (INSERT) | (REMOVE) |
+  C-r: Isearch Backward                |   FIND   |          |   COPY   |
+  C-s: Isearch Forward                 +----------+----------+----------+
+  C-t: Display the Time                |SELECT/RES|SECT BACKW|SECT FORWA|
+  C-u: Universal Argument              | (SELECT) |(PREVIOUS)|  (NEXT)  |
+  C-v: Redraw Display                  |          |          |          |
+  C-w: Set Screen Width 132            +----------+----------+----------+
+  C-z: Suspend Emacs
+G-C-\\: Split Window
+
+  G-a: Append to Kill Buffer
+  G-b: Buffer Menu
+  G-c: Compile
+  G-d: Delete Window
+  G-e: Exit
+  G-f: Find File
+  G-g: Find File Other Window
+  G-h: Keypad Help
+  G-i: Insert File
+  G-k: Toggle Capitalization Word
+  G-l: Lowercase Word or Region
+  G-m: Save Some Buffers
+  G-n: Next Error
+  G-o: Switch Windows
+  G-q: Quit
+  G-r: Revert File
+  G-s: Save Buffer
+  G-u: Uppercase Word or Region
+  G-v: Find File Other Window
+  G-w: Write file
+  G-y: EDT Emulation OFF
+  G-z: Switch to Default EDT Key Bindings
+  G-2: Split Window
+  G-%: Go to Percentage
+  G- : Undo  (GOLD Spacebar)
+  G-=: Go to Line
+  G-`: What line"
+
+  (interactive)
+  (describe-function 'edt-user-keypad-help))
+;;; edt-vt100.el --- Enhanced EDT Keypad Mode Emulation for VT Series Terminals
+
+;; Copyright (C) 1986, 1992, 1993, 1995 Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: FSF 19.34
+
+;;; Usage:
+
+;;  See edt-user.doc in the Emacs etc directory.
+
+;; ====================================================================
+
+;; Get keyboard function key mapping to EDT keys.
+(load "edt-lk201" nil t)
+
+;; The following functions are called by the EDT screen width commands defined
+;; in edt.el.
+
+(defun edt-set-term-width-80 ()
+  "Set terminal width to 80 columns."
+  (vt100-wide-mode -1))
+
+(defun edt-set-term-width-132 ()
+  "Set terminal width to 132 columns."
+  (vt100-wide-mode 1))
+;;; edt.el --- Enhanced EDT Keypad Mode Emulation for GNU Emacs 19
+
+;; Copyright (C) 1986, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+
+;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Keywords: emulations
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: FSF 19.34
+
+;;; Usage:
+
+;;  See edt-user.doc in the Emacs etc directory.
+
+;; Maintainer's note:  There was a very old edt.el here that wouldn't even
+;; load, so I replaced it completely with the newer one from 19.34. -sb
+;; ====================================================================
+
+;;;  Electric Help functions are used for keypad help displays.  A few
+;;;  picture functions are used in rectangular cut and paste commands.
+(require 'ehelp)
+(require 'picture)
+
+;;;;
+;;;; VARIABLES and CONSTANTS
+;;;;
+
+(defvar edt-last-deleted-lines ""
+  "Last text deleted by an EDT emulation line delete command.")
+
+(defvar edt-last-deleted-words ""
+  "Last text deleted by an EDT emulation word delete command.")
+
+(defvar edt-last-deleted-chars ""
+  "Last text deleted by an EDT emulation character delete command.")
+
+(defvar edt-last-replaced-key-definition ""
+  "Key definition replaced with edt-define-key or edt-learn command.")
+
+(defvar edt-direction-string ""
+  "String indicating current direction of movement.")
+
+(defvar edt-select-mode nil
+  "Non-nil means select mode is active.")
+
+(defvar edt-select-mode-text ""
+  "Text displayed in mode line when select mode is active.")
+
+(defconst edt-select-mode-string " Select"
+  "String to indicate select mode is active.")
+
+(defconst edt-forward-string " ADVANCE"
+  "Direction string in mode line to indicate forward movement.")
+
+(defconst edt-backward-string "  BACKUP"
+  "Direction string in mode line to indicate backward movement.")
+
+(defvar edt-default-map-active nil
+  "Non-nil indicates that default EDT emulation key bindings are active.
+Nil means user-defined custom bindings are active.")
+
+(defvar edt-user-map-configured nil
+  "Non-nil indicates that user custom EDT key bindings are configured.
+This means that an edt-user.el file was found in the user's load-path.")
+
+(defvar edt-keep-current-page-delimiter nil
+  "Non-nil leaves current value of page-delimiter unchanged.
+Nil causes the page-delimiter variable to be set to to \"\\f\"
+when edt-emulation-on is first invoked.  Original value is restored
+when edt-emulation-off is called.")
+
+(defvar edt-use-EDT-control-key-bindings nil
+  "Non-nil causes the control key bindings to be replaced with EDT bindings.
+Nil (the default) means EDT control key bindings are not used and the current
+control key bindings are retained for use in the EDT emulation.")
+
+(defvar edt-word-entities '(?\t)
+  "*Specifies the list of EDT word entity characters.")
+
+;;;
+;;;  Emacs version identifiers - currently referenced by
+;;;
+;;;     o edt-emulation-on      o edt-load-xkeys
+;;;
+(defconst edt-emacs19-p (not (string-lessp emacs-version "19"))
+  "Non-nil if we are running Lucid or GNU Emacs version 19.")
+
+(defconst edt-lucid-emacs19-p
+  (and edt-emacs19-p (string-match "Lucid" emacs-version))
+  "Non-nil if we are running Lucid Emacs version 19.")
+
+(defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-lucid-emacs19-p))
+  "Non-nil if we are running GNU Emacs version 19.")
+
+(defvar edt-xkeys-file nil
+  "File mapping X function keys to LK-201 keyboard function and keypad keys.")
+
+;;;;
+;;;; EDT Emulation Commands
+;;;;
+
+;;; Almost all of EDT's keypad mode commands have equivalent
+;;; counterparts in Emacs.  Some behave the same way in Emacs as they
+;;; do in EDT, but most do not.
+;;;
+;;; The following Emacs functions emulate, where practical, the exact
+;;; behavior of the corresponding EDT keypad mode commands.  In a few
+;;; cases, the emulation is not exact, but it is close enough for most
+;;; EDT die-hards.
+;;;
+;;; In a very few cases, we chose to use the superior Emacs way of
+;;; handling things.  For example, we do not emulate the EDT SUBS
+;;; command.  Instead, we chose to use the superior Emacs
+;;; query-replace function.
+;;;
+
+;;;
+;;; PAGE
+;;;
+;;; Emacs uses the regexp assigned to page-delimiter to determine what
+;;; marks a page break.  This is normally "^\f", which causes the
+;;; edt-page command to ignore form feeds not located at the beginning
+;;; of a line.  To emulate the EDT PAGE command exactly,
+;;; page-delimiter is set to "\f" when EDT emulation is turned on, and
+;;; restored to its original value when EDT emulation is turned off.
+;;; But this can be overridden if the EDT definition is not desired by
+;;; placing
+;;;
+;;;         (setq edt-keep-current-page-delimiter t)
+;;;
+;;; in your .emacs file.
+
+(defun edt-page-forward (num)
+  "Move forward to just after next page delimiter.
+Accepts a positive prefix argument for the number of page delimiters to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (eobp)
+      (error "End of buffer")
+      (progn
+        (forward-page num)
+	(if (eobp)
+	    (edt-line-to-bottom-of-window)
+	    (edt-line-to-top-of-window)))))
+
+(defun edt-page-backward (num)
+  "Move backward to just after previous page delimiter.
+Accepts a positive prefix argument for the number of page delimiters to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (bobp)
+      (error "Beginning of buffer")
+      (progn
+        (backward-page num)
+        (edt-line-to-top-of-window))))
+
+(defun edt-page (num)
+  "Move in current direction to next page delimiter.
+Accepts a positive prefix argument for the number of page delimiters to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-page-forward num)
+      (edt-page-backward num)))
+
+;;;
+;;; SECT
+;;;
+;;; EDT defaults a section size to be 16 lines of its one and only
+;;; 24-line window.  That's two-thirds of the window at a time.  The
+;;; EDT SECT commands moves the cursor, not the window.  
+;;; 
+;;; This emulation of EDT's SECT moves the cursor approximately two-thirds
+;;; of the current window at a time.
+
+(defun edt-sect-forward (num)
+  "Move cursor forward two-thirds of a window.
+Accepts a positive prefix argument for the number of sections to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (edt-line-forward (* (* (/ (- (window-height) 1) 3) 2) num)))
+
+(defun edt-sect-backward (num)
+  "Move cursor backward two-thirds of a window.
+Accepts a positive prefix argument for the number of sections to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (edt-line-backward (* (* (/ (- (window-height) 1) 3) 2) num)))
+
+(defun edt-sect (num)
+  "Move in current direction a full window.
+Accepts a positive prefix argument for the number windows to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-sect-forward num)
+      (edt-sect-backward num)))
+
+;;;
+;;; BEGINNING OF LINE
+;;;
+;;; EDT's beginning-of-line command is not affected by current
+;;; direction, for some unknown reason.
+
+(defun edt-beginning-of-line (num)
+  "Move backward to next beginning of line mark.
+Accepts a positive prefix argument for the number of BOL marks to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (bolp)
+      (forward-line (* -1 num))
+      (progn
+        (setq num (1- num))
+        (forward-line (* -1 num)))))
+
+;;;
+;;; EOL (End of Line)
+;;;
+
+(defun edt-end-of-line-forward (num)
+  "Move forward to next end of line mark.
+Accepts a positive prefix argument for the number of EOL marks to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (forward-char)
+  (end-of-line num))
+
+(defun edt-end-of-line-backward (num)
+  "Move backward to next end of line mark.
+Accepts a positive prefix argument for the number of EOL marks to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (end-of-line (1- num)))
+
+(defun edt-end-of-line (num)
+  "Move in current direction to next end of line mark.
+Accepts a positive prefix argument for the number of EOL marks to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-end-of-line-forward num)
+      (edt-end-of-line-backward num)))
+
+;;;
+;;; WORD
+;;;
+;;; This one is a tad messy.  To emulate EDT's behavior everywhere in
+;;; the file (beginning of file, end of file, beginning of line, end
+;;; of line, etc.) it takes a bit of special handling.  
+;;; 
+;;; The variable edt-word-entities contains a list of characters which
+;;; are to be viewed as distinct words where ever they appear in the
+;;; buffer.  This emulates the EDT line mode command SET ENTITY WORD. 
+
+
+(defun edt-one-word-forward ()
+  "Move forward to first character of next word."
+  (interactive)
+  (if (eobp)
+      (error "End of buffer"))
+  (if (eolp)
+      (forward-char)
+      (progn
+        (if (memq (following-char) edt-word-entities)
+            (forward-char)
+            (while (and 
+                     (not (eolp))
+                     (not (eobp))
+                     (not (eq ?\  (char-syntax (following-char))))
+                     (not (memq (following-char) edt-word-entities)))
+              (forward-char)))
+        (while (and 
+                 (not (eolp))
+                 (not (eobp))
+                 (eq ?\  (char-syntax (following-char)))
+                 (not (memq (following-char) edt-word-entities)))
+          (forward-char)))))
+
+(defun edt-one-word-backward ()
+  "Move backward to first character of previous word."
+  (interactive)
+  (if (bobp)
+      (error "Beginning of buffer"))
+  (if (bolp)
+      (backward-char)
+      (progn
+        (backward-char)
+        (while (and 
+                 (not (bolp))
+                 (not (bobp))
+                 (eq ?\  (char-syntax (following-char)))
+                 (not (memq (following-char) edt-word-entities)))
+          (backward-char))
+        (if (not (memq (following-char) edt-word-entities))
+            (while (and 
+                     (not (bolp))
+                     (not (bobp))
+                     (not (eq ?\  (char-syntax (preceding-char))))
+                     (not (memq (preceding-char) edt-word-entities)))
+              (backward-char))))))
+
+(defun edt-word-forward (num)
+  "Move forward to first character of next word.
+Accepts a positive prefix argument for the number of words to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (edt-one-word-forward)
+    (setq num (1- num))))
+
+(defun edt-word-backward (num)
+  "Move backward to first character of previous word.
+Accepts a positive prefix argument for the number of words to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (edt-one-word-backward)
+    (setq num (1- num))))
+
+(defun edt-word (num)
+  "Move in current direction to first character of next word.
+Accepts a positive prefix argument for the number of words to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-word-forward num)
+      (edt-word-backward num)))
+
+;;;
+;;; CHAR
+;;;
+
+(defun edt-character (num)
+  "Move in current direction to next character.
+Accepts a positive prefix argument for the number of characters to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (equal edt-direction-string edt-forward-string)
+      (forward-char num)
+      (backward-char num)))
+
+;;;
+;;; LINE
+;;;
+;;; When direction is set to BACKUP, LINE behaves just like BEGINNING
+;;; OF LINE in EDT.  So edt-line-backward is not really needed as a
+;;; separate function.
+
+(defun edt-line-backward (num)
+  "Move backward to next beginning of line mark.
+Accepts a positive prefix argument for the number of BOL marks to move."
+  (interactive "p")
+  (edt-beginning-of-line num))
+
+(defun edt-line-forward (num)
+  "Move forward to next beginning of line mark.
+Accepts a positive prefix argument for the number of BOL marks to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (forward-line num))
+
+(defun edt-line (num)
+  "Move in current direction to next beginning of line mark.
+Accepts a positive prefix argument for the number of BOL marks to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-line-forward num)
+      (edt-line-backward num)))
+
+;;;
+;;; TOP
+;;;
+
+(defun edt-top ()
+  "Move cursor to the beginning of buffer."
+  (interactive)
+  (goto-char (point-min)))
+
+;;;
+;;; BOTTOM
+;;;
+
+(defun edt-bottom ()
+  "Move cursor to the end of buffer."
+  (interactive)
+  (goto-char (point-max))
+  (edt-line-to-bottom-of-window))
+
+;;;
+;;; FIND
+;;;
+
+(defun edt-find-forward (&optional find)
+  "Find first occurrence of a string in forward direction and save it."
+  (interactive)
+  (if (not find)
+      (set 'search-last-string (read-string "Search forward: ")))
+  (if (search-forward search-last-string)
+      (search-backward search-last-string)))
+
+(defun edt-find-backward (&optional find)
+  "Find first occurrence of a string in the backward direction and save it."
+  (interactive)
+  (if (not find)
+      (set 'search-last-string (read-string "Search backward: ")))
+  (search-backward search-last-string))
+
+(defun edt-find ()
+  "Find first occurrence of string in current direction and save it."
+  (interactive)
+  (set 'search-last-string (read-string "Search: "))
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-find-forward t)
+      (edt-find-backward t)))
+  
+
+;;;
+;;; FNDNXT
+;;;
+
+(defun edt-find-next-forward ()
+  "Find next occurrence of a string in forward direction."
+  (interactive)
+  (forward-char 1)
+  (if (search-forward search-last-string nil t)
+      (search-backward search-last-string)
+      (progn
+        (backward-char 1)
+        (error "Search failed: \"%s\"." search-last-string))))
+
+(defun edt-find-next-backward ()
+  "Find next occurrence of a string in backward direction."
+  (interactive)
+  (if (eq (search-backward search-last-string nil t) nil)
+      (progn
+        (error "Search failed: \"%s\"." search-last-string))))
+
+(defun edt-find-next ()
+  "Find next occurrence of a string in current direction."
+  (interactive)
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-find-next-forward)
+      (edt-find-next-backward)))
+  
+;;;
+;;; APPEND
+;;;
+
+(defun edt-append ()
+  "Append this kill region to last killed region."
+  (interactive "*")
+  (edt-check-selection)
+  (append-next-kill)
+  (kill-region (mark) (point))
+  (message "Selected text APPENDED to kill ring"))
+
+;;;
+;;; DEL L
+;;;
+
+(defun edt-delete-line (num)
+  "Delete from cursor up to and including the end of line mark.
+Accepts a positive prefix argument for the number of lines to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (let ((beg (point)))
+    (forward-line num)
+    (if (not (eq (preceding-char) ?\n))
+        (insert "\n"))
+    (setq edt-last-deleted-lines
+          (buffer-substring beg (point)))
+    (delete-region beg (point))))
+
+;;;
+;;; DEL EOL
+;;;
+
+(defun edt-delete-to-end-of-line (num)
+  "Delete from cursor up to but excluding the end of line mark.
+Accepts a positive prefix argument for the number of lines to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (let ((beg (point)))
+    (forward-char 1)
+    (end-of-line num)
+    (setq edt-last-deleted-lines
+          (buffer-substring beg (point)))
+    (delete-region beg (point))))
+
+;;;
+;;; SELECT
+;;;
+
+(defun edt-select-mode (arg)
+  "Turn EDT select mode off if ARG is nil; otherwise, turn EDT select mode on.
+In select mode, selected text is highlighted."
+  (if arg
+      (progn
+	(make-local-variable 'edt-select-mode)
+	(setq edt-select-mode 'edt-select-mode-text)
+	(setq rect-start-point (window-point)))
+    (progn
+      (kill-local-variable 'edt-select-mode)))
+  (force-mode-line-update))
+
+(defun edt-select ()
+  "Set mark at cursor and start text selection."
+  (interactive)   
+  (set-mark-command nil)) 
+
+(defun edt-reset ()
+  "Cancel text selection."
+  (interactive)
+  (deactivate-mark))
+
+;;;
+;;; CUT
+;;;
+
+(defun edt-cut ()
+  "Deletes selected text but copies to kill ring."
+  (interactive "*")
+  (edt-check-selection)
+  (kill-region (mark) (point))
+  (message "Selected text CUT to kill ring"))
+
+;;;
+;;; DELETE TO BEGINNING OF LINE
+;;;
+
+(defun edt-delete-to-beginning-of-line (num)
+  "Delete from cursor to beginning of line.
+Accepts a positive prefix argument for the number of lines to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (let ((beg (point)))
+    (edt-beginning-of-line num)
+    (setq edt-last-deleted-lines
+          (buffer-substring (point) beg))
+    (delete-region beg (point))))
+
+;;;
+;;; DEL W
+;;;
+
+(defun edt-delete-word (num)
+  "Delete from cursor up to but excluding first character of next word.
+Accepts a positive prefix argument for the number of words to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (let ((beg (point)))
+    (edt-word-forward num)
+    (setq edt-last-deleted-words (buffer-substring beg (point)))
+    (delete-region beg (point))))
+
+;;;
+;;; DELETE TO BEGINNING OF WORD
+;;;
+
+(defun edt-delete-to-beginning-of-word (num)
+  "Delete from cursor to beginning of word.
+Accepts a positive prefix argument for the number of words to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (let ((beg (point)))
+    (edt-word-backward num)
+    (setq edt-last-deleted-words (buffer-substring (point) beg))
+    (delete-region beg (point))))
+
+;;;
+;;; DEL C
+;;;
+
+(defun edt-delete-character (num)
+  "Delete character under cursor.
+Accepts a positive prefix argument for the number of characters to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (setq edt-last-deleted-chars
+        (buffer-substring (point) (min (point-max) (+ (point) num))))
+  (delete-region (point) (min (point-max) (+ (point) num))))
+
+;;;
+;;; DELETE CHAR
+;;;
+
+(defun edt-delete-previous-character (num)
+  "Delete character in front of cursor.
+Accepts a positive prefix argument for the number of characters to delete."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (setq edt-last-deleted-chars
+        (buffer-substring (max (point-min) (- (point) num)) (point)))
+  (delete-region (max (point-min) (- (point) num)) (point)))
+
+;;;
+;;; UND L
+;;;
+
+(defun edt-undelete-line ()
+  "Undelete previous deleted line(s)."
+  (interactive "*")
+  (point-to-register 1)
+  (insert edt-last-deleted-lines)
+  (register-to-point 1))
+
+;;;
+;;; UND W
+;;;
+
+(defun edt-undelete-word ()
+  "Undelete previous deleted word(s)."
+  (interactive "*")
+  (point-to-register 1)
+  (insert edt-last-deleted-words)
+  (register-to-point 1))
+
+;;;
+;;; UND C
+;;;
+
+(defun edt-undelete-character ()
+  "Undelete previous deleted character(s)."
+  (interactive "*")
+  (point-to-register 1)
+  (insert edt-last-deleted-chars)
+  (register-to-point 1))
+
+;;;
+;;; REPLACE
+;;;
+
+(defun edt-replace ()
+  "Replace marked section with last CUT (killed) text."
+  (interactive "*")
+  (exchange-point-and-mark)
+  (let ((beg (point)))
+    (exchange-point-and-mark)
+    (delete-region beg (point)))
+  (yank))
+
+;;;
+;;; ADVANCE
+;;;
+
+(defun edt-advance ()
+  "Set movement direction forward.
+Also, execute command specified if in Minibuffer."
+  (interactive)
+  (setq edt-direction-string edt-forward-string)
+  (force-mode-line-update)
+  (if (string-equal " *Minibuf" 
+                    (substring (buffer-name) 0 (min (length (buffer-name)) 9)))
+      (exit-minibuffer)))
+  
+;;;
+;;; BACKUP
+;;;
+
+(defun edt-backup ()
+  "Set movement direction backward.
+Also, execute command specified if in Minibuffer."
+  (interactive)
+  (setq edt-direction-string edt-backward-string)
+  (force-mode-line-update)
+  (if (string-equal " *Minibuf" 
+                    (substring (buffer-name) 0 (min (length (buffer-name)) 9)))
+      (exit-minibuffer)))
+
+;;;
+;;; CHNGCASE
+;;;
+;; This function is based upon Jeff Kowalski's case-flip function in his 
+;; tpu.el.
+
+(defun edt-change-case (num)
+  "Change the case of specified characters.
+If text selection IS active, then characters between the cursor and mark are
+changed.  If text selection is NOT active, there are two cases.  First, if the
+current direction is ADVANCE, then the prefix number of character(s) under and
+following cursor are changed.  Second, if the current direction is BACKUP, then
+the prefix number of character(s) before the cursor are changed.  Accepts a
+positive prefix for the number of characters to change, but the prefix is
+ignored if text selection is active."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (if edt-select-mode
+      (let ((end (max (mark) (point)))
+            (point-save (point)))
+        (goto-char (min (point) (mark)))
+        (while (not (eq (point) end))
+          (funcall (if (<= ?a (following-char))
+                       'upcase-region 'downcase-region)
+                   (point) (1+ (point)))
+          (forward-char 1))
+        (goto-char point-save))
+      (progn
+        (if (string= edt-direction-string edt-backward-string)
+            (backward-char num))
+        (while (> num 0)
+          (funcall (if (<= ?a (following-char))
+                       'upcase-region 'downcase-region)
+                   (point) (1+ (point)))
+          (forward-char 1)
+          (setq num (1- num))))))
+
+;;;
+;;; DEFINE KEY
+;;;
+
+(defun edt-define-key ()
+  "Assign an interactively-callable function to a specified key sequence.
+The current key definition is saved in edt-last-replaced-key-definition.
+Use edt-restore-key to restore last replaced key definition."
+  (interactive)
+  (let (edt-function
+    edt-key-definition-string)
+    (setq edt-key-definition-string
+         (read-key-sequence "Press the key to be defined: "))
+    (if (string-equal "\C-m" edt-key-definition-string) 
+        (message "Key not defined") 
+        (progn
+          (setq edt-function (read-command "Enter command name: "))
+          (if (string-equal "" edt-function)
+              (message "Key not defined") 
+              (progn
+                (setq edt-last-replaced-key-definition
+                   (lookup-key (current-global-map) edt-key-definition-string))
+                (define-key (current-global-map) 
+                    edt-key-definition-string edt-function)))))))
+
+;;;
+;;; FORM FEED INSERT
+;;;
+
+(defun edt-form-feed-insert (num)
+  "Insert form feed character at cursor position.
+Accepts a positive prefix argument for the number of form feeds to insert."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (insert ?\f)
+    (setq num (1- num))))
+
+;;;
+;;; TAB INSERT
+;;;
+
+(defun edt-tab-insert (num)
+  "Insert tab character at cursor position.
+Accepts a positive prefix argument for the number of tabs to insert."
+  (interactive "*p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (insert ?\t)
+    (setq num (1- num))))
+
+;;;
+;;; Check Prefix
+;;;
+
+(defun edt-check-prefix (num)
+  "Indicate error if prefix is not positive."
+  (if (<= num 0)
+      (error "Prefix must be positive")))
+      
+;;;
+;;; Check Selection
+;;;
+
+(defun edt-check-selection ()
+  "Indicate error if EDT selection is not active."
+  (if (not edt-select-mode)
+      (error "Selection NOT active")))
+
+;;;;
+;;;; ENHANCEMENTS AND ADDITIONS FOR EDT KEYPAD MODE
+;;;;
+
+;;; 
+;;; Several enhancements and additions to EDT keypad mode commands are
+;;; provided here.  Some of these have been motivated by similar
+;;; TPU/EVE and EVE-Plus commands.  Others are new.
+
+;;;
+;;; CHANGE DIRECTION
+;;;
+
+(defun edt-change-direction ()
+  "Toggle movement direction."
+  (interactive)
+  (if (equal edt-direction-string edt-forward-string) 
+      (edt-backup)
+      (edt-advance)))
+
+;;;
+;;; TOGGLE SELECT
+;;;
+
+(defun edt-toggle-select ()
+  "Toggle to start (or cancel) text selection."
+  (interactive)
+  (if edt-select-mode
+      (edt-reset)
+    (edt-select)))
+
+;;;
+;;; SENTENCE
+;;;
+
+(defun edt-sentence-forward (num)
+  "Move forward to start of next sentence.
+Accepts a positive prefix argument for the number of sentences to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (eobp)
+      (progn
+        (error "End of buffer"))
+      (progn
+        (forward-sentence num)
+        (edt-one-word-forward))))
+
+(defun edt-sentence-backward (num)
+  "Move backward to next sentence beginning.
+Accepts a positive prefix argument for the number of sentences to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (if (eobp)
+      (progn
+        (error "End of buffer"))
+      (backward-sentence num)))
+
+(defun edt-sentence (num)
+  "Move in current direction to next sentence.
+Accepts a positive prefix argument for the number of sentences to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-sentence-forward num)
+      (edt-sentence-backward num)))
+
+;;;
+;;; PARAGRAPH
+;;;
+
+(defun edt-paragraph-forward (num)
+  "Move forward to beginning of paragraph.
+Accepts a positive prefix argument for the number of paragraphs to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (next-line 1)
+    (forward-paragraph)
+    (previous-line 1)
+    (if (eolp)
+        (next-line 1))
+    (setq num (1- num))))
+
+(defun edt-paragraph-backward (num)
+  "Move backward to beginning of paragraph.
+Accepts a positive prefix argument for the number of paragraphs to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (while (> num 0)
+    (backward-paragraph)
+    (previous-line 1)
+    (if (eolp) (next-line 1))
+    (setq num (1- num))))
+
+(defun edt-paragraph (num)
+  "Move in current direction to next paragraph.
+Accepts a positive prefix argument for the number of paragraph to move."
+  (interactive "p")
+  (if (equal edt-direction-string edt-forward-string)
+      (edt-paragraph-forward num)
+      (edt-paragraph-backward num)))
+
+;;;
+;;; RESTORE KEY
+;;;
+
+(defun edt-restore-key ()
+  "Restore last replaced key definition.
+Definition is stored in edt-last-replaced-key-definition."
+  (interactive)
+  (if edt-last-replaced-key-definition
+      (progn
+        (let (edt-key-definition-string)
+          (set 'edt-key-definition-string
+               (read-key-sequence "Press the key to be restored: "))
+          (if (string-equal "\C-m" edt-key-definition-string) 
+              (message "Key not restored") 
+              (define-key (current-global-map) 
+                 edt-key-definition-string edt-last-replaced-key-definition))))
+      (error "No replaced key definition to restore!")))
+
+;;;
+;;; WINDOW TOP
+;;;
+
+(defun edt-window-top ()
+  "Move the cursor to the top of the window."
+  (interactive)
+  (let ((start-column (current-column)))
+    (move-to-window-line 0)
+    (move-to-column start-column)))
+
+;;;
+;;; WINDOW BOTTOM
+;;;
+
+(defun edt-window-bottom ()
+  "Move the cursor to the bottom of the window."
+  (interactive)
+  (let ((start-column (current-column)))
+    (move-to-window-line (- (window-height) 2))
+    (move-to-column start-column)))
+
+;;;
+;;; SCROLL WINDOW LINE
+;;;
+
+(defun edt-scroll-window-forward-line ()
+  "Move window forward one line leaving cursor at position in window."
+  (interactive)
+  (scroll-up 1))
+
+(defun edt-scroll-window-backward-line ()
+  "Move window backward one line leaving cursor at position in window."
+  (interactive)
+  (scroll-down 1))