changeset 18054:0b9d9cbf3cd4

new version
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 31 May 1997 01:10:39 +0000
parents 941f5d1a241e
children 9e0c7dffc231
files lisp/ediff-diff.el lisp/ediff-help.el lisp/ediff-hook.el lisp/ediff-init.el lisp/ediff-merg.el lisp/ediff-mult.el lisp/ediff-ptch.el lisp/ediff-util.el lisp/ediff-vers.el lisp/ediff-wind.el lisp/ediff.el
diffstat 11 files changed, 678 insertions(+), 351 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ediff-diff.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-diff.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-diff.el --- diff-related utilities
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -23,10 +23,29 @@
 
 ;;; Code:
 
+(provide 'ediff-diff)
+
+;; compiler pacifier
+(defvar ediff-default-variant)
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-util)
+	(load "ediff-util.el" nil nil 'nosuffix))
+    ))
+;; end pacifier
+
 (require 'ediff-init)
 
+(defgroup ediff-diff nil
+  "Diff related utilities"
+  :prefix "ediff-"
+  :group 'ediff)
 
-(defvar ediff-shell
+
+(defcustom ediff-shell
   (cond ((eq system-type 'emx) "cmd") ; OS/2
 	((memq system-type '(ms-dos windows-nt windows-95))
 	 shell-file-name) ; no standard name on MS-DOS
@@ -36,37 +55,53 @@
 .cshrc files are set up correctly, any shell will do.  However, some people
 set $prompt or other things incorrectly, which leads to undesirable output
 messages.  These may cause Ediff to fail.  In such a case, set ediff-shell
-to a shell that you are not using or, better, fix your shell's startup file.")
+to a shell that you are not using or, better, fix your shell's startup file."
+  :type 'string
+  :group 'ediff-diff)
 
 
-(defvar ediff-diff-program "diff"
-  "*Program to use for generating the differential of the two files.")
-(defvar ediff-diff-options ""  
+(defcustom ediff-diff-program "diff"
+  "*Program to use for generating the differential of the two files."
+  :type 'string
+  :group 'ediff-diff)
+(defcustom ediff-diff-options ""  
   "*Options to pass to `ediff-diff-program'. 
 If diff\(1\) is used as `ediff-diff-program', then the most useful options are
 `-w', to ignore space, and `-i', to ignore case of letters.
 At present, the option `-c' is ignored, since Ediff doesn't understand this
-type of output.")
+type of output."
+  :type 'string
+  :group 'ediff-diff)
 
-(defvar ediff-custom-diff-program ediff-diff-program
+(defcustom ediff-custom-diff-program ediff-diff-program
   "*Program to use for generating custom diff output for saving it in a file.
-This output is not used by Ediff internally.")
-(defvar ediff-custom-diff-options "-c"
-  "*Options to pass to `ediff-custom-diff-program'.")
+This output is not used by Ediff internally."
+  :type 'string
+  :group 'ediff-diff)
+(defcustom ediff-custom-diff-options "-c"
+  "*Options to pass to `ediff-custom-diff-program'."
+  :type 'string
+  :group 'ediff-diff)
 
 ;;; Support for diff3
 
 (defvar ediff-match-diff3-line "^====\\(.?\\)$"
   "Pattern to match lines produced by diff3 that describe differences.")
-(defvar ediff-diff3-program "diff3"
+(defcustom ediff-diff3-program "diff3"
   "*Program to be used for three-way comparison.
-Must produce output compatible with Unix's diff3 program.")
-(defvar ediff-diff3-options ""  
-  "*Options to pass to `ediff-diff3-program'.")
-(defvar ediff-diff3-ok-lines-regexp
+Must produce output compatible with Unix's diff3 program."
+  :type 'string
+  :group 'ediff-diff)
+(defcustom ediff-diff3-options ""  
+  "*Options to pass to `ediff-diff3-program'."
+  :type 'string
+  :group 'ediff-diff)
+(defcustom ediff-diff3-ok-lines-regexp
   "^\\([1-3]:\\|====\\|  \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
   "*Regexp that matches normal output lines from `ediff-diff3-program'.
-Lines that do not match are assumed to be error messages.")
+Lines that do not match are assumed to be error messages."
+  :type 'regexp
+  :group 'ediff-diff)
 
 ;; keeps the status of the current diff in 3-way jobs.
 ;; the status can be =diff(A), =diff(B), or =diff(A+B)
@@ -551,13 +586,7 @@
 	    (whitespace-C (ediff-whitespace-diff-region-p n 'C))
 	    cumulative-fine-diff-length)
 	
-	(cond ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A))
-	       ;; don't compute fine diffs if diff vector exists
-	       (if (ediff-no-fine-diffs-p n)
-		   ;;(ediff-message-if-verbose
-		   (message
-		    "Only white-space differences in region %d" (1+ n))))
-	      ;; If one of the regions is empty (or 2 in 3way comparison)
+	(cond ;; If one of the regions is empty (or 2 in 3way comparison)
 	      ;; then don't refine.
 	      ;; If the region happens to be entirely whitespace or empty then
 	      ;; mark as such.
@@ -586,6 +615,20 @@
 		 ;; if some regions are white and others don't, then mark as
 		 ;; non-white-space-only
 		 (ediff-mark-diff-as-space-only n nil)))
+
+	      ;; don't compute fine diffs if diff vector exists
+	      ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A))
+	       (if (ediff-no-fine-diffs-p n)
+		   (message
+		    "Only white-space differences in region %d %s"
+		    (1+ n)
+		    (cond ((eq (ediff-no-fine-diffs-p n) 'A)
+			   "in buffers B & C")
+			  ((eq (ediff-no-fine-diffs-p n) 'B)
+			   "in buffers A & C")
+			  ((eq (ediff-no-fine-diffs-p n) 'C)
+			   "in buffers A & B")
+			  (t "")))))
 	      ;; don't compute fine diffs for this region
 	      ((eq flag 'skip)
 	       (or (ediff-get-fine-diff-vector n 'A)
@@ -666,13 +709,15 @@
 		      (ediff-message-if-verbose
 		       "Only white-space differences in region %d" (1+ n)))
 		     ((eq cumulative-fine-diff-length 0)
-		      (ediff-mark-diff-as-space-only n t)
 		      (ediff-message-if-verbose
 		       "Only white-space differences in region %d %s"
 		       (1+ n)
-		       (cond (whitespace-A "in buffers B & C")
-			     (whitespace-B "in buffers A & C")
-			     (whitespace-C "in buffers A & B"))))
+		       (cond (whitespace-A (ediff-mark-diff-as-space-only n 'A)
+					   "in buffers B & C")
+			     (whitespace-B (ediff-mark-diff-as-space-only n 'B)
+					   "in buffers A & C")
+			     (whitespace-C (ediff-mark-diff-as-space-only n 'C)
+					   "in buffers A & B"))))
 		     (t 
 		      (ediff-mark-diff-as-space-only n nil)))
 	       )
@@ -1204,7 +1249,5 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-diff)
-
 
 ;; ediff-diff.el ends here
--- a/lisp/ediff-help.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-help.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-help.el --- Code related to the contents of Ediff help buffers
 
-;; Copyright (C) 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -22,17 +22,21 @@
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
-
-(require 'ediff-init)
+	 
+(provide 'ediff-help)
 
 ;; Compiler pacifier start
 (defvar ediff-multiframe)
-(and noninteractive
-     (eval-when-compile
-       (let ((load-path (cons (expand-file-name ".") load-path)))
-	 (load-file "ediff-init.el"))))
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    ))
 ;; end pacifier
 
+(require 'ediff-init)
+
 ;; Help messages
 
 (defconst ediff-long-help-message-head
@@ -178,8 +182,7 @@
   "Explain Ediff commands in more detail."
   (interactive)
   (ediff-barf-if-not-control-buffer)
-  (let ((ctl-buf (current-buffer))
-	(pos (ediff-event-point last-command-event))
+  (let ((pos (ediff-event-point last-command-event))
 	overl cmd)
 
     (if ediff-xemacs-p
@@ -306,6 +309,5 @@
 			     ediff-brief-help-message))
   (run-hooks 'ediff-display-help-hook))
 
-(provide 'ediff-help)
 
 ;;; ediff-help.el ends here
--- a/lisp/ediff-hook.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-hook.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
 
-;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -25,6 +25,8 @@
 
 ;;;   These must be placed in menu-bar.el in Emacs
 ;;
+;;      (define-key menu-bar-tools-menu [ediff-misc]
+;;	'("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
 ;;      (define-key menu-bar-tools-menu [epatch]
 ;;	'("Apply Patch" . menu-bar-epatch-menu))
 ;;      (define-key menu-bar-tools-menu [ediff-merge]
@@ -36,32 +38,24 @@
 (defvar ediff-menu)
 (defvar ediff-merge-menu)
 (defvar epatch-menu)
+(defvar ediff-misc-menu)
 ;; end pacifier
 
+;; allow menus to be set up without ediff-wind.el being loaded
+(defvar ediff-window-setup-function)
+
 
 (defun ediff-xemacs-init-menus ()
   (if (featurep 'menubar)
       (progn
-	(add-menu-button
-	 '("Tools")
-	 ["Use separate frame for Ediff control buffer"
-	  ediff-toggle-multiframe
-	  :style toggle
-	  :selected (eq ediff-window-setup-function 'ediff-setup-windows-multiframe)]
-	 "00-Browser...")
-	(add-menu-button
-	 '("Tools")
-	 ["Use a toolbar with Ediff control buffer"
-	  ediff-menu-toggle-use-toolbar
-	  :style toggle
-	  :selected (ediff-use-toolbar-p)]
-	 "00-Browser...")
 	(add-submenu
 	 '("Tools") ediff-menu "OO-Browser...")
 	(add-submenu
 	 '("Tools") ediff-merge-menu "OO-Browser...")
 	(add-submenu
 	 '("Tools") epatch-menu "OO-Browser...")
+	(add-submenu
+	 '("Tools") ediff-misc-menu "OO-Browser...")
 	(add-menu-button
 	 '("Tools")
 	 ["-------" nil nil] "OO-Browser...")
@@ -88,9 +82,6 @@
 	   "---"
 	   ["Regions Word-by-word..." ediff-regions-wordwise t]
 	   ["Regions Line-by-line..." ediff-regions-linewise t]
-	   "---"
-	   ["List Ediff Sessions..." ediff-show-registry t]
-	   ["Ediff Manual..." ediff-documentation t]
 	   ))
        (defvar ediff-merge-menu
 	 '("Merge"
@@ -110,17 +101,28 @@
 	   ["Directory Revisions..." ediff-merge-directory-revisions t]
 	   ["Directory Revisions with Ancestor..."
 	    ediff-merge-directory-revisions-with-ancestor t]
-	   "---"
-	   ["List Ediff Sessions..." ediff-show-registry t]
-	   ["Ediff Manual..." ediff-documentation t]
 	   ))
        (defvar epatch-menu
 	 '("Apply Patch"
 	   ["To a file..."  ediff-patch-file t]
 	   ["To a buffer..." ediff-patch-buffer t]
-	   "---"
+	   ))
+       (defvar ediff-misc-menu
+	 '("Ediff Miscellanea"
+	   ["Ediff Manual..." ediff-documentation t]
 	   ["List Ediff Sessions..." ediff-show-registry t]
-	   ["Ediff Manual..." ediff-documentation t]
+	   ["Use separate frame for Ediff control buffer..."
+	    ediff-toggle-multiframe
+	    :style toggle
+	    :selected (if (and (featurep 'ediff-util)
+			       (boundp 'ediff-window-setup-function))
+			  (eq ediff-window-setup-function
+			      'ediff-setup-windows-multiframe))]
+	   ["Use a toolbar with Ediff control buffer"
+	    ediff-toggle-use-toolbar
+	    :style toggle
+	    :selected (if (featurep 'ediff-tbar)
+			  (ediff-use-toolbar-p))]
 	   ))
 
        ;; put these menus before Object-Oriented-Browser in Tools menu
@@ -132,6 +134,10 @@
       ;; Emacs--only if menu-bar is loaded
       ((featurep 'menu-bar)
        ;; initialize menu bar keymaps
+       (defvar menu-bar-ediff-misc-menu
+	 (make-sparse-keymap "Ediff Miscellanea"))
+       (fset 'menu-bar-ediff-misc-menu
+	     (symbol-value 'menu-bar-ediff-misc-menu))
        (defvar menu-bar-epatch-menu (make-sparse-keymap "Apply Patch"))
        (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
        (defvar menu-bar-ediff-merge-menu (make-sparse-keymap "Merge"))
@@ -141,14 +147,6 @@
        (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
 
        ;; define ediff-menu
-       (define-key menu-bar-ediff-menu [ediff-doc]
-	 '("Ediff Manual..." . ediff-documentation))
-       (define-key menu-bar-ediff-menu [emultiframe]
-	'("Toggle separate control buffer frame..."
-	  . ediff-toggle-multiframe))
-       (define-key menu-bar-ediff-menu [eregistry]
-	'("List Ediff Sessions..." . ediff-show-registry))
-       (define-key menu-bar-ediff-menu [separator-ediff-manual] '("--"))
        (define-key menu-bar-ediff-menu [window]
 	 '("This Window and Next Window" . compare-windows))
        (define-key menu-bar-ediff-menu [ediff-windows-linewise]
@@ -181,15 +179,6 @@
 	 '("Two Files..." . ediff-files))
 
        ;; define merge menu
-       (define-key menu-bar-ediff-merge-menu [ediff-doc2]
-	 '("Ediff Manual..." . ediff-documentation))
-       (define-key menu-bar-ediff-merge-menu [emultiframe2]
-	'("Toggle separate control buffer frame..."
-	  . ediff-toggle-multiframe))
-       (define-key menu-bar-ediff-merge-menu [eregistry2]
-	'("List Ediff Sessions..." . ediff-show-registry))
-       (define-key
-	 menu-bar-ediff-merge-menu [separator-ediff-merge-manual] '("--"))
        (define-key
 	 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
 	 '("Directory Revisions with Ancestor..."
@@ -223,18 +212,20 @@
 	 '("Files..." . ediff-merge-files))
 
        ;; define epatch menu
-       (define-key menu-bar-epatch-menu [ediff-doc3]
-	 '("Ediff Manual..." . ediff-documentation))
-       (define-key menu-bar-epatch-menu [emultiframe3]
-	'("Toggle separate control buffer frame..."
-	  . ediff-toggle-multiframe))
-       (define-key menu-bar-epatch-menu [eregistry3]
-	'("List Ediff Sessions..." . ediff-show-registry))
-       (define-key menu-bar-epatch-menu [separator-epatch] '("--"))
        (define-key menu-bar-epatch-menu [ediff-patch-buffer]
 	 '("To a Buffer..." . ediff-patch-buffer))
        (define-key menu-bar-epatch-menu [ediff-patch-file]
-	 '("To a File..." . ediff-patch-file)))
+	 '("To a File..." . ediff-patch-file))
+
+       ;; define ediff miscellanea
+       (define-key menu-bar-ediff-misc-menu [emultiframe]
+	 '("Toggle use of separate control buffer frame..."
+	   . ediff-toggle-multiframe))
+       (define-key menu-bar-ediff-misc-menu [eregistry]
+	 '("List Ediff Sessions..." . ediff-show-registry))
+       (define-key menu-bar-ediff-misc-menu [ediff-doc]
+	 '("Ediff Manual..." . ediff-documentation))
+       )
       
       ) ; cond
 
@@ -338,11 +329,11 @@
     "ediff-util"
     "Toggle the use of separate frame for Ediff control buffer."
     t)
-  (if (string-match "XEmacs" emacs-version)
-      (autoload 'ediff-toggle-use-toolbar
-	"ediff-tbar"
-	"Toggle the use of Ediff toolbar."
-	t))
+  (autoload 'ediff-toggle-use-toolbar
+    "ediff-util"
+    "Toggle the use of Ediff toolbar."
+    t)
+  
   ) ; if purify-flag
 
 
--- a/lisp/ediff-init.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-init.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -32,6 +32,10 @@
 (defvar ediff-mouse-pixel-threshold)
 (defvar ediff-whitespace)
 (defvar ediff-multiframe)
+
+(and noninteractive
+     (eval-when-compile
+	 (load "ange-ftp" 'noerror)))
 ;; end pacifier
 
 ;; Is it XEmacs?
@@ -90,7 +94,7 @@
 (ediff-defvar-local ediff-buffer-C nil "")
 ;; Ancestor buffer
 (ediff-defvar-local ediff-ancestor-buffer nil "")
-;; The control buffer of ediff.
+;; The Ediff control buffer
 (ediff-defvar-local ediff-control-buffer nil "")
 
 ;;; Macros
@@ -125,10 +129,18 @@
       (symbol-value
        (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n))))
   
-;; tell if it has been previously determined that the region has
+;; Tell if it has been previously determined that the region has
 ;; no diffs other than the white space and newlines
 ;; The argument, N, is the diff region number used by Ediff to index the
 ;; diff vector. It is 1 less than the number seen by the user.
+;; Returns:
+;;		t  if the diffs are whitespace in all buffers
+;;		'A (in 3-buf comparison only) if there are only whitespace
+;;		   diffs in bufs B and C
+;;		'B (in 3-buf comparison only) if there are only whitespace
+;;		   diffs in bufs A and C
+;;		'C (in 3-buf comparison only) if there are only whitespace
+;;		   diffs in bufs A and B
 ;;
 ;; A difference vector has the form:
 ;; [diff diff diff ...]
@@ -625,8 +637,8 @@
   
   
 ;;;; warn if it is a wrong version of emacs
-;;(if (or (ediff-check-version '< 19 29 'emacs)
-;;	(ediff-check-version '< 19 12 'xemacs))
+;;(if (or (ediff-check-version '< 19 35 'emacs)
+;;	(ediff-check-version '< 19 15 'xemacs))
 ;;    (progn
 ;;      (with-output-to-temp-buffer ediff-msg-buffer
 ;;	(switch-to-buffer ediff-msg-buffer)
@@ -635,9 +647,9 @@
 ;;
 ;;This version of Ediff requires 
 ;;
-;;\t Emacs 19.29 and higher
+;;\t Emacs 19.35 and higher
 ;;\t OR
-;;\t XEmacs 19.12 and higher
+;;\t XEmacs 19.15 and higher
 ;;
 ;;It is unlikely to work under Emacs version %s
 ;;that you are using... " emacs-version))
@@ -1152,11 +1164,13 @@
 
 ;;; In-line functions
 
-(defsubst ediff-file-remote-p (file-name)
-  (require 'ange-ftp)
-  (car (if ediff-xemacs-p
-	   (ange-ftp-ftp-path file-name)
-	 (ange-ftp-ftp-name file-name))))
+(or (fboundp 'ediff-file-remote-p) ; user supplied his own function: use it
+    (defun ediff-file-remote-p (file-name)
+      (car (cond ((featurep 'efs-auto) (efs-ftp-path file-name))
+		 ((fboundp 'file-remote-p) (file-remote-p file-name))
+		 (t (require 'ange-ftp)
+		    ;; Can happen only in Emacs, since XEmacs has file-remote-p
+		    (ange-ftp-ftp-name file-name))))))
 
     
 (defsubst ediff-frame-unsplittable-p (frame)
@@ -1174,6 +1188,14 @@
   (if (ediff-buffer-live-p buf)
       (kill-buffer (get-buffer buf))))
 
+(defsubst ediff-background-face (buf-type dif-num)
+  ;; The value of dif-num is always 1- the one that user sees.
+  ;; This is why even face is used when dif-num is odd.
+  (intern (format (if (ediff-odd-p dif-num)
+		      "ediff-even-diff-face-%S"
+		    "ediff-odd-diff-face-%S")
+		  buf-type)))
+
 
 ;; activate faces on diff regions in buffer
 (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight)
@@ -1184,11 +1206,13 @@
 	     (lambda (rec)
 	       (setq overl (ediff-get-diff-overlay-from-diff-record rec)
 		     diff-num (ediff-overlay-get overl 'ediff-diff-num))
-	       (ediff-set-overlay-face
-		overl
-		(if (not unhighlight)
-		    (ediff-background-face buf-type diff-num))
-		)))
+	       (if (ediff-overlay-buffer overl)
+		   ;; only if overlay is alive
+		   (ediff-set-overlay-face
+		    overl
+		    (if (not unhighlight)
+			(ediff-background-face buf-type diff-num))))
+	       ))
 	    diff-vector)))
 
 
@@ -1287,14 +1311,6 @@
   (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor)
   )
 
-(defsubst ediff-background-face (buf-type dif-num)
-  ;; The value of dif-num is always 1- the one that user sees.
-  ;; This is why even face is used when dif-num is odd.
-  (intern (format (if (ediff-odd-p dif-num)
-		      "ediff-even-diff-face-%S"
-		    "ediff-odd-diff-face-%S")
-		  buf-type)))
-    
       
 ;; arg is a record for a given diff in a difference vector
 ;; this record is itself a vector
@@ -1419,6 +1435,18 @@
     
 ;; Some overlay functions
 
+(defsubst ediff-overlay-start (overl)
+  (if (ediff-overlayp overl)
+      (if ediff-emacs-p
+	  (overlay-start overl)
+	(extent-start-position overl))))
+	
+(defsubst ediff-overlay-end  (overl)
+  (if (ediff-overlayp overl)
+      (if ediff-emacs-p
+	  (overlay-end overl)
+	(extent-end-position overl))))
+
 (defsubst ediff-empty-overlay-p (overl)
   (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
 
@@ -1583,10 +1611,10 @@
       (apply 'message string args)))
 
 (defun ediff-file-attributes (filename attr-number)
-  (let ((handler (find-file-name-handler filename 'find-file-noselect)))
-    (if (and handler (string-match "ange-ftp" (format "%S" handler)))
-	-1
-      (nth attr-number (file-attributes filename)))))
+  (if (ediff-file-remote-p filename)
+      -1
+    (nth attr-number (file-attributes filename))))
+
 (defsubst ediff-file-size (filename)
   (ediff-file-attributes filename 7))
 (defsubst ediff-file-modtime (filename)
@@ -1594,9 +1622,8 @@
 
 
 (defun ediff-convert-standard-filename (fname)
-  (if ediff-emacs-p
+  (if (fboundp 'convert-standard-filename)
       (convert-standard-filename fname)
-    ;; hopefully, XEmacs adds this functionality
     fname))
 
 
--- a/lisp/ediff-merg.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-merg.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-merg.el --- merging utilities
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -23,14 +23,40 @@
 
 ;;; Code:
 
+(provide 'ediff-merg)
+
+(defgroup ediff-merge nil
+  "Merging utilities"
+  :prefix "ediff-"
+  :group 'ediff)
+
+
+;; compiler pacifier
+(defvar ediff-window-A)
+(defvar ediff-window-B)
+(defvar ediff-window-C)
+(defvar ediff-merge-window-share)
+(defvar ediff-window-config-saved)
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-util)
+	(load "ediff-util.el" nil nil 'nosuffix))
+    ))
+;; end pacifier
+
 (require 'ediff-init)
 
 
-(defvar ediff-default-variant 'combined
+(defcustom ediff-default-variant 'combined
   "*The variant to be used as a default for buffer C in merging.
-Valid values are the symbols `default-A', `default-B', and `combined'.")
+Valid values are the symbols `default-A', `default-B', and `combined'."
+  :type '(radio (const default-A) (const default-B) (const combined))
+  :group 'ediff-merge)
 
-(defvar ediff-combination-pattern 
+(defcustom ediff-combination-pattern 
   '("<<<<<<<<<<<<<< variant A" ">>>>>>>>>>>>>> variant B" "======= end of combination")
   "*Pattern to be used for combining difference regions in buffers A and B.
 The value is (STRING1 STRING2 STRING3). The combined text will look like this:
@@ -40,7 +66,9 @@
 STRING2
 diff region from variant B
 STRING3
-")
+"
+  :type '(list string string string)
+  :group 'ediff-merge)
 
 (ediff-defvar-local ediff-show-clashes-only  nil
   "*If t, show only those diff regions where both buffers disagree with the ancestor.
@@ -270,6 +298,4 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-merg)
-
 ;; ediff-merg.el ends here
--- a/lisp/ediff-mult.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-mult.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
 
-;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -90,7 +90,26 @@
 
 ;;; Code:
 
+(provide 'ediff-mult)
+
+(defgroup ediff-mult nil
+  "Multi-file and multi-buffer processing in ediff"
+  :prefix "ediff-"
+  :group 'ediff)
+
+
+;; compiler pacifier
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-util)
+	(load "ediff-util.el" nil nil 'nosuffix))
+    ))
+;; end pacifier
+
 (require 'ediff-init)
+(require 'ediff-util)
 
 ;; meta-buffer
 (ediff-defvar-local ediff-meta-buffer nil "")
@@ -150,22 +169,34 @@
 ;; The registry of Ediff sessions. A list of control buffers.
 (defvar ediff-session-registry nil)
 
-(defvar ediff-registry-setup-hook nil
-  "*Hooks run just after the registry control panel is set up.")
-(defvar ediff-session-group-setup-hook nil
+(defcustom ediff-registry-setup-hook nil
+  "*Hooks run just after the registry control panel is set up."
+  :type 'hook
+  :group 'ediff-mult)
+(defcustom ediff-session-group-setup-hook nil
   "*Hooks run just after a meta-buffer controlling a session group, such as
-ediff-directories, is run.")
-(defvar ediff-quit-session-group-hook nil
-  "*Hooks run just before exiting a session group.")
-(defvar ediff-show-registry-hook nil
-  "*Hooks run just after the registry buffer is shown.")
-(defvar ediff-show-session-group-hook nil
-  "*Hooks run just after a session group buffer is shown.")
-(defvar ediff-meta-buffer-keymap-setup-hook nil
+ediff-directories, is run."
+  :type 'hook
+  :group 'ediff-mult)
+(defcustom ediff-quit-session-group-hook nil
+  "*Hooks run just before exiting a session group."
+  :type 'hook
+  :group 'ediff-mult)
+(defcustom ediff-show-registry-hook nil
+  "*Hooks run just after the registry buffer is shown."
+  :type 'hook
+  :group 'ediff-mult)
+(defcustom ediff-show-session-group-hook nil
+  "*Hooks run just after a session group buffer is shown."
+  :type 'hook
+  :group 'ediff-mult)
+(defcustom ediff-meta-buffer-keymap-setup-hook nil
   "*Hooks run just after setting up the ediff-meta-buffer-map.
 This keymap controls key bindings in the meta buffer and is a local variable.
 This means that you can set different bindings for different kinds of meta
-buffers.")
+buffers."
+  :type 'hook
+  :group 'ediff-mult)
 
 ;; buffer holding the multi-file patch. local to the meta buffer
 (ediff-defvar-local ediff-meta-patchbufer nil "")
@@ -654,7 +685,8 @@
 	   "     `=':\tmark identical files in each session\n\n"))
 
       (if (and (stringp regexp) (> (length regexp) 0))
-	  (insert (format "Filter-through regular expression: %s\n" regexp)))
+	  (insert
+	   (format "\n*** Filter-through regular expression: %s\n" regexp)))
       (if (and ediff-autostore-merges (ediff-merge-metajob)
 	       (stringp merge-autostore-dir))
 	  (insert (format
@@ -808,7 +840,8 @@
      DEL: previous line\n\n")
 
       (if (and (stringp regexp) (> (length regexp) 0))
-	  (insert (format "Filter-through regular expression: %s\n" regexp)))
+	  (insert
+	   (format "\n*** Filter-through regular expression: %s\n" regexp)))
       (insert "\n")
       (insert (format "\n%-27s%-26s"
 		      (ediff-truncate-string-left
@@ -1718,7 +1751,4 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-mult)
-(require 'ediff-util)
-
 ;;; ediff-mult.el ends here
--- a/lisp/ediff-ptch.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-ptch.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-ptch.el --- Ediff's  patch support
 
-;; Copyright (C) 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -23,6 +23,30 @@
 
 
 ;;; Code:
+	 
+(provide 'ediff-ptch)
+
+(defgroup ediff-ptch nil
+  "Ediff patch support"
+  :tag "Patch"
+  :prefix "ediff-"
+  :group 'ediff)
+
+;; compiler pacifier
+(defvar ediff-window-A)
+(defvar ediff-window-B)
+(defvar ediff-window-C)
+(defvar ediff-use-last-dir)
+(defvar ediff-shell)
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff)
+	(load "ediff.el" nil nil 'nosuffix))
+    ))
+;; end pacifier
 
 (require 'ediff-init)
 
@@ -35,7 +59,7 @@
   "Backup extension used by the patch program.
 See also `ediff-backup-specs'.")
 
-(defvar ediff-backup-specs (format "-b %s" ediff-backup-extension)
+(defcustom ediff-backup-specs (format "-b %s" ediff-backup-extension)
   "*Backup directives to pass to the patch program.
 Ediff requires that the old version of the file \(before applying the patch\)
 is saved in a file named `the-patch-file.extension'. Usually `extension' is
@@ -49,31 +73,41 @@
 Note that both `ediff-backup-extension' and `ediff-backup-specs'
 must be properly set. If your patch program takes the option `-b',
 but not `-b extension', the variable `ediff-backup-extension' must
-still be set so Ediff will know which extension to use.")
+still be set so Ediff will know which extension to use."
+  :type 'string
+  :group 'ediff-ptch)
 
 
-(defvar ediff-patch-default-directory nil
-  "*Default directory to look for patches.")
+(defcustom ediff-patch-default-directory nil
+  "*Default directory to look for patches."
+  :type '(choice (const nil) string)
+  :group 'ediff-ptch)
 
-(defvar ediff-context-diff-label-regexp
+(defcustom ediff-context-diff-label-regexp
   (concat "\\(" 	; context diff 2-liner
 	  "^\\*\\*\\* \\([^ \t]+\\)[^*]+[\t ]*\n--- \\([^ \t]+\\)"
 	  "\\|" 	; GNU unified format diff 2-liner
 	  "^--- \\([^ \t]+\\)[\t ]+.*\n\\+\\+\\+ \\([^ \t]+\\)"
 	  "\\)")
-  "*Regexp matching filename 2-liners at the start of each context diff.")
+  "*Regexp matching filename 2-liners at the start of each context diff."
+  :type 'regexp
+  :group 'ediff-ptch)
 
-(defvar ediff-patch-program "patch"
+(defcustom ediff-patch-program "patch"
   "*Name of the program that applies patches.
-It is recommended to use GNU-compatible versions.")
-(defvar ediff-patch-options "-f"
+It is recommended to use GNU-compatible versions."
+  :type 'string
+  :group 'ediff-ptch)
+(defcustom ediff-patch-options "-f"
   "*Options to pass to ediff-patch-program.
 
 Note: the `-b' option should be specified in `ediff-backup-specs'.
 
 It is recommended to pass the `-f' option to the patch program, so it won't ask
 questions. However, some implementations don't accept this option, in which
-case the default value for this variable should be changed.")
+case the default value for this variable should be changed."
+  :type 'string
+  :group 'ediff-ptch)
 
 ;; The buffer of the patch file. Local to control buffer.
 (ediff-defvar-local ediff-patchbufer nil "")
@@ -625,6 +659,4 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-ptch)
-
 ;;; ediff-ptch.el ends here
--- a/lisp/ediff-util.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-util.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-util.el --- the core commands and utilities of ediff
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -22,27 +22,55 @@
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
+	 
+(provide 'ediff-util)
 
-;; Pacify compiler and avoid the need in checking for boundp
-(defvar ediff-patch-diagnostics nil)
-(defvar ediff-patchbufer nil)
-(and noninteractive
-     (eval-when-compile
-       (let ((load-path (cons (expand-file-name ".") load-path)))
-	 (load-file "ediff-init.el")
-	 (load-file "ediff-help.el"))))
+;; Compiler pacifier
+(defvar ediff-patch-diagnostics)
+(defvar ediff-patchbufer)
+(defvar ediff-toolbar)
+(defvar ediff-toolbar-3way)
+(defvar bottom-toolbar)
+(defvar bottom-toolbar-visible-p)
+(defvar bottom-toolbar-height)
+(defvar mark-active)
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-help)
+	(load "ediff-help.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-mult)
+	(load "ediff-mult.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-wind)
+	(load "ediff-wind.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-diff)
+	(load "ediff-diff.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-merg)
+	(load "ediff-merg.el" nil nil 'nosuffix))
+    (or (featurep 'ediff)
+	(load "ediff.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-tbar)
+	(load "ediff-tbar.el" 'noerror nil 'nosuffix))
+    ))
 ;; end pacifier
 
 (require 'ediff-init)
 (require 'ediff-help)
 (require 'ediff-mult)
+(require 'ediff-wind)
+(require 'ediff-diff)
+(require 'ediff-merg)
 
-;;(if ediff-xemacs-p
-;;    (require 'ediff-tbar)
-;;  (defun ediff-use-toolbar-p () nil))
-;;
-;; for the time being
-(defun ediff-use-toolbar-p () nil)
+
+;; be careful with ediff-tbar
+(if ediff-xemacs-p
+    (condition-case nil
+	(require 'ediff-tbar)
+      (error
+       (defun ediff-use-toolbar-p () nil)))
+  (defun ediff-use-toolbar-p () nil))
 
 
 ;;; Functions
@@ -83,9 +111,6 @@
   (run-hooks 'ediff-mode-hook))
 
     
-(require 'ediff-diff)
-(require 'ediff-merg)
-  
 
 ;;; Build keymaps
 
@@ -218,14 +243,11 @@
 
 ;;; Setup functions
 
-(require 'ediff-wind)
-
-;; No longer needed: XEmacs has surrogate minibuffers now.
-;;(or (boundp 'synchronize-minibuffers)
-;;    (defvar synchronize-minibuffers nil))
-
-;; Common startup entry for all Ediff functions
-;; It now returns control buffer so other functions can do post-processing
+;; Common startup entry for all Ediff functions It now returns control buffer
+;; so other functions can do post-processing SETUP-PARAMETERS is a list of the
+;; form ((param .val) (param . val)...)  This serves a similar purpose to
+;; STARTUP-HOOKS, but these parameters are set in the new control buffer right
+;; after this buf is created and before any windows are set and such.
 (defun ediff-setup (buffer-A file-A buffer-B file-B buffer-C file-C
 			     startup-hooks setup-parameters)
   ;; ediff-convert-standard-filename puts file names in the form appropriate
@@ -241,6 +263,14 @@
 			   (get-buffer-create control-buffer-name))))
     (ediff-eval-in-buffer control-buffer
       (ediff-mode)                 
+	
+      (make-local-variable 'ediff-use-long-help-message)
+      (make-local-variable 'ediff-prefer-iconified-control-frame)
+      (make-local-variable 'ediff-split-window-function)
+      (make-local-variable 'ediff-default-variant)
+      (make-local-variable 'ediff-merge-window-share)
+      (make-local-variable 'ediff-window-setup-function)
+      (make-local-variable 'ediff-keep-variants)
       
       ;; unwrap set up parameters passed as argument
       (while setup-parameters
@@ -248,6 +278,7 @@
 	(setq setup-parameters (cdr setup-parameters)))
 	
       ;; set variables classifying the current ediff job
+      ;; must come AFTER setup-parameters
       (setq ediff-3way-comparison-job (ediff-3way-comparison-job)
 	    ediff-merge-job (ediff-merge-job)
 	    ediff-merge-with-ancestor-job (ediff-merge-with-ancestor-job)
@@ -256,14 +287,6 @@
 	    ediff-narrow-job (ediff-narrow-job)
 	    ediff-windows-job (ediff-windows-job)
 	    ediff-word-mode-job (ediff-word-mode-job))
-	
-      (make-local-variable 'ediff-use-long-help-message)
-      (make-local-variable 'ediff-prefer-iconified-control-frame)
-      (make-local-variable 'ediff-split-window-function)
-      (make-local-variable 'ediff-default-variant)
-      (make-local-variable 'ediff-merge-window-share)
-      (make-local-variable 'ediff-window-setup-function)
-      (make-local-variable 'ediff-keep-variants)
 
       ;; Don't delete variants in case of ediff-buffer-* jobs without asking.
       ;; This is because u may loose work---dangerous.
@@ -496,8 +519,10 @@
 		  ediff-split-window-function
 		  (ediff-multiframe-setup-p)
 		  ediff-wide-display-p))
+
+    ;; In multiframe, toolbar is set in ediff-setup-control-frame
     (if (not (ediff-multiframe-setup-p))
-	(ediff-make-bottom-toolbar))    ; checks if toolbar is requested
+	(ediff-make-bottom-toolbar)) ; this checks if toolbar is requested
     (goto-char (point-min))
     (skip-chars-forward ediff-whitespace)))
     
@@ -1162,33 +1187,59 @@
 	
 ;;;###autoload
 (defun ediff-toggle-multiframe ()
-  "Switch from the multiframe display to single-frame display and back.
-For a permanent change, set the variable `ediff-window-setup-function',
+  "Switch from multiframe display to single-frame display and back.
+To change the default, set the variable `ediff-window-setup-function',
 which see."
   (interactive)
-  (let (set-func)
-  (or (ediff-window-display-p)
-      (error "%sEmacs is not running as a window application"
-	     (if ediff-emacs-p "" "X")))
-
-  (setq set-func (if (ediff-in-control-buffer-p) 'setq 'setq-default))
+  (let (window-setup-func)
+    (or (ediff-window-display-p)
+	(error "%sEmacs is not running as a window application"
+	       (if ediff-emacs-p "" "X")))
 
   (cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe)
-	 (eval
-	  (list
-	   set-func
-	   'ediff-window-setup-function ''ediff-setup-windows-plain)))
+	 (setq window-setup-func 'ediff-setup-windows-plain))
 	((eq ediff-window-setup-function 'ediff-setup-windows-plain)
 	 (if (ediff-in-control-buffer-p)
 	     (ediff-kill-bottom-toolbar))
-	 (eval
-	  (list
-	   set-func
-	   'ediff-window-setup-function ''ediff-setup-windows-multiframe))))
+	 (setq window-setup-func 'ediff-setup-windows-multiframe)))
+
+  ;; change default
+  (setq-default ediff-window-setup-function window-setup-func)
+  ;; change in all active ediff sessions
+  (mapcar (function (lambda(buf)
+		      (ediff-eval-in-buffer buf
+			(setq ediff-window-setup-function window-setup-func
+			      ediff-window-B nil))))
+	  ediff-session-registry)
   (if (ediff-in-control-buffer-p)
+      (ediff-recenter 'no-rehighlight))))
+
+
+;;;###autoload
+(defun ediff-toggle-use-toolbar ()
+  "Enable or disable Ediff toolbar.
+Works only in versions of Emacs that support toolbars.
+To change the default, set the variable `ediff-use-toolbar-p', which see."
+  (interactive)
+  (if (featurep 'ediff-tbar)
       (progn
-	(setq ediff-window-B nil)
-	(ediff-recenter 'no-rehighlight)))))
+	(or (ediff-window-display-p)
+	    (error "%sEmacs is not running as a window application"
+		   (if ediff-emacs-p "" "X")))
+	(if (ediff-use-toolbar-p)
+	    (ediff-kill-bottom-toolbar))
+	;; do this only after killing the toolbar
+	(setq ediff-use-toolbar-p (not ediff-use-toolbar-p))
+	
+	(mapcar (function (lambda(buf)
+			    (ediff-eval-in-buffer buf
+			      ;; force redisplay
+			      (setq ediff-window-config-saved "")
+			      )))
+		ediff-session-registry)
+	(if (ediff-in-control-buffer-p)
+	    (ediff-recenter 'no-rehighlight)))))
+
 
 ;; if was using toolbar, kill it
 (defun ediff-kill-bottom-toolbar ()
@@ -1203,13 +1254,25 @@
 	(set-specifier bottom-toolbar (list (selected-frame) nil))
 	(set-specifier bottom-toolbar-visible-p (list (selected-frame) nil)))))
 
-;; if wants to use toolbar, make it
-(defun ediff-make-bottom-toolbar ()
-  (if (ediff-use-toolbar-p)
+;; If wants to use toolbar, make it.
+;; If not, zero the toolbar for XEmacs.
+;; Do nothing for Emacs.
+(defun ediff-make-bottom-toolbar (&optional frame)
+  (if (ediff-window-display-p)
       (progn
-	(set-specifier bottom-toolbar (list (selected-frame) ediff-toolbar))
-	(set-specifier bottom-toolbar-visible-p (list (selected-frame) t)) 
-	(set-specifier bottom-toolbar-height (list (selected-frame) 34)))))
+	(setq frame (or frame (selected-frame)))
+	(cond ((ediff-use-toolbar-p) ; this checks for XEmacs
+	       (set-specifier
+		bottom-toolbar
+		(list frame (if (ediff-3way-comparison-job)
+				ediff-toolbar-3way ediff-toolbar)))
+	       (set-specifier bottom-toolbar-visible-p (list frame t)) 
+	       (set-specifier bottom-toolbar-height
+			      (list frame ediff-toolbar-height)))
+	      (ediff-xemacs-p
+	       (set-specifier bottom-toolbar-height (list frame 0)))
+	      ))
+    ))
 	       
 ;; Merging
 
@@ -1266,7 +1329,7 @@
 	(narrow-to-region
 	 (ediff-overlay-start overl-B) (ediff-overlay-end overl-B)))
       
-      (if ediff-3way-comparison-job
+      (if ediff-3way-job
 	  (ediff-eval-in-buffer ediff-buffer-C
 	    (narrow-to-region
 	     (ediff-overlay-start overl-C) (ediff-overlay-end overl-C))))
@@ -1516,6 +1579,7 @@
 		    (+ ediff-current-difference arg)))
 	    regexp-skip)
 	    
+	(ediff-visible-region)
 	(or (>= n ediff-number-of-differences)
 	    (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	    (ediff-install-fine-diff-if-necessary n))
@@ -1529,7 +1593,7 @@
 					(or (ediff-get-state-of-merge n) "")))
 		     ;; skip difference regions that differ in white space
 		     (and ediff-ignore-similar-regions
-			  (ediff-no-fine-diffs-p n))))
+			  (eq (ediff-no-fine-diffs-p n) t))))
 	  (setq n (1+ n))
 	  (if (= 0 (mod n 20))
 	      (message "Skipped over region %d and counting ..."  n))
@@ -1552,6 +1616,7 @@
       (let ((n (max -1 (- ediff-current-difference arg)))
 	    regexp-skip)
 	    
+	(ediff-visible-region)
 	(or (< n 0)
 	    (setq regexp-skip (funcall ediff-skip-diff-region-function n))
 	    (ediff-install-fine-diff-if-necessary n))
@@ -1565,7 +1630,7 @@
 					(or (ediff-get-state-of-merge n) "")))
 		     ;; skip difference regions that differ in white space
 		     (and ediff-ignore-similar-regions
-			  (ediff-no-fine-diffs-p n))))
+			  (eq (ediff-no-fine-diffs-p n) t))))
 	  (if (= 0 (mod (1+ n) 20))
 	      (message "Skipped over region %d and counting ..."  (1+ n)))
 	  (setq n (1- n))
@@ -2170,13 +2235,15 @@
 temporarily reverses the meaning of this variable."
   (interactive "P")
   (ediff-barf-if-not-control-buffer)
-  (if (y-or-n-p (format "Quit this Ediff session%s? "
-			(if (ediff-buffer-live-p ediff-meta-buffer)
-			    " & show containing session group" "")))
-      (progn
-	(message "")
-	(ediff-really-quit reverse-default-keep-variants))
-    (message "")))
+  (let ((ctl-buf (current-buffer)))
+    (if (y-or-n-p (format "Quit this Ediff session%s? "
+			  (if (ediff-buffer-live-p ediff-meta-buffer)
+			      " & show containing session group" "")))
+	(progn
+	  (message "")
+	  (set-buffer ctl-buf)
+	  (ediff-really-quit reverse-default-keep-variants))
+      (message ""))))
 
 
 ;; Perform the quit operations.
@@ -2319,9 +2386,10 @@
     (ediff-kill-buffer-carefully ediff-fine-diff-buffer)
     (ediff-kill-buffer-carefully ediff-tmp-buffer)
     (ediff-kill-buffer-carefully ediff-error-buffer)
-    (ediff-kill-buffer-carefully ediff-patch-diagnostics)
     (ediff-kill-buffer-carefully ediff-msg-buffer)
     (ediff-kill-buffer-carefully ediff-debug-buffer)
+    (if (boundp 'ediff-patch-diagnostics)
+	(ediff-kill-buffer-carefully ediff-patch-diagnostics))
 
     (if (and (ediff-window-display-p) (frame-live-p ctl-frame))
 	(delete-frame ctl-frame))
@@ -2389,27 +2457,33 @@
 					(buffer-name ediff-buffer-C)))))
 	(ediff-kill-buffer-carefully ediff-buffer-C))))
 
-(defun ediff-maybe-save-and-delete-merge ()
+(defun ediff-maybe-save-and-delete-merge (&optional save-and-continue)
   "Default hook to run on quitting a merge job.
+This can also be used to save merge buffer in the middle of an Ediff session.
+
+If the optional SAVE-AND-CONTINUE argument is non-nil, save merge buffer and
+continue. Otherwise:
 If `ediff-autostore-merges' is nil, this does nothing.
 If it is t, it saves the merge buffer in the file `ediff-merge-store-file'
-or asks the user, if the latter is nil. It then then asks the user whether to
+or asks the user, if the latter is nil. It then asks the user whether to
 delete the merge buffer.
 If `ediff-autostore-merges' is neither nil nor t, the merge buffer is saved
 only if this merge job is part of a group, i.e., was invoked from within
 `ediff-merge-directories', `ediff-merge-directory-revisions', and such."
-  (let ((merge-store-file ediff-merge-store-file))
+  (let ((merge-store-file ediff-merge-store-file)
+	(ediff-autostore-merges ; fake ediff-autostore-merges, if necessary
+	 (if save-and-continue t ediff-autostore-merges)))
     (if ediff-autostore-merges
 	(cond ((stringp ediff-merge-store-file)
 	       ;; store, ask to delete
-	       (ediff-write-merge-buffer-then-kill
-		ediff-buffer-C merge-store-file 'show-file))
+	       (ediff-write-merge-buffer-and-maybe-kill
+		ediff-buffer-C merge-store-file 'show-file save-and-continue))
 	      ((eq ediff-autostore-merges t)
 	       ;; ask for file name
 	       (setq merge-store-file
-		     (read-file-name "Save the result of the merge in: "))
-	       (ediff-write-merge-buffer-then-kill
-		ediff-buffer-C merge-store-file))
+		     (read-file-name "Save the merge buffer in file: "))
+	       (ediff-write-merge-buffer-and-maybe-kill
+		ediff-buffer-C merge-store-file nil save-and-continue))
 	      ((and (ediff-buffer-live-p ediff-meta-buffer)
 		    (ediff-eval-in-buffer ediff-meta-buffer
 		      (ediff-merge-metajob)))
@@ -2418,12 +2492,16 @@
 	       ;; of the merge.
 	       ;; Ask where to save anyway--will decide what to do here later.
 	       (setq merge-store-file
-		     (read-file-name "The result of the merge goes into: "))
-	       (ediff-write-merge-buffer-then-kill
-		ediff-buffer-C merge-store-file))))
+		     (read-file-name "Save the merge buffer in file: "))
+	       (ediff-write-merge-buffer-and-maybe-kill
+		ediff-buffer-C merge-store-file nil save-and-continue))))
     ))
 
-(defun ediff-write-merge-buffer-then-kill (buf file &optional show-file)
+;; write merge buffer. If the optional argument save-and-continue is non-nil,
+;; then don't kill the merge buffer
+(defun ediff-write-merge-buffer-and-maybe-kill (buf file
+					       &optional
+					       show-file save-and-continue)
   (ediff-eval-in-buffer buf
     (if (or (not (file-exists-p file))
 	    (y-or-n-p (format "File %s exists, overwrite? " file)))
@@ -2433,7 +2511,9 @@
 	      (progn
 		(message "Merge buffer saved in: %s" file)
 		(sit-for 2)))
-	  (if (y-or-n-p "Merge buffer saved in file. Now kill the buffer? ")
+	  (if (and
+	       (not save-and-continue)
+	       (y-or-n-p "Merge buffer saved in file. Now kill the buffer? "))
 	      (ediff-kill-buffer-carefully buf))))))
 
 ;; The default way of suspending Ediff.
@@ -2445,8 +2525,9 @@
 	 (buf-A-wind (ediff-get-visible-buffer-window buf-A))
 	 (buf-B-wind (ediff-get-visible-buffer-window buf-B))
 	 (buf-C-wind (ediff-get-visible-buffer-window buf-C))
-	 (buf-patch  ediff-patchbufer)
-	 (buf-patch-diag ediff-patch-diagnostics)
+	 (buf-patch  (if (boundp 'ediff-patchbufer) ediff-patchbufer nil))
+	 (buf-patch-diag (if (boundp 'ediff-patch-diagnostics)
+			     ediff-patch-diagnostics nil))
 	 (buf-err  ediff-error-buffer)
 	 (buf-diff ediff-diff-buffer)
 	 (buf-custom-diff ediff-custom-diff-buffer)
@@ -2467,20 +2548,28 @@
 	  (select-window buf-A-wind)
 	  (delete-other-windows)
 	  (bury-buffer))
-      (if (ediff-buffer-live-p buf-A) (bury-buffer buf-A)))
+      (if (ediff-buffer-live-p buf-A)
+	  (progn
+	    (set-buffer buf-A)
+	    (bury-buffer))))
     (if (window-live-p buf-B-wind)
 	(progn
 	  (select-window buf-B-wind)
 	  (delete-other-windows)
 	  (bury-buffer))
-      (if (ediff-buffer-live-p buf-B) (bury-buffer buf-B)))
+      (if (ediff-buffer-live-p buf-B)
+	  (progn
+	    (set-buffer buf-B)
+	    (bury-buffer))))
     (if (window-live-p buf-C-wind)
 	(progn
 	  (select-window buf-C-wind)
 	  (delete-other-windows)
 	  (bury-buffer))
-      (if (ediff-buffer-live-p buf-C) (bury-buffer buf-C)))
-
+      (if (ediff-buffer-live-p buf-C)
+	  (progn
+	    (set-buffer buf-C)
+	    (bury-buffer))))
     ))
 
      
@@ -2530,12 +2619,12 @@
 		   (if (ediff-buffer-live-p ediff-custom-diff-buffer)
 		       (concat "\tin buffer "
 			       (buffer-name ediff-custom-diff-buffer))
-		     "is not available")))
+		     " is not available")))
     (princ (format "Plain diff output %s\n"
 		   (if (ediff-buffer-live-p ediff-diff-buffer)
 		       (concat "\tin buffer "
 			       (buffer-name ediff-diff-buffer))
-		     "is not available")))
+		     " is not available")))
 			      
     (let* ((A-line (ediff-eval-in-buffer ediff-buffer-A
 		     (1+ (count-lines (point-min) (point)))))
@@ -2557,9 +2646,9 @@
 			 (t (1+ ediff-current-difference)))))
 
     (princ
-     (format "\n%s regions that differ only in white space & line breaks"
+     (format "\n%s regions that differ in white space & line breaks only"
 	     (if ediff-ignore-similar-regions
-		 "Skipping" "Not skipping")))
+		 "Ignoring" "Showing")))
     (if (and ediff-merge-job ediff-show-clashes-only)
 	(princ
 	 "\nFocusing on regions where both buffers differ from the ancestor"))
@@ -2906,16 +2995,19 @@
   (let ((answer "")
 	(possibilities (list ?A ?B ?C))
 	(zmacs-regions t)
+	(ctl-buf (current-buffer))
 	quit-now
 	begA begB endA endB bufA bufB)
 
     (cond ((ediff-merge-job)
 	   (setq bufB ediff-buffer-C)
-	   (while (cond ((memq answer '(?A ?a))
-			 (setq bufA ediff-buffer-A)
+	   (while (cond ((eq answer ?A)
+			 (setq bufA ediff-buffer-A
+			       possibilities '(?B))
 			 nil)
-			((memq answer '(?B ?b))
-			 (setq bufA ediff-buffer-B)
+			((eq answer ?B)
+			 (setq bufA ediff-buffer-B
+			       possibilities '(?A))
 			 nil)
 			((equal answer ""))
 			(t (beep 1)
@@ -2924,7 +3016,7 @@
 			   t))
 	     (let ((cursor-in-echo-area t))
 	       (message "Which buffer to compare to the merge buffer (A/B)? ")
-	       (setq answer (read-char-exclusive)))))
+	       (setq answer (capitalize (read-char-exclusive))))))
 
 	  ((ediff-3way-comparison-job)
 	   (while (cond ((memq answer possibilities)
@@ -2964,7 +3056,8 @@
 	       (setq answer (capitalize (read-char-exclusive))))))
 	  (t ; 2way comparison
 	   (setq bufA ediff-buffer-A
-		 bufB ediff-buffer-B)))
+		 bufB ediff-buffer-B
+		 possibilities nil)))
 
     (ediff-eval-in-buffer bufA
       (or (mark t)
@@ -3010,8 +3103,21 @@
       )
     ;; (sit-for 0)
     
+    ;; At this point, possibilities contains either the window char A/B/C
+    ;; that was not selected, or it is nil. We delete the window that is not
+    ;; selected.
+    (if possibilities
+	(ediff-eval-in-buffer ctl-buf
+	  (let* ((wind-to-delete (eval
+				  (intern
+				   (format
+				    "ediff-window-%c" (car possibilities)))))
+		 (frame (window-frame wind-to-delete)))
+	    (delete-window wind-to-delete)
+	    (select-frame frame)
+	    (balance-windows))))
     (or (y-or-n-p 
-	 "Please check the selected regions. Continue? ")
+	 "Please check regions selected for comparison. Continue? ")
 	(setq quit-now t))
     
     (ediff-eval-in-buffer bufA
@@ -3019,13 +3125,18 @@
     (ediff-eval-in-buffer bufB
       (widen))
     (if quit-now
-	(error "Thank you. Come back another day..."))
+	(ediff-eval-in-buffer ctl-buf
+	  (ediff-recenter)
+	  (sit-for 0)
+	  (error "All right. Make up your mind and come back...")))
 
     (ediff-regions-internal
      bufA begA endA bufB begB endB
-     nil  			; startup hook
+     nil			; setup-hook
      'ediff-regions-linewise	; job name
-     nil)			; no word mode
+     nil			; no word mode
+     ;; setup param to pass to ediff-setup
+     (list (cons 'ediff-split-window-function ediff-split-window-function)))
     ))
       
     
@@ -3184,18 +3295,6 @@
 	  (ediff-overlay-put overl 'ediff-diff-num 0)
 	  overl))))
 	  
-(defsubst ediff-overlay-start (overl)
-  (if (ediff-overlayp overl)
-      (if ediff-emacs-p
-	  (overlay-start overl)
-	(extent-start-position overl))))
-	
-(defsubst ediff-overlay-end  (overl)
-  (if (ediff-overlayp overl)
-      (if ediff-emacs-p
-	  (overlay-end overl)
-	(extent-end-position overl))))
-
   
 ;; Like other-buffer, but prefers visible buffers and ignores temporary or
 ;; other insignificant buffers (those beginning with "^[ *]").
@@ -3594,6 +3693,4 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-util)
-
 ;;; ediff-util.el ends here
--- a/lisp/ediff-vers.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-vers.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-vers.el --- version control interface to Ediff
 
-;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+;;; Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -30,6 +30,7 @@
 (defvar cvs-shell)
 (defvar cvs-program)
 (defvar cvs-cookie-handle)
+(defvar ediff-temp-file-prefix)
 
 (and noninteractive
      (eval-when-compile
--- a/lisp/ediff-wind.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff-wind.el	Sat May 31 01:10:39 1997 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-wind.el --- window manipulation utilities
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 
@@ -22,11 +22,8 @@
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
-
-(require 'ediff-init)
-(if ediff-xemacs-p
-    (require 'ediff-tbar)
-  (defun ediff-compute-toolbar-width () 0))
+	 
+(provide 'ediff-wind)
 
 ;; Compiler pacifier
 (defvar icon-title-format)
@@ -38,10 +35,39 @@
 (defvar right-toolbar-width)
 (defvar default-menubar)
 (defvar frame-icon-title-format)
+(defvar ediff-diff-status)
+
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-util)
+	(load "ediff-util.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-help)
+	(load "ediff-help.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-tbar)
+	(load "ediff-tbar.el" 'noerror nil 'nosuffix))
+    ))
 ;; end pacifier
 
+(require 'ediff-init)
 
-(defvar ediff-window-setup-function (if (ediff-window-display-p)
+;; be careful with ediff-tbar
+(if ediff-xemacs-p
+    (condition-case nil
+	(require 'ediff-tbar)
+      (error
+       (defun ediff-compute-toolbar-width () 0)))
+  (defun ediff-compute-toolbar-width () 0))
+
+(defgroup ediff-window nil
+  "Ediff window manipulation"
+  :prefix "ediff-"
+  :group 'ediff
+  :group 'frames)
+
+
+(defcustom ediff-window-setup-function (if (ediff-window-display-p)
 					'ediff-setup-windows-multiframe
 				      'ediff-setup-windows-plain)
   "*Function called to set up windows.
@@ -62,7 +88,9 @@
        buffer-A, buffer-B, buffer-C, control-buffer
        Buffer C may not be used in jobs that compare only two buffers.
 If you plan to do something fancy, take a close look at how the two
-provided functions are written.")
+provided functions are written."
+  :type 'function
+  :group 'ediff-window)
 
 ;; indicates if we are in a multiframe setup
 (ediff-defvar-local ediff-multiframe nil "")
@@ -83,21 +111,25 @@
 (ediff-defvar-local ediff-window-config-saved "" "")
 
 
-(defvar ediff-split-window-function 'split-window-vertically
+(defcustom ediff-split-window-function 'split-window-vertically
   "*The function used to split the main window between buffer-A and buffer-B.
 You can set it to a horizontal split instead of the default vertical split
 by setting this variable to `split-window-horizontally'.
 You can also have your own function to do fancy splits.
 This variable has no effect when buffer-A/B are shown in different frames.
-In this case, Ediff will use those frames to display these buffers.")
+In this case, Ediff will use those frames to display these buffers."
+  :type 'function
+  :group 'ediff-window)
 
-(defvar ediff-merge-split-window-function 'split-window-horizontally
+(defcustom ediff-merge-split-window-function 'split-window-horizontally
   "*The function used to split the main window between buffer-A and buffer-B.
 You can set it to a vertical split instead of the default horizontal split
 by setting this variable to `split-window-vertically'.
 You can also have your own function to do fancy splits.
 This variable has no effect when buffer-A/B/C are shown in different frames.
-In this case, Ediff will use those frames to display these buffers.")
+In this case, Ediff will use those frames to display these buffers."
+  :type 'function
+  :group 'ediff-window)
 
 (defconst ediff-control-frame-parameters
   (list 
@@ -132,40 +164,50 @@
 (defvar ediff-mouse-pixel-threshold 30
   "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.")
 
-(defvar ediff-grab-mouse t
+(defcustom ediff-grab-mouse t
   "*If t, Ediff will always grab the mouse and put it in the control frame.
 If 'maybe, Ediff will do it sometimes, but not after operations that require
 relatively long time. If nil, the mouse will be entirely user's
-responsibility.")
+responsibility."
+  :type 'boolean
+  :group 'ediff-window)
 
-(defvar ediff-control-frame-position-function 'ediff-make-frame-position
+(defcustom ediff-control-frame-position-function 'ediff-make-frame-position
   "Function to call to determine the desired location for the control panel.
 Expects three parameters: the control buffer, the desired width and height
 of the control frame. It returns an association list
-of the form \(\(top . <position>\) \(left . <position>\)\)")
+of the form \(\(top . <position>\) \(left . <position>\)\)"
+  :type 'boolean
+  :group 'ediff-window)
 
-(defvar ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14)
+(defcustom ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14)
   "*The upward shift of control frame from the top of buffer A's frame.
 Measured in pixels.
 This is used by the default control frame positioning function,
 `ediff-make-frame-position'. This variable is provided for easy
-customization of the default.")
+customization of the default."
+  :type 'integer
+  :group 'ediff-window)
 
-(defvar ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3)
+(defcustom ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3)
   "*The leftward shift of control frame from the right edge of buf A's frame.
 Measured in characters.
 This is used by the default control frame positioning function,
 `ediff-make-frame-position' to adjust the position of the control frame
 when it shows the short menu. This variable is provided for easy
-customization of the default.")
+customization of the default."
+  :type 'integer
+  :group 'ediff-window)
 
-(defvar ediff-wide-control-frame-rightward-shift 7
+(defcustom ediff-wide-control-frame-rightward-shift 7
   "*The rightward shift of control frame from the left edge of buf A's frame.
 Measured in characters.
 This is used by the default control frame positioning function,
 `ediff-make-frame-position' to adjust the position of the control frame
 when it shows the full menu. This variable is provided for easy
-customization of the default.")
+customization of the default."
+  :type 'integer
+  :group 'ediff-window)
 
 
 ;; Wide frame display
@@ -189,7 +231,7 @@
 ;; Frame used for the control panel in a windowing system.
 (ediff-defvar-local ediff-control-frame nil "")
 
-(defvar ediff-prefer-iconified-control-frame nil
+(defcustom ediff-prefer-iconified-control-frame nil
   "*If t, keep control panel iconified when help message is off.
 This has effect only on a windowing system.
 If t, hitting `?' to toggle control panel off iconifies it.
@@ -197,7 +239,9 @@
 This is only useful in Emacs and only for certain kinds of window managers,
 such as TWM and its derivatives, since the window manager must permit
 keyboard input to go into icons. XEmacs completely ignores keyboard input
-into icons, regardless of the window manager.")
+into icons, regardless of the window manager."
+  :type 'boolean
+  :group 'ediff-window)
 
 ;;; Functions
 
@@ -515,8 +559,12 @@
     
     (if use-same-frame
 	(let ((window-min-height 1))
-	  ;; avoid dedicated and non-splittable windows
-	  (ediff-skip-unsuitable-frames)
+	  (if (and (eq frame-A frame-B)
+		   (eq frame-B frame-C)
+		   (frame-live-p frame-A))
+	      (select-frame frame-A)
+	    ;; avoid dedicated and non-splittable windows
+	    (ediff-skip-unsuitable-frames))
 	  (delete-other-windows)
 	  (setq merge-window-lines
 		(max 2 (round (* (window-height) merge-window-share))))
@@ -678,8 +726,10 @@
     
     (if use-same-frame
 	(let (wind-width-or-height) ; this affects 3way setups only
-	  ;; avoid dedicated and non-splittable windows
-	  (ediff-skip-unsuitable-frames)
+	  (if (and (eq frame-A frame-B) (frame-live-p frame-A))
+	      (select-frame frame-A)
+	    ;; avoid dedicated and non-splittable windows
+	    (ediff-skip-unsuitable-frames))
 	  (delete-other-windows)
 	  (switch-to-buffer buf-A)
 	  (setq wind-A (selected-window))
@@ -858,16 +908,15 @@
 	  fheight lines
 	  fwidth (max (+ (ediff-help-message-line-length) 2)
 		      (ediff-compute-toolbar-width))
-	  adjusted-parameters (append (list
-				       ;; possibly change surrogate minibuffer
-				       (cons 'minibuffer
-					     (minibuffer-window
-					      designated-minibuffer-frame))
-				       (cons 'width fwidth)
-				       (cons 'height fheight))
-				      (funcall
-				       ediff-control-frame-position-function
-				       ctl-buffer fwidth fheight)))
+	  adjusted-parameters
+	  (list
+	   ;; possibly change surrogate minibuffer
+	   (cons 'minibuffer
+		 (minibuffer-window
+		  designated-minibuffer-frame))
+	   (cons 'width fwidth)
+	   (cons 'height fheight))
+	  )
     (if ediff-use-long-help-message
 	(setq adjusted-parameters
 	      (cons '(auto-raise . nil) adjusted-parameters)))
@@ -876,8 +925,10 @@
     ;; are changed. 
     (if ediff-xemacs-p
 	(progn
+	  (set-specifier top-toolbar-height (list ctl-frame 2))
+	  (sit-for 0)
 	  (set-specifier top-toolbar-height (list ctl-frame 0))
-	  (set-specifier bottom-toolbar-height (list ctl-frame 0))
+	  ;;(set-specifier bottom-toolbar-height (list ctl-frame 0))
 	  (set-specifier left-toolbar-width (list ctl-frame 0))
 	  (set-specifier right-toolbar-width (list ctl-frame 0))
 	  ))
@@ -890,11 +941,13 @@
     (if (memq system-type '(emx windows-nt windows-95))
 	(modify-frame-parameters ctl-frame adjusted-parameters))
       
+    ;; make or zap toolbar (if not requested)
+    (ediff-make-bottom-toolbar ctl-frame)
+    
     (goto-char (point-min))
-    
+
     (modify-frame-parameters ctl-frame adjusted-parameters)
     (make-frame-visible ctl-frame)
-    (ediff-make-bottom-toolbar) ; no effect if the toolbar is not requested
     
     ;; This works around a bug in 19.25 and earlier. There, if frame gets
     ;; iconified, the current buffer changes to that of the frame that
@@ -910,6 +963,12 @@
 	   (raise-frame ctl-frame)))
     
     (set-window-dedicated-p (selected-window) t)
+
+    ;; Now move the frame. We must do it separately due to an obscure bug in
+    ;; XEmacs
+    (modify-frame-parameters
+     ctl-frame
+     (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight))
       
     ;; synchronize so the cursor will move to control frame
     ;; per RMS suggestion
@@ -935,6 +994,7 @@
     (ediff-eval-in-buffer ctl-buffer
       (run-hooks 'ediff-after-setup-control-frame-hook))
     ))
+
     
 (defun ediff-destroy-control-frame (ctl-buffer)
   (ediff-eval-in-buffer ctl-buffer
@@ -1061,9 +1121,9 @@
     
     ;; control buffer format
     (setq mode-line-format
-	  (list (if (ediff-narrow-control-frame-p) "   " "-- ")
-		mode-line-buffer-identification
-		"        Quick Help"))
+	  (if (ediff-narrow-control-frame-p)
+	      (list "   " mode-line-buffer-identification)
+	    (list "-- " mode-line-buffer-identification "        Quick Help")))
     ;; control buffer id
     (setq mode-line-buffer-identification 
 	  (if (ediff-narrow-control-frame-p)
@@ -1204,7 +1264,4 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff-wind)
-
-
 ;;; ediff-wind.el ends here
--- a/lisp/ediff.el	Sat May 31 00:54:45 1997 +0000
+++ b/lisp/ediff.el	Sat May 31 01:10:39 1997 +0000
@@ -1,13 +1,13 @@
 ;;; ediff.el --- a comprehensive visual interface to diff & patch
 
-;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
 ;; Created: February 2, 1994
 ;; Keywords: comparing, merging, patching, version control.
 
-(defconst ediff-version "2.63" "The current version of Ediff")
-(defconst ediff-date "September 12, 1996" "Date of last update")  
+(defconst ediff-version "2.65" "The current version of Ediff")
+(defconst ediff-date "May 1, 1997" "Date of last update")  
 
 
 ;; This file is part of GNU Emacs.
@@ -106,21 +106,40 @@
 
 ;;; Code:
 
-(require 'ediff-init)
-;; ediff-mult is always required, because of the registry stuff
-(require 'ediff-mult)
+(provide 'ediff)
 
+;; Compiler pacifier
 (and noninteractive
      (eval-when-compile
-       (let ((load-path (cons (expand-file-name ".") load-path)))
 	 (load-library "dired")
-	 (load-file "ediff-ptch.el")
-	 (load-file "ediff-vers.el")
-	 (load "pcl-cvs" 'noerror))))
+	 (load-library "info")
+	 (load "pcl-cvs" 'noerror)))
+(eval-when-compile
+  (let ((load-path (cons (expand-file-name ".") load-path)))
+    (or (featurep 'ediff-init)
+	(load "ediff-init.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-mult)
+	(load "ediff-mult.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-ptch)
+	(load "ediff-ptch.el" nil nil 'nosuffix))
+    (or (featurep 'ediff-vers)
+	(load "ediff-vers.el" nil nil 'nosuffix))
+    ))
+;; end pacifier
 
-(defvar ediff-use-last-dir nil
-  "*If t, Ediff uses previous directory as default when reading file name.")
-  
+(require 'ediff-init)
+(require 'ediff-mult)  ; required because of the registry stuff
+
+(defgroup ediff nil
+  "A comprehensive visual interface to diff & patch"
+  :group 'tools)
+
+
+(defcustom ediff-use-last-dir nil
+  "*If t, Ediff uses previous directory as default when reading file name."
+  :type 'boolean
+  :group 'ediff)
+
 (defvar ediff-last-dir-A nil
   "Last directory used by an Ediff command for file-A.")
 (defvar ediff-last-dir-B nil
@@ -276,8 +295,8 @@
   
     (ediff-eval-in-buffer (symbol-value buffer-name)
       (widen) ; Make sure the entire file is seen
-      (cond (file-magic  ;; file has handler, such as jka-compr-handler or
-	     ;; ange-ftp-hook-function--arrange for temp file
+      (cond (file-magic  ;   file has a handler, such as jka-compr-handler or
+	     		 ;;; ange-ftp-hook-function--arrange for temp file
 	     (ediff-verify-file-buffer 'magic)
 	     (setq file
 		   (ediff-make-temp-file
@@ -767,7 +786,7 @@
 	      end-B (window-end))))
     (ediff-regions-internal
      buffer-A beg-A end-A buffer-B beg-B end-B
-     startup-hooks job-name word-mode)))
+     startup-hooks job-name word-mode nil)))
      
 ;;;###autoload
 (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks)
@@ -804,7 +823,7 @@
     (ediff-regions-internal
      (get-buffer buffer-A) reg-A-beg reg-A-end
      (get-buffer buffer-B) reg-B-beg reg-B-end
-     startup-hooks 'ediff-regions-wordwise 'word-mode)))
+     startup-hooks 'ediff-regions-wordwise 'word-mode nil)))
      
 ;;;###autoload
 (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks)
@@ -864,7 +883,8 @@
 ;; compare region beg-A to end-A of buffer-A
 ;; to regions beg-B -- end-B in buffer-B. 
 (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
-					startup-hooks job-name word-mode)
+					startup-hooks job-name word-mode
+					setup-parameters)
   (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer))
 	overl-A overl-B
 	file-A file-B)
@@ -915,9 +935,11 @@
 			    (delete-file (, file-A))
 			    (delete-file (, file-B))))
 		       startup-hooks)
-		 (list (cons 'ediff-word-mode  word-mode)
-		       (cons 'ediff-narrow-bounds (list overl-A overl-B))
-		       (cons 'ediff-job-name job-name))
+		 (append
+		  (list (cons 'ediff-word-mode  word-mode)
+			(cons 'ediff-narrow-bounds (list overl-A overl-B))
+			(cons 'ediff-job-name job-name))
+		  setup-parameters)
 		 )
     ))
     
@@ -1132,7 +1154,7 @@
 ;;;###autoload
 (defun run-ediff-from-cvs-buffer (pos)
   "Run Ediff-merge on appropriate revisions of the selected file.
-First run after `M-x cvs-update'. Then place the cursor on a lide describing a
+First run after `M-x cvs-update'. Then place the cursor on a line describing a
 file and then run `run-ediff-from-cvs-buffer'."
   (interactive "d")
   (ediff-load-version-control)
@@ -1273,7 +1295,6 @@
 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
 ;;; End:
 
-(provide 'ediff)
 (require 'ediff-util)
 
 ;;; ediff.el ends here