changeset 93652:6523ed37006c

2008-04-04 Michael Kifer <kifer@cs.stonybrook.edu> * ediff*el: replaced load with require in eval-when-compile. * ediff-hook: deleted all invocations of (autoload ...). * ediff-util.el (ediff-setup): make window-min-height a local variable in ediff control window, and set its min height to 2. (ediff-setup-control-buffer): dedicate the control window. (ediff-toggle-multiframe): undedicate control window. Work directly with ediff-setup-windows-multiframe and ediff-setup-windows-plain. * ediff-wind (ediff-choose-window-setup-function-automatically): new function. (ediff-window-setup-function): change initialization. (ediff-setup-windows-automatic): deleted. (ediff-setup-windows-plain-merge): make control window dedicated. (ediff-destroy-control-frame): do not skip frames if working in a single frame. * emulation/viper-ex.el: move provide's forward, prevent ecursion in eval-when-compile. * emulation/viper-util.el: move provide's forward, prevent ecursion in eval-when-compile.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 04 Apr 2008 07:51:27 +0000
parents 1500b4e92cd0
children 5aea038bff86
files lisp/ChangeLog 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 lisp/emulation/viper-ex.el lisp/emulation/viper-util.el
diffstat 14 files changed, 208 insertions(+), 192 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ChangeLog	Fri Apr 04 07:51:27 2008 +0000
@@ -1,3 +1,30 @@
+2008-04-04  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* ediff*el: replaced load with require in eval-when-compile.
+	
+	* ediff-hook: deleted all invocations of (autoload ...).
+	
+	* ediff-util.el (ediff-setup): make window-min-height a local variable
+	in ediff control window, and set its min height to 2.
+	(ediff-setup-control-buffer): dedicate the control window.
+	(ediff-toggle-multiframe): undedicate control window.
+	Work directly with ediff-setup-windows-multiframe and
+	ediff-setup-windows-plain.
+	
+	* ediff-wind (ediff-choose-window-setup-function-automatically): new
+	function.
+	(ediff-window-setup-function): change initialization.
+	(ediff-setup-windows-automatic): deleted.
+	(ediff-setup-windows-plain-merge): make control window dedicated.
+	(ediff-destroy-control-frame): do not skip frames if working in a
+	single frame.
+	
+	* emulation/viper-ex.el: move provide's forward, prevent ecursion in
+	eval-when-compile.
+	
+	* emulation/viper-util.el: move provide's forward, prevent ecursion in
+	eval-when-compile.
+	
 2008-04-04  Glenn Morris  <rgm@gnu.org>
 
 	* calendar/cal-bahai.el (calendar-bahai-to-absolute): Rename
--- a/lisp/ediff-diff.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-diff.el	Fri Apr 04 07:51:27 2008 +0000
@@ -27,18 +27,18 @@
 ;;; Code:
 
 
