1. xemacs
  2. ediff

Commits

michaelk  committed 5f4f11c

* 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.

  • Participants
  • Parent commits de808bd
  • Branches default

Comments (0)

Files changed (13)

File ChangeLog

View file
+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.
+	
 2008-01-10  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.74 released.

File ediff-diff.el

View file
 ;;; 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)
 (make-variable-buffer-local 'ediff-whitespace)
 
 (defvar ediff-word-1
-  (ediff-cond-compile-for-xemacs-or-emacs "a-zA-Z---_" "-[:word:]_")
+  (if (featurep 'xemacs) "a-zA-Z---_" "-[:word:]_")
   "*Characters that constitute words of type 1.
 More precisely, [ediff-word-1] is a regexp that matches type 1 words.
 See `ediff-forward-word' for more details.")
   )
 
 
-(provide 'ediff-diff)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)

File ediff-help.el

View file
 (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)
   (let ((pos (ediff-event-point last-command-event))
 	overl cmd)
 
-    (ediff-cond-compile-for-xemacs-or-emacs
-     ;; xemacs
-     (setq overl (extent-at pos (current-buffer) 'ediff-help-info)
-	   cmd   (ediff-overlay-get overl 'ediff-help-info))
-     ;; emacs
-     (setq cmd (car (mapcar (lambda (elt)
-			      (overlay-get elt 'ediff-help-info))
-			    (overlays-at pos))))
-     )
+    (if (featurep 'xemacs)
+	(setq overl (extent-at pos (current-buffer) 'ediff-help-info)
+	      cmd   (ediff-overlay-get overl 'ediff-help-info))
+      (setq cmd (car (mapcar (lambda (elt)
+			       (overlay-get elt 'ediff-help-info))
+			     (overlays-at pos)))))
 
     (if (not (stringp cmd))
 	(error "Hmm...  I don't see an Ediff command around here..."))

File ediff-hook.el

View file
 ;; end pacifier
 
 ;; allow menus to be set up without ediff-wind.el being loaded
-;;;###autoload
 (defvar ediff-window-setup-function)
 
-;; This macro is used to avoid compilation warnings.
-;; The macro will expand into the form that is appropriate to the
-;; compiler at hand (emacs or xemacs).
-;; The autoload, below, is useless in Emacs because ediff-hook.el
-;; is dumped with emacs, but it is needed in XEmacs
-;;;###autoload (defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form) (if (featurep 'xemacs) xemacs-form emacs-form))
-
-(defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
-  (if (featurep 'xemacs)
-      xemacs-form emacs-form))
-
 ;; This autoload is useless in Emacs because ediff-hook.el is dumped with
 ;; emacs, but it is needed in XEmacs
 ;;;###autoload
-(ediff-cond-compile-for-xemacs-or-emacs
- ;; xemacs form
- (defun ediff-xemacs-init-menus ()
-   (if (featurep 'menubar)
-       (progn
-	 (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...")
-	 )))
- nil ; emacs form
- )
+(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...")
+	  ))
+      (defvar ediff-menu
+	'("Compare"
+	  ["Two Files..."  ediff-files t]
+	  ["Two Buffers..." ediff-buffers t]
+	  ["Three Files..."  ediff-files3 t]
+	  ["Three Buffers..." ediff-buffers3 t]
+	  "---"
+	  ["Two Directories..." ediff-directories t]
+	  ["Three Directories..." ediff-directories3 t]
+	  "---"
+	  ["File with Revision..."  ediff-revision t]
+	  ["Directory Revisions..."  ediff-directory-revisions t]
+	  "---"
+	  ["Windows Word-by-word..." ediff-windows-wordwise t]
+	  ["Windows Line-by-line..." ediff-windows-linewise t]
+	  "---"
+	  ["Regions Word-by-word..." ediff-regions-wordwise t]
+	  ["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]
+	  ))
+      (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]
+	  ["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)))
+	  (ediff-xemacs-init-menus)))
+  ;; Emacs
+  ;; 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"))
+  (fset 'menu-bar-ediff-merge-menu
+	(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))
+  (define-key menu-bar-ediff-menu [ediff-windows-linewise]
+    '("Windows Line-by-line..." . ediff-windows-linewise))
+  (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
+    '("Windows Word-by-word..." . ediff-windows-wordwise))
+  (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
+  (define-key menu-bar-ediff-menu [ediff-regions-linewise]
+    '("Regions Line-by-line..." . ediff-regions-linewise))
+  (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
+    '("Regions Word-by-word..." . ediff-regions-wordwise))
+  (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
+  (define-key menu-bar-ediff-menu [ediff-dir-revision]
+    '("Directory Revisions..." . ediff-directory-revisions))
+  (define-key menu-bar-ediff-menu [ediff-revision]
+    '("File with Revision..." . ediff-revision))
+  (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
+  (define-key menu-bar-ediff-menu [ediff-directories3]
+    '("Three Directories..." . ediff-directories3))
+  (define-key menu-bar-ediff-menu [ediff-directories]
+    '("Two Directories..." . ediff-directories))
+  (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
+  (define-key menu-bar-ediff-menu [ediff-buffers3]
+    '("Three Buffers..." . ediff-buffers3))
+  (define-key menu-bar-ediff-menu [ediff-files3]
+    '("Three Files..." . ediff-files3))
+  (define-key menu-bar-ediff-menu [ediff-buffers]
+    '("Two Buffers..." . ediff-buffers))
+  (define-key menu-bar-ediff-menu [ediff-files]
+    '("Two Files..." . ediff-files))
 
+  ;; define merge menu
+  (define-key
+    menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
+    '("Directory Revisions with Ancestor..."
+      . ediff-merge-directory-revisions-with-ancestor))
+  (define-key
+    menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
+    '("Directory Revisions..." . ediff-merge-directory-revisions))
+  (define-key
+    menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
+    '("Revisions with Ancestor..."
+      . ediff-merge-revisions-with-ancestor))
+  (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
+    '("Revisions..." . ediff-merge-revisions))
+  (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
+  (define-key
+    menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
+    '("Directories with Ancestor..."
+      . ediff-merge-directories-with-ancestor))
+  (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
+    '("Directories..." . ediff-merge-directories))
+  (define-key
+    menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
+  (define-key
+    menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
+    '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
+  (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
+    '("Buffers..." . ediff-merge-buffers))
+  (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
+    '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
+  (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
+    '("Files..." . ediff-merge-files))
 
-;; This autoload is useless in Emacs because ediff-hook.el is dumped with
-;; emacs, but it is needed in XEmacs
-;;;###autoload
-(ediff-cond-compile-for-xemacs-or-emacs
- (progn
-   (defvar ediff-menu
-     '("Compare"
-       ["Two Files..."  ediff-files t]
-       ["Two Buffers..." ediff-buffers t]
-       ["Three Files..."  ediff-files3 t]
-       ["Three Buffers..." ediff-buffers3 t]
-       "---"
-       ["Two Directories..." ediff-directories t]
-       ["Three Directories..." ediff-directories3 t]
-       "---"
-       ["File with Revision..."  ediff-revision t]
-       ["Directory Revisions..."  ediff-directory-revisions t]
-       "---"
-       ["Windows Word-by-word..." ediff-windows-wordwise t]
-       ["Windows Line-by-line..." ediff-windows-linewise t]
-       "---"
-       ["Regions Word-by-word..." ediff-regions-wordwise t]
-       ["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]
-       ))
-   (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]
-       ["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))]
-       ))
+  ;; define epatch menu
+  (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))
 
-   ;; put these menus before Object-Oriented-Browser in Tools menu
-   (if (and (featurep 'menubar) (not (featurep 'infodock))
-	    (not (featurep 'ediff-hook)))
-	   (ediff-xemacs-init-menus)))
-
- ;; Emacs--only if menu-bar is loaded
- (if (featurep 'menu-bar)
-     (progn
-       ;; 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"))
-       (fset 'menu-bar-ediff-merge-menu
-	     (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))
-       (define-key menu-bar-ediff-menu [ediff-windows-linewise]
-	 '("Windows Line-by-line..." . ediff-windows-linewise))
-       (define-key menu-bar-ediff-menu [ediff-windows-wordwise]
-	 '("Windows Word-by-word..." . ediff-windows-wordwise))
-       (define-key menu-bar-ediff-menu [separator-ediff-windows] '("--"))
-       (define-key menu-bar-ediff-menu [ediff-regions-linewise]
-	 '("Regions Line-by-line..." . ediff-regions-linewise))
-       (define-key menu-bar-ediff-menu [ediff-regions-wordwise]
-	 '("Regions Word-by-word..." . ediff-regions-wordwise))
-       (define-key menu-bar-ediff-menu [separator-ediff-regions] '("--"))
-       (define-key menu-bar-ediff-menu [ediff-dir-revision]
-	 '("Directory Revisions..." . ediff-directory-revisions))
-       (define-key menu-bar-ediff-menu [ediff-revision]
-	 '("File with Revision..." . ediff-revision))
-       (define-key menu-bar-ediff-menu [separator-ediff-directories] '("--"))
-       (define-key menu-bar-ediff-menu [ediff-directories3]
-	 '("Three Directories..." . ediff-directories3))
-       (define-key menu-bar-ediff-menu [ediff-directories]
-	 '("Two Directories..." . ediff-directories))
-       (define-key menu-bar-ediff-menu [separator-ediff-files] '("--"))
-       (define-key menu-bar-ediff-menu [ediff-buffers3]
-	 '("Three Buffers..." . ediff-buffers3))
-       (define-key menu-bar-ediff-menu [ediff-files3]
-	 '("Three Files..." . ediff-files3))
-       (define-key menu-bar-ediff-menu [ediff-buffers]
-	 '("Two Buffers..." . ediff-buffers))
-       (define-key menu-bar-ediff-menu [ediff-files]
-	 '("Two Files..." . ediff-files))
-
-       ;; define merge menu
-       (define-key
-	 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions-with-ancestor]
-	 '("Directory Revisions with Ancestor..."
-	   . ediff-merge-directory-revisions-with-ancestor))
-       (define-key
-	 menu-bar-ediff-merge-menu [ediff-merge-dir-revisions]
-	 '("Directory Revisions..." . ediff-merge-directory-revisions))
-       (define-key
-	 menu-bar-ediff-merge-menu [ediff-merge-revisions-with-ancestor]
-	 '("Revisions with Ancestor..."
-	   . ediff-merge-revisions-with-ancestor))
-       (define-key menu-bar-ediff-merge-menu [ediff-merge-revisions]
-	 '("Revisions..." . ediff-merge-revisions))
-       (define-key menu-bar-ediff-merge-menu [separator-ediff-merge] '("--"))
-       (define-key
-	 menu-bar-ediff-merge-menu [ediff-merge-directories-with-ancestor]
-	 '("Directories with Ancestor..."
-	   . ediff-merge-directories-with-ancestor))
-       (define-key menu-bar-ediff-merge-menu [ediff-merge-directories]
-	 '("Directories..." . ediff-merge-directories))
-       (define-key
-	 menu-bar-ediff-merge-menu [separator-ediff-merge-dirs] '("--"))
-       (define-key
-	 menu-bar-ediff-merge-menu [ediff-merge-buffers-with-ancestor]
-	 '("Buffers with Ancestor..." . ediff-merge-buffers-with-ancestor))
-       (define-key menu-bar-ediff-merge-menu [ediff-merge-buffers]
-	 '("Buffers..." . ediff-merge-buffers))
-       (define-key menu-bar-ediff-merge-menu [ediff-merge-files-with-ancestor]
-	 '("Files with Ancestor..." . ediff-merge-files-with-ancestor))
-       (define-key menu-bar-ediff-merge-menu [ediff-merge-files]
-	 '("Files..." . ediff-merge-files))
-
-       ;; define epatch menu
-       (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))
-
-       ;; 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-cust]
-	 '("Customize Ediff" . ediff-customize))
-       (define-key menu-bar-ediff-misc-menu [ediff-doc]
-	 '("Ediff Manual" . ediff-documentation))
-       )
-
-      ) ; emacs case
- ) ; ediff-cond-compile-for-xemacs-or-emacs
-
-;; arrange for autoloads
-(if purify-flag
-    () ; if dumping, autoloads are set up in loaddefs.el
-  ;; if the user decides to load this file, set up autoloads
-  ;; compare files and buffers
-  (autoload 'ediff "ediff" "Compare two files." t)
-  (autoload 'ediff-files "ediff" "Compare two files." t)
-  (autoload 'ediff-buffers "ediff" "Compare two buffers." t)
-  (autoload 'ebuffers "ediff" "Compare two buffers." t)
-  (autoload 'ediff3  "ediff"  "Compare three files." t)
-  (autoload 'ediff-files3 "ediff" "Compare three files." t)
-  (autoload 'ediff-buffers3 "ediff" "Compare three buffers." t)
-  (autoload 'ebuffers3 "ediff" "Compare three buffers." t)
-
-  (autoload 'erevision "ediff" "Compare versions of a file." t)
-  (autoload 'ediff-revision "ediff" "Compare versions of a file." t)
-
-  ;; compare regions and windows
-  (autoload 'ediff-windows-wordwise
-    "ediff" "Compare two windows word-by-word." t)
-  (autoload 'ediff-regions-wordwise
-    "ediff" "Compare two regions word-by-word." t)
-  (autoload 'ediff-windows-linewise
-    "ediff" "Compare two windows line-by-line." t)
-  (autoload 'ediff-regions-linewise
-    "ediff" "Compare two regions line-by-line." t)
-
-  ;; patch
-  (autoload 'ediff-patch-file "ediff" "Patch a file." t)
-  (autoload 'epatch "ediff" "Patch a file." t)
-  (autoload 'ediff-patch-buffer "ediff" "Patch a buffer.")
-  (autoload 'epatch-buffer "ediff" "Patch a buffer." t)
-
-  ;; merge
-  (autoload 'ediff-merge "ediff" "Merge two files." t)
-  (autoload 'ediff-merge-files "ediff" "Merge two files." t)
-  (autoload 'ediff-merge-files-with-ancestor
-    "ediff" "Merge two files using a third file as an ancestor." t)
-  (autoload 'ediff-merge-buffers "ediff" "Merge two buffers." t)
-  (autoload 'ediff-merge-buffers-with-ancestor
-    "ediff" "Merge two buffers using a third buffer as an ancestor." t)
-
-  (autoload 'ediff-merge-revisions "ediff" "Merge two versions of a file." t)
-  (autoload 'ediff-merge-revisions-with-ancestor
-    "ediff" "Merge two versions of a file." t)
-
-  ;; compare directories
-  (autoload 'edirs "ediff" "Compare files in two directories." t)
-  (autoload 'ediff-directories "ediff" "Compare files in two directories." t)
-  (autoload 'edirs3 "ediff" "Compare files in three directories." t)
-  (autoload
-    'ediff-directories3 "ediff" "Compare files in three directories." t)
-
-  (autoload 'edir-revisions
-    "ediff" "Compare two versions of a file." t)
-  (autoload 'ediff-directory-revisions
-    "ediff" "Compare two versions of a file." t)
-
-  ;; merge directories
-  (autoload 'edirs-merge "ediff" "Merge files in two directories." t)
-  (autoload 'ediff-merge-directories
-    "ediff" "Merge files in two directories." t)
-  (autoload 'edirs-merge-with-ancestor
-    "ediff"
-    "Merge files in two directories using files in a third dir as ancestors."
-    t)
-  (autoload 'ediff-merge-directories-with-ancestor
-    "ediff"
-    "Merge files in two directories using files in a third dir as ancestors."
-    t)
-
-  (autoload 'edir-merge-revisions
-    "ediff" "Merge versions of files in a directory." t)
-  (autoload 'ediff-merge-directory-revisions
-    "ediff" "Merge versions of files in a directory." t)
-  (autoload 'ediff-merge-directory-revisions-with-ancestor
-    "ediff"
-    "Merge versions of files in a directory using other versions as ancestors."
-    t)
-  (autoload 'edir-merge-revisions-with-ancestor
-    "ediff"
-    "Merge versions of files in a directory using other versions as ancestors."
-    t)
-
-  ;; misc
-  (autoload 'ediff-show-registry
-    "ediff-mult"
-    "Display the registry of active Ediff sessions."
-    t)
-  (autoload 'eregistry
-    "ediff-mult"
-    "Display the registry of active Ediff sessions."
-    t)
-  (autoload 'ediff-documentation
-    "ediff"
-    "Display Ediff's manual."
-    t)
-  (autoload 'ediff-version
-    "ediff"
-    "Show Ediff's version and last modification date."
-    t)
-  (autoload 'ediff-toggle-multiframe
-    "ediff-util"
-    "Toggle the use of separate frame for Ediff control buffer."
-    t)
-  (autoload 'ediff-toggle-use-toolbar
-    "ediff-util"
-    "Toggle the use of Ediff toolbar."
-    t)
-
-  ) ; if purify-flag
-
+  ;; 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-cust]
+    '("Customize Ediff" . ediff-customize))
+  (define-key menu-bar-ediff-misc-menu [ediff-doc]
+    '("Ediff Manual" . ediff-documentation)))
 
 (provide 'ediff-hook)
 

File ediff-init.el

View file
 (defvar mswindowsx-bitmap-file-path)
 ;; end pacifier
 
-;; This is used to avoid compilation warnings. When emacs/xemacs forms can
-;; generate compile time warnings, we use this macro.
-;; In this case, the macro will expand into the form that is appropriate to the
-;; compiler at hand.
-;; Suggested by rms.
-(defmacro ediff-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
-  (if (featurep 'xemacs)
-      xemacs-form emacs-form))
-
 (defvar ediff-force-faces nil
   "If t, Ediff will think that it is running on a display that supports faces.
 This is provided as a temporary relief for users of face-capable displays
 
 ;; Are we running as a window application or on a TTY?
 (defsubst ediff-device-type ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (device-type (selected-device)) ; xemacs form
-   window-system  ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (device-type (selected-device))
+    window-system))
 
 ;; in XEmacs: device-type is tty on tty and stream in batch.
 (defun ediff-window-display-p ()
 
 ;; toolbar support for emacs hasn't been implemented in ediff
 (defun ediff-has-toolbar-support-p ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (and (featurep 'toolbar) (console-on-window-system-p)) ; xemacs form
-   nil ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (if (featurep 'toolbar) (console-on-window-system-p))))
 
 
 (defun ediff-has-gutter-support-p ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (and (featurep 'gutter) (console-on-window-system-p)) ; xemacs form
-   nil ; emacs form
-   ))
-
+  (if (featurep 'xemacs)
+      (if (featurep 'gutter) (console-on-window-system-p))))
 
 (defun ediff-use-toolbar-p ()
   (and (ediff-has-toolbar-support-p)	;Can it do it ?
   :group 'ediff)
 
 
-(ediff-cond-compile-for-xemacs-or-emacs
- (progn ; xemacs
-   (defalias 'ediff-read-event 'next-command-event)
-   (defalias 'ediff-overlayp 'extentp)
-   (defalias 'ediff-make-overlay 'make-extent)
-   (defalias 'ediff-delete-overlay 'delete-extent))
- (progn ; emacs
-   (defalias 'ediff-read-event 'read-event)
-   (defalias 'ediff-overlayp 'overlayp)
-   (defalias 'ediff-make-overlay 'make-overlay)
-   (defalias 'ediff-delete-overlay 'delete-overlay))
- )
+(defalias 'ediff-read-event
+  (if (featurep 'xemacs) 'next-command-event 'read-event))
+
+(defalias 'ediff-overlayp
+  (if (featurep 'xemacs) 'extentp 'overlayp))
+
+(defalias 'ediff-make-overlay
+  (if (featurep 'xemacs) 'make-extent 'make-overlay))
+
+(defalias 'ediff-delete-overlay
+  (if (featurep 'xemacs) 'delete-extent 'delete-overlay))
 
 ;; Check the current version against the major and minor version numbers
 ;; using op: cur-vers op major.minor If emacs-major-version or
 
 (defun ediff-color-display-p ()
   (condition-case nil
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (eq (device-class (selected-device)) 'color) ; xemacs form
-       (if (fboundp 'display-color-p) ; emacs form
-	   (display-color-p)
-	 (x-display-color-p))
-	)
+      (if (featurep 'xemacs)
+	  (eq (device-class (selected-device)) 'color) ; xemacs form
+	(display-color-p)) ; emacs form
     (error nil)))
 
 
 
 
 (if (ediff-has-face-support-p)
-    (ediff-cond-compile-for-xemacs-or-emacs
-     (progn ; xemacs
-       (defalias 'ediff-valid-color-p 'valid-color-name-p)
-       (defalias 'ediff-get-face 'get-face))
-     (progn ; emacs
-       (defalias 'ediff-valid-color-p (if (fboundp 'color-defined-p)
-					  'color-defined-p
-					'x-color-defined-p))
-       (defalias 'ediff-get-face 'internal-get-face))
-     ))
+    (if (featurep '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)
+					 'color-defined-p
+				       'x-color-defined-p))
+      (defalias 'ediff-get-face 'internal-get-face)))
 
 (if (ediff-window-display-p)
-    (ediff-cond-compile-for-xemacs-or-emacs
-     (progn   ; xemacs
-       (defalias 'ediff-display-pixel-width 'device-pixel-width)
-       (defalias 'ediff-display-pixel-height 'device-pixel-height))
-     (progn   ; emacs
-       (defalias 'ediff-display-pixel-width
-	     (if (fboundp 'display-pixel-width)
-		 'display-pixel-width
-	       'x-display-pixel-width))
-       (defalias 'ediff-display-pixel-height
-	     (if (fboundp 'display-pixel-height)
-		 'display-pixel-height
-	       'x-display-pixel-height)))
-     ))
+    (if (featurep 'xemacs)
+	(progn
+	  (defalias 'ediff-display-pixel-width 'device-pixel-width)
+	  (defalias 'ediff-display-pixel-height 'device-pixel-height))
+      (defalias 'ediff-display-pixel-width
+	(if (fboundp 'display-pixel-width)
+	    'display-pixel-width
+	  'x-display-pixel-width))
+      (defalias 'ediff-display-pixel-height
+	(if (fboundp 'display-pixel-height)
+	    'display-pixel-height
+	  'x-display-pixel-height))))
 
 ;; A-list of current-diff-overlay symbols associated with buf types
 (defconst ediff-current-diff-overlay-alist
 (ediff-hide-face ediff-current-diff-face-A)
 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
 ;; This means that some user customization may be trashed.
-(if (and (featurep 'xemacs)
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p)))
-    (copy-face 'modeline ediff-current-diff-face-A))
+(and (featurep 'xemacs)
+     (ediff-has-face-support-p)
+     (not (ediff-color-display-p))
+     (copy-face 'modeline ediff-current-diff-face-A))
 
 
 
 (ediff-hide-face ediff-current-diff-face-B)
 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
 ;; This means that some user customization may be trashed.
-(if (and (featurep 'xemacs)
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p)))
-    (copy-face 'modeline ediff-current-diff-face-B))
+(and (featurep 'xemacs)
+     (ediff-has-face-support-p)
+     (not (ediff-color-display-p))
+     (copy-face 'modeline ediff-current-diff-face-B))
 
 
 (defface ediff-current-diff-C
 (ediff-hide-face ediff-current-diff-face-C)
 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
 ;; This means that some user customization may be trashed.
-(if (and (featurep 'xemacs)
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p)))
-    (copy-face 'modeline ediff-current-diff-face-C))
+(and (featurep 'xemacs)
+     (ediff-has-face-support-p)
+     (not (ediff-color-display-p))
+     (copy-face 'modeline ediff-current-diff-face-C))
 
 
 (defface ediff-current-diff-Ancestor
 (ediff-hide-face ediff-current-diff-face-Ancestor)
 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
 ;; This means that some user customization may be trashed.
-(if (and (featurep 'xemacs)
-	 (ediff-has-face-support-p)
-	 (not (ediff-color-display-p)))
-    (copy-face 'modeline ediff-current-diff-face-Ancestor))
+(and (featurep 'xemacs)
+     (ediff-has-face-support-p)
+     (not (ediff-color-display-p))
+     (copy-face 'modeline ediff-current-diff-face-Ancestor))
 
 
 (defface ediff-fine-diff-A
 (defun ediff-highest-priority (start end buffer)
   (let ((pos (max 1 (1- start)))
 	ovr-list)
-    (ediff-cond-compile-for-xemacs-or-emacs
-     (1+ ediff-shadow-overlay-priority)  ; xemacs form
-     ;; emacs form
-     (ediff-with-current-buffer buffer
-       (while (< pos (min (point-max) (1+ end)))
-	 (setq ovr-list (append (overlays-at pos) ovr-list))
-	 (setq pos (next-overlay-change pos)))
-       (+ 1 ediff-shadow-overlay-priority
-	  (apply 'max
-		 (cons
-		  1
-		  (mapcar
-		   (lambda (ovr)
-		     (if (and ovr
-			      ;; exclude ediff overlays from priority
-			      ;; calculation, or else priority will keep
-			      ;; increasing
-			      (null (ediff-overlay-get ovr 'ediff))
-			      (null (ediff-overlay-get ovr 'ediff-diff-num)))
-			 ;; use the overlay priority or 0
-			 (or (ediff-overlay-get ovr 'priority) 0)
-		       0))
-		   ovr-list)
-		  )
-		 )))
-     ) ; ediff-cond-compile-for-xemacs-or-emacs
-    ))
+    (if (featurep 'xemacs)
+	(1+ ediff-shadow-overlay-priority)
+      (ediff-with-current-buffer buffer
+	(while (< pos (min (point-max) (1+ end)))
+	  (setq ovr-list (append (overlays-at pos) ovr-list))
+	  (setq pos (next-overlay-change pos)))
+	(+ 1 ediff-shadow-overlay-priority
+	   (apply 'max
+		  (cons
+		   1
+		   (mapcar
+		    (lambda (ovr)
+		      (if (and ovr
+			       ;; exclude ediff overlays from priority
+			       ;; calculation, or else priority will keep
+			       ;; increasing
+			       (null (ediff-overlay-get ovr 'ediff))
+			       (null (ediff-overlay-get ovr 'ediff-diff-num)))
+			  ;; use the overlay priority or 0
+			  (or (ediff-overlay-get ovr 'priority) 0)
+			0))
+		    ovr-list))))))))
 
 
 (defvar ediff-toggle-read-only-function nil
 ;; this record is itself a vector
 (defsubst ediff-clear-fine-diff-vector (diff-record)
   (if diff-record
-      (mapcar 'ediff-delete-overlay
-	      (ediff-get-fine-diff-vector-from-diff-record diff-record))))
+      (mapc 'ediff-delete-overlay
+	    (ediff-get-fine-diff-vector-from-diff-record diff-record))))
 
 (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type)
   (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type))
 
 
 (defsubst ediff-mouse-event-p (event)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (button-event-p event) ; xemacs form
-   (string-match "mouse" (format "%S" (event-basic-type event))) ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (button-event-p event)
+    (string-match "mouse" (format "%S" (event-basic-type event)))))
 
 
 (defsubst ediff-key-press-event-p (event)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (key-press-event-p event) ; xemacs form
-   (or (char-or-string-p event) (symbolp event)) ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (key-press-event-p event)
+    (or (char-or-string-p event) (symbolp event))))
 
 (defun ediff-event-point (event)
   (cond ((ediff-mouse-event-p event)
-	 (ediff-cond-compile-for-xemacs-or-emacs
-	  (event-point event)               ; xemacs form
-	  (posn-point (event-start event))  ; emacs form
-	  )
-	 )
+	 (if (featurep 'xemacs)
+	     (event-point event)
+	   (posn-point (event-start event))))
 	((ediff-key-press-event-p event)
 	 (point))
 	(t (error "Error"))))
 
 (defun ediff-event-buffer (event)
   (cond ((ediff-mouse-event-p event)
-	 (ediff-cond-compile-for-xemacs-or-emacs
-	  (event-buffer event)                              ; xemacs form
-	  (window-buffer (posn-window (event-start event))) ; emacs form
-	  )
-	 )
+	 (if (featurep 'xemacs)
+	     (event-buffer event)
+	   (window-buffer (posn-window (event-start event)))))
 	((ediff-key-press-event-p event)
 	 (current-buffer))
 	(t (error "Error"))))
 
 (defun ediff-event-key (event-or-key)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (if (eventp event-or-key) (event-key event-or-key) event-or-key) ; xemacs
-   event-or-key   ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (if (eventp event-or-key) (event-key event-or-key) event-or-key)
+    event-or-key))
 
 
 (defsubst ediff-frame-iconified-p (frame)
-  (if (and (ediff-window-display-p) (frame-live-p frame))
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (frame-iconified-p frame)          ; xemacs form
-       (eq (frame-visible-p frame) 'icon) ; emacs form
-       )
-    ))
+  (and (ediff-window-display-p) (frame-live-p frame)
+       (if (featurep 'xemacs)
+	   (frame-iconified-p frame)
+	 (eq (frame-visible-p frame) 'icon))))
 
 (defsubst ediff-window-visible-p (wind)
   ;; under TTY, window-live-p also means window is visible
 
 
 (defsubst ediff-frame-char-width (frame)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (/ (frame-pixel-width frame) (frame-width frame)) ; xemacs
-   (frame-char-width frame) ; emacs
-   ))
+  (if (featurep 'xemacs)
+      (/ (frame-pixel-width frame) (frame-width frame))
+    (frame-char-width frame)))
 
 (defun ediff-reset-mouse (&optional frame do-not-grab-mouse)
   (or frame (setq frame (selected-frame)))
 	    (t nil))))
 
 (defsubst ediff-frame-char-height (frame)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (glyph-height ediff-H-glyph (frame-selected-window frame)) ; xemacs case
-   (frame-char-height frame) ; emacs case
-   )
-  )
+  (if (featurep 'xemacs)
+      (glyph-height ediff-H-glyph (frame-selected-window frame))
+    (frame-char-height frame)))
 
 ;; Some overlay functions
 
 (defsubst ediff-overlay-start (overl)
   (if (ediff-overlayp overl)
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (extent-start-position overl) ; xemacs form
-       (overlay-start overl)         ; emacs form
-       )
-    ))
+      (if (featurep 'xemacs)
+	  (extent-start-position overl)
+	(overlay-start overl))))
 
 (defsubst ediff-overlay-end  (overl)
   (if (ediff-overlayp overl)
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (extent-end-position overl) ; xemacs form
-       (overlay-end overl) ; emacs form
-       )
-    ))
+      (if (featurep 'xemacs)
+	  (extent-end-position overl)
+	(overlay-end overl))))
 
 (defsubst ediff-empty-overlay-p (overl)
   (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
 ;; like overlay-buffer in Emacs.  In XEmacs, returns nil if the extent is
 ;; dead.  Otherwise, works like extent-buffer
 (defun ediff-overlay-buffer (overl)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (and (extent-live-p overl) (extent-object overl)) ; xemacs form
-   (overlay-buffer overl) ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (and (extent-live-p overl) (extent-object overl))
+    (overlay-buffer overl)))
 
 ;; like overlay-get in Emacs.  In XEmacs, returns nil if the extent is
 ;; dead.  Otherwise, like extent-property
 (defun ediff-overlay-get (overl property)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (and (extent-live-p overl) (extent-property overl property)) ; xemacs form
-   (overlay-get overl property) ; emacs form
-   ))
+  (if (featurep 'xemacs)
+      (and (extent-live-p overl) (extent-property overl property))
+    (overlay-get overl property)))
 
 
 ;; These two functions are here because XEmacs refuses to
 Checks if overlay's buffer exists before actually doing the move."
   (let ((buf (and overlay (ediff-overlay-buffer overlay))))
     (if (ediff-buffer-live-p buf)
-	(ediff-cond-compile-for-xemacs-or-emacs
-	 (set-extent-endpoints overlay beg end) ; xemacs form
-	 (move-overlay overlay beg end buffer)  ; emacs form
-	 )
+	(if (featurep 'xemacs)
+	    (set-extent-endpoints overlay beg end)
+	  (move-overlay overlay beg end buffer))
       ;; buffer's dead
       (if overlay
 	  (ediff-delete-overlay overlay)))))
   "Calls `overlay-put' or `set-extent-property' depending on Emacs version.
 Checks if overlay's buffer exists."
   (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (set-extent-property overlay prop value) ; xemacs form
-       (overlay-put overlay prop value) ; emacs form
-       )
+      (if (featurep 'xemacs)
+	  (set-extent-property overlay prop value)
+	(overlay-put overlay prop value))
     (ediff-delete-overlay overlay)))
 
 ;; temporarily uses DIR to abbreviate file name
 	 (let ((directory-abbrev-alist (list (cons dir ""))))
 	   (abbreviate-file-name file)))
 	(t
-	 (ediff-cond-compile-for-xemacs-or-emacs
-	  ;; XEmacs requires addl argument
-	  (abbreviate-file-name file t) ; xemacs form
-	  (abbreviate-file-name file))  ; emacs form
-	 )
-	))
+	 (if (featurep 'xemacs)
+	     ;; XEmacs requires addl argument
+	     (abbreviate-file-name file t)
+	   (abbreviate-file-name file)))))
 
 ;; Takes a directory and returns the parent directory.
 ;; does nothing to `/'.  If the ARG is a regular file,
   "Don't skip difference regions."
   nil)
 
-(defsubst Xor (a b)
-  (or (and a (not b)) (and (not a) b)))
-
 (defsubst ediff-message-if-verbose (string &rest args)
   (if ediff-verbose-p
       (apply 'message string args)))
       (convert-standard-filename fname)
     fname))
 
-
-(if (fboundp 'with-syntax-table)
+(if (featurep 'emacs)
     (defalias 'ediff-with-syntax-table 'with-syntax-table)
-  ;; stolen from subr.el in emacs 21
-  (defmacro ediff-with-syntax-table (table &rest body)
-    (let ((old-table (make-symbol "table"))
-	  (old-buffer (make-symbol "buffer")))
-      `(let ((,old-table (syntax-table))
-	     (,old-buffer (current-buffer)))
-	 (unwind-protect
-	     (progn
-	       (set-syntax-table (copy-syntax-table ,table))
-	       ,@body)
-	   (save-current-buffer
-	     (set-buffer ,old-buffer)
-	     (set-syntax-table ,old-table)))))))
+  (if (fboundp 'with-syntax-table)
+      (defalias 'ediff-with-syntax-table 'with-syntax-table)
+    ;; stolen from subr.el in emacs 21
+    (defmacro ediff-with-syntax-table (table &rest body)
+      (let ((old-table (make-symbol "table"))
+	    (old-buffer (make-symbol "buffer")))
+	`(let ((,old-table (syntax-table))
+	       (,old-buffer (current-buffer)))
+	   (unwind-protect
+	       (progn
+		 (set-syntax-table (copy-syntax-table ,table))
+		 ,@body)
+	     (save-current-buffer
+	       (set-buffer ,old-buffer)
+	       (set-syntax-table ,old-table))))))))
 
 
 (provide 'ediff-init)

File ediff-merg.el

View file
 (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)

File ediff-mult.el

View file
 ;;; Code:
 
 
+(provide 'ediff-mult)
+
 (defgroup ediff-mult nil
   "Multi-file and multi-buffer processing in Ediff."
   :prefix "ediff-"
 
 ;; 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)
       (erase-buffer)
       ;; delete phony overlays that used to represent sessions before the buff
       ;; was redrawn
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (map-extents 'delete-extent)   ; xemacs
-       (mapc 'delete-overlay (overlays-in 1 1))  ; emacs
-       )
+      (if (featurep 'xemacs)
+	  (map-extents 'delete-extent)
+	(mapc 'delete-overlay (overlays-in 1 1)))
 
       (setq regexp (ediff-get-group-regexp meta-list)
 	    merge-autostore-dir
 (defun ediff-update-session-marker-in-dir-meta-buffer (session-num)
   (let (buffer-meta-overlays session-info overl buffer-read-only)
     (setq overl
-	  (ediff-cond-compile-for-xemacs-or-emacs
-	   (map-extents ; xemacs
-	    (lambda (ext maparg)
-	      (if (and
-		   (ediff-overlay-get ext 'ediff-meta-info)
-		   (eq (ediff-overlay-get ext 'ediff-meta-session-number)
-		       session-num))
-		  ext)))
+	  (if (featurep 'xemacs)
+	      (map-extents
+	       (lambda (ext maparg)
+		 (if (and
+		      (ediff-overlay-get ext 'ediff-meta-info)
+		      (eq (ediff-overlay-get ext 'ediff-meta-session-number)
+			  session-num))
+		     ext)))
 	    ;; Emacs doesn't have map-extents, so try harder
 	    ;; Splice overlay lists to get all buffer overlays
-	   (progn
-	     (setq buffer-meta-overlays (overlay-lists)
-		   buffer-meta-overlays (append (car buffer-meta-overlays)
+	    (setq buffer-meta-overlays (overlay-lists)
+		  buffer-meta-overlays (append (car buffer-meta-overlays)
 						(cdr buffer-meta-overlays)))
-	     (car
-	      (delq nil
-		    (mapcar
-		     (lambda (overl)
-		       (if (and
-			    (ediff-overlay-get overl 'ediff-meta-info)
-			    (eq (ediff-overlay-get
-				 overl 'ediff-meta-session-number)
-				session-num))
-			   overl))
-		     buffer-meta-overlays))))
-	   ))
+	    (car
+	     (delq nil
+		   (mapcar
+		    (lambda (overl)
+		      (if (and
+			   (ediff-overlay-get overl 'ediff-meta-info)
+			   (eq (ediff-overlay-get
+				overl 'ediff-meta-session-number)
+			       session-num))
+			  overl))
+		    buffer-meta-overlays)))))
     (or overl
 	(error
 	 "Bug in ediff-update-session-marker-in-dir-meta-buffer: no overlay with given number %S"
       (erase-buffer)
       ;; delete phony overlays that used to represent sessions before the buff
       ;; was redrawn
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (map-extents 'delete-extent) ; xemacs
-       (mapc 'delete-overlay (overlays-in 1 1)) ; emacs
-       )
+      (if (featurep 'xemacs)
+	  (map-extents 'delete-extent)
+       (mapc 'delete-overlay (overlays-in 1 1)))
 
       (insert "This is a registry of all active Ediff sessions.
 
   (let (result olist tmp)
     (if (and point (ediff-buffer-live-p buf))
 	(ediff-with-current-buffer buf
-	  (ediff-cond-compile-for-xemacs-or-emacs
-	   (setq result  ; xemacs
-		 (if (setq tmp (extent-at point buf 'ediff-meta-info))
-		     (ediff-overlay-get tmp 'ediff-meta-info)))
-	   (progn ; emacs
-	     (setq olist (overlays-at point))
-	     (setq olist
-		   (mapcar (lambda (elt)
-			     (unless (overlay-get elt 'invisible)
-			       (overlay-get elt 'ediff-meta-info)))
-			   olist))
-	     (while (and olist (null (car olist)))
-	       (setq olist (cdr olist)))
-	     (setq result (car olist)))
-	   )
-	  ))
-    (if result
-	result
-      (if noerror
-	  nil
-	(ediff-update-registry)
-	(error "No session info in this line")))))
+	  (if (featurep 'xemacs)
+	      (setq result
+		    (if (setq tmp (extent-at point buf 'ediff-meta-info))
+			(ediff-overlay-get tmp 'ediff-meta-info)))
+	    (setq olist
+		  (mapcar (lambda (elt)
+			    (unless (overlay-get elt 'invisible)
+			      (overlay-get elt 'ediff-meta-info)))
+			  (overlays-at point)))
+	    (while (and olist (null (car olist)))
+	      (setq olist (cdr olist)))
+	    (setq result (car olist)))))
+    (or result
+	(unless noerror
+	  (ediff-update-registry)
+	  (error "No session info in this line")))))
 
 
 (defun ediff-get-meta-overlay-at-pos (point)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (extent-at point (current-buffer) 'ediff-meta-info) ; xemacs
-   ;; emacs
-   (let* ((overl-list (overlays-at point))
-	  (overl (car overl-list)))
-     (while (and overl (null (overlay-get overl 'ediff-meta-info)))
-       (setq overl-list (cdr overl-list)
-	     overl (car overl-list)))
-     overl)
-   )
-  )
+  (if (featurep 'xemacs)
+      (extent-at point (current-buffer) 'ediff-meta-info)
+    (let* ((overl-list (overlays-at point))
+	   (overl (car overl-list)))
+      (while (and overl (null (overlay-get overl 'ediff-meta-info)))
+	(setq overl-list (cdr overl-list)
+	      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)))
   (if (eobp)
       (goto-char (point-min))
     (let ((overl (ediff-get-meta-overlay-at-pos point)))
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (progn ; xemacs
-	 (if overl
-	     (setq overl (next-extent overl))
-	   (setq overl (next-extent (current-buffer))))
-	 (if overl
-	     (extent-start-position overl)
-	   (point-max)))
-       ;; emacs
-       (if overl
-	   ;; note: end of current overlay is the beginning of the next one
-	   (overlay-end overl)
-	 (next-overlay-change point))
-       )
-      )
-    ))
+      (if (featurep 'xemacs)
+	  (progn ; xemacs
+	    (if overl
+		(setq overl (next-extent overl))
+	      (setq overl (next-extent (current-buffer))))
+	    (if overl
+		(extent-start-position overl)
+	      (point-max)))
+	;; emacs
+	(if overl
+	    ;; note: end of current overlay is the beginning of the next one
+	    (overlay-end overl)
+	  (next-overlay-change point))))))
 
 
 (defun ediff-previous-meta-overlay-start (point)
   (if (bobp)
       (goto-char (point-max))
     (let ((overl (ediff-get-meta-overlay-at-pos point)))
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (progn
-	 (if overl
-	     (setq overl (previous-extent overl))
-	   (setq overl (previous-extent (current-buffer))))
-	 (if overl
-	     (extent-start-position overl)
-	   (point-min)))
-       (progn
-	 (if overl (setq point (overlay-start overl)))
-	 ;; to get to the beginning of prev overlay
-	 (if (not (bobp))
-	     ;; trick to overcome an emacs bug--doesn't always find previous
-	     ;; overlay change correctly
-	     (setq point (1- point)))
-	 (setq point (previous-overlay-change point))
-	 ;; If we are not over an overlay after subtracting 1, it means we are
-	 ;; in the description area preceding session records.  In this case,
-	 ;; goto the top of the registry buffer.
-	 (or (car (overlays-at point))
-	     (setq point (point-min)))
-	 point)
-       )
-      )))
+      (if (featurep 'xemacs)
+	  (progn
+	    (if overl
+		(setq overl (previous-extent overl))
+	      (setq overl (previous-extent (current-buffer))))
+	    (if overl
+		(extent-start-position overl)
+	      (point-min)))
+	(if overl (setq point (overlay-start overl)))
+	;; to get to the beginning of prev overlay
+	(if (not (bobp))
+	    ;; trick to overcome an emacs bug--doesn't always find previous
+	    ;; overlay change correctly
+	    (setq point (1- point)))
+	(setq point (previous-overlay-change point))
+	;; If we are not over an overlay after subtracting 1, it means we are
+	;; in the description area preceding session records.  In this case,
+	;; goto the top of the registry buffer.
+	(or (car (overlays-at point))
+	    (setq point (point-min)))
+	point))))
 
 ;; this is the action invoked when the user selects a patch from the meta
 ;; buffer.
     ))
 
 
-(provide 'ediff-mult)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)

File ediff-ptch.el

View file
 ;;; Code:
 
 
+(provide 'ediff-ptch)
+
 (defgroup ediff-ptch nil
   "Ediff patch support."
   :tag "Patch"
 (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)
 
 
 
-(provide 'ediff-ptch)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)

File ediff-tbar.el

View file
 
 ;; 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))
-    ))
+  (require 'ediff-init)
+  (require 'ediff-util)
+  )
 (defvar toolbar-icon-directory)
 ;; end pacifier
 

File ediff-util.el

View file
 ;;; Code:
 
 
+(provide 'ediff-util)
+
 ;; Compiler pacifier
 (defvar ediff-patch-diagnostics)
 (defvar ediff-patchbufer)
   (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
 
 
       (make-local-variable 'ediff-window-setup-function)
       (make-local-variable 'ediff-keep-variants)
 
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (make-local-hook 'ediff-after-quit-hook-internal) ; xemacs form
-       nil ; emacs form
-       )
+      (make-local-variable 'window-min-height)
+      (setq window-min-height 2)
+
+      (if (featurep 'xemacs)
+	  (make-local-hook 'ediff-after-quit-hook-internal))
 
       ;; unwrap set up parameters passed as argument
       (while setup-parameters
       (if (string-match "buffer" (symbol-name ediff-job-name))
 	  (setq ediff-keep-variants t))
 
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (make-local-hook 'pre-command-hook) ; xemacs form
-       nil                                 ; emacs form
-       )
+      (if (featurep 'xemacs)
+	  (make-local-hook 'pre-command-hook))
 
       (if (ediff-window-display-p)
 	  (add-hook 'pre-command-hook 'ediff-spy-after-mouse nil 'local))
 		  (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
 	       (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)
   ;; The problem with this is that any previous bottom-toolbar
   ;; will not re-appear after our cleanup here.  Is there a way
   ;; to do "push" and "pop" toolbars ?  --marcpa
-  (if (ediff-use-toolbar-p)
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (progn ; xemacs
-	 (set-specifier bottom-toolbar (list (selected-frame) nil))
-	 (set-specifier bottom-toolbar-visible-p (list (selected-frame) nil)))
-       nil  ; emacs
-       )
-    ))
+  (if (featurep 'xemacs)
+      (when (ediff-use-toolbar-p)
+	(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.
 ;; If not, zero the toolbar for XEmacs.
 ;; Do nothing for Emacs.
 (defun ediff-make-bottom-toolbar (&optional frame)
-  (if (ediff-window-display-p)
-      (progn
-	(setq frame (or frame (selected-frame)))
+  (when (ediff-window-display-p)
+    (setq frame (or frame (selected-frame)))
+    (if (featurep 'xemacs)
 	(cond ((ediff-use-toolbar-p) ; this checks for XEmacs
-	       (ediff-cond-compile-for-xemacs-or-emacs
-		(progn ; 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)))
-		nil ; emacs
-		)
-	       )
+	       (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-has-toolbar-support-p)
-	       (ediff-cond-compile-for-xemacs-or-emacs
-		(set-specifier bottom-toolbar-height (list frame 0)) ; xemacs
-		nil                                                  ; emacs
-		)
-	       )
-	      ))
-    ))
+	       (set-specifier bottom-toolbar-height (list frame 0)))))))
 
 ;; Merging
 
 (defun ediff-make-cloned-buffer (buff region-name)
   (ediff-make-indirect-buffer
    buff (generate-new-buffer-name
-         (concat (if (stringp buff) buff (buffer-name buff)) region-name))
-   ))
+         (concat (if (stringp buff) buff (buffer-name buff)) region-name))))
 
 
 (defun ediff-make-indirect-buffer (base-buf indirect-buf-name)
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (make-indirect-buffer base-buf indirect-buf-name) ; xemacs
-   (make-indirect-buffer base-buf indirect-buf-name 'clone) ; emacs
-   ))
+  (if (featurep 'xemacs)
+      (make-indirect-buffer base-buf indirect-buf-name)
+    (make-indirect-buffer base-buf indirect-buf-name 'clone)))
 
 
 ;; This function operates only from an ediff control buffer
   (let ((buf-A-file-name (buffer-file-name ediff-buffer-A))
 	(buf-B-file-name (buffer-file-name ediff-buffer-B))
 	file-A file-B)
-    (unless (and buf-A-file-name (file-exists-p buf-A-file-name))
-      (setq file-A
-	    (ediff-make-temp-file ediff-buffer-A)))
-    (unless (and buf-B-file-name (file-exists-p buf-B-file-name))
-      (setq file-B
-	    (ediff-make-temp-file ediff-buffer-B)))
+    (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)))
+    (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)))
     (or (ediff-buffer-live-p ediff-custom-diff-buffer)
 	(setq ediff-custom-diff-buffer
 	      (get-buffer-create
 	  (or (number-or-marker-p end)
 	      (setq end (eval end)))
 	  (setq overl
-		(ediff-cond-compile-for-xemacs-or-emacs
-		 (make-extent beg end buff)                     ; xemacs
-		 ;; advance front and rear of the overlay
-		 (make-overlay beg end buff nil 'rear-advance)  ; emacs
-		 ))
+		(if (featurep 'xemacs)
+		    (make-extent beg end buff)
+		  ;; advance front and rear of the overlay
+		  (make-overlay beg end buff nil 'rear-advance)))
 
 	  ;; never detach
 	  (ediff-overlay-put
 	   overl (if (featurep 'emacs) 'evaporate 'detachable) nil)
 	  ;; make overlay open-ended
 	  ;; In emacs, it is made open ended at creation time
-	  (if (featurep 'xemacs)
-	      (progn
-		(ediff-overlay-put overl 'start-open nil)
-		(ediff-overlay-put overl 'end-open nil)))
+	  (when (featurep 'xemacs)
+	    (ediff-overlay-put overl 'start-open nil)
+	    (ediff-overlay-put overl 'end-open nil))
 	  (ediff-overlay-put overl 'ediff-diff-num 0)
 	  overl))))
 
 
 
 (defun ediff-deactivate-mark ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (zmacs-deactivate-region) ; xemacs
-   (deactivate-mark) ; emacs
-   ))
+  (if (featurep 'xemacs)
+      (zmacs-deactivate-region)
+    (deactivate-mark)))
+
 (defun ediff-activate-mark ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (zmacs-activate-region) ; xemacs
-   (progn
-     (make-local-variable 'transient-mark-mode)
-     (setq mark-active t
-	   transient-mark-mode t) ; emacs
-     )
-   ))
+  (if (featurep 'xemacs)
+      (zmacs-activate-region)
+    (make-local-variable 'transient-mark-mode)
+    (setq mark-active t transient-mark-mode t)))
 
 (defun ediff-nuke-selective-display ()
   (if (featurep 'xemacs)
   (interactive)
   (ediff-barf-if-not-control-buffer)
 
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (make-local-hook 'post-command-hook) ; xemacs form
-   nil                                  ; emacs form
-   )
+  (if (featurep 'xemacs)
+      (make-local-hook 'post-command-hook))
 
   (let ((pre-hook 'pre-command-hook)
 	(post-hook 'post-command-hook))
 
 (run-hooks 'ediff-load-hook)
 
-(provide 'ediff-util)
-
 
 ;; Local Variables:
 ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)

File ediff-vers.el

View file
 
 (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

File ediff-wind.el

View file
 
 
 (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)
   :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.
        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)
 	  (beep 1))
       (message "Please click on Window %d " wind-number))
     (ediff-read-event) ; discard event
-    (setq wind (ediff-cond-compile-for-xemacs-or-emacs
-		(event-window event) ; xemacs
-		(posn-window (event-start event)) ; emacs
-		)
-	  )
-    ))
+    (setq wind (if (featurep 'xemacs)
+		   (event-window event)
+		 (posn-window (event-start event))))))
 
 
 ;; Select the lowest window on the frame.
 (defun ediff-select-lowest-window ()
-  (ediff-cond-compile-for-xemacs-or-emacs
-   (select-window (frame-lowest-window)) ; xemacs
-   ;; emacs
-   (let* ((lowest-window (selected-window))
-	  (bottom-edge (car (cdr (cdr (cdr (window-edges))))))
-	  (last-window (save-excursion
-			 (other-window -1) (selected-window)))
-	  (window-search t))
-     (while window-search
-       (let* ((this-window (next-window))
-	      (next-bottom-edge
-	       (car (cdr (cdr (cdr (window-edges this-window)))))))
-	 (if (< bottom-edge next-bottom-edge)
-	     (progn
-	       (setq bottom-edge next-bottom-edge)
-	       (setq lowest-window this-window)))
-
-	 (select-window this-window)
-	 (if (eq last-window this-window)
-	     (progn
-	       (select-window lowest-window)
-	       (setq window-search nil))))))
-   ))
+  (if (featurep 'xemacs)
+      (select-window (frame-lowest-window))
+    (let* ((lowest-window (selected-window))
+	   (bottom-edge (car (cdr (cdr (cdr (window-edges))))))
+	   (last-window (save-excursion
+			  (other-window -1) (selected-window)))
+	   (window-search t))
+      (while window-search
+	(let* ((this-window (next-window))
+	       (next-bottom-edge
+		(car (cdr (cdr (cdr (window-edges this-window)))))))
+	  (if (< bottom-edge next-bottom-edge)
+	      (setq bottom-edge next-bottom-edge
+		    lowest-window this-window))
+	  (select-window this-window)
+	  (when (eq last-window this-window)
+	    (select-window lowest-window)
+	    (setq window-search nil)))))))
 
 
 ;;; Common window setup routines
        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.
 	    ;; 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)
 	    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)
    (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)))
     )))
 
 	fheight fwidth adjusted-parameters)
 
     (ediff-with-current-buffer ctl-buffer
-      (ediff-cond-compile-for-xemacs-or-emacs
-       (when (featurep 'menubar) (set-buffer-menubar nil)) ; xemacs
-       nil ; emacs
-       )
+      (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))
 
 	    ediff-control-frame ctl-frame)
       ;; protect against undefined face-attribute
       (condition-case nil
-	  (ediff-cond-compile-for-xemacs-or-emacs
-	   nil ; xemacs
-	   (when (face-attribute 'mode-line :box)
-	     (set-face-attribute 'mode-line ctl-frame :box nil))
-	   )
-	(error))
-      )
+	  (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))
     (select-frame ctl-frame)
     ;; In XEmacs, buffer menubar needs to be killed before frame parameters
     ;; are changed.
     (if (ediff-has-toolbar-support-p)
-	(ediff-cond-compile-for-xemacs-or-emacs
-	 (progn ; xemacs
-	   (if (ediff-has-gutter-support-p)
-	       (set-specifier top-gutter (list ctl-frame nil)))
-	   (sit-for 0)
-	   (set-specifier top-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))
-	   )
-	 nil ; emacs
-	 )
-      )
+	(when (featurep 'xemacs)
+	  (if (ediff-has-gutter-support-p)
+	      (set-specifier top-gutter (list ctl-frame nil)))
+	  (sit-for 0)
+	  (set-specifier top-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))))
 
     ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order
     ;; to make sure that at least once we do it for non-iconified frame.  If
 			   (or (eq this-command 'ediff-quit)
 			       (not (eq ediff-grab-mouse t)))))
 
-    (if (featurep 'xemacs)
-	(ediff-with-current-buffer ctl-buffer
-	  (ediff-cond-compile-for-xemacs-or-emacs
-	   (make-local-hook 'select-frame-hook) ; xemacs
-	   nil     ; emacs
-	   )
-	  (add-hook
-	   'select-frame-hook 'ediff-xemacs-select-frame-hook nil 'local)
-	  ))
+    (when (featurep 'xemacs)
+      (ediff-with-current-buffer ctl-buffer
+	(make-local-hook 'select-frame-hook)
+	(add-hook 'select-frame-hook
+		  'ediff-xemacs-select-frame-hook nil 'local)))
 
     (ediff-with-current-buffer ctl-buffer
-      (run-hooks 'ediff-after-setup-control-frame-hook))
-    ))
+      (run-hooks 'ediff-after-setup-control-frame-hook))))
 
 
 (defun ediff-destroy-control-frame (ctl-buffer)
   (ediff-with-current-buffer ctl-buffer
     (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
 	(let ((ctl-frame ediff-control-frame))
-	  (ediff-cond-compile-for-xemacs-or-emacs
-	   (when (featurep 'menubar)
-	     (set-buffer-menubar default-menubar)) ; xemacs
-	   nil ; emacs
-	   )
+	  (if (and (featurep 'xemacs) (featurep 'menubar))
+	      (set-buffer-menubar default-menubar))
 	  (setq ediff-control-frame nil)
-	  (delete-frame ctl-frame)
-	  )))
-  (ediff-skip-unsuitable-frames)
+	  (delete-frame ctl-frame))))
+  (if ediff-multiframe
+      (ediff-skip-unsuitable-frames))
   ;;(ediff-reset-mouse nil)
   )
 

File ediff.el

View file
 
 ;;; 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)
 
 (run-hooks 'ediff-load-hook)
 
-(provide 'ediff)
-
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)