Anonymous avatar Anonymous committed 56ed835

2001-07-14 Steve Youngs <youngs@xemacs.org>;

* ibuffer.el: Replaced with newer version that was in
xemacs-devel.

2001-07-14 Kevin Gallagher <kevingal@onramp.net>;

* Import version 4.0.

2001-06-06 Mark Thomas <mthomas@edrc.cmu.edu>;

* nnmail.el (nnmail-fix-eudora-headers): Change the In-Reply-To
fix so it works with older versions of XEmacs.

2001-07-14 Steve Youngs <youngs@xemacs.org>;

* emacsbug.el (report-emacs-bug-address): Change address to
xemacs-beta@xemacs.org.

2001-06-06 Raymond Toy <toy@rtp.ericsson.se>;

* cvs-edit.el (cvs-edit-done): Check for a null vc-comment-ring
and initialize if necessary.

2001-06-21 Jeff Mincy <jeff@delphioutpost.com>;

* diff-mode.el (vc-backend-diff): Fix when default-major-mode is text-mode,
also enabled font-lock

2001-07-14 I. Sheldon <is@kaidea.freeserve.co.uk>;

* vc.el (vc-populate-vc-log-hook): New.
(vc-log-template): New.
(vc-start-entry): Use vc-populate-vc-log-hook.
(vc-populate-vc-log-with-template): New.
(vc-populate-vc-log-with-goto-first-eol): New.

2001-07-14 Steve Youngs <youngs@xemacs.org>;

* ibuffer.el: Move to edit-utils package.

* Makefile (ELCS): Remove ibuffer.elc

2001-06-16 Simon Josefsson <jas@extundo.com>;

* zenirc.el (zenirc-font-lock-keywords): Some font-lock defaults.
(toplevel): Put font-lock-defaults on mode.
(zenirc-mode): Allow font-lock initialization.

Comments (0)

Files changed (4)

+2001-07-14  Kevin Gallagher  <kevingal@onramp.net>
+
+	* Import version 4.0.
+
 2000-10-05  Martin Buchholz  <martin@xemacs.org>
 
 	* *: Mega typo fix.
 ;;; edt-mapper.el --- Create an EDT LK-201 Map File for X-Windows Emacs
 
-;; Copyright (C) 1994, 1995  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 2000  Free Software Foundation, Inc.
 
-;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
-;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Author: Kevin Gallagher <kevingal@onramp.net>
+;; Maintainer: Kevin Gallagher <kevingal@onramp.net>
 ;; Keywords: emulations
 
-;; This file is part of XEmacs.
+;; This file is part of GNU Emacs.
 
-;; XEmacs is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
+;; 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.
 
-;; 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.
+;; 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 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
+;; 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:
+;;
+
+;;  [Part of the GNU Emacs EDT Emulation.]
 
 ;;  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.) 
+;;  that defines the mapping of the user's keyboard to the LK-201
+;;  keyboard function keys and keypad keys (around which EDT has been
+;;  designed).  Please read the "Usage" AND "Known Problems" sections
+;;  below before attempting to run this program.  (The design of this
+;;  file, edt-mapper.el, was heavily influenced by tpu-mapper.el.)
 
-;;; Usage:
+;;  Version 4.0 contains the following enhancements:
 
-;;  Simply load this file into the X-Windows version of emacs (version 19)
+;;  1.  If you access a workstation using an X Server, note that the
+;;      initialization file generated by edt-mapper.el will now
+;;      contain the name of the X Server vendor.  This is a
+;;      convenience for those who have access to their Unix account
+;;      from more than one type of X Server.  Since different X
+;;      Servers typically require different EDT emulation
+;;      initialization files, edt-mapper.el will now generate these
+;;      different initialization files and save them with different
+;;      names.
+
+;;  2.  Also, edt-mapper.el is now capable of binding an ASCII key
+;;      sequence, providing the ASCII key sequence prefix is already
+;;      known by Emacs to be a prefix.  As a result, some
+;;      terminal/keyboard/window system configurations, which don't
+;;      have a complete set of sensible function key map bindings, can
+;;      still be configured for EDT Emulation.
+
+
+;;  Usage:
+
+;;  Simply load this file into emacs (version 19 or higher)
 ;;  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).