+(provide 'ediff-diff)
+
 ;; compiler pacifier
 (defvar ediff-default-variant)
 (defvar null-device)
 (defvar longlines-mode)
 
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-util)
-	(load "ediff-util.el" nil t 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (if (not (featurep 'ediff-util))
+      (require 'ediff-util))
+  )
 ;; end pacifier
 
 (require 'ediff-init)
@@ -1536,8 +1536,6 @@
   )
 
 
-(provide 'ediff-diff)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/ediff-help.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-help.el	Fri Apr 04 07:51:27 2008 +0000
@@ -31,10 +31,8 @@
 (defvar ediff-multiframe)
 
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    ))
+  (require 'ediff-init)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
--- a/lisp/ediff-hook.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-hook.el	Fri Apr 04 07:51:27 2008 +0000
@@ -52,19 +52,19 @@
 ;;;###autoload
 (if (featurep 'xemacs)
     (progn
-    (defun ediff-xemacs-init-menus ()
-      (when (featurep 'menubar)
-	(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") "-------" "OO-Browser...")
-	))
+      (defun ediff-xemacs-init-menus ()
+	(when (featurep 'menubar)
+	  (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") "-------" "OO-Browser...")
+	  ))
       (defvar ediff-menu
 	'("Compare"
 	  ["Two Files..."  ediff-files t]
@@ -85,47 +85,47 @@
 	  ["Regions Line-by-line..." ediff-regions-linewise t]
 	  ))
       (defvar ediff-merge-menu
-      '("Merge"
-	["Files..."  ediff-merge-files t]
-	["Files with Ancestor..." ediff-merge-files-with-ancestor t]
-	["Buffers..."  ediff-merge-buffers t]
-	["Buffers with Ancestor..."
-	 ediff-merge-buffers-with-ancestor t]
-	"---"
-	["Directories..."  ediff-merge-directories t]
-	["Directories with Ancestor..."
-	 ediff-merge-directories-with-ancestor t]
-	"---"
-	["Revisions..."  ediff-merge-revisions t]
-	["Revisions with Ancestor..."
-	 ediff-merge-revisions-with-ancestor t]
-	["Directory Revisions..." ediff-merge-directory-revisions t]
-	["Directory Revisions with Ancestor..."
-	 ediff-merge-directory-revisions-with-ancestor t]
-	))
+	'("Merge"
+	  ["Files..."  ediff-merge-files t]
+	  ["Files with Ancestor..." ediff-merge-files-with-ancestor t]
+	  ["Buffers..."  ediff-merge-buffers t]
+	  ["Buffers with Ancestor..."
+	   ediff-merge-buffers-with-ancestor t]
+	  "---"
+	  ["Directories..."  ediff-merge-directories t]
+	  ["Directories with Ancestor..."
+	   ediff-merge-directories-with-ancestor t]
+	  "---"
+	  ["Revisions..."  ediff-merge-revisions t]
+	  ["Revisions with Ancestor..."
+	   ediff-merge-revisions-with-ancestor t]
+	  ["Directory Revisions..." ediff-merge-directory-revisions t]
+	  ["Directory Revisions with Ancestor..."
+	   ediff-merge-directory-revisions-with-ancestor t]
+	  ))
       (defvar epatch-menu
-      '("Apply Patch"
-	["To a file..."  ediff-patch-file t]
-	["To a buffer..." ediff-patch-buffer t]
-	))
+	'("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]
-	["Customize Ediff" ediff-customize t]
-	["List Ediff Sessions" ediff-show-registry 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))]))
-
+	'("Ediff Miscellanea"
+	  ["Ediff Manual" ediff-documentation t]
+	  ["Customize Ediff" ediff-customize t]
+	  ["List Ediff Sessions" ediff-show-registry 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
       (if (and (featurep 'menubar) (not (featurep 'infodock))
 	       (not (featurep 'ediff-hook)))
@@ -143,7 +143,7 @@
 	(symbol-value 'menu-bar-ediff-merge-menu))
   (defvar menu-bar-ediff-menu (make-sparse-keymap "Compare"))
   (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))
-
+  
   ;; define ediff-menu
   (define-key menu-bar-ediff-menu [window]
     '("This Window and Next Window" . compare-windows))
@@ -228,5 +228,6 @@
 
 (provide 'ediff-hook)
 
+
 ;;; arch-tag: 512f8656-8a4b-4789-af5d-5c6144498df3
 ;;; ediff-hook.el ends here
--- a/lisp/ediff-init.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-init.el	Fri Apr 04 07:51:27 2008 +0000
@@ -795,7 +795,7 @@
 
 (if (ediff-has-face-support-p)
     (if (featurep 'xemacs)
-	(progn ; xemacs
+	(progn
 	  (defalias 'ediff-valid-color-p 'valid-color-name-p)
 	  (defalias 'ediff-get-face 'get-face))
       (defalias 'ediff-valid-color-p (if (fboundp 'color-defined-p)
@@ -805,7 +805,7 @@
 
 (if (ediff-window-display-p)
     (if (featurep 'xemacs)
-	(progn   ; xemacs
+	(progn
 	  (defalias 'ediff-display-pixel-width 'device-pixel-width)
 	  (defalias 'ediff-display-pixel-height 'device-pixel-height))
       (defalias 'ediff-display-pixel-width
--- a/lisp/ediff-merg.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-merg.el	Fri Apr 04 07:51:27 2008 +0000
@@ -35,12 +35,9 @@
 (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 t 'nosuffix))
-    (or (featurep 'ediff-util)
-	(load "ediff-util.el" nil t 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (require 'ediff-util)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
--- a/lisp/ediff-mult.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-mult.el	Fri Apr 04 07:51:27 2008 +0000
@@ -105,6 +105,8 @@
 ;;; Code:
 
 
+(provide 'ediff-mult)
+
 (defgroup ediff-mult nil
   "Multi-file and multi-buffer processing in Ediff."
   :prefix "ediff-"
@@ -113,12 +115,13 @@
 
 ;; compiler pacifier
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-util)
-	(load "ediff-util.el" nil t 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (if (not (featurep 'ediff-util))
+      (require 'ediff-util))
+  (if (not (featurep 'ediff-ptch))
+      (require 'ediff-ptch))
+  (require 'ediff)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
@@ -2237,7 +2240,7 @@
 	      overl (car overl-list)))
       overl)))
 
-(defsubst ediff-get-session-number-at-pos (point &optional meta-buffer)
+(defun ediff-get-session-number-at-pos (point &optional meta-buffer)
   (setq meta-buffer (if (ediff-buffer-live-p meta-buffer)
 			meta-buffer
 		      (current-buffer)))
@@ -2399,8 +2402,6 @@
     ))
 
 
-(provide 'ediff-mult)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/ediff-ptch.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-ptch.el	Fri Apr 04 07:51:27 2008 +0000
@@ -27,6 +27,8 @@
 ;;; Code:
 
 
+(provide 'ediff-ptch)
+
 (defgroup ediff-ptch nil
   "Ediff patch support."
   :tag "Patch"
@@ -41,14 +43,11 @@
 (defvar ediff-shell)
 
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-mult)
-	(load "ediff-mult.el" nil t 'nosuffix))
-    (or (featurep 'ediff)
-	(load "ediff.el" nil t 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (if (not (featurep 'ediff-mult))
+      (require 'ediff-mult))
+  (require 'ediff)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
@@ -846,8 +845,6 @@
 
 
 
-(provide 'ediff-ptch)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/ediff-util.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-util.el	Fri Apr 04 07:51:27 2008 +0000
@@ -27,6 +27,8 @@
 ;;; Code:
 
 
+(provide 'ediff-util)
+
 ;; Compiler pacifier
 (defvar ediff-patch-diagnostics)
 (defvar ediff-patchbufer)
@@ -45,26 +47,18 @@
   (unless (fboundp 'declare-function) (defmacro declare-function (&rest  r))))
 
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (provide 'ediff-util) ; to break recursive load cycle
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-help)
-	(load "ediff-help.el" nil t 'nosuffix))
-    (or (featurep 'ediff-mult)
-	(load "ediff-mult.el" nil t 'nosuffix))
-    (or (featurep 'ediff-wind)
-	(load "ediff-wind.el" nil t 'nosuffix))
-    (or (featurep 'ediff-diff)
-	(load "ediff-diff.el" nil t 'nosuffix))
-    (or (featurep 'ediff-merg)
-	(load "ediff-merg.el" nil t 'nosuffix))
-    (or (featurep 'ediff)
-	(load "ediff.el" nil t 'nosuffix))
-    (or (featurep 'ediff-tbar)
-	(featurep 'emacs)
-	(load "ediff-tbar.el" 'noerror nil 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (require 'ediff-help)
+  (if (not (featurep 'ediff-mult))
+      (require 'ediff-mult))
+  (require 'ediff-mult)
+  (require 'ediff-wind)
+  (if (not (featurep 'ediff-diff))
+      (require 'ediff-diff))
+  (require 'ediff-merg)
+  (require 'ediff)
+  (require 'ediff-tbar nil 'noerror)
+  )
 ;; end pacifier
 
 
@@ -306,6 +300,9 @@
       (make-local-variable 'ediff-window-setup-function)
       (make-local-variable 'ediff-keep-variants)
 
+      (make-local-variable 'window-min-height)
+      (setq window-min-height 2)
+
       (if (featurep 'xemacs)
 	  (make-local-hook 'ediff-after-quit-hook-internal))
 
@@ -581,6 +578,7 @@
 		  (ediff-multiframe-setup-p)
 		  ediff-wide-display-p))
 
+    (set-window-dedicated-p (selected-window) t)
     ;; In multiframe, toolbar is set in ediff-setup-control-frame
     (if (not (ediff-multiframe-setup-p))
 	(ediff-make-bottom-toolbar)) ; this checks if toolbar is requested
@@ -1305,11 +1303,21 @@
 	       (if (featurep 'emacs) "" "X")))
 
   (cond ((eq ediff-window-setup-function 'ediff-setup-windows-multiframe)
+	 (setq ediff-multiframe nil)
 	 (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))
-	 (setq window-setup-func 'ediff-setup-windows-multiframe)))
+	 (if (ediff-buffer-live-p ediff-control-buffer)
+	     (set-window-dedicated-p ediff-control-window nil))
+	 (setq ediff-multiframe t)
+	 (setq window-setup-func 'ediff-setup-windows-multiframe))
+	(t
+	 (if (ediff-buffer-live-p ediff-control-buffer)
+	     (set-window-dedicated-p ediff-control-window nil))
+	 (setq ediff-multiframe t)
+	 (setq window-setup-func 'ediff-setup-windows-multiframe))
+	)
 
   ;; change default
   (setq-default ediff-window-setup-function window-setup-func)
@@ -3406,13 +3414,11 @@
     (unless (and buf-A-file-name
 		 (file-exists-p buf-A-file-name)
 		 (not (ediff-file-remote-p buf-A-file-name)))
-      (setq file-A
-	    (ediff-make-temp-file ediff-buffer-A)))
+      (setq file-A (ediff-make-temp-file ediff-buffer-A)))
     (unless (and buf-B-file-name
 		 (file-exists-p buf-B-file-name)
 		 (not (ediff-file-remote-p buf-B-file-name)))
-      (setq file-B
-	    (ediff-make-temp-file ediff-buffer-B)))
+      (setq file-B (ediff-make-temp-file ediff-buffer-B)))
     (or (ediff-buffer-live-p ediff-custom-diff-buffer)
 	(setq ediff-custom-diff-buffer
 	      (get-buffer-create
@@ -3424,14 +3430,16 @@
      ediff-custom-diff-program ediff-custom-diff-buffer 'synchronize
      ediff-custom-diff-options
      ;; repetition of buf-A-file-name is needed so it'll return a file
-     (or file-A buf-A-file-name)
-     (or file-B buf-B-file-name))
+     (or (and buf-A-file-name (file-exists-p buf-A-file-name) buf-A-file-name)
+	 file-A)
+     (or (and buf-B-file-name (file-exists-p buf-B-file-name) buf-B-file-name)
+	 file-B))
     ;; put the diff file in diff-mode, if it is available
     (if (fboundp 'diff-mode)
 	(with-current-buffer ediff-custom-diff-buffer
 	  (diff-mode)))
-    (and file-A (delete-file file-A))
-    (and file-B (delete-file file-B))
+    (and file-A (file-exists-p file-A) (delete-file file-A))
+    (and file-B (file-exists-p file-B) (delete-file file-B))
     ))
 
 (defun ediff-show-diff-output (arg)
@@ -4045,13 +4053,12 @@
   (if (featurep 'xemacs)
       (zmacs-deactivate-region)
     (deactivate-mark)))
+
 (defun ediff-activate-mark ()
   (if (featurep 'xemacs)
       (zmacs-activate-region)
-    (progn
-      (make-local-variable 'transient-mark-mode)
-      (setq mark-active t
-	    transient-mark-mode t))))
+    (make-local-variable 'transient-mark-mode)
+    (setq mark-active t transient-mark-mode t)))
 
 (defun ediff-nuke-selective-display ()
   (if (featurep 'xemacs)
@@ -4280,8 +4287,6 @@
 
 (run-hooks 'ediff-load-hook)
 
-(provide 'ediff-util)
-
 
 ;; Local Variables:
 ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/ediff-vers.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-vers.el	Fri Apr 04 07:51:27 2008 +0000
@@ -36,13 +36,11 @@
 
 (and noninteractive
      (eval-when-compile
-       (let ((load-path (cons (expand-file-name ".") load-path)))
-	 (load "pcl-cvs" 'noerror)
-	 (load "rcs" 'noerror)
-	 ;; (load "vc" 'noerror) ; this sometimes causes compiler error
-	 (or (featurep 'ediff-init)
-	     (load "ediff-init.el" nil t 'nosuffix))
-	 )))
+       (require 'pcvs nil 'noerror)
+       (require 'rcs nil 'noerror)
+       (require 'vc)
+       (require 'ediff-init)
+       ))
 ;; end pacifier
 
 (defcustom ediff-keep-tmp-versions nil
--- a/lisp/ediff-wind.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff-wind.el	Fri Apr 04 07:51:27 2008 +0000
@@ -46,17 +46,11 @@
 
 
 (eval-when-compile
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-util)
-	(load "ediff-util.el" nil t 'nosuffix))
-    (or (featurep 'ediff-help)
-	(load "ediff-help.el" nil t 'nosuffix))
-    (or (featurep 'ediff-tbar)
-	(featurep 'emacs)
-	(load "ediff-tbar.el" 'noerror nil 'nosuffix))
-    ))
+  (require 'ediff-init)
+  (require 'ediff-util)
+  (require 'ediff-help)
+  (require 'ediff-tbar nil 'noerror)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
@@ -76,17 +70,24 @@
   :group 'frames)
 
 
-(defcustom ediff-window-setup-function 'ediff-setup-windows-automatic
+;; Determine which window setup function to use based on current window system.
+(defun ediff-choose-window-setup-function-automatically ()
+  (if (ediff-window-display-p)
+      'ediff-setup-windows-multiframe
+    'ediff-setup-windows-plain))
+
+(defcustom ediff-window-setup-function (ediff-choose-window-setup-function-automatically)
   "*Function called to set up windows.
-Ediff provides a choice of three functions: `ediff-setup-windows-plain', for
-doing everything in one frame, `ediff-setup-windows-multiframe', which sets
-the control panel in a separate frame, and
-`ediff-setup-windows-automatic' (the default), which chooses an appropriate
-behavior based on the current window system.  If the multiframe function
-detects that one of the buffers A/B is seen in some other frame, it will try
-to keep that buffer in that frame.
+Ediff provides a choice of two functions: `ediff-setup-windows-plain', for
+doing everything in one frame and `ediff-setup-windows-multiframe', which sets
+the control panel in a separate frame. By default, the appropriate function is
+chosen automatically depending on the current window system.
+However, `ediff-toggle-multiframe' can be used to toggle between the multiframe
+display and the single frame display.
+If the multiframe function detects that one of the buffers A/B is seen in some
+other frame, it will try to keep that buffer in that frame.
 
-If you don't like the two functions provided---write your own one.
+If you don't like any of the two provided functions, write your own one.
 The basic guidelines:
     1. It should leave the control buffer current and the control window
        selected.
@@ -98,8 +99,7 @@
        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."
-  :type '(choice (const :tag "Automatic" ediff-setup-windows-automatic)
-		 (const :tag "Multi Frame" ediff-setup-windows-multiframe)
+  :type '(choice (const :tag "Multi Frame" ediff-setup-windows-multiframe)
 		 (const :tag "Single Frame" ediff-setup-windows-plain)
 		 (function :tag "Other function"))
   :group 'ediff-window)
@@ -294,8 +294,7 @@
 ;; Select the lowest window on the frame.
 (defun ediff-select-lowest-window ()
   (if (featurep 'xemacs)
-      (select-window (frame-lowest-window)) ; xemacs
-    ;; emacs
+      (select-window (frame-lowest-window))
     (let* ((lowest-window (selected-window))
 	   (bottom-edge (car (cdr (cdr (cdr (window-edges))))))
 	   (last-window (save-excursion
@@ -337,12 +336,6 @@
        buffer-A buffer-B buffer-C control-buffer))
   (run-hooks 'ediff-after-setup-windows-hook))
 
-;; Set up windows using the correct method based on the current window system.
-(defun ediff-setup-windows-automatic (buffer-A buffer-B buffer-C control-buffer)
-  (if (ediff-window-display-p)
-      (ediff-setup-windows-multiframe buffer-A buffer-B buffer-C control-buffer)
-    (ediff-setup-windows-plain buffer-A buffer-B buffer-C control-buffer)))
-
 ;; Just set up 3 windows.
 ;; Usually used without windowing systems
 ;; With windowing, we want to use dedicated frames.
@@ -367,6 +360,7 @@
 	    ;; this lets us have local versions of ediff-split-window-function
 	    split-window-function ediff-split-window-function))
     (delete-other-windows)
+    (set-window-dedicated-p (selected-window) nil)
     (split-window-vertically)
     (ediff-select-lowest-window)
     (ediff-setup-control-buffer control-buffer)
@@ -426,6 +420,7 @@
 	    split-window-function ediff-split-window-function
 	    three-way-comparison ediff-3way-comparison-job))
     (delete-other-windows)
+    (set-window-dedicated-p (selected-window) nil)
     (split-window-vertically)
     (ediff-select-lowest-window)
     (ediff-setup-control-buffer control-buffer)
@@ -895,7 +890,7 @@
    (or
     ;; only one window
     (eq wind (next-window wind 'ignore-minibuffer (window-frame wind)))
-    ;; none is dedicated
+    ;; none is dedicated (in multiframe setup)
     (not (ediff-frame-has-dedicated-windows (window-frame wind)))
     )))
 
@@ -908,8 +903,8 @@
 	fheight fwidth adjusted-parameters)
 
     (ediff-with-current-buffer ctl-buffer
-      (if (featurep 'xemacs)
-	  (if (featurep 'menubar) (set-buffer-menubar nil)))
+      (if (and (featurep 'xemacs) (featurep 'menubar))
+	  (set-buffer-menubar nil))
       ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))
       (run-hooks 'ediff-before-setup-control-frame-hook))
 
@@ -921,9 +916,8 @@
 	    ediff-control-frame ctl-frame)
       ;; protect against undefined face-attribute
       (condition-case nil
-	  (unless (featurep 'xemacs)
-	    (when (face-attribute 'mode-line :box)
-	      (set-face-attribute 'mode-line ctl-frame :box nil)))
+	  (if (and (featurep 'emacs) (face-attribute 'mode-line :box))
+	      (set-face-attribute 'mode-line ctl-frame :box nil))
 	(error)))
 
     (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))
@@ -1048,11 +1042,12 @@
   (ediff-with-current-buffer ctl-buffer
     (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
 	(let ((ctl-frame ediff-control-frame))
-	  (if (featurep 'xemacs)
-	      (if (featurep 'menubar) (set-buffer-menubar default-menubar)))
+	  (if (and (featurep 'xemacs) (featurep 'menubar))
+	      (set-buffer-menubar default-menubar))
 	  (setq ediff-control-frame nil)
 	  (delete-frame ctl-frame))))
-  (ediff-skip-unsuitable-frames)
+  (if ediff-multiframe
+      (ediff-skip-unsuitable-frames))
   ;;(ediff-reset-mouse nil)
   )
 
--- a/lisp/ediff.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/ediff.el	Fri Apr 04 07:51:27 2008 +0000
@@ -107,30 +107,30 @@
 
 ;;; Code:
 
+(provide 'ediff)
 
 ;; Compiler pacifier
 (defvar cvs-cookie-handle)
 (defvar ediff-last-dir-patch)
 (defvar ediff-patch-default-directory)
+(defvar ediff-control-window)
 
 (eval-and-compile
   (unless (fboundp 'declare-function) (defmacro declare-function (&rest  r))))
 
 
 (eval-when-compile
-  (and noninteractive
-       (load "dired" nil t))
-  (let ((load-path (cons (expand-file-name ".") load-path)))
-    (provide 'ediff) ; to break recursive load cycle
-    (or (featurep 'ediff-init)
-	(load "ediff-init.el" nil t 'nosuffix))
-    (or (featurep 'ediff-mult)
-	(load "ediff-mult.el" nil t 'nosuffix))
-    (or (featurep 'ediff-ptch)
-	(load "ediff-ptch.el" nil t 'nosuffix))
-    (or (featurep 'ediff-vers)
-	(load "ediff-vers.el" nil t 'nosuffix))
-    ))
+  (require 'dired)
+  (require 'ediff-init)
+  (if (not (featurep 'ediff-mult))
+      (require 'ediff-mult))
+  (if (not (featurep 'ediff-util))
+      (require 'ediff-util))
+  (require 'ediff-wind)
+  (if (not (featurep 'ediff-ptch))
+      (require 'ediff-ptch))
+  (require 'ediff-vers)
+  )
 ;; end pacifier
 
 (require 'ediff-init)
@@ -1513,8 +1513,6 @@
 
 (run-hooks 'ediff-load-hook)
 
-(provide 'ediff)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
--- a/lisp/emulation/viper-ex.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/emulation/viper-ex.el	Fri Apr 04 07:51:27 2008 +0000
@@ -46,7 +46,8 @@
 ;; in order to spare non-viperized emacs from being viperized
 (if noninteractive
     (eval-when-compile
-      (require 'viper-cmd)
+      (if (not (featurep 'viper-cmd))
+	  (require 'viper-cmd))
       ))
 ;; end pacifier
 
--- a/lisp/emulation/viper-util.el	Fri Apr 04 07:37:36 2008 +0000
+++ b/lisp/emulation/viper-util.el	Fri Apr 04 07:51:27 2008 +0000
@@ -26,6 +26,9 @@
 
 ;;; Code:
 
+(provide 'viper-util)
+
+
 ;; Compiler pacifier
 (defvar viper-overriding-map)
 (defvar pm-color-alist)
@@ -1557,9 +1560,6 @@
 
 
 
-(provide 'viper-util)
-
-
 ;;; Local Variables:
 ;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
 ;;; End: