changeset 38514:10482dd382e7

* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy of Scott Bronson. (ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions. (viper-check-sub,viper-get-ex-command,viper-execute-ex-command): Deleted functions. (viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new ex-token-list. (viper-get-ex-address-subr): convert registers to char data type. * viper-util.el (viper-int-to-char,viper-char-equal): new functions. (viper-memq-char): use viper-int-to-char. (viper-file-checked-in-p): use vc-locking-user, if vc doesn't have vc-locking-state. (viper-read-key): use viper-read-key-sequence. * viper.el (viper-major-mode-modifier-list): added inferior-emacs-lisp-mode. (this-major-mode-requires-vi-state): new function that uses simple heuristics to decide if vi state is appropriate. (set-viper-state-in-major-mode): use this-major-mode-requires-vi-state. (viper-non-hook-settings): don't advise read-key-sequence. (viper-read-key-sequence): new function that replaces the previously used advice to read-key-sequence. * viper-cmd.el (viper-test-com-defun,viper-exec-change, viper-exec-Change,viper-execute-com,viper-insert,viper-append, viper-Append,viper-Insert,viper-open-line,viper-Open-line, viper-open-line-at-point,viper-substitute,viper-overwrite, viper-replace-char-subr,viper-forward-word,viper-forward-Word): got rid of the negative character hack. (viper-escape-to-state,viper-replace-state-exit-cmd): use viper-read-key-sequence. (viper-envelop-ESC-key): no need for ad-get-orig-definition. (viper-minibuffer-standard-hook,viper-read-string-with-history): don't override existing minibuffer-setup-hook. (viper-mark-point,viper-goto-mark-subr,viper-brac-function): convert registers to char data type. (viper-autoindent): use viper-indent-line. * viper-keym.el: use viper-exec-key-in-emacs. * viper.texi: Added credits, new commands, like :make. * ediff-util.el: Copyright years. (ediff-choose-syntax-table): New function. (ediff-setup): Use ediff-choose-syntax-table. (ediff-file-checked-out-p,ediff-file-checked-in-p): check if vc-state is available. (ediff-make-temp-file): use ediff-coding-system-for-write. * ediff-init.el (ediff-with-syntax-table): New macro, uses with-syntax-table. (ediff-coding-system-for-read): from ediff-diff.el (ediff-coding-system-for-write): new variable. (ediff-highest-priority): fixed the bug having to do with disappearing overlays. (ediff-file-remote-p): use file-remote-p, if available. (ediff-listable-file): new function. (ediff-file-attributes): use ediff-listable-file. * ediff-mult.el (ediff-meta-insert-file-info1): use ediff-listable-file. * ediff-ptch.el (ediff-prompt-for-patch-file): use ediff-coding-system-for-read. (ediff-patch-file-internal): use ediff-coding-system-for-write. * ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el. (ediff-match-diff3-line,ediff-get-diff3-group): improved pattern. * ediff.el: Date of last update, copyright years. * ediff-wind (ediff-setup-control-frame): Nill->nil. * ediff.texi: added clarifications, acknowledgements.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 21 Jul 2001 05:28:24 +0000
parents 144b56521d1d
children bc021306e722
files lisp/ChangeLog lisp/ediff-diff.el lisp/ediff-init.el lisp/ediff-mult.el lisp/ediff-ptch.el lisp/ediff-util.el lisp/ediff.el lisp/emulation/viper-cmd.el lisp/emulation/viper-ex.el lisp/emulation/viper-keym.el lisp/emulation/viper-util.el lisp/emulation/viper.el man/ChangeLog man/ediff.texi man/viper.texi
diffstat 15 files changed, 441 insertions(+), 187 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ChangeLog	Sat Jul 21 05:28:24 2001 +0000
@@ -1,3 +1,78 @@
+2001-07-21  Michael Kifer  <kifer@cs.sunysb.edu>
+	
+	* ediff-util.el: Copyright years.
+	(ediff-choose-syntax-table): New function.
+	(ediff-setup): Use ediff-choose-syntax-table.
+	(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
+	vc-state is available.
+	(ediff-make-temp-file): use ediff-coding-system-for-write.
+	
+	* ediff-init.el (ediff-with-syntax-table): New macro, uses
+	with-syntax-table.
+	(ediff-coding-system-for-read): from ediff-diff.el
+	(ediff-coding-system-for-write): new variable.
+	(ediff-highest-priority): fixed the bug having to do with disappearing
+	overlays.
+	(ediff-file-remote-p): use file-remote-p, if available.
+	(ediff-listable-file): new function.
+	(ediff-file-attributes): use ediff-listable-file.
+	
+	* ediff-mult.el (ediff-meta-insert-file-info1): use
+	ediff-listable-file.
+	
+	* ediff-ptch.el (ediff-prompt-for-patch-file): use
+	ediff-coding-system-for-read.
+	(ediff-patch-file-internal): use ediff-coding-system-for-write.
+	
+	* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
+	(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
+	
+	* ediff.el: Date of last update, copyright years.
+	
+	* ediff-wind (ediff-setup-control-frame): Nill->nil.
+	
+	* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
+	of Scott Bronson.
+	(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
+	(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
+	Deleted functions.
+	(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
+	ex-token-list.
+	(viper-get-ex-address-subr): convert registers to char data type.
+	
+	* viper-util.el (viper-int-to-char,viper-char-equal): new
+	functions.
+	(viper-memq-char): use viper-int-to-char.
+	(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
+	vc-locking-state.
+	(viper-read-key): use viper-read-key-sequence.
+	
+	* viper.el (viper-major-mode-modifier-list): added
+	inferior-emacs-lisp-mode.
+	(this-major-mode-requires-vi-state): new function that uses simple
+	heuristics to decide if vi state is appropriate.
+	(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
+	(viper-non-hook-settings): don't advise read-key-sequence.
+	(viper-read-key-sequence): new function that replaces the
+	previously used advice to read-key-sequence.
+	
+	* viper-cmd.el (viper-test-com-defun,viper-exec-change,
+	viper-exec-Change,viper-execute-com,viper-insert,viper-append,
+	viper-Append,viper-Insert,viper-open-line,viper-Open-line,
+	viper-open-line-at-point,viper-substitute,viper-overwrite,
+	viper-replace-char-subr,viper-forward-word,viper-forward-Word):
+	got rid of the negative character hack.
+	(viper-escape-to-state,viper-replace-state-exit-cmd):
+	use viper-read-key-sequence.
+	(viper-envelop-ESC-key): no need for ad-get-orig-definition.
+	(viper-minibuffer-standard-hook,viper-read-string-with-history):
+	don't override existing minibuffer-setup-hook.
+	(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
+	convert registers to char data type. 
+	(viper-autoindent): use viper-indent-line.
+	
+	* viper-keym.el: use viper-exec-key-in-emacs. 
+	
 2001-07-20  Stefan Monnier  <monnier@cs.yale.edu>
 
 	* server.el (server-visit-files): Fix variable name typo.
--- a/lisp/ediff-diff.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-diff.el	Sat Jul 21 05:28:24 2001 +0000
@@ -57,15 +57,6 @@
   :type 'string
   :group 'ediff-diff)
 
-(defcustom ediff-coding-system-for-read 'raw-text
-  "*The coding system for read to use when running the diff program as a subprocess. 
-In most cases, the default will do. However, under certain circumstances in
-Windows NT/98/95 you might need to use something like 'raw-text-dos here.
-So, if the output that your diff program sends to Emacs contains extra ^M's,
-you might need to experiment here, if the default or 'raw-text-dos doesn't
-work."
-  :type 'symbol
-  :group 'ediff-diff)
 
 ;; The following functions must precede all defcustom-defined variables.
 
@@ -153,7 +144,7 @@
 
 ;;; Support for diff3
 
-(defvar ediff-match-diff3-line "^====\\(.?\\)$"
+(defvar ediff-match-diff3-line "^====\\(.?\\)\C-m?$"
   "Pattern to match lines produced by diff3 that describe differences.")
 (defcustom ediff-diff3-options ""  
   "*Options to pass to `ediff-diff3-program'."
@@ -918,7 +909,7 @@
   ;; can produce the groups in the order 1, 2, 3 or 1, 3, 2.
   (save-excursion
     (re-search-forward
-     (concat "^" file ":\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\\([ac]\\)$"))
+     (concat "^" file ":\\([0-9]+\\)\\(,\\([0-9]+\\)\\)?\\([ac]\\)\C-m?$"))
     (beginning-of-line 2)
     ;; treatment depends on whether it is an "a" group or a "c" group
     (if (string-equal (buffer-substring (match-beginning 4) (match-end 4)) "c")
--- a/lisp/ediff-init.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-init.el	Sat Jul 21 05:28:24 2001 +0000
@@ -1,4 +1,4 @@
-;;; ediff-init.el --- macros, variables, and defsubsts used by Ediff
+;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
 
 ;; Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
 
@@ -714,6 +714,22 @@
   :type 'symbol
   :group 'ediff)
 
+(defcustom ediff-coding-system-for-read 'raw-text
+  "*The coding system for read to use when running the diff program as a subprocess. 
+In most cases, the default will do. However, under certain circumstances in
+Windows NT/98/95 you might need to use something like 'raw-text-dos here.
+So, if the output that your diff program sends to Emacs contains extra ^M's,
+you might need to experiment here, if the default or 'raw-text-dos doesn't
+work."
+  :type 'symbol
+  :group 'ediff)
+
+(defcustom ediff-coding-system-for-write 'no-conversion
+  "*The coding system for write to use when writing out difference regions
+to temp files when Ediff needs to find fine differences."
+  :type 'symbol
+  :group 'ediff)
+
 
 (if ediff-xemacs-p
     (progn
@@ -1174,7 +1190,7 @@
 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
   "Overlay for the current difference region in the ancestor buffer.")
 
-;; Compute priority of ediff overlay.
+;; Compute priority of a current ediff overlay.
 (defun ediff-highest-priority (start end buffer)
   (let ((pos (max 1 (1- start)))
 	ovr-list)
@@ -1184,13 +1200,21 @@
 	(while (< pos (min (point-max) (1+ end)))
 	  (setq ovr-list (append (overlays-at pos) ovr-list))
 	  (setq pos (next-overlay-change pos)))
-	(1+ (apply '+
-		   (mapcar (lambda (ovr)
-			     (if ovr
-				 (or (ediff-overlay-get ovr 'priority) 0)
-			       0))
-			   ovr-list)
-		   ))
+	(+ 1 ediff-shadow-overlay-priority
+	   (apply 'max
+		  (mapcar
+		   (lambda (ovr)
+		     (if (and ovr
+			      ;; exclude ediff overlays from priority
+			      ;; calculation, or else priority will keep
+			      ;; increasing
+			      (null (ediff-overlay-get ovr 'ediff))
+			      (null (ediff-overlay-get ovr 'ediff-diff-num)))
+			 ;; use the overlay priority or 0
+			 (or (ediff-overlay-get ovr 'priority) 0)
+		       0))
+		   ovr-list)
+		  ))
 	))))
 
 
@@ -1281,14 +1305,16 @@
 
 ;;; In-line functions
 
-(or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it
-    (defun ediff-file-remote-p (file-name)
+;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
+;; if find-file-name-handler is defined for 'file-local-copy
+(defun ediff-file-remote-p (file-name)
+  (or (and (fboundp 'file-remote-p) (file-remote-p file-name))
       (find-file-name-handler file-name 'file-local-copy)))
-;;;      (or (and (featurep 'efs-auto) (efs-ftp-path file-name))
-;;;	  (and (featurep 'tramp) (tramp-tramp-file-p file-name))
-;;;	  (and (fboundp 'file-remote-p) (file-remote-p file-name))
-;;;	  ;; Can happen only in Emacs, since XEmacs has file-remote-p
-;;;	  (and (require 'ange-ftp) (ange-ftp-ftp-name file-name)))))
+
+;; File for which we can get attributes, such as size or date
+(defun ediff-listable-file (file-name)
+  (let ((handler (find-file-name-handler file-name 'file-local-copy)))
+    (or (null handler) (eq handler 'dired-handler-fn))))
 
 
 (defsubst ediff-frame-unsplittable-p (frame)
@@ -1740,9 +1766,10 @@
       (apply 'message string args)))
 
 (defun ediff-file-attributes (filename attr-number)
-  (if (ediff-file-remote-p filename)
-      -1
-    (nth attr-number (file-attributes filename))))
+  (if (ediff-listable-file filename)
+      (nth attr-number (file-attributes filename))
+    -1)
+  )
 
 (defsubst ediff-file-size (filename)
   (ediff-file-attributes filename 7))
--- a/lisp/ediff-mult.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-mult.el	Sat Jul 21 05:28:24 2001 +0000
@@ -970,7 +970,7 @@
 			      500))
 	file-modtime file-size)
     (cond ((not (stringp fname)) (setq file-size -2)) ; file doesn't exits
-	  ((not (ediff-file-remote-p fname))
+	  ((ediff-listable-file fname)
 	   (if (file-exists-p fname)
 	       ;; set real size and modtime
 	       (setq file-size (ediff-file-size fname)
--- a/lisp/ediff-ptch.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-ptch.el	Sat Jul 21 05:28:24 2001 +0000
@@ -408,7 +408,8 @@
 (defun ediff-prompt-for-patch-file ()
   (let ((dir (cond (ediff-patch-default-directory) ; try patch default dir
 		   (ediff-use-last-dir ediff-last-dir-patch)
-		   (t default-directory))))
+		   (t default-directory)))
+	(coding-system-for-read ediff-coding-system-for-read))
     (find-file-noselect
      (read-file-name
       (format "Patch is in file:%s "
@@ -445,7 +446,7 @@
 	       (goto-char (point-min))
 	       (and (re-search-forward ediff-context-diff-label-regexp nil t)
 		    (current-buffer)))))
-	  (t (other-buffer (current-buffer) 'visible-ok)))
+	  (t (ediff-other-buffer (current-buffer))))
     'must-match)))
 
 
@@ -576,6 +577,10 @@
 	 ;; file for the purpose of patching.
 	 (true-source-filename source-filename)
 	 (target-filename source-filename)
+	 ;; this ensures that the patch process gets patch buffer in the
+	 ;; encoding that Emacs thinks is right for that type of text
+	 (coding-system-for-write 
+	  (if (boundp 'buffer-file-coding-system) buffer-file-coding-system))
 	 target-buf buf-to-patch file-name-magic-p 
 	 patch-return-code ctl-buf backup-style aux-wind)
 	  
--- a/lisp/ediff-util.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff-util.el	Sat Jul 21 05:28:24 2001 +0000
@@ -1101,15 +1101,24 @@
 (defsubst ediff-file-checked-out-p (file)
   (or (not (featurep 'vc-hooks))
       (and (vc-backend file)
-           (or (memq (vc-state file) '(edited needs-merge))
-               (stringp (vc-state file))))))
+	   (if (fboundp 'vc-state)
+	       (or (memq (vc-state file) '(edited needs-merge))
+		   (stringp (vc-state file)))
+	     ;; XEmacs has no vc-state
+	     (vc-locking-user file))
+	   )))
   
 (defsubst ediff-file-checked-in-p (file)
   (and (featurep 'vc-hooks)
        ;; CVS files are considered not checked in
        (not (memq (vc-backend file) '(nil CVS)))
-       (not (memq (vc-state file) '(edited needs-merge)))
-       (not (stringp (vc-state file)))))
+       (if (fboundp 'vc-state)
+	   (progn
+	     (not (memq (vc-state file) '(edited needs-merge)))
+	     (not (stringp (vc-state file))))
+	 ;; XEmacs has no vc-state
+	 (not (vc-locking-user file)))
+       ))
 
 (defun ediff-file-compressed-p (file)
   (condition-case nil
@@ -2971,7 +2980,7 @@
 (defun ediff-make-temp-file (buff &optional prefix given-file start end)
   (let* ((p (ediff-convert-standard-filename (or prefix "ediff")))
 	 (short-p p)
-	 (coding-system-for-write 'no-conversion)
+	 (coding-system-for-write ediff-coding-system-for-write)
 	 f short-f)
     (if (and (fboundp 'msdos-long-file-names)
 	     (not (msdos-long-file-names))
@@ -3464,7 +3473,7 @@
 	  ;; never detach
 	  (ediff-overlay-put
 	   overl (if ediff-emacs-p 'evaporate 'detachable) nil)
-	  ;; make vip-minibuffer-overlay open-ended
+	  ;; make overlay open-ended
 	  ;; In emacs, it is made open ended at creation time
 	  (if ediff-xemacs-p
 	      (progn
--- a/lisp/ediff.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/ediff.el	Sat Jul 21 05:28:24 2001 +0000
@@ -6,8 +6,8 @@
 ;; Created: February 2, 1994
 ;; Keywords: comparing, merging, patching, tools, unix
 
-(defconst ediff-version "2.75" "The current version of Ediff")
-(defconst ediff-date "March 5, 2001" "Date of last update")  
+(defconst ediff-version "2.76" "The current version of Ediff")
+(defconst ediff-date "July 18, 2001" "Date of last update")  
 
 
 ;; This file is part of GNU Emacs.
--- a/lisp/emulation/viper-cmd.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper-cmd.el	Sat Jul 21 05:28:24 2001 +0000
@@ -74,18 +74,15 @@
 ;; given symbol foo, foo-p is the test function, foos is the set of
 ;; Viper command keys
 ;; (macroexpand '(viper-test-com-defun foo))
-;; (defun foo-p (com) (consp (memq (if (< com 0) (- com) com) foos)))
+;; (defun foo-p (com) (consp (memq com foos)))
 
 (defmacro viper-test-com-defun (name)
   (let* ((snm (symbol-name name))
 	 (nm-p (intern (concat snm "-p")))
 	 (nms (intern (concat snm "s"))))
     `(defun ,nm-p (com)
-      (consp (viper-memq-char
-	      (if (and (viper-characterp com) (< com 0))
-		  (- com) com)
-	      ,nms)
-	     ))))
+       (consp (viper-memq-char com ,nms)
+	      ))))
 
 ;; Variables for defining VI commands
 
@@ -725,10 +722,8 @@
 	      viper-emacs-kbd-minor-mode)
 	  (unwind-protect
 	      (progn
-		(setq com (key-binding (setq key
-					     (if viper-xemacs-p
-						 (read-key-sequence nil)
-					       (read-key-sequence nil t)))))
+		(setq com
+		      (key-binding (setq key (viper-read-key-sequence nil))))
 		;; In case of binding indirection--chase definitions.
 		;; Have to do it here because we execute this command under
 		;; different keymaps, so command-execute may not do the
@@ -797,6 +792,12 @@
     (viper-set-mode-vars-for viper-current-state)
     result))
 
+;; This executes the last kbd event in emacs mode. Is used when we want to
+;; interpret certain keys directly in emacs (as, for example, in comint mode).
+(defun viper-exec-key-in-emacs (arg)
+  (interactive "P")
+  (viper-escape-to-emacs arg last-command-event))
+
 
 ;; This is needed because minor modes sometimes override essential Viper
 ;; bindings.  By letting Viper know which files these modes are in, it will
@@ -878,9 +879,7 @@
 	      (progn
 		(let (minor-mode-map-alist)
 		  (viper-set-unread-command-events event)
-		  (setq keyseq
-			(funcall
-			 (ad-get-orig-definition 'read-key-sequence) nil))
+		  (setq keyseq (read-key-sequence nil 'continue-echo))
 		  ) ; let
 		;; If keyseq translates into something that still has ESC
 		;; at the beginning, separate ESC from the rest of the seq.
@@ -933,8 +932,7 @@
 	    ;; this is escape event with nothing after it
 	    ;; put in unread-command-event and then re-read
 	    (viper-set-unread-command-events event)
-	    (setq keyseq
-		  (funcall (ad-get-orig-definition 'read-key-sequence) nil))
+	    (setq keyseq (read-key-sequence nil))
 	    ))
       ;; not an escape event
       (setq keyseq (vector event)))
@@ -1121,7 +1119,8 @@
 	;; execute apropriate region command.
 	(let ((char (car com)) (com (cdr com)))
 	  (setq prefix-arg (cons value com))
-	  (if (viper= char ?r) (viper-region prefix-arg)
+	  (if (viper= char ?r)
+	      (viper-region prefix-arg)
 	    (viper-Region prefix-arg))
 	  ;; reset prefix-arg
 	  (setq prefix-arg nil))
@@ -1249,9 +1248,10 @@
       (exchange-point-and-mark))
   (if (eq (preceding-char) ?\n)
       (viper-backward-char-carefully)) ; give back the newline
-  (if (viper= com ?c)
-      (viper-change (mark t) (point))
-    (viper-change-subr (mark t) (point))))
+  (if (eq viper-intermediate-command 'viper-repeat)
+      (viper-change-subr (mark t) (point))
+    (viper-change (mark t) (point))
+    ))
 
 ;; this is invoked by viper-substitute-line
 (defun viper-exec-Change (m-com com)
@@ -1271,9 +1271,10 @@
 	  (setq viper-use-register nil)))
     (delete-region (mark t) (point)))
   (open-line 1)
-  (if (viper= com ?C)
-      (viper-change-state-to-insert)
-    (viper-yank-last-insertion)))
+  (if (eq viper-intermediate-command 'viper-repeat)
+      (viper-yank-last-insertion)
+    (viper-change-state-to-insert)
+    ))
 
 (defun viper-exec-delete (m-com com)
   (or (and (markerp viper-com-point) (marker-position viper-com-point))
@@ -1455,15 +1456,13 @@
     ;; this is the special command `#'
     (if (> com 128)
 	(viper-special-prefix-com (- com 128))
-      (let ((fn (aref viper-exec-array (if (< com 0) (- com) com))))
+      (let ((fn (aref viper-exec-array com)))
 	(if (null fn)
 	    (error "%c: %s" com viper-InvalidViCommand)
 	  (funcall fn m-com com))))
     (if (viper-dotable-command-p com)
 	(viper-set-destructive-command
-	 (list m-com val
-	       (if (viper-memq-char com (list ?c ?C ?!)) (- com) com)
-	       reg nil nil)))
+	 (list m-com val com reg nil nil)))
     ))
 
 
@@ -1889,8 +1888,7 @@
 	(if (fboundp 'minibuffer-prompt-end)
 	    (delete-region (minibuffer-prompt-end) (point-max))
 	  (erase-buffer))
-	(insert initial)))
-  (viper-minibuffer-setup-sentinel))
+	(insert initial))))
 
 (defsubst viper-minibuffer-real-start ()
   (if (fboundp 'minibuffer-prompt-end)
@@ -1994,7 +1992,16 @@
   ;; KEYMAP is used, if given, instead of minibuffer-local-map.
   ;; INIT-MESSAGE is the message temporarily displayed after entering the
   ;; minibuffer.
-  (let ((minibuffer-setup-hook 'viper-minibuffer-standard-hook)
+  (let ((minibuffer-setup-hook
+	 ;; stolen from add-hook
+	 (let ((old
+		(if (boundp 'minibuffer-setup-hook)
+		    minibuffer-setup-hook
+		  nil)))
+	   (cons
+	    'viper-minibuffer-standard-hook
+	    (if (or (not (listp old)) (eq (car old) 'lambda))
+		(list old) old))))
 	(val "")
 	(padding "")
 	temp-msg)
@@ -2059,7 +2066,7 @@
   (let ((val (viper-p-val arg))
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-insert val ?r nil nil nil))
-    (if com
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-loop val (viper-yank-last-insertion))
       (viper-change-state-to-insert))))
 
@@ -2071,7 +2078,7 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-append val ?r nil nil nil))
     (if (not (eolp)) (forward-char))
-    (if (viper= com ?r)
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-loop val (viper-yank-last-insertion))
       (viper-change-state-to-insert))))
 
@@ -2083,7 +2090,7 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-Append val ?r nil nil nil))
     (end-of-line)
-    (if (viper= com ?r)
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-loop val (viper-yank-last-insertion))
       (viper-change-state-to-insert))))
 
@@ -2095,7 +2102,7 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-Insert val ?r nil nil nil))
     (back-to-indentation)
-    (if (viper= com ?r)
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-loop val (viper-yank-last-insertion))
       (viper-change-state-to-insert))))
 
@@ -2107,26 +2114,15 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-open-line val ?r nil nil nil))
     (let ((col (current-indentation)))
-      (if (viper= com ?r)
+      (if (eq viper-intermediate-command 'viper-repeat)
 	  (viper-loop val
 		      (end-of-line)
 		      (newline 1)
-		      (if viper-auto-indent
-			  (progn
-			    (setq viper-cted t)
-			    (if viper-electric-mode
-				(indent-according-to-mode)
-			      (indent-to col))
-			    ))
+		      (viper-indent-line col)
 		      (viper-yank-last-insertion))
 	(end-of-line)
 	(newline 1)
-	(if viper-auto-indent
-	    (progn
-	      (setq viper-cted t)
-	      (if viper-electric-mode
-		  (indent-according-to-mode)
-		(indent-to col))))
+	(viper-indent-line col)
 	(viper-change-state-to-insert)))))
 
 (defun viper-Open-line (arg)
@@ -2137,27 +2133,15 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command (list 'viper-Open-line val ?r nil nil nil))
     (let ((col (current-indentation)))
-      (if (viper= com ?r)
+      (if (eq viper-intermediate-command 'viper-repeat)
 	  (viper-loop val
 		      (beginning-of-line)
 		      (open-line 1)
-		      (if viper-auto-indent
-			  (progn
-			    (setq viper-cted t)
-			    (if viper-electric-mode
-				(indent-according-to-mode)
-			      (indent-to col))
-			    ))
+		      (viper-indent-line col)
 		      (viper-yank-last-insertion))
 	(beginning-of-line)
 	(open-line 1)
-	(if viper-auto-indent
-	    (progn
-	      (setq viper-cted t)
-	      (if viper-electric-mode
-		  (indent-according-to-mode)
-		(indent-to col))
-	      ))
+	(viper-indent-line col)
 	(viper-change-state-to-insert)))))
 
 (defun viper-open-line-at-point (arg)
@@ -2168,13 +2152,14 @@
 	(com (viper-getcom arg)))
     (viper-set-destructive-command
      (list 'viper-open-line-at-point val ?r nil nil nil))
-    (if (viper= com ?r)
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-loop val
 		    (open-line 1)
 		    (viper-yank-last-insertion))
       (open-line 1)
       (viper-change-state-to-insert))))
 
+;; bound to s
 (defun viper-substitute (arg)
   "Substitute characters."
   (interactive "P")
@@ -2182,9 +2167,10 @@
 	(com (viper-getcom arg)))
     (push-mark nil t)
     (forward-char val)
-    (if (viper= com ?r)
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(viper-change-subr (mark t) (point))
       (viper-change (mark t) (point)))
+    ;; com is set to ?r when we repeat this comand with dot
     (viper-set-destructive-command (list 'viper-substitute val ?r nil nil nil))
     ))
 
@@ -2356,7 +2342,7 @@
     (if (eq this-command 'viper-intercept-ESC-key)
 	(setq com 'viper-exit-insert-state)
       (viper-set-unread-command-events last-input-char)
-      (setq com (key-binding (read-key-sequence nil))))
+      (setq com (key-binding (viper-read-key-sequence nil))))
 
     (condition-case conds
 	(command-execute com)
@@ -2405,11 +2391,11 @@
   (let ((val (viper-p-val arg))
 	(com (viper-getcom arg)) (len))
     (viper-set-destructive-command (list 'viper-overwrite val ?r nil nil nil))
-    (if com
+    (if (eq viper-intermediate-command 'viper-repeat)
 	(progn
 	  ;; Viper saves inserted text in viper-last-insertion
 	  (setq len (length viper-last-insertion))
-	  (delete-char len)
+	  (delete-char (min len (- (point-max) (point) 1)))
 	  (viper-loop val (viper-yank-last-insertion)))
       (setq last-command 'viper-overwrite)
       (viper-set-complex-command-for-undo)
@@ -2476,7 +2462,7 @@
 
 (defun viper-replace-char-subr (com arg)
   (let (char)
-    (setq char (if (viper= com ?r)
+    (setq char (if (eq viper-intermediate-command 'viper-repeat)
 		   viper-d-char
 		 (read-char)))
     (let (inhibit-quit) ; preserve consistency of undo-list and iso-accents
@@ -2694,15 +2680,17 @@
 	(com (viper-getcom arg)))
     (if com (viper-move-marker-locally 'viper-com-point (point)))
     (viper-forward-word-kernel val)
-    (if com (progn
-	      (cond ((viper-memq-char com (list ?c (- ?c)))
-		     (viper-separator-skipback-special 'twice viper-com-point))
-		    ;; Yank words including the whitespace, but not newline
-		    ((viper-memq-char com (list ?y (- ?y)))
-		     (viper-separator-skipback-special nil viper-com-point))
-		    ((viper-dotable-command-p com)
-		     (viper-separator-skipback-special nil viper-com-point)))
-	      (viper-execute-com 'viper-forward-word val com)))))
+    (if com
+	(progn
+	  (cond ((viper-char-equal com ?c)
+		 (viper-separator-skipback-special 'twice viper-com-point))
+		;; Yank words including the whitespace, but not newline
+		((viper-char-equal com ?y)
+		 (viper-separator-skipback-special nil viper-com-point))
+		((viper-dotable-command-p com)
+		 (viper-separator-skipback-special nil viper-com-point)))
+	  (viper-execute-com 'viper-forward-word val com)))
+    ))
 
 
 (defun viper-forward-Word (arg)
@@ -2716,10 +2704,10 @@
 		(viper-skip-nonseparators 'forward)
 		(viper-skip-separators t))
     (if com (progn
-	      (cond ((viper-memq-char com (list ?c (- ?c)))
+	      (cond ((viper-char-equal com ?c)
 		     (viper-separator-skipback-special 'twice viper-com-point))
 		    ;; Yank words including the whitespace, but not newline
-		    ((viper-memq-char com (list ?y (- ?y)))
+		    ((viper-char-equal com ?y)
 		     (viper-separator-skipback-special nil viper-com-point))
 		    ((viper-dotable-command-p com)
 		     (viper-separator-skipback-special nil viper-com-point)))
@@ -4234,7 +4222,7 @@
   (interactive)
   (let ((char (read-char)))
     (cond ((and (<= ?a char) (<= char ?z))
-	   (point-to-register (1+ (- char ?a))))
+	   (point-to-register (viper-int-to-char (1+ (- char ?a)))))
 	  ((viper= char ?<) (viper-mark-beginning-of-buffer))
 	  ((viper= char ?>) (viper-mark-end-of-buffer))
 	  ((viper= char ?.) (viper-set-mark-if-necessary))
@@ -4304,7 +4292,7 @@
 	(backward-char 1)))
   (cond ((viper-valid-register char '(letter))
 	 (let* ((buff (current-buffer))
-	        (reg (1+ (- char ?a)))
+	        (reg (viper-int-to-char (1+ (- char ?a))))
 	        (text-marker (get-register reg)))
 	   ;; If marker points to file that had markers set (and those markers
 	   ;; were saved (as e.g., in session.el), then restore those markers
@@ -4410,6 +4398,19 @@
 	(if (or (bolp) (viper-looking-back "[^ \t]"))
 	    (setq viper-cted nil)))))
 
+;; do smart indent
+(defun viper-indent-line (col)
+  (if viper-auto-indent
+      (progn
+	(setq viper-cted t)
+	(if (and viper-electric-mode
+		 (not (memq major-mode '(fundamental-mode
+					 text-mode
+					 paragraph-indent-text-mode))))
+	    (indent-according-to-mode)
+	  (indent-to col)))))
+
+
 (defun viper-autoindent ()
   "Auto Indentation, Vi-style."
   (interactive)
@@ -4427,17 +4428,7 @@
     ;; use \n instead of newline, or else <Return> will move the insert point
     ;;(newline 1)
     (insert "\n")
-    (if viper-auto-indent
-	(progn
-	  (setq viper-cted t)
-	  (if (and viper-electric-mode
-		   (not
-		    (memq major-mode '(fundamental-mode
-				       text-mode
-				       paragraph-indent-text-mode ))))
-	      (indent-according-to-mode)
-	    (indent-to viper-current-indent))
-	  ))
+    (viper-indent-line viper-current-indent)
     ))
 
 
@@ -4469,7 +4460,7 @@
 	  ((viper= ?\] reg)
 	   (viper-heading-end arg))
 	  ((viper-valid-register reg '(letter))
-	   (let* ((val (get-register (1+ (- reg ?a))))
+	   (let* ((val (get-register (viper-int-to-char (1+ (- reg ?a)))))
 		  (buf (if (not (markerp val))
 			   (error viper-EmptyTextmarker reg)
 			 (marker-buffer val)))
@@ -4699,17 +4690,17 @@
       (if (and enforce-buffer
 	       (not (equal (current-buffer) (marker-buffer val))))
 	  (error (concat viper-EmptyTextmarker " in this buffer")
-		 (1- (+ char ?a))))
+		 (viper-int-to-char (1- (+ char ?a)))))
       (pop-to-buffer  (marker-buffer val))
       (goto-char val))
      ((and (consp val) (eq (car val) 'file))
       (find-file (cdr val)))
      (t
-      (error viper-EmptyTextmarker (1- (+ char ?a)))))))
+      (error viper-EmptyTextmarker (viper-int-to-char (1- (+ char ?a))))))))
 
 
 (defun viper-save-kill-buffer ()
-  "Save then kill current buffer. "
+  "Save then kill current buffer."
   (interactive)
   (if (< viper-expert-level 2)
       (save-buffers-kill-emacs)
--- a/lisp/emulation/viper-ex.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper-ex.el	Sat Jul 21 05:28:24 2001 +0000
@@ -122,6 +122,7 @@
 	("k"			(ex-mark) one-letter)
 	("kmark"		(ex-mark))
 	("m"			"move")
+	("make"     	    	(ex-compile))
 	; old viper doesn't specify a default for "ma" so leave it undefined
 	("map"			(ex-map))
 	("mark"			(ex-mark))
@@ -215,7 +216,7 @@
 ;; If there is no appropriate key (no match or duplicate matches) return nil
 (defun ex-cmd-assoc (key list)
   (let ((entry (try-completion key list))
-	result onelet)
+	result)
     (setq result (cond
 		  ((eq entry t)     (assoc key list))
 		  ((stringp entry)  (or (ex-splice-args-in-1-letr-cmd key list)
@@ -320,6 +321,11 @@
   :type '(choice (const nil) string)
   :group 'viper-ex)
 
+(defcustom ex-compile-command "make"
+  "The comand to run when the user types :make."
+  :type 'string
+  :group 'viper-ex)
+
 (defcustom viper-glob-function
   (cond (ex-unix-type-shell 'viper-glob-unix-files)
 	((eq system-type 'emx) 'viper-glob-mswindows-files) ; OS/2
@@ -643,7 +649,7 @@
 		      'viper-ex-history
 		      ;; no default when working on region
 		      (if initial-str
-			  "none"
+			  nil
 			(car viper-ex-history))
 		      map
 		      (if initial-str
@@ -855,8 +861,9 @@
 	   (save-excursion
 	     (if (null ex-token)
 		 (exchange-point-and-mark)
-	       (goto-char (viper-register-to-point
-			   (1+ (- ex-token ?a)) 'enforce-buffer)))
+	       (goto-char 
+		(viper-register-to-point
+		 (viper-int-to-char (1+ (- ex-token ?a))) 'enforce-buffer)))
 	     (setq address (point-marker)))))
     address))
 
@@ -1454,7 +1461,7 @@
 	(error "`%s' requires a following letter" ex-token))))
     (save-excursion
       (goto-char (car ex-addresses))
-      (point-to-register (1+ (- char ?a))))))
+      (point-to-register (viper-int-to-char (1+ (- char ?a)))))))
 
     
       
@@ -2159,6 +2166,29 @@
 	  (shell-command-on-region (point) (mark t) command t))
 	(goto-char beg)))))
 
+(defun ex-compile ()
+  "Reads args from the command line, then runs make with the args.
+If no args are given, then it runs the last compile command.
+Type 'mak ' (including the space) to run make with no args."
+  (let (args)
+    (save-window-excursion
+      (setq viper-ex-work-buf (get-buffer-create viper-ex-work-buf-name))
+      (set-buffer viper-ex-work-buf)
+      (setq args (buffer-substring (point) (point-max)))
+      (end-of-line))
+    ;; Remove the newline that may (will?) be at the end of the args
+    (if (string= "\n" (substring args (1- (length args))))
+	(setq args (substring args 0 (1- (length args)))))
+    ;; Run last command if no args given, else construct a new command.
+    (setq args
+	  (if (string= "" args)
+	      (if (boundp 'compile-command)
+		  compile-command
+		ex-compile-command)
+	    (concat ex-compile-command " " args)))
+    (compile args)
+    ))
+
 ;; Print line number
 (defun ex-line-no ()
   (message "%d"
--- a/lisp/emulation/viper-keym.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper-keym.el	Sat Jul 21 05:28:24 2001 +0000
@@ -445,8 +445,8 @@
 
 (defvar viper-comint-mode-modifier-map (make-sparse-keymap)
   "This map modifies comint mode.")
-(define-key viper-comint-mode-modifier-map "\C-m" 'comint-send-input)
-(define-key viper-comint-mode-modifier-map "\C-d" 'comint-delchar-or-maybe-eof)
+(define-key viper-comint-mode-modifier-map "\C-m" 'viper-exec-key-in-emacs)
+(define-key viper-comint-mode-modifier-map "\C-d" 'viper-exec-key-in-emacs)
 
 (defvar viper-dired-modifier-map (make-sparse-keymap)
   "This map modifies Dired behavior.")
--- a/lisp/emulation/viper-util.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper-util.el	Sat Jul 21 05:28:24 2001 +0000
@@ -1,4 +1,4 @@
-;;; viper-util.el --- utilities used by viper.el
+;;; viper-util.el --- Utilities used by viper.el
 
 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
@@ -103,16 +103,26 @@
       (symbol-function
        (if viper-xemacs-p 'characterp 'integerp)))
 
+(fset 'viper-int-to-char
+      (symbol-function
+       (if viper-xemacs-p 'int-to-char 'identity)))
+
 ;; CHAR is supposed to be a char or an integer (positive or negative)
 ;; LIST is a list of chars, nil, and negative numbers
-;; Check if CHAR is a member by trying to convert into integers, if necessary.
+;; Check if CHAR is a member by trying to convert in characters, if necessary.
 ;; Introduced for compatibility with XEmacs, where integers are not the same as
 ;; chars.
 (defun viper-memq-char (char list)
-  (cond (viper-emacs-p (memq char list))
-	((and (integerp char) (>= char 0)) (memq (int-to-char char) list))
+  (cond ((and (integerp char) (>= char 0))
+	 (memq (viper-int-to-char char) list))
 	((memq char list))))
 
+;; Check if char-or-int and char are the same as characters
+(defun viper-char-equal (char-or-int char)
+  (cond ((and (integerp char-or-int) (>= char-or-int 0))
+	 (= (viper-int-to-char char-or-int) char))
+	((eq char-or-int char))))
+
 ;; Like =, but accommodates null and also is t for eq-objects
 (defun viper= (char char1)
   (cond ((eq char char1) t)
@@ -683,8 +693,13 @@
   (and (featurep 'vc-hooks)
        ;; CVS files are considered not checked in
        (not (memq (vc-backend file) '(nil CVS)))
-       (not (memq (vc-state file) '(edited needs-merge)))
-       (not (stringp (vc-state file)))))
+       (if (fboundp 'vc-state)
+	   (progn
+	     (not (memq (vc-state file) '(edited needs-merge)))
+	     (not (stringp (vc-state file))))
+	 ;; XEmacs has no vc-state
+	 (not (vc-locking-user file)))
+       ))
 
 ;; checkout if visited file is checked in
 (defun viper-maybe-checkout (buf)
@@ -926,7 +941,7 @@
 	help-char key) 
     (use-global-map viper-overriding-map) 
     (unwind-protect
-	(setq key (elt (read-key-sequence nil) 0)) 
+	(setq key (elt (viper-read-key-sequence nil) 0)) 
       (use-global-map global-map))
     key))
 
--- a/lisp/emulation/viper.el	Fri Jul 20 22:46:18 2001 +0000
+++ b/lisp/emulation/viper.el	Sat Jul 21 05:28:24 2001 +0000
@@ -1,4 +1,4 @@
-;;; viper.el --- a full-featured Vi emulator for GNU Emacs and XEmacs,
+;;; viper.el --- A full-featured Vi emulator for GNU Emacs and XEmacs,
 ;;		 a VI Plan for Emacs Rescue,
 ;;		 and a venomous VI PERil.
 ;;		 Viper Is also a Package for Emacs Rebels.
@@ -8,7 +8,7 @@
 
 ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01 Free Software Foundation, Inc.
 
-(defconst viper-version "3.10 of March 3, 2001"
+(defconst viper-version "3.11 of July 18, 2001"
   "The current version of Viper")
 
 ;; This file is part of GNU Emacs.
@@ -401,6 +401,7 @@
 				  
     completion-list-mode
     diff-mode
+    idl-mode
     
     perl-mode
     cperl-mode
@@ -446,6 +447,7 @@
 (defcustom viper-insert-state-mode-list
   '(internal-ange-ftp-mode
     comint-mode
+    inferior-emacs-lisp-mode
     eshell-mode
     shell-mode)
   "*A list of major modes that should come up in Vi Insert state."
@@ -462,11 +464,14 @@
 	     (nth 0 triple) (nth 1 triple) (eval (nth 2 triple))))
 	  viper-major-mode-modifier-list))
 
+;; We change standard bindings in some major mode, making them slightly
+;; different than in "normal" vi/insert/emacs states
 (defcustom viper-major-mode-modifier-list
   '((help-mode emacs-state viper-slash-and-colon-map)
     (comint-mode insert-state viper-comint-mode-modifier-map)
     (comint-mode vi-state viper-comint-mode-modifier-map)
     (shell-mode insert-state viper-comint-mode-modifier-map)
+    (inferior-emacs-lisp-mode insert-state viper-comint-mode-modifier-map)
     (shell-mode vi-state viper-comint-mode-modifier-map)
     (ange-ftp-shell-mode insert-state viper-comint-mode-modifier-map)
     (ange-ftp-shell-mode vi-state viper-comint-mode-modifier-map)
@@ -595,11 +600,23 @@
 
 	(if viper-xemacs-p
 	    (make-variable-buffer-local 'bar-cursor))
+	(if (eq major-mode 'viper-mode)
+	    (setq major-mode 'fundamental-mode))
 
 	(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
 	    (memq major-mode viper-insert-state-mode-list) ; don't switch
 	    (viper-change-state-to-vi)))))
    
+
+;; Apply a little heuristic to invoke vi state on major-modes
+;; that are not listed in viper-vi-state-mode-list
+(defun this-major-mode-requires-vi-state (mode)
+  (cond ((memq mode viper-vi-state-mode-list) t)
+	((memq mode viper-emacs-state-mode-list) nil)
+	((memq mode viper-insert-state-mode-list) nil)
+	(t (and (eq (key-binding "a") 'self-insert-command)
+		(eq (key-binding " ") 'self-insert-command)))))
+
 
 ;; This hook designed to enable Vi-style editing in comint-based modes."
 (defun viper-comint-mode-hook ()
@@ -760,7 +777,7 @@
    (lambda (buf)
      (if (viper-buffer-live-p buf)
 	 (with-current-buffer buf
-	   (cond ((and (memq major-mode viper-vi-state-mode-list)
+	   (cond ((and (this-major-mode-requires-vi-state major-mode)
 		       (eq viper-current-state 'emacs-state))
 		  (viper-mode))
 		 ((memq major-mode viper-emacs-state-mode-list)
@@ -798,6 +815,8 @@
   ;; However, this has the effect that if the user didn't specify the
   ;; default mode, new buffers that fall back on the default will come up
   ;; in Fundamental Mode and Vi state.
+  ;; When viper-mode is executed in such a case, it will set the major mode
+  ;; back to fundamental-mode.
   (if (eq default-major-mode 'fundamental-mode)
       (setq default-major-mode 'viper-mode))
   
@@ -956,36 +975,16 @@
       (setq global-mode-string
 	    (append '("" viper-mode-string) (cdr global-mode-string))))
 
-  (defadvice read-key-sequence (around viper-read-keyseq-ad activate)
-    "Harness to work for Viper.  This advice is harmless---don't worry!"
-    (let (inhibit-quit event keyseq)
-      (setq keyseq ad-do-it)
-      (setq event (if viper-xemacs-p
-		      (elt keyseq 0) ; XEmacs returns vector of events
-		    (elt (listify-key-sequence keyseq) 0)))
-      (if (viper-ESC-event-p event)
-	  (let (unread-command-events)
-	    (viper-set-unread-command-events keyseq)
-	    (if (viper-fast-keysequence-p)
-		(let ((viper-vi-global-user-minor-mode  nil)
-		      (viper-vi-local-user-minor-mode  nil)
-		      (viper-replace-minor-mode nil) ; actually unnecessary
-		      (viper-insert-global-user-minor-mode  nil)
-		      (viper-insert-local-user-minor-mode  nil))
-		  (setq keyseq ad-do-it)) 
-	      (setq keyseq ad-do-it))))
-      keyseq))
-  
   (defadvice describe-key (before viper-read-keyseq-ad protect activate)
-    "Force to read key via `read-key-sequence'."
+    "Force to read key via `viper-read-key-sequence'."
     (interactive (list (viper-events-to-keys
-			(read-key-sequence "Describe key: ")))))
+			(viper-read-key-sequence "Describe key: ")))))
   
   (defadvice describe-key-briefly
     (before viper-read-keyseq-ad protect activate)
-    "Force to read key via `read-key-sequence'."
+    "Force to read key via `viper-read-key-sequence'."
     (interactive (list (viper-events-to-keys
-			(read-key-sequence "Describe key briefly: ")))))
+			(viper-read-key-sequence "Describe key briefly: ")))))
   
   
   (defadvice find-file (before viper-add-suffix-advice activate)
@@ -1056,6 +1055,27 @@
 
   ) ; end viper-non-hook-settings
 
+;; Viperized read-key-sequence
+(defun viper-read-key-sequence (prompt &optional continue-echo)
+  (let (inhibit-quit event keyseq)
+    (setq keyseq (read-key-sequence prompt continue-echo))
+    (setq event (if viper-xemacs-p
+		    (elt keyseq 0) ; XEmacs returns vector of events
+		  (elt (listify-key-sequence keyseq) 0)))
+    (if (viper-ESC-event-p event)
+	(let (unread-command-events)
+	  (viper-set-unread-command-events keyseq)
+	  (if (viper-fast-keysequence-p)
+	      (let ((viper-vi-global-user-minor-mode  nil)
+		    (viper-vi-local-user-minor-mode  nil)
+		    (viper-replace-minor-mode nil) ; actually unnecessary
+		    (viper-insert-global-user-minor-mode  nil)
+		    (viper-insert-local-user-minor-mode  nil))
+		(setq keyseq (read-key-sequence prompt continue-echo))) 
+	    (setq keyseq (read-key-sequence prompt continue-echo)))))
+    keyseq))
+
+
 
 ;; Ask only if this-command/last-command are nil, i.e., when loading
 (cond ((and (eq viper-mode 'ask) (null this-command) (null last-command))
@@ -1259,7 +1279,7 @@
       (setq-default minor-mode-map-alist minor-mode-map-alist)
       ))
 
-(if (and viper-mode (memq major-mode viper-vi-state-mode-list))
+(if (and viper-mode (this-major-mode-requires-vi-state major-mode))
     (viper-mode))
 
 (if viper-mode
--- a/man/ChangeLog	Fri Jul 20 22:46:18 2001 +0000
+++ b/man/ChangeLog	Sat Jul 21 05:28:24 2001 +0000
@@ -1,3 +1,9 @@
+2001-07-21  Michael Kifer  <kifer@cs.sunysb.edu>
+	
+	* viper.texi: Added credits, new commands, like :make.
+	
+	* ediff.texi: added credits.
+	
 2001-06-08  Carsten Dominik  <dominik@astro.uva.nl>
 
 	* reftex.texi: Updated to version 4.16
--- a/man/ediff.texi	Fri Jul 20 22:46:18 2001 +0000
+++ b/man/ediff.texi	Sat Jul 21 05:28:24 2001 +0000
@@ -13,6 +13,7 @@
 @synindex vr cp
 @synindex fn cp
 @synindex pg cp
+@synindex ky cp
 
 @dircategory Emacs
 @direntry
@@ -150,6 +151,15 @@
 @node Major Entry Points, Session Commands, Introduction, Top
 @chapter Major Entry Points
 
+When Ediff starts up, it displays a small control window, which accepts the
+Ediff commands and two or three windows displaying the files to be compared
+or merged. The control window can be in its own small frame or it can be
+part of a bigger frame that displays other buffers. In any case, it is
+important that the control window be active (i.e., be the one receiving the
+keystrokes) when you use Ediff. You can switch to other Emacs buffers at
+will and even edit the files currently being compared with Ediff and then
+switch back to Ediff at any time by activating the appropriate Emacs windows.
+
 Ediff can be invoked interactively using the following functions, which can
 be run either from the minibuffer or from the menu bar.  In the menu bar,
 all Ediff's entry points belong to three submenus of the Tools menu:
@@ -443,27 +453,35 @@
 
 @table @kbd
 @item ?
+@kindex ?
 Toggles the Ediff Quick Help window ON and OFF.
 @item G
+@kindex G
 Prepares a mail buffer for sending a praise or a curse to the Ediff maintainer.
 
 @item E
+@kindex E
 Brings up the top node of this manual, where you can find further
 information on the various Ediff functions and advanced issues, such as
 customization, session groups, etc.
 
 @item v
+@kindex v
 Scrolls up buffers A and B (and buffer C where appropriate) in a
 coordinated fashion.
 @item V
+@kindex V
 Scrolls the buffers down.
 
 @item <
+@kindex <
 Scrolls the buffers to the left simultaneously.
 @item >
+@kindex >
 Scrolls buffers to the right.
 
 @item wd
+@kindex wd
 Saves the output from the diff utility, for further reference.
 
 With prefix argument, saves the plain output from @code{diff} (see
@@ -473,14 +491,18 @@
 it is available.
 
 @item wa
+@kindex wa
 Saves buffer A, if it was modified.
 @item wb
+@kindex wb
 Saves buffer B, if it was modified.
 @item wc
+@kindex wc
 Saves buffer C, if it was modified (if you are in a session that
 compares three files simultaneously).
 
 @item a
+@kindex a
 @emph{In comparison sessions:}
 Copies the current difference region (or the region specified as the prefix
 to this command) from buffer A to buffer B.
@@ -493,6 +515,7 @@
 this region in buffer C can be restored via the command @kbd{r}.
 
 @item b
+@kindex b
 Works similarly, but copies the current difference region from buffer B to
 buffer A (in @emph{comparison sessions}) or the merge buffer (in
 @emph{merge sessions}).
@@ -502,39 +525,50 @@
 @kbd{r} in merge sessions.
 
 @item ab
+@kindex ab
 Copies the current difference region (or the region specified as the prefix
 to this command) from buffer A to buffer B.  This (and the next five)
 command is enabled only in sessions that compare three files
 simultaneously.  The old region in buffer B is saved and can be restored
 via the command @kbd{rb}.
 @item ac
+@kindex ac
 Copies the difference region from buffer A to buffer C.
 The old region in buffer C is saved and can be restored via the command
 @kbd{rc}.
 @item ba
+@kindex ba
 Copies the difference region from buffer B to buffer A.
 The old region in buffer A is saved and can be restored via the command
 @kbd{ra}.
 @item bc
+@kindex bc
 Copies the difference region from buffer B to buffer C.
 The command @kbd{rc} undoes this.
 @item ca
+@kindex ca
 Copies the difference region from buffer C to buffer A.
 The command @kbd{ra} undoes this.
 @item cb
+@kindex cb
 Copies the difference region from buffer C to buffer B.
 The command @kbd{rb} undoes this.
 
 @item p
 @itemx DEL
+@kindex p
+@kindex DEL
 Makes the previous difference region current.
 @item n
 @itemx SPC
+@kindex n
+@kindex SPC
 Makes the next difference region current.
 
 @item j
 @itemx -j
 @itemx Nj
+@kindex j
 Makes the very first difference region current.
 
 @kbd{-j} makes the last region current.  Typing a number, N, and then `j'
@@ -542,6 +576,7 @@
 `j' makes current the region Last - N.
 
 @item ga
+@kindex ga
 Makes current the difference region closest to the position of the point in
 buffer A.
 
@@ -553,11 +588,13 @@
 this case, the variants will be positioned so that each would display this
 area (of agreement).
 @item gb
+@kindex gb
 Makes current the difference region closest to the position of the point in
 buffer B.
 
 With a prefix argument, behaves like @kbd{ga}, but with respect to buffer B.
 @item gc
+@kindex gc
 @emph{In merge sessions:}
 makes current the difference region closest to the point in the merge buffer.
 
@@ -567,12 +604,14 @@
 With a prefix argument, behaves like @kbd{ga}, but with respect to buffer C.
 
 @item !
+@kindex !
 Recomputes the difference regions, bringing them up to date.  This is often
 needed because it is common to do all sorts of editing during Ediff
 sessions, so after a while, the highlighted difference regions may no
 longer reflect the actual differences among the buffers.
 
 @item *
+@kindex *
 Forces refinement of the current difference region, which highlights the exact
 words of disagreement among the buffers.  With a negative prefix argument,
 unhighlights the current region.
@@ -589,17 +628,20 @@
 no longer current, due to user editing.
 
 @item m
+@kindex m
 Displays the current Ediff session in a frame as wide as the physical
 display.  This is useful when comparing files side-by-side.  Typing `m' again
 restores the original size of the frame.
 
 @item |
+@kindex |
 Toggles the horizontal/vertical split of the Ediff display.  Horizontal
 split is convenient when it is possible to compare files
 side-by-side.  If the frame in which files are displayed is too narrow
 and lines are cut off, typing @kbd{m} may help some.
 
 @item @@
+@kindex @@
 Toggles auto-refinement of difference regions (i.e., automatic highlighting
 of the exact words that differ among the variants).  Auto-refinement is
 turned off on devices where Emacs doesn't support highlighting.
@@ -609,11 +651,13 @@
 @kbd{*}.
 
 @item h
+@kindex h
 Cycles between full highlighting, the mode where fine differences are not
 highlighted (but computed), and the mode where highlighting is done with
 ASCII strings.  The latter is not really recommended, unless on a dumb TTY.
 
 @item r
+@kindex r
 Restores the old contents of the region in the merge buffer.
 (If you copied a difference region from buffer A or B into the merge buffer
 using the commands @kbd{a} or @kbd{b}, Ediff saves the old contents of the
@@ -622,22 +666,26 @@
 This command is enabled in merge sessions only.
 
 @item ra
+@kindex ra
 Restores the old contents of the current difference region in buffer A,
 which was previously saved when the user invoked one of these commands:
 @kbd{b}, @kbd{ba}, @kbd{ca}, which see.  This command is enabled in
 comparison sessions only.
 @item rb
+@kindex rb
 Restores the old contents of the current difference region in buffer B,
 which was previously saved when the user invoked one of these commands:
 @kbd{a}, @kbd{ab}, @kbd{cb}, which see.  This command is enabled in
 comparison sessions only.
 @item rc
+@kindex rc
 Restores the old contents of the current difference region in buffer C,
 which was previously saved when the user invoked one of these commands:
 @kbd{ac}, @kbd{bc}, which see.  This command is enabled in 3-file
 comparison sessions only.
 
 @item ##
+@kindex ##
 Tell Ediff to skip over regions that disagree among themselves only in the
 amount of white space and line breaks.
 
@@ -647,6 +695,8 @@
 
 @item #h
 @itemx #f
+@kindex #f
+@kindex #h
 Ediff works hard to ameliorate the effects of boredom in the workplace...
 
 Quite often differences are due to identical replacements (e.g., the word
@@ -667,24 +717,30 @@
 over.  @xref{Selective Browsing}, for more.
 
 @item A
+@kindex A
 Toggles the read-only property in buffer A.
 If file A is under version control and is checked in, it is checked out
 (with your permission).
 @item B
+@kindex B
 Toggles the read-only property in buffer B.
 If file B is under version control and is checked in, it is checked out.
 @item C
+@kindex C
 Toggles the read-only property in buffer C (in 3-file comparison sessions).
 If file C is under version control and is checked in, it is checked out.
 
 @item ~
+@kindex ~
 Swaps the windows where buffers A and B are displayed.  If you are comparing
 three buffers at once, then this command would rotate the windows among
 buffers A, B, and C.
 
 @item i
+@kindex i
 Displays all kinds of useful data about the current Ediff session.
 @item D
+@kindex D
 Runs @code{ediff-custom-diff-program} on the variants and displays the
 buffer containing the output.  This is useful when you must send the output
 to your Mom.
@@ -693,6 +749,7 @@
 @xref{Patch and Diff Programs}, for details.
 
 @item R
+@kindex R
 Displays a list of currently active Ediff sessions---the Ediff Registry.
 You can then restart any of these sessions by either clicking on a session
 record or by putting the cursor over it and then typing the return key.
@@ -706,10 +763,12 @@
 minibuffer: @kbd{M-x eregistry}.  @xref{Registry of Ediff Sessions}.
 
 @item M
+@kindex M
 Shows the session group buffer that invoked the current Ediff session.
 @xref{Session Groups}, for more information on session groups.
 
 @item z
+@kindex z
 Suspends the current Ediff session.  (If you develop a condition known as
 Repetitive Ediff Injury---a serious but curable illness---you must change
 your current activity.  This command tries hard to hide all Ediff-related
@@ -718,21 +777,25 @@
 The easiest way to resume a suspended Ediff session is through the registry
 of active sessions.  @xref{Registry of Ediff Sessions}, for details.
 @item q
+@kindex q
 Terminates this Ediff session.  With a prefix argument (e.g.,@kbd{1q}), asks
 if you also want to delete the buffers of the variants.
 Modified files and the results of merges are never deleted.
 
 @item %
+@kindex %
 Toggles narrowing in Ediff buffers.  Ediff buffers may be narrowed if you
 are comparing only parts of these buffers via the commands
 @code{ediff-windows-*} and @code{ediff-regions-*}, which see.
 
 @item C-l
+@kindex C-l
 Restores the usual Ediff window setup.  This is the quickest way to resume
 an Ediff session, but it works only if the control panel of that session is
 visible.
 
 @item $$
+@kindex $$
 While merging with an ancestor file, Ediff is determined to reduce user's
 wear and tear by saving him and her much of unproductive, repetitive
 typing.  If it notices that, say, file A's difference region is identical to
@@ -752,6 +815,7 @@
 it.  Typing @kbd{$$} again undoes this setting.
 
 @item $*
+@kindex $*
 When merging files with large number of differences, it is sometimes
 convenient to be able to skip the difference regions for which you already
 decided which variant is most appropriate. Typing @kbd{$*} will accomplish
@@ -767,8 +831,10 @@
 region in buffer A, etc.
 
 @item /
+@kindex /
 Displays the ancestor file during merges.
 @item &
+@kindex &
 In some situations, such as when one of the files agrees with the ancestor file
 on a difference region and the other doesn't, Ediff knows what to do: it copies
 the current difference region from the second buffer into the merge buffer.
@@ -788,6 +854,7 @@
 corresponding region from buffer B.
 
 @item s
+@kindex s
 Causes the merge window shrink to its minimum size, thereby exposing as much
 of the variant buffers as possible.  Typing `s' again restores
 the original size of that window.
@@ -807,12 +874,14 @@
 the variable @code{ediff-merge-window-share}, which see.
 
 @item +
+@kindex +
 Combines the difference regions from buffers A and B and copies the
 result into the merge buffer.  @xref{Merging and diff3}, and the
 variables @code{ediff-combine-diffs} and @code{ediff-combination-pattern}.
 
 
 @item =
+@kindex =
 You may run into situations when a large chunk of text in one file has been
 edited and then moved to a different place in another file.  In such a case,
 these two chunks of text are unlikely to belong to the same difference
@@ -836,6 +905,9 @@
 Ediff would take the current region in the merge buffer and compare
 it to the current region in the buffer of your choice (A or B).
 
+@emph{Note: In all these cases you must first switch to the appropriate
+Emacs buffers and manually set the regions that you want to compare.}
+
 Highlighting set by the parent Ediff session is removed, to avoid interference
 with highlighting of the child session.  When done with the child session, type
 @kbd{C-l} in the parent's control panel to restore the original highlighting.
@@ -2329,12 +2401,14 @@
 Fritz Knabe (Fritz.Knabe@@ecrc.de),
 Heinz Knutzen (hk@@informatik.uni-kiel.d400.de),
 Andrew Koenig (ark@@research.att.com),
+Hannu Koivisto (azure@@iki.fi),
 Ken Laprade (laprade@@dw3f.ess.harris.com),
 Will C Lauer (wcl@@cadre.com),
 Richard Levitte (levitte@@e.kth.se),
 Mike Long (mike.long@@analog.com),
 Martin Maechler (maechler@@stat.math.ethz.ch),
 Simon Marshall (simon@@gnu.org),
+Paul C. Meuse (pmeuse@@delcomsys.com),
 Richard Mlynarik (mly@@adoc.xerox.com),
 Stefan Monnier (monnier@@cs.yale.edu),
 Chris Murphy (murphycm@@sun.aston.ac.uk),
--- a/man/viper.texi	Fri Jul 20 22:46:18 2001 +0000
+++ b/man/viper.texi	Sat Jul 21 05:28:24 2001 +0000
@@ -168,6 +168,17 @@
 Emacs ideas that you should know about, how to use Viper within Emacs and
 some incompatibilities.
 
+This manual is written with the assumption that you are an experienced Vi
+user who wants to switch to Emacs while retaining the ability to edit files
+Vi style. Incredible as it might seem, there are experienced Emacs users
+who use Viper as a backdoor into the superior (as every Vi user already knows)
+world of Vi! These users are well familiar with Emacs bindings and prefer them
+in some cases, especially in the Vi Insert state. John Hawkins
+<jshawkin@@eecs.umich.edu> has provided a set of customizations, which
+enables additional Emacs bindings under Viper.  These customizations can be
+included in your @file{~/.viper} file and are found at the following URL:
+@file{http://www.eecs.umich.edu/~jshawkin/viper-sample}.
+
 Viper was formerly known as VIP-19, which was
 a descendant of VIP 3.5 by Masahiko Sato and VIP 4.4 by Aamod Sane.
 
@@ -1850,10 +1861,8 @@
 reference.)  On a color display, the following customization method is
 usually most effective:
 @example
-(set-face-foreground viper-replace-overlay-face 
-                     "DarkSlateBlue")
-(set-face-background viper-replace-overlay-face 
-                     "yellow")
+(set-face-foreground viper-replace-overlay-face "DarkSlateBlue")
+(set-face-background viper-replace-overlay-face "yellow")
 @end example
 For a complete list of colors available to you, evaluate the expression
 @code{(x-defined-colors)}.  (Type it in the buffer @code{*scratch*} and then
@@ -2059,8 +2068,7 @@
 @noindent
 To customize the binding for @kbd{C-h} in Insert state:
 @example
-(define-key viper-insert-global-user-map 
-            "\C-h" 'my-del-backwards-function)
+(define-key viper-insert-global-user-map "\C-h" 'my-del-backwards-function)
 @end example
 @noindent
 
@@ -2109,8 +2117,7 @@
 (setq my-dired-vi-purist-map (make-sparse-keymap))
 (define-key my-dired-vi-purist-map "k" 'viper-previous-line)
 (define-key my-dired-vi-purist-map "l" 'viper-forward-char)
-(viper-modify-major-mode 'dired-mode 
-                         'emacs-state my-dired-vi-purist-map)
+(viper-modify-major-mode 'dired-mode 'emacs-state my-dired-vi-purist-map)
 @end example
 
 Yet another way to customize key bindings in a major mode is to edit the
@@ -4198,6 +4205,8 @@
 @item :<address>r <name>
 Read the file <name> into the buffer after the line <address> (default
 current).
+@item :make
+Run the make command in the current directory.
 @end table
 @findex @kbd{:<address>r <name>}
 @findex @kbd{:<address>r !<cmd>}
@@ -4209,6 +4218,7 @@
 @findex @kbd{:!!@: <args>}
 @findex @kbd{:!<cmd>}
 @findex @kbd{:sh}
+@findex @kbd{:make}
 
 @node Options,Emacs Related Commands,Shell Commands,Commands
 @section Options
@@ -4455,6 +4465,7 @@
 Mark.Bordas@@East.Sun.COM (Mark Bordas),
 meyering@@comco.com (Jim Meyering),
 martin@@xemacs.org (Martin Buchholz),
+mbutler@@redfernnetworks.com (Malcolm Butler),
 mveiga@@dit.upm.es (Marcelino Veiga Tuimil),
 paulk@@summit.esg.apertus.com (Paul Keusemann),
 pfister@@cs.sunysb.edu (Hanspeter Pfister),