+;;  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.
+;;  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.
+;;  variable "edt-keys-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"))
+;;    (setq edt-keys-file (expand-file-name "~/.my-emacs-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.
+;;  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 Emacs guru
+;;  can try to figure out why the key is being ignored.
+
+;;; History:
+;; 
+
+;;  Version 4.0    2000    Added 2 New Features
+
+;;; Code:
 
 ;;;
-;;;  Make sure we're running X-windows and Emacs version 19
+;;;  Make sure we're running Emacs version 19, or higher.
 ;;;
+
 (cond
- ((not (and window-system (not (string-lessp emacs-version "19"))))
+ ((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.
+    You must run edt-mapper.el under Emacs version 19 or higher.
 
     Press any key to exit.  ")
   (sit-for 600)
 
 
 ;;;
-;;;  Decide whether we're running GNU or Lucid emacs.
+;;;  Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs).
+;;;  Determine Window System, and X Server Vendor (if appropriate).
 ;;;
-(defconst edt-lucid-emacs19-p (string-match "XEmacs" emacs-version)
-  "Non-NIL if we are running XEmacs.")
+(defconst edt-x-emacs-p (string-match "XEmacs" emacs-version)
+  "Non-NIL if we are running XEmacs version 19, or higher.")
+
+(defconst edt-emacs-variant (if edt-x-emacs-p "xemacs" "gnu")
+  "Indicates Emacs variant:  GNU Emacs or XEmacs \(aka Lucid Emacs\).")
+
+(defconst edt-window-system (if edt-x-emacs-p (console-type) window-system)
+  "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).")
+
+(defconst edt-xserver (if (eq edt-window-system 'x)
+			  (if edt-x-emacs-p
+			      (replace-in-string (x-server-vendor) "[ _]" "-")
+			    (subst-char-in-string ?  ?- (x-server-vendor)))
+			nil)
+  "Indicates X server vendor name, if applicable.")
 
 
 ;;;
 (defvar edt-key-seq nil)
 (defvar edt-enter-seq nil)
 (defvar edt-return-seq nil)
+(defvar edt-term nil)
 
+;;;  
+;;;  Determine Terminal Type (if appropriate).
+;;;
+
+(if (and edt-window-system (not (eq edt-window-system 'tty)))
+    (setq edt-term nil)
+  (setq edt-term (getenv "TERM")))
 
 ;;;
-;;;  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))
+;;;  Make sure the window is big enough to display the instructions,
+;;;  except where window cannot be re-sized.
+;;;  
 
+(if (and edt-window-system (not (eq edt-window-system 'tty)))
+    (set-frame-size (selected-frame) 80 36))
 
 ;;;
 ;;;  Create buffers - Directions and Keys
 ;;;   Display directions
 ;;;
 (switch-to-buffer "Directions")
-(insert "
+(if (and edt-window-system (not (eq edt-window-system 'tty)))
+    (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.)  
+    You will be asked to press keys to create a custom mapping (under a
+    Window Manager) 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.
+    your local system 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, 
+    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.
 
 ")
+  (insert "
+                                  EDT MAPPER
+
+    You will be asked to press keys to create a custom mapping 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.)
+
+    If you are using an real LK-201 keyboard, you should map the keys
+    exactly as they are on the keyboard.
+
+    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
+;;;  Save <CR> for future reference.
 ;;;
+;;;  For GNU Emacs, running in a Window System, first hide bindings in
+;;;  function-key-map.
+;;;  
 (cond
- (edt-lucid-emacs19-p
+ (edt-x-emacs-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) "]")))) 
+  (if edt-window-system
+      (progn
+	(setq edt-save-function-key-map function-key-map)
+	(setq function-key-map (make-sparse-keymap))))
+  (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue "))))
 
 ;;;
+;;;  Remove prefix-key bindings to F1 and F2 in global-map so they can be
+;;;  bound in the EDT Emulation mode.
+;;;
+(global-unset-key [f1])
+(global-unset-key [f2])
+  
+;;;
 ;;;   Display Keypad Diagram and Begin Prompting for Keys
 ;;;
 (set-buffer "Directions")
 (delete-region (point-min) (point-max))
-(insert "
-
-
+(if (and edt-window-system (not (eq edt-window-system 'tty)))
+    (insert "
 
           PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
 
-
-
-
     Here's a picture of the standard LK-201 keypad for reference:
 
           _______________________    _______________________________
                                     |               |       |       |
                                     |_______________|_______|_______|
 
+         REMEMBER:  JUST PRESS RETURN TO SKIP MAPPING A KEY.
+
 ")
+  (progn
+    (insert "
+    GENERATING A CUSTOM CONFIGURATION FILE FOR TERMINAL TYPE:  ")
+    (insert (format "%s." edt-term))
+    (insert "
+
+          PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
+
+          _______________________    _______________________________
+         | 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  |       |
+                                    |_______________|_______|_______|
+
+         REMEMBER:  JUST PRESS RETURN TO SKIP MAPPING A KEY.")))
+
 
 ;;;
 ;;;  Key mapping functions
   (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)))
+         (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)
 
 (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) "]"))
+  (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip)))
   (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")))
+         (set-buffer "Keys")
+         (insert (if (vectorp edt-key)
+                     (format "    (\"%s\" . %s)\n" ident edt-key)
+                   (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))
+(fset 'edt-map-key (if edt-x-emacs-p 'edt-lucid-map-key 'edt-gnu-map-key))
 (set-buffer "Keys")
 (insert "
 ;;
 (set-buffer "Directions")
 (delete-region (point-min) (point-max))
 (insert "
-		       ADDITIONAL FUNCTION KEYS
+                       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.
+    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.
+    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, for example, \"linedel\".  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 LK-201 function and
+    keypad 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.)
+    When you are done, just press RETURN at the \"EDT Key Name:\" prompt.
 ")
 (switch-to-buffer "Directions")
 ;;;
 (set-buffer "Keys")
 (insert "\
 ;;
-;;  Extra Keys 
+;;  Extra Keys
 ;;
 ")
+;;;
+;;;  Restore function-key-map.
+;;;  
+(if (and edt-window-system (not edt-x-emacs-p))
+    (setq function-key-map edt-save-function-key-map))
 (setq EDT-key-name "")
-(while (not 
-	(string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) ""))
+(while (not
+        (string-equal (setq EDT-key-name (read-string "EDT Key Name: ")) ""))
   (edt-map-key EDT-key-name ""))
 
 ;
 ")
 
 ;;;
-;;;  Save the key mapping program and blow this pop stand
+;;;  Save the key mapping program
 ;;;
-(let ((file (if edt-lucid-emacs19-p "~/.edt-lucid-keys" "~/.edt-gnu-keys")))
+;;;
+;;;  Save the key mapping file
+;;;
+(let ((file (concat
+	     "~/.edt-" edt-emacs-variant
+	     (if edt-term (concat "-" edt-term))
+	     (if edt-xserver (concat "-" edt-xserver))
+	     (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system))))
+	     "-keys")))
   (set-visited-file-name
    (read-file-name (format "Save key mapping to file (default %s): " file) nil file)))
 (save-buffer)
 
                                 For GNU Emacs 19
 
-Copyright (C) 1986, 1992, 1994, 1995 Free Software Foundation, Inc.
+Copyright (C) 1986, 1992, 1994, 1995, 1999, 2000 Free Software Foundation, Inc.
 
-Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
-Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+Author: Kevin Gallagher <kevingal@onramp.net>
+Maintainer: Kevin Gallagher <kevingal@onramp.net>
 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 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.
+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.
+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.
+This is Version 4.0 of the EDT Emulation for Emacs 19 and above.
+It comes with special functions which replicate nearly all of EDT's
+keypad mode behavior.  It sets up default keypad and function key
+bindings which closely match those found in EDT.  Support is
+provided so that users may reconfigure most keypad and function key
+bindings to their own liking.
+
+NOTE: Version 4.0 contains several enhancements.  See the
+Enhancements section below for the details.
+
+
+Quick Start:
+
+To start the EDT Emulation, first start Emacs and then enter 
+
+   M-x edt-emulation-on
    
-Send bug fixes, suggestions for enhancements, and corrections to this
-documentation to Kevin Gallagher (kgallagh@spd.dsccc.com).
+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:
+
+   (add-hook term-setup-hook 'edt-emulation-on)
+
+IMPORTANT: Be sure to read the rest of this file.  It contains very
+           useful information on how the EDT Emulation behaves and how
+           to customize it to your liking.
 
 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
+edt-user.doc     - User Instructions and Sample Customization File
+edt.el           - EDT Emulation Functions and Default Configuration
+edt-lk201.el     - Built-in support for DEC LK-201 Keyboards
+edt-vt100.el     - Built-in support for DEC VT-100 (and above) terminals
+edt-pc.el        - Built-in support for PC 101 Keyboards under MS-DOS
+edt-mapper.el    - Create an EDT LK-201 Map File for Keyboards Without 
+                     Built-in Support
 
-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;
+Enhancements:
+
+Version 4.0 contains the following enhancements:
+
+ 1.  Scroll margins at the top and bottom of the window are now
+     supported.  (The design was copied from tpu-extras.el.)  By
+     default, this feature is enabled with the top margin set to
+     10% of the window and the bottom margin set to 15% of the
+     window.  To change these settings, you can invoke the function
+     edt-set-scroll-margins in your .emacs file.  For example, the
+     following line
+
+          (edt-set-scroll-margins "20%" "25%")
+      
+     sets the top margin to 20% of the window and the bottom margin
+     to 25% of the window.  To disable this feature, set each
+     margin to 0%.  You can also invoke edt-set-scroll-margins
+     interactively while EDT Emulation is active to change the
+     settings for that session.
+
+     NOTE: Another way to set the scroll margins is to use the
+     Emacs customization feature (not available in Emacs 19) to set
+     the following two variables directly:
+      
+          edt-top-scroll-margin and edt-bottom-scroll-margin
+
+     Enter the Emacs `customize' command.  First select the Editing
+     group and then select the Emulations group.  Finally, select
+     the Edt group and follow the directions.
+      
+ 2.  The SUBS command is now supported and bound to GOLD-Enter by
+     default.  (This design was copied from tpu-edt.el.)  Note, in
+     earlier versions of EDT Emulation, GOLD-Enter was assigned to
+     the Emacs function `query-replace'.  The binding of
+     `query-replace' has been moved to GOLD-/.  If you prefer to
+     restore `query-replace' to GOLD-Enter, then use an EDT user
+     customization file, edt-user.el, to do this.  See edt-user.doc
+     for details.
+
+ 3.  EDT Emulation now also works in XEmacs, including the
+     highlighting of selected text.
+
+ 4.  If you access a workstation using an X Server, observe that
+     the initialization file generated by edt-mapper.el will now
+     contain the name of the X Server vendor.  This is a
+     convenience for those who have access to their Unix account
+     from more than one type of X Server.  Since different X
+     Servers typically require different EDT emulation
+     initialization files, edt-mapper.el will now generate these
+     different initialization files and save them with different
+     names.  Then, the correct initialization file for the
+     particular X server in use is loaded correctly automatically.
+
+ 5.  Also, edt-mapper.el is now capable of binding an ASCII key
+     sequence, providing the ASCII key sequence prefix is already
+     known by Emacs to be a prefix.  As a result of providing this
+     support, some terminal/keyboard/window system configurations,
+     which don't have a complete set of sensible function key
+     bindings built into Emacs in `function-key-map', can still be
+     configured for use with EDT Emulation.  (Note: In a few rare
+     circumstances this does not work properly.  In particular, it
+     does not work if a subset of the leading ASCII characters in a
+     key sequence are recognized by Emacs as having an existing
+     binding.  For example, if the keypad 7 (KP-7) key generates
+     the sequence \"<ESC>Ow\" and \"<ESC>O\" is already bound to a
+     function, pressing KP-7 when told to do so by edt-mapper.el
+     will result in edt-mapper.el incorrectly mapping \"<ESC>O\" to
+     KP-7 and \"w\" to KP-8.  If something like this happens to
+     you, it is probably a bug in the support for your keyboard
+     within Emacs OR a bug in the Unix termcap/terminfo support for
+     your terminal OR a bug in the terminal emulation software you
+     are using.)
+
+ 6.  The edt-quit function (bound to GOLD-q by default) has been
+     modified to warn the user when file-related buffer
+     modifications exist.  It now cautions the user that those
+     modifications will be lost if the user quits without saving
+     those buffers.
+
+
+Goals:
+
+        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;
+        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.
+            and the user's customized EDT bindings, without having to exit
+            Emacs.
 
-        4.  Provide support for some TPU/EVE functions not supported in
-            EDT. 
+        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. 
+        6.  Support GNU Emacs 19 and higher.  (GNU Emacs 18 and below is no
+	        longer supported.)  XEmacs 19, and above, is also supported.
 
-        7.  When running under X, support highlighting of marked text.
+        7.  Supports highlighting of marked text within the EDT emulation on
+            all platforms on which Emacs supports highlighting of marked text.
 
-        8.  Handle terminal configuration under X interactively when the
-            emulation is invoked for the first time.
+        8.  Handle terminal configuration interactively for most terminal
+            configurations, 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.
+Keyboards used under a Window System are supported via the edt-mapper function.
+The first time you invoke the emulation under a window system, 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, KP0, KP1, F1, F2, 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.
+In character oriented connections not running a window manager, built-in
+support for the following terminals/keyboards is provided:
+
+  (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.
 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)
+                  (add-hook 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
                        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.
+Emulation key bindings and the default EDT Emulation key bindings.  (See the
+sample edt-user.el file below.  Look at the binding to GOLD Z.)  It is also
+easy to turn off the emulation (via the command edt-emulation-off).  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.
+Emacs binds keys to ASCII control characters and so does the real EDT.  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 so that the EDT bindings to ASCII control characters override the default
+Emacs bindings.
 
 
 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.  
+     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:
+     The Sun Type 5 and other more recent Sun keyboards, however, do have
+     separate arrow keys.  This makes them candidates for setting up a
+     reasonable EDT keypad emulation.  
+
+     Depending upon the configuration of the version of X installed on your
+     system, you may find the default X keynames for the keypad keys don't
+     permit Emacs to interpret some or all the keypad keys as something other
+     than arrow keys, numeric keys, Home, PgUP, etc.  Both Sun and HP have been
+     particularly guilty of making bizarre keysym assignments to the keypad
+     keys. 
+
+     In most cases, the X Windows command, xmodmap, can be used to correct the
+     problem.  Here's a sample .xmodmaprc file which corrects this problem on
+     one Sun workstation configuration using an older SunOS release configured
+     with a Sun Type 5 keyboard:
 
          ! File:  .xmodmaprc
          !
          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
+     If edt-mapper.el does not recognize your keypad keys as unique keys, use
+     the command
+
+	 xmodmap -pke
+
+     to get a listing of the actual key codes and the keysyms mapped to them
+     and then generate you own custom .xmodmaprc similar to the one above.
+
+     Next, 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).  In this example, 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
+     changes the X Windows name of the keypad NumLock key to be known
+     internally as the F24 key.  Doing so permits it to be configured to behave
+     as the PF1 (Gold) key.  
+
+     The side effect of this change is that 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
+     redefine it to be the NumLock key.  Basically, you need to clear the
+     NumLock key from being assigned as a modifier, assign it to the key of
+     your choice, and then add it back as a modifier.  (See the "General Notes
+     on Using NumLock for the PF1 Key on a Unix System" section below 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.)
+     can be used instead if you load a freeware TSR distributed with MS-Kermit,
+     call gold.com.  This was once distributed in a file called gold22.zip and
+     came with the source code as well as a loadable binary image.  (See
+     edt-pc.el in the Emacs lisp/emulation directory for more information.)
 
-  PC users running Linux:
+  PC users running GNU/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:
+     The default X server configuration varies from distribution to
+     distribution and release to release of GNU/Linux.  If your system fails to
+     recognize the keypad keys as distinct keys, change the NumLock state,
+     turning it on or off, as the case may be, then try again.  If this doesn't
+     solve your problem, you may have to modify the X keysym mappings with
+     xmodmap.
+
+     On one distribution on an Intel PC, the following .xmodmaprc set things up
+     nicely.  
 
          ! File:  .xmodmaprc
          !
-         ! Set up PC keypad under Linux for the GNU Emacs EDT Emulation 
+         ! Set up PC keypad under GNU/Linux for the GNU Emacs EDT Emulation 
          !
-         keycode  22 = BackSpace
-         keycode  77 = F12
-         keycode  96 = Num_Lock
+	 clear  mod2
+	 keycode  77 = F12
+	 keycode  96 = Num_Lock Pointer_EnableKeys
+	 add mod2 = 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.
+     In this example, after feeding the file to the xmodmap command, the PC
+     NumLock keypad key will be configurable for the emulation of the PF1 key.
+     The PC keypad can now emulate an LK-201 keypad (less the comma key), the
+     standard keyboard supplied with DEC terminals VT-200 and above.  This
+     .xmodmaprc file switches the role of the F12 and NumLock keys.  It has
+     been tested on RedHat GNU/Linux 5.2.  Other versions of GNU/Linux may
+     require different keycodes.  (See the "General Notes on Using NumLock for
+     the PF1 Key on a Unix System" section below for further help on how to do
+     this.)
 
-     NOTE: It is necessary to have NumLock ON for the PC keypad to emulate the
-     LK-201 keypad properly.
+     NOTE: Remember, it may be necessary to have NumLock in one position (ON)
+     or the other (OFF) for the PC keypad to emulate the LK-201 keypad
+     properly.
 
+  General Notes on Using NumLock for the PF1 Key on a Unix System:
 
+     Making the physical NumLock key available for use in the EDT
+     Emulation requires some modification to the default X Window
+     settings.  Since the keycode assignments vary from system to
+     system, some investigation is needed to see how to do this on
+     a particular system.
+
+     You will need to look at the output generated by xmodmap invoked with the
+     "-pm" switch.  examined.  For example, on RedHat GNU/Linux 5.2 on a PC, we
+     get the following output when running xmodmap.
+
+     "xmodmap -pm"  yields:
+
+          xmodmap:  up to 2 keys per modifier, (keycodes in parentheses):
+
+          shift       Shift_L (0x32),  Shift_R (0x3e)
+          lock        Caps_Lock (0x42)
+          control     Control_L (0x25),  Control_R (0x6d)
+          mod1        Alt_L (0x40),  Alt_R (0x71)
+          mod2        Num_Lock (0x4d)
+          mod3
+          mod4
+          mod5        Scroll_Lock (0x4e)
+
+
+     Note that Num_Lock is assigned to the modifier mod2.  This is
+     what hides Num_Lock from being seen by Emacs.
+
+     Now, "xmodmap -pke" yields:
+
+             .
+             .
+             .
+          keycode  77 = Num_Lock Pointer_EnableKeys
+             .
+             .
+             .
+          keycode  96 = F12
+             .
+             .
+             .
+
+     So, in RedHat GNU/Linux 5.2 on a PC, Num_Lock generates keycode
+     77.  The following steps are taken:
+
+         1.  clear the assignment of Num_Lock to mod2;
+         2.  swap the keycodes assigned to F12 and Num_Lock;
+         3.  assign Num_Lock back to mod2.
+
+     The .xmodmaprc file looks like this:
+
+         ! File:  .xmodmaprc
+         !
+         ! Set up PC keypad under GNU/Linux for the GNU Emacs EDT Emulation 
+         !
+	 clear  mod2
+	 keycode  77 = F12
+	 keycode  96 = Num_Lock Pointer_EnableKeys
+	 add mod2 = Num_Lock
+
+     So, after executing "xmodmap .xmodmaprc", a press of the physical
+     F12 key looks like a Num_Lock keypress to X.  Also, a press of the
+     physical NumLock key looks like a press of the F12 key to X.
+
+     Now, edt-mapper.el will see "f12" when the physical NumLock key
+     is pressed, allowing the NumLock key to be used as the EDT PF1
+     (Gold) key. 
+
 V.    HOW DOES THIS EDT EMULATION DIFFER FROM REAL EDT?:
 
 In general, you will find that this emulation of EDT replicates most, but not
 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.
+    accepts repeat counts.  For example, when using the real EDT, pressing
+    these three keys in sequence, GOLD 5 KP1, will move the cursor in the
+    current direction 5 words.  This does NOT work in Emacs!
 
-    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 
+    Emacs provides two ways to enter repeat counts and neither involves using
+    the GOLD key.  First, repeat counts can be entered in Emacs 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. 
+    move the cursor in the current direction 10 words.  Second, Emacs provides
+    another command called universal-argument that can be used to do the same
+    thing.  Normally, in Emacs has this bound to C-u.
 
-    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
+2.  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.
+    To enter Emacs commands not bound to keys, you can press GOLD KP7 or the DO
+    key.  Emacs will display its own command prompt "M-x".  This stands for the
+    keypress Meta-x, where Meta is a special shift key.  The Alt key is often
+    mapped to behave as a Meta key.  So, you can also invoke this prompt by
+    pressing Meta-x.  Typing the sequence "ESC x" will also invoke the prompt.
 
-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. 
+3.  Selected text is highlighted ONLY on systems where Emacs supports the
+    highlighting of text.
 
-5.  Just like TPU/EVE, The ENTER key is NOT used to terminate input when the
+4.  Just like in 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.)
+    KP5 (the direction keys) do terminate input for the FIND command, just like
+    in EDT, however.)
 
 
 
     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.
+    but is bound in the sample edt-user.el file.
 
     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
     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.
+2.  Direction support is fully supported.  
 
-3.  All original emacs bindings are fully restored when EDT emulation is
-    turned off.
+3.  All original Emacs bindings are fully restored when EDT emulation is turned
+    off.  So, if a fellow worker comes over to your terminal to help you with a
+    software problem, for example, and is completely confused by your EDT
+    emulation bindings, just enter the command, edt-emulation-off, at the M-x
+    prompt and the original Emacs bindings will be restored.  To resume the EDT
+    emulation, just enter edt-emulation-on.
 
 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
 
             (setq edt-keep-current-page-delimiter t)
 
-    in your .emacs file.
+    in your .emacs file.  Or, you can used the Emacs customize command
+    to change its setting.
 
 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
 
 9.  EDT's FIND and FNDNXT are supported.
 
-10. EDT's APPEND and REPLACE commands are supported.
+10. EDT's APPEND, REPLACE, and SUBS 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:
     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.
+
+20. EDT scroll margins are supported, but are disabled by default.  (See
+    CUSTOMIZING section below for instructions on how to enable them.)
 
 
 VII.  CUSTOMIZING:
                 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.
+There are three basic functions that do the EDT emulation custom bindings:
+edt-bind-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
+The first, edt-bind-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
 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!
+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 LK-201 function keys, to keypad keys, and to gold sequences
+of those keys.
 
 
 SPECIFYING WORD ENTITIES:
 
         (setq edt-use-EDT-control-key-bindings t)
 
+
+SETTING SCROLL MARGINS:
+
+Scroll margins at the top and bottom of the window are now supported.  (The
+design was copied from tpu-extras.el.)  By default, this feature is enabled
+with the top margin set to 10% of the window and the bottom margin set to 15%
+of the window.  To change these settings, you can invoke the function
+edt-set-scroll-margins in your .emacs file.  For example, the following line
+
+          (edt-set-scroll-margins "20%" "25%")
+      
+sets the top margin to 20% of the window and the bottom margin to 25% of the
+window.  To disable this feature, set each margin to 0%.  You can also invoke
+edt-set-scroll-margins interactively while EDT Emulation is active to change
+the settings for that session.
+
+NOTE: Another way to set the scroll margins is to use the Emacs customization
+feature (not available in Emacs 19) to set the following two variables
+directly:
+      
+          edt-top-scroll-margin and edt-bottom-scroll-margin
+
+Enter the Emacs `customize' command.  First select the Editing group and then
+select the Emulations group.  Finally, select the Edt group and follow the
+directions.
 
                               DEFAULT EDT Keypad
 
 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   |
+G-HELP: Emacs Help                +----------+----------+----------+----------+
+   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- : Undo  (GOLD Spacebar)
   G-=: Go to Line
   G-`: What line
+  G-/: Query-Replace
 
 ;;; File:  edt-user.el   ---  Sample User Customizations for the Enhanced 
 ;;;                             EDT Keypad Mode Emulation 
 ;;;                             
-;;;                          For GNU Emacs 19
+;;;                      For GNU Emacs 19 and Above
 ;;;
-;; Copyright (C) 1986, 1992, 1993 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1992, 1993, 2000 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
 ;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
 
 ;;; 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!
-;;
+;; This file contains GNU Emacs User Custom EDT bindings and functions.
 
 ;;; Usage:
 
 
   ;; 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-key "\C-j" 'edt-duplicate-word)
+  (edt-bind-key "\C-k" 'edt-define-key)
   (edt-bind-gold-key  "\C-k" 'edt-restore-key)
-  (edt-bind-standard-key "\C-l" 'edt-learn)
+  (edt-bind-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)
+  (edt-bind-key "\C-n" 'edt-set-screen-width-80)
+  (edt-bind-key "\C-o" 'open-line)
+  (edt-bind-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)
+  (edt-bind-key "\C-t" 'edt-display-the-time)
+  (edt-bind-key "\C-v" 'redraw-display)
+  (edt-bind-key "\C-w" 'edt-set-screen-width-132)
   ;;; Leave binding of C-x as original prefix key.
 )
 
 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)   |   (-)    |
+G-HELP: Emacs Help                |   PAGE   |Scroll Win|Open Line |  DEL W   |
+   DO: Execute extended command   |    (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   |
   G-%: Go to Percentage
   G- : Undo  (GOLD Spacebar)
   G-=: Go to Line
-  G-`: What line"
+  G-`: What line
+  G-/: Query-Replace"
 
   (interactive)
   (describe-function 'edt-user-keypad-help))
 ;;; edt.el --- Enhanced EDT Keypad Mode Emulation for GNU Emacs 19
 
-;; Copyright (C) 1986, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000 Free Software
+;; Foundation, Inc.
 
-;; Author: Kevin Gallagher <kgallagh@spd.dsccc.com>
-;; Maintainer: Kevin Gallagher <kgallagh@spd.dsccc.com>
+;; Author: Kevin Gallagher <kevingal@onramp.net>
+;; Maintainer: Kevin Gallagher <kevingal@onramp.net>
 ;; Keywords: emulations
 
-;; This file is part of XEmacs.
+;; This file is part of GNU Emacs.
 
-;; 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.
+;; 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.
 
-;; XEmacs is distributed in the hope that it will be useful, but
+;; 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 XEmacs; see the file COPYING.  If not, write to the Free
-;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-;; 02111-1307, USA.
+;; 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.
 
-;;; Synched up with: FSF 19.34
 
-;;; Usage:
+
+;;; Commentary:
+;; 
 
-;;  See edt-user.doc in the Emacs etc directory.
+;; This is Version 4.0 of the EDT Emulation for Emacs 19 and above.
+;; It comes with special functions which replicate nearly all of EDT's
+;; keypad mode behavior.  It sets up default keypad and function key
+;; bindings which closely match those found in EDT.  Support is
+;; provided so that users may reconfigure most keypad and function key
+;; bindings to their own liking.
 
-;; 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
-;; ====================================================================
+;; NOTE: Version 4.0 contains several enhancements.  See the
+;; Enhancement section below for the details.
+
+;; Getting Started:
+
+;; To start the EDT Emulation, first start Emacs and then 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:
+;;
+;;    (add-hook term-setup-hook 'edt-emulation-on)
+
+;; IMPORTANT: Be sure to read the file, edt-user.doc, located in the
+;; Emacs "etc" directory.  It contains very helpful user information.
+
+;; The EDT emulation consists of the following files:
+;; 
+;; edt-user.doc     - User Instructions and Sample Customization File
+;; edt.el           - EDT Emulation Functions and Default Configuration
+;; edt-lk201.el     - Built-in support for DEC LK-201 Keyboards
+;; edt-vt100.el     - Built-in support for DEC VT-100 (and above) terminals
+;; edt-pc.el        - Built-in support for PC 101 Keyboards under MS-DOS
+;; edt-mapper.el    - Create an EDT LK-201 Map File for Keyboards Without 
+;;                      Built-in Support
+
+;; Enhancements:
+
+;; Version 4.0 contains the following enhancements:
+
+;;  1.  Scroll margins at the top and bottom of the window are now
+;;      supported.  (The design was copied from tpu-extras.el.)  By
+;;      default, this feature is enabled, with the top margin set to
+;;      10% of the window and the bottom margin set to 15% of the
+;;      window.  To change these settings, you can invoke the function
+;;      edt-set-scroll-margins in your .emacs file.  For example, the
+;;      following line
+;;
+;;           (edt-set-scroll-margins "20%" "25%")
+;;      
+;;      sets the top margin to 20% of the window and the bottom margin
+;;      to 25% of the window.  To disable this feature, set each
+;;      margin to 0%.  You can also invoke edt-set-scroll-margins
+;;      interactively while EDT Emulation is active to change the
+;;      settings for that session.
+;;
+;;      NOTE: Another way to set the scroll margins is to use the
+;;      Emacs customization feature (not available in Emacs 19) to set
+;;      the following two variables directly:
+;;      
+;;           edt-top-scroll-margin and edt-bottom-scroll-margin
+;;
+;;      Enter the Emacs `customize' command.  First select the Editing
+;;      group and then select the Emulations group.  Finally, select
+;;      the Edt group and follow the directions.
+;;      
+;;  2.  The SUBS command is now supported and bound to GOLD-Enter by
+;;      default.  (This design was copied from tpu-edt.el.)  Note, in
+;;      earlier versions of EDT Emulation, GOLD-Enter was assigned to
+;;      the Emacs function `query-replace'.  The binding of
+;;      `query-replace' has been moved to GOLD-/.  If you prefer to
+;;      restore `query-replace' to GOLD-Enter, then use an EDT user
+;;      customization file, edt-user.el, to do this.  See edt-user.doc
+;;      for details.
+
+;;  3.  EDT Emulation now also works in XEmacs, including the
+;;      highlighting of selected text.
+
+;;  4.  If you access a workstation using an X Server, observe that
+;;      the initialization file generated by edt-mapper.el will now
+;;      contain the name of the X Server vendor.  This is a
+;;      convenience for those who have access to their Unix account
+;;      from more than one type of X Server.  Since different X
+;;      Servers typically require different EDT emulation
+;;      initialization files, edt-mapper.el will now generate these
+;;      different initialization files and save them with different
+;;      names.  Then, the correct initialization file for the
+;;      particular X server in use is loaded correctly automatically.
+
+;;  5.  Also, edt-mapper.el is now capable of binding an ASCII key
+;;      sequence, providing the ASCII key sequence prefix is already
+;;      known by Emacs to be a prefix.  As a result of providing this
+;;      support, some terminal/keyboard/window system configurations,
+;;      which don't have a complete set of sensible function key
+;;      bindings built into Emacs in `function-key-map', can still be
+;;      configured for use with EDT Emulation.  (Note: In a few rare
+;;      circumstances this does not work properly.  In particular, it
+;;      does not work if a subset of the leading ASCII characters in a
+;;      key sequence are recognized by Emacs as having an existing
+;;      binding.  For example, if the keypad 7 (KP-7) key generates
+;;      the sequence \"<ESC>Ow\" and \"<ESC>O\" is already bound to a
+;;      function, pressing KP-7 when told to do so by edt-mapper.el
+;;      will result in edt-mapper.el incorrectly mapping \"<ESC>O\" to
+;;      KP-7 and \"w\" to KP-8.  If something like this happens to
+;;      you, it is probably a bug in the support for your keyboard
+;;      within Emacs OR a bug in the Unix termcap/terminfo support for
+;;      your terminal OR a bug in the terminal emulation software you
+;;      are using.)
+
+;;  6.  The edt-quit function (bound to GOLD-q by default) has been
+;;      modified to warn the user when file-related buffer
+;;      modifications exist.  It now cautions the user that those
+;;      modifications will be lost if the user quits without saving
+;;      those buffers.
+
+
+;;; History:
+;; 
+;;  Version 4.0    2000    Added New Features and Fixed a Few Bugs
+;;  
+
 
+;;; Code:
+
 ;;;  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
 ;;;;
 
+;; For backward compatibility to Emacs 19, skip this if defgroup is
+;; not defined.
+(if (fboundp 'defgroup)
+    (defgroup edt nil
+      "Emacs emulating EDT."
+      :prefix "edt-"
+      :group 'emulations))
+
+;;;
+;;;  Version Information
+;;;
+(defconst edt-version "4.0" "EDT Emulation version number.")
+
+;;;
+;;;  User Configurable Variables
+;;;
+
+;; For backward compatibility to Emacs 19, use defvar if defcustom is
+;; not defined.
+(if (fboundp 'defcustom)
+    (progn
+      (defcustom edt-keep-current-page-delimiter nil
+	"*Emacs MUST be restarted for a change in value to take effect!
+Non-nil leaves Emacs value of `page-delimiter' unchanged within EDT
+Emulation.  If set to nil (the default), the `page-delimiter' variable
+is set to \"\\f\" when edt-emulation-on is first invoked.  This
+setting replicates EDT's page delimiter behavior.  The original value
+is restored when edt-emulation-off is called."
+	:type 'boolean
+	:group 'edt)
+      
+      (defcustom edt-use-EDT-control-key-bindings nil
+	"*Emacs MUST be restarted for a change in value to take effect!
+Non-nil causes the control key bindings to be replaced with EDT
+bindings.  If set to nil (the default), EDT control key bindings are
+not used and the current Emacs control key bindings are retained for
+use within the EDT emulation."
+	:type 'boolean
+	:group 'edt)
+
+      (defcustom edt-word-entities '(?\t)
+	"*Specifies the list of EDT word entity characters.  
+The default list, (\?\\t), contains just the TAB character, which
+emulates EDT.  Characters are specified in the list using their
+decimal ASCII values.  A question mark, followed by the actual
+character, can be used to indicate the numerical value of the
+character, instead of the actual decimal value.  So, ?A means the
+numerical value for the letter A, \?/ means the numerical value for /,
+etc.  Several unprintable and special characters have special
+representations, which you can also use:
+
+            \?\\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  \\
+
+In EDT Emulation movement-by-word commands, each character in the list
+will be treated as if it were a separate word."
+	:type '(repeat integer)
+	:group 'edt)
+
+      (defcustom edt-top-scroll-margin 10
+	"*Scroll margin at the top of the screen.  
+Interpreted as a percent of the current window size with a default
+setting of 10%.  If set to 0, top scroll margin is disabled."
+	:type 'integer
+	:group 'edt)
+
+      (defcustom edt-bottom-scroll-margin 15
+	"*Scroll margin at the bottom of the screen.
+Interpreted as a percent of the current window size with a default
+setting of 15%.  If set to 0, bottom scroll margin is disabled."
+	:type 'integer
+	:group 'edt))
+  (progn
+    (defvar edt-keep-current-page-delimiter nil
+      "*Non-nil leaves Emacs value of `page-delimiter' unchanged within EDT
+Emulation.  If set to nil (the default), the `page-delimiter' variable
+is set to \"\\f\" when edt-emulation-on is first invoked.  This
+setting replicates EDT's page delimiter behavior.  The 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.  If set to nil (the default), EDT control key bindings are
+not used and the current Emacs control key bindings are retained for
+use within the EDT emulation.")
+
+    (defvar edt-word-entities '(?\t)
+      "*Specifies the list of EDT word entity characters.  
+The default list, (\?\\t), contains just the TAB character, which
+emulates EDT.  Characters are specified in the list using their
+decimal ASCII values.  A question mark, followed by the actual
+character, can be used to indicate the numerical value of the
+character, instead of the actual decimal value.  So, ?A means the
+numerical value for the letter A, \?/ means the numerical value for /,
+etc.  Several unprintable and special characters have special
+representations, which you can also use:
+
+            \?\\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  \\
+
+In EDT Emulation movement-by-word commands, each character in the list
+will be treated as if it were a separate word.")
+
+    (defvar edt-top-scroll-margin 10
+      "*Scroll margin at the top of the screen.
+Interpreted as a percent of the current window size with a default
+setting of 10%.  If set to 0, top scroll margin is disabled.")
+
+    (defvar edt-bottom-scroll-margin 15
+      "*Scroll margin at the bottom of the screen.
+Interpreted as a percent of the current window size with a default
+setting of 15%.  If set to 0, bottom scroll margin is disabled.")))
+
+;;;
+;;; Internal Variables
+;;;
+
 (defvar edt-last-deleted-lines ""
-  "Last text deleted by an EDT emulation line delete command.")
+  "Last text deleted by the EDT emulation DEL L command.")
 
 (defvar edt-last-deleted-words ""
-  "Last text deleted by an EDT emulation word delete command.")
+  "Last text deleted by the EDT emulation DEL W command.")
 
 (defvar edt-last-deleted-chars ""
-  "Last text deleted by an EDT emulation character delete command.")
+  "Last text deleted by the EDT emulation DEL C command.")
 
-(defvar edt-last-replaced-key-definition ""
-  "Key definition replaced with edt-define-key or edt-learn command.")
+(defvar edt-find-last-text ""
+  "Last text found by the EDT emulation FIND command.")
+
+(defvar edt-match-beginning-mark (make-marker)
+  "Used internally by the EDT emulation SUBS command.")
+
+(defvar edt-match-end-mark (make-marker)
+  "Used internally by the EDT emulation SUBS command.")
+
+(defvar edt-last-replaced-key-definition nil
+  "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.")
+(defvar edt-select-mode-current ""
+  "Text displayed in mode line to indicate the state of EDT select mode.
+When select mode is inactive, it is set to an empty string.")
 
 (defconst edt-select-mode-string " Select"
-  "String to indicate select mode is active.")
+  "Used in mode line to indicate select mode is active.")
 
 (defconst edt-forward-string " ADVANCE"
   "Direction string in mode line to indicate forward movement.")
 
 (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.")
+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.")
+(defvar edt-term nil
+  "Specifies the terminal type, if applicable.")
 
 ;;;
 ;;;  Emacs version identifiers - currently referenced by
 ;;;
-;;;     o edt-emulation-on      o edt-load-xkeys
+;;;     o edt-emulation-on      o edt-load-keys
 ;;;
 (defconst edt-emacs19-p (not (string-lessp emacs-version "19"))
-  "Non-nil if we are running Lucid or GNU Emacs version 19.")
+  "Non-nil if we are running GNU Emacs or XEmacs version 19, or higher.")
 
-(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-x-emacs19-p
+  (and edt-emacs19-p (string-match "XEmacs" emacs-version))
+  "Non-nil if we are running XEmacs version 19, or higher.")
 
-(defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-lucid-emacs19-p))
-  "Non-nil if we are running GNU Emacs version 19.")
+(defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-x-emacs19-p))
+  "Non-nil if we are running GNU Emacs version 19, or higher.")
 
-(defvar edt-xkeys-file nil
-  "File mapping X function keys to LK-201 keyboard function and keypad keys.")
+(defconst edt-emacs-variant (if edt-gnu-emacs19-p "gnu" "xemacs")
+  "Indicates Emacs variant:  GNU Emacs or XEmacs \(aka Lucid Emacs\).")
+
+(defconst edt-window-system (if edt-gnu-emacs19-p window-system (console-type))
+  "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).")
+
+(defconst edt-xserver (if (eq edt-window-system 'x)
+			  (if edt-x-emacs19-p
+			      (replace-in-string (x-server-vendor) "[ _]" "-")
+			    (subst-char-in-string ?  ?- (x-server-vendor)))
+			nil)
+  "Indicates X server vendor name, if applicable.")
+
+(defvar edt-keys-file nil
+  "User's custom keypad and function keys mappings to emulate LK-201 keyboard.")
 
 ;;;;
 ;;;; 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.
+;;; Almost all of EDT's keypad mode commands have equivalent Emacs
+;;; function counterparts.  But many of these counterparts behave
+;;; somewhat differently in Emacs.
 ;;;
-;;; 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.
+;;; So, 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 should be close
+;;; enough for most EDT die-hards.
 ;;;
 
 ;;;
 
 (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."
+Argument NUM is 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)))))
+	(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."
+Argument NUM is 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))))
+	(progn
+	  (backward-page num)
+      (edt-line-to-top-of-window)
+	  (if edt-x-emacs19-p (setq zmacs-region-stays t)))))
 
 (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."
+Argument NUM is 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)))
+    (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.  
+;;; 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.
+;;; 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."
+  "Move cursor forward two-thirds of a window's number of lines.
+Argument NUM is 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."
+Argument NUM is 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."
+Argument NUM is the number of sections to move."
   (interactive "p")
   (if (equal edt-direction-string edt-forward-string)
       (edt-sect-forward num)
-      (edt-sect-backward num)))
+    (edt-sect-backward num)))
 
 ;;;
 ;;; BEGINNING OF LINE
 
 (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."
+Argument NUM is the number of BOL marks to move."
   (interactive "p")
   (edt-check-prefix num)
-  (if (bolp)
-      (forward-line (* -1 num))
+  (let ((beg (edt-current-line)))
+    (if (bolp)
+	(forward-line (* -1 num))
       (progn
-        (setq num (1- num))
-        (forward-line (* -1 num)))))
+	(setq num (1- num))
+	(forward-line (* -1 num))))
+    (edt-top-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
+
 
 ;;;
 ;;; 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."
+Argument NUM is the number of EOL marks to move."
   (interactive "p")
   (edt-check-prefix num)
-  (forward-char)
-  (end-of-line num))
+  (let ((beg (edt-current-line)))
+    (forward-char)
+    (end-of-line num)
+    (edt-bottom-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
+
 
 (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."
+Argument NUM is the number of EOL marks to move."
   (interactive "p")
   (edt-check-prefix num)
-  (end-of-line (1- num)))
+  (let ((beg (edt-current-line)))
+    (end-of-line (1- num))
+    (edt-top-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
+
 
 (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."
+Argument NUM is 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)))
+    (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.  
+;;; 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. 
+;;; buffer.  This emulates the EDT line mode command SET ENTITY WORD.
 
 
 (defun edt-one-word-forward ()
       (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)))))
+    (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))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (defun edt-one-word-backward ()
   "Move backward to first character of previous word."
       (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))))))
+    (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)))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (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."
+Argument NUM is the number of words to move."
   (interactive "p")
   (edt-check-prefix num)
   (while (> num 0)
 
 (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."
+Argument NUM is the number of words to move."
   (interactive "p")
   (edt-check-prefix num)
   (while (> num 0)
 
 (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."
+Argument NUM is the number of words to move."
   (interactive "p")
   (if (equal edt-direction-string edt-forward-string)
       (edt-word-forward num)
-      (edt-word-backward 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."
+Argument NUM is 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)))
+    (backward-char num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 ;;;
 ;;; LINE
 
 (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."
+Argument NUM is 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."
+Argument NUM is the number of BOL marks to move."
   (interactive "p")
   (edt-check-prefix num)
-  (forward-line num))
+  (let ((beg (edt-current-line)))
+    (forward-line num)
+    (edt-bottom-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (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."
+Argument NUM is 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)))
+    (edt-line-backward num)))
+
+;;;
+;;; UP and DOWN Arrows
+;;;
+
+(defun edt-next-line (num)
+  "Move cursor down one line.
+Argument NUM is the number of lines to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (let ((beg (edt-current-line)))
+    (next-line num)
+    (edt-bottom-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
+
+(defun edt-previous-line (num)
+  "Move cursor up one line.
+Argument NUM is the number of lines to move."
+  (interactive "p")
+  (edt-check-prefix num)
+  (let ((beg (edt-current-line)))
+    (previous-line num)
+    (edt-top-check beg num))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
+
 
 ;;;
 ;;; TOP
 (defun edt-top ()
   "Move cursor to the beginning of buffer."
   (interactive)
-  (goto-char (point-min)))
+  (goto-char (point-min))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 ;;;
 ;;; BOTTOM
 ;;;
 
 (defun edt-find-forward (&optional find)
-  "Find first occurrence of a string in forward direction and save it."
+  "Find first occurrence of a string in forward direction and save it.
+Optional argument FIND is t is this function is called from `edt-find'."
   (interactive)
   (if (not find)
-      (set 'search-last-string (read-string "Search forward: ")))
-  (if (search-forward search-last-string)
-      (search-backward search-last-string)))
+      (set 'edt-find-last-text (read-string "Search forward: ")))
+  (let* ((left nil)
+	 (beg (edt-current-line))
+	 (height (window-height))
+	 (top-percent
+	  (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin))
+	 (bottom-percent
+	  (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin))
+	 (top-margin (/ (* height top-percent) 100))
+	 (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100)))
+	 (bottom-margin (max beg (- height bottom-up-margin 1)))
+	 (top (save-excursion (move-to-window-line top-margin) (point)))
+	 (bottom (save-excursion (move-to-window-line bottom-margin) (point)))
+	 (far (save-excursion
+		(goto-char bottom) (forward-line (- height 2)) (point))))
+    (if (search-forward edt-find-last-text)
+	(progn
+	  (search-backward edt-find-last-text)
+	  (edt-set-match)
+	  (cond((> (point) far)
+		(setq left (save-excursion (forward-line height)))
+		(if (= 0 left) (recenter top-margin)
+		  (recenter (- left bottom-up-margin))))
+	       (t
+		(and (> (point) bottom) (recenter bottom-margin)))))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (defun edt-find-backward (&optional find)
-  "Find first occurrence of a string in the backward direction and save it."
+  "Find first occurrence of a string in the backward direction and save it.
+Optional argument FIND is t if this function is called from `edt-find'."
   (interactive)
   (if (not find)
-      (set 'search-last-string (read-string "Search backward: ")))
-  (search-backward search-last-string))
+      (set 'edt-find-last-text (read-string "Search backward: ")))
+  (let* ((left nil)
+	 (beg (edt-current-line))
+	 (height (window-height))
+	 (top-percent
+	  (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin))
+	 (bottom-percent
+	  (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin))
+	 (top-margin (/ (* height top-percent) 100))
+	 (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100)))
+	 (bottom-margin (max beg (- height bottom-up-margin 1)))
+	 (top (save-excursion (move-to-window-line top-margin) (point)))
+	 (bottom (save-excursion (move-to-window-line bottom-margin) (point)))
+	 (far (save-excursion
+		(goto-char bottom) (forward-line (- height 2)) (point))))
+    (if (search-backward edt-find-last-text)
+	(edt-set-match))
+    (and (< (point) top) (recenter (min beg top-margin))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (defun edt-find ()
   "Find first occurrence of string in current direction and save it."
   (interactive)
-  (set 'search-last-string (read-string "Search: "))
+  (set 'edt-find-last-text (read-string "Search: "))
   (if (equal edt-direction-string edt-forward-string)
       (edt-find-forward t)
       (edt-find-backward t)))
 (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)
+  (let* ((left nil)
+	 (beg (edt-current-line))
+	 (height (window-height))
+	 (top-percent
+	  (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin))
+	 (bottom-percent
+	  (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin))
+	 (top-margin (/ (* height top-percent) 100))
+	 (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100)))
+	 (bottom-margin (max beg (- height bottom-up-margin 1)))
+	 (top (save-excursion (move-to-window-line top-margin) (point)))
+	 (bottom (save-excursion (move-to-window-line bottom-margin) (point)))
+	 (far (save-excursion
+		(goto-char bottom) (forward-line (- height 2)) (point))))
+    (forward-char 1)
+    (if (search-forward edt-find-last-text nil t)
+	(progn
+	  (search-backward edt-find-last-text)
+	  (edt-set-match)
+	  (cond((> (point) far)
+		(setq left (save-excursion (forward-line height)))
+		(if (= 0 left) (recenter top-margin)
+		  (recenter (- left bottom-up-margin))))
+	       (t
+		(and (> (point) bottom) (recenter bottom-margin)))))
       (progn
-        (backward-char 1)
-        (error "Search failed: \"%s\"." search-last-string))))
+	(backward-char 1)
+	(error "Search failed: \"%s\"" edt-find-last-text))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (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)
+  (let* ((left nil)
+	 (beg (edt-current-line))
+	 (height (window-height))
+	 (top-percent
+	  (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin))
+	 (bottom-percent
+	  (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin))
+	 (top-margin (/ (* height top-percent) 100))
+	 (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100)))
+	 (bottom-margin (max beg (- height bottom-up-margin 1)))
+	 (top (save-excursion (move-to-window-line top-margin) (point)))
+	 (bottom (save-excursion (move-to-window-line bottom-margin) (point)))
+	 (far (save-excursion
+		(goto-char bottom) (forward-line (- height 2)) (point))))
+    (if (not (search-backward edt-find-last-text nil t))
+	(error "Search failed: \"%s\"" edt-find-last-text)
       (progn
-        (error "Search failed: \"%s\"." search-last-string))))
+	(edt-set-match)
+	(and (< (point) top) (recenter (min beg top-margin))))))
+  (if edt-x-emacs19-p (setq zmacs-region-stays t)))
 
 (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)))
+    (edt-find-next-backward)))
   
 ;;;
 ;;; APPEND
 
 (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."
+Argument NUM is the number of lines to delete."
   (interactive "*p")
   (edt-check-prefix num)
   (let ((beg (point)))
 
 (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."
+Argument NUM is the number of lines to delete."
   (interactive "*p")
   (edt-check-prefix num)
   (let ((beg (point)))
   (if arg
       (progn
 	(make-local-variable 'edt-select-mode)
-	(setq edt-select-mode 'edt-select-mode-text)
+	(setq edt-select-mode 'edt-select-mode-current)
 	(setq rect-start-point (window-point)))
     (progn
       (kill-local-variable 'edt-select-mode)))
 
 (defun edt-select ()
   "Set mark at cursor and start text selection."
-  (interactive)   
-  (set-mark-command nil)) 
+  (interactive)
+  (set-mark-command nil))
 
 (defun edt-reset ()
   "Cancel text selection."
   (interactive)
-  (deactivate-mark))
+  (if edt-gnu-emacs19-p
+      (deactivate-mark)
+    (zmacs-deactivate-region)))
 
 ;;;
 ;;; CUT
 
 (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."
+Argument NUM is the number of lines to delete."
   (interactive "*p")
   (edt-check-prefix num)
   (let ((beg (point)))
 
 (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."
+Argument NUM is the number of words to delete."
   (interactive "*p")
   (edt-check-prefix num)
   (let ((beg (point)))
 
 (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."
+Argument NUM is the number of words to delete."
   (interactive "*p")
   (edt-check-prefix num)
   (let ((beg (point)))