]> code.delx.au - gnu-emacs/blobdiff - lisp/ediff-init.el
* completion.el (add-completion-to-head, add-completion): Doc fixes.
[gnu-emacs] / lisp / ediff-init.el
index dd4e6ac7a19219680d353c29ce6a3c56fcc93c28..2dc021380de42fb361a4c6912ec74640c1bdcec3 100644 (file)
@@ -1,15 +1,16 @@
 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
 
-;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+;;   2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,9 +18,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -28,7 +27,6 @@
 ;; Start compiler pacifier
 (defvar ediff-metajob-name)
 (defvar ediff-meta-buffer)
-(defvar pm-color-alist)
 (defvar ediff-grab-mouse)
 (defvar ediff-mouse-pixel-position)
 (defvar ediff-mouse-pixel-threshold)
 (defvar ediff-multiframe)
 (defvar ediff-use-toolbar-p)
 (defvar mswindowsx-bitmap-file-path)
-
-(and noninteractive
-     (eval-when-compile
-        (load "ange-ftp" 'noerror)))
 ;; end pacifier
 
-;; Is it XEmacs?
-(defconst ediff-xemacs-p (string-match "XEmacs" emacs-version))
-;; Is it Emacs?
-(defconst ediff-emacs-p (not ediff-xemacs-p))
-
-;; 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 (string-match "XEmacs" emacs-version)
-      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
@@ -63,10 +43,9 @@ that Ediff doesn't know about.")
 
 ;; 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 ()
@@ -77,31 +56,26 @@ that Ediff doesn't know about.")
   (cond ((ediff-window-display-p))
        (ediff-force-faces)
        ((ediff-color-display-p))
-       (ediff-emacs-p (memq (ediff-device-type) '(pc)))
-       (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))
+       ((featurep 'emacs) (memq (ediff-device-type) '(pc)))
+       ((featurep 'xemacs) (memq (ediff-device-type) '(tty pc)))
        ))
 
 ;; 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 ?
        (boundp 'ediff-use-toolbar-p)
        ediff-use-toolbar-p))           ;Does the user want it ?
 
-;; Defines SYMBOL as an advertised local variable.
+;; Defines VAR as an advertised local variable.
 ;; Performs a defvar, then executes `make-variable-buffer-local' on
 ;; the variable.  Also sets the `permanent-local' property,
 ;; so that `kill-all-local-variables' (called by major-mode setting
@@ -109,6 +83,8 @@ that Ediff doesn't know about.")
 ;;
 ;; Plagiarised from `emerge-defvar-local' for XEmacs.
 (defmacro ediff-defvar-local (var value doc)
+  "Defines VAR as a local variable."
+  (declare (indent defun))
   `(progn
      (defvar ,var ,value ,doc)
      (make-variable-buffer-local ',var)
@@ -257,6 +233,8 @@ It needs to be killed when we quit the session.")
 ;; Doesn't save the point and mark.
 ;; This is `with-current-buffer' with the added test for live buffers."
 (defmacro ediff-with-current-buffer (buffer &rest body)
+  "Evaluates BODY in BUFFER."
+  (declare (indent 1) (debug (form body)))
   `(if (ediff-buffer-live-p ,buffer)
        (save-current-buffer
         (set-buffer ,buffer)
@@ -392,17 +370,17 @@ It needs to be killed when we quit the session.")
             this-command)))
 
 (defgroup ediff-highlighting nil
-  "Hilighting of difference regions in Ediff"
+  "Hilighting of difference regions in Ediff."
   :prefix "ediff-"
   :group 'ediff)
 
 (defgroup ediff-merge nil
-  "Merging utilities"
+  "Merging utilities."
   :prefix "ediff-"
   :group 'ediff)
 
 (defgroup ediff-hook nil
-  "Hooks run by Ediff"
+  "Hooks run by Ediff."
   :prefix "ediff-"
   :group 'ediff)
 
@@ -501,7 +479,7 @@ set local variables that determine how the display looks like."
 *** of %sEmacs, does not seem to be properly installed.
 ***
 *** Please contact your system administrator. "
-                                (if ediff-xemacs-p "X" "")))
+                                (if (featurep 'xemacs) "X" "")))
 
 ;; Selective browsing
 
@@ -558,24 +536,24 @@ See the documentation string of `ediff-focus-on-regexp-matches' for details.")
 
 
 ;; Highlighting
-(defcustom ediff-before-flag-bol (if ediff-xemacs-p (make-glyph "->>") "->>")
+(defcustom ediff-before-flag-bol (if (featurep 'xemacs) (make-glyph "->>") "->>")
   "*Flag placed before a highlighted block of differences, if block starts at beginning of a line."
   :type 'string
   :tag  "Region before-flag at beginning of line"
   :group 'ediff)
 
-(defcustom ediff-after-flag-eol  (if ediff-xemacs-p (make-glyph "<<-") "<<-")
+(defcustom ediff-after-flag-eol  (if (featurep 'xemacs) (make-glyph "<<-") "<<-")
   "*Flag placed after a highlighted block of differences, if block ends at end of a line."
   :type 'string
   :tag  "Region after-flag at end of line"
   :group 'ediff)
 
-(defcustom ediff-before-flag-mol (if ediff-xemacs-p (make-glyph "->>") "->>")
+(defcustom ediff-before-flag-mol (if (featurep 'xemacs) (make-glyph "->>") "->>")
   "*Flag placed before a highlighted block of differences, if block starts in mid-line."
   :type 'string
   :tag  "Region before-flag in the middle of line"
   :group 'ediff)
-(defcustom ediff-after-flag-mol  (if ediff-xemacs-p (make-glyph "<<-") "<<-")
+(defcustom ediff-after-flag-mol  (if (featurep 'xemacs) (make-glyph "<<-") "<<-")
   "*Flag placed after a highlighted block of differences, if block ends in mid-line."
   :type 'string
   :tag  "Region after-flag in the middle of line"
@@ -740,110 +718,95 @@ appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
   :group 'ediff)
 
 (defcustom ediff-coding-system-for-read 'raw-text
-  "*The coding system for read to use when running the diff program as a subprocess. 
-In most cases, the default will do. However, under certain circumstances in
-Windows NT/98/95 you might need to use something like 'raw-text-dos here.
+  "*The coding system for read to use when running the diff program as a subprocess.
+In most cases, the default will do.  However, under certain circumstances in
+MS-Windows you might need to use something like 'raw-text-dos here.
 So, if the output that your diff program sends to Emacs contains extra ^M's,
 you might need to experiment here, if the default or 'raw-text-dos doesn't
 work."
   :type 'symbol
   :group 'ediff)
 
-(defcustom ediff-coding-system-for-write 'no-conversion
+(defcustom ediff-coding-system-for-write 'emacs-internal
   "*The coding system for write to use when writing out difference regions
-to temp files when Ediff needs to find fine differences."
+to temp files in buffer jobs and when Ediff needs to find fine differences."
   :type 'symbol
   :group 'ediff)
 
 
-(ediff-cond-compile-for-xemacs-or-emacs
- (progn ; xemacs
-   (fset 'ediff-read-event (symbol-function 'next-command-event))
-   (fset 'ediff-overlayp (symbol-function 'extentp))
-   (fset 'ediff-make-overlay (symbol-function 'make-extent))
-   (fset 'ediff-delete-overlay (symbol-function 'delete-extent)))
- (progn ; emacs
-   (fset 'ediff-read-event (symbol-function 'read-event))
-   (fset 'ediff-overlayp (symbol-function 'overlayp))
-   (fset 'ediff-make-overlay (symbol-function 'make-overlay))
-   (fset 'ediff-delete-overlay (symbol-function '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
-;; emacs-minor-version are not defined, we assume that the current version
-;; is hopelessly outdated.  We assume that emacs-major-version and
-;; emacs-minor-version are defined.  Otherwise, for Emacs/XEmacs 19, if the
-;; current minor version is < 10 (xemacs) or < 23 (emacs) the return value
-;; will be nil (when op is =, >, or >=) and t (when op is <, <=), which may be
-;; incorrect.  However, this gives correct result in our cases, since we are
-;; testing for sufficiently high Emacs versions.
-(defun ediff-check-version (op major minor &optional type-of-emacs)
-  (if (and (boundp 'emacs-major-version) (boundp 'emacs-minor-version))
-      (and (cond ((eq type-of-emacs 'xemacs) ediff-xemacs-p)
-                ((eq type-of-emacs 'emacs) ediff-emacs-p)
-                (t t))
-          (cond ((eq op '=) (and (= emacs-minor-version minor)
-                                 (= emacs-major-version major)))
-                ((memq op '(> >= < <=))
-                 (and (or (funcall op emacs-major-version major)
-                          (= emacs-major-version major))
-                      (if (= emacs-major-version major)
-                          (funcall op emacs-minor-version minor)
-                        t)))
-                (t
-                 (error "%S: Invalid op in ediff-check-version" op))))
-    (cond ((memq op '(= > >=)) nil)
-         ((memq op '(< <=)) t))))
+(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))
+
+;; Assumes that emacs-major-version and emacs-minor-version are defined.
+(defun ediff-check-version (op major minor &optional type-of-emacs)
+  "Check the current version against MAJOR and MINOR version numbers.
+The comparison uses operator OP, which may be any of: =, >, >=, <, <=.
+TYPE-OF-EMACS is either 'xemacs or 'emacs."
+  (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs))
+            ((eq type-of-emacs 'emacs) (featurep 'emacs))
+            (t))
+       (cond ((eq op '=) (and (= emacs-minor-version minor)
+                             (= emacs-major-version major)))
+            ((memq op '(> >= < <=))
+             (and (or (funcall op emacs-major-version major)
+                      (= emacs-major-version major))
+                  (if (= emacs-major-version major)
+                      (funcall op emacs-minor-version minor)
+                    t)))
+            (t
+             (error "%S: Invalid op in ediff-check-version" op)))))
+
+;; ediff-check-version seems to be totally unused anyway.
+(make-obsolete 'ediff-check-version 'version< "23.1")
 
 (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)))
 
 
 ;; A var local to each control panel buffer.  Indicates highlighting style
 ;; in effect for this buffer: `face', `ascii',
 ;; `off' -- turned off \(on a dumb terminal only\).
-(ediff-defvar-local ediff-highlighting-style 
+(ediff-defvar-local ediff-highlighting-style
   (if (and (ediff-has-face-support-p) ediff-use-faces) 'face 'ascii)
   "")
 
 
 (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
-       (fset 'ediff-display-pixel-width (symbol-function 'device-pixel-width))
-       (fset 'ediff-display-pixel-height
-            (symbol-function 'device-pixel-height)))
-     (progn   ; emacs
-       (fset 'ediff-display-pixel-width
-            (if (fboundp 'display-pixel-width)
-                (symbol-function 'display-pixel-width)
-              (symbol-function 'x-display-pixel-width)))
-       (fset 'ediff-display-pixel-height
-            (if (fboundp 'display-pixel-height)
-                (symbol-function 'display-pixel-height)
-              (symbol-function '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
@@ -854,10 +817,10 @@ to temp files when Ediff needs to find fine differences."
 
 ;; A-list of current-diff-face-* symbols associated with buf types
 (defconst ediff-current-diff-face-alist
-  '((A . ediff-current-diff-face-A)
-    (B . ediff-current-diff-face-B)
-    (C . ediff-current-diff-face-C)
-    (Ancestor . ediff-current-diff-face-Ancestor)))
+  '((A . ediff-current-diff-A)
+    (B . ediff-current-diff-B)
+    (C . ediff-current-diff-C)
+    (Ancestor . ediff-current-diff-Ancestor)))
 
 
 (defun ediff-set-overlay-face (extent face)
@@ -896,153 +859,218 @@ to temp files when Ediff needs to find fine differences."
         (sit-for 1)))))
 
 (defun ediff-hide-face (face)
-  (if (and (ediff-has-face-support-p) ediff-emacs-p)
+  (if (and (ediff-has-face-support-p)
+          (boundp 'add-to-list)
+          (boundp 'facemenu-unlisted-faces))
       (add-to-list 'facemenu-unlisted-faces face)))
 
 
 
-(defface ediff-current-diff-face-A
-  '((((class color)) (:foreground "firebrick" :background "pale green"))
-    (t (:inverse-video t)))
+(defface ediff-current-diff-A
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "firebrick" :background "pale green"))
+       (((class color))
+        (:foreground "blue3" :background "yellow3"))
+       (t                   (:inverse-video t)))
+    '((((type tty))    (:foreground "blue3" :background "yellow3"))
+      (((class color)) (:foreground "firebrick" :background "pale green"))
+      (t                    (:inverse-video t))))
   "Face for highlighting the selected difference in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-current-diff-face-A 'ediff-current-diff-face-A
+(defvar ediff-current-diff-face-A 'ediff-current-diff-A
   "Face for highlighting the selected difference in buffer A.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-current-diff-face-A'
+widget to customize the actual face object `ediff-current-diff-A'
 this variable represents.")
-(ediff-hide-face 'ediff-current-diff-face-A)
+(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 ediff-xemacs-p
-        (ediff-has-face-support-p)
-        (not (ediff-color-display-p)))
-    (copy-face 'modeline 'ediff-current-diff-face-A))
-
-
-
-(defface ediff-current-diff-face-B
-  '((((class color)) (:foreground "DarkOrchid" :background "Yellow"))
-    (t (:inverse-video t)))
+(and (featurep 'xemacs)
+     (ediff-has-face-support-p)
+     (not (ediff-color-display-p))
+     (copy-face 'modeline ediff-current-diff-face-A))
+
+
+
+(defface ediff-current-diff-B
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "DarkOrchid" :background "Yellow"))
+       (((class color))
+        (:foreground "magenta3" :background "yellow3"
+                     :weight bold))
+       (t                   (:inverse-video t)))
+    '((((type tty))    (:foreground "magenta3" :background "yellow3"
+                                   :weight bold))
+      (((class color)) (:foreground "DarkOrchid" :background "Yellow"))
+      (t                    (:inverse-video t))))
   "Face for highlighting the selected difference in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-current-diff-face-B 'ediff-current-diff-face-B
+(defvar ediff-current-diff-face-B 'ediff-current-diff-B
   "Face for highlighting the selected difference in buffer B.
  this variable.  Instead, use the customization
-widget to customize the actual face `ediff-current-diff-face-B'
+widget to customize the actual face `ediff-current-diff-B'
 this variable represents.")
-(ediff-hide-face 'ediff-current-diff-face-B)
+(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 ediff-xemacs-p
-        (ediff-has-face-support-p)
-        (not (ediff-color-display-p)))
-    (copy-face 'modeline 'ediff-current-diff-face-B))
-
-
-(defface ediff-current-diff-face-C
-  '((((class color)) (:foreground "Navy" :background "Pink"))
-    (t (:inverse-video t)))
+(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
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "Navy" :background "Pink"))
+       (((class color))
+        (:foreground "cyan3" :background "yellow3" :weight bold))
+       (t                   (:inverse-video t)))
+    '((((type tty))    (:foreground "cyan3" :background "yellow3" :weight bold))
+      (((class color)) (:foreground "Navy" :background "Pink"))
+      (t                    (:inverse-video t))))
   "Face for highlighting the selected difference in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-current-diff-face-C 'ediff-current-diff-face-C
+(defvar ediff-current-diff-face-C 'ediff-current-diff-C
   "Face for highlighting the selected difference in buffer C.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-current-diff-face-C'
+widget to customize the actual face object `ediff-current-diff-C'
 this variable represents.")
-(ediff-hide-face 'ediff-current-diff-face-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 ediff-xemacs-p
-        (ediff-has-face-support-p)
-        (not (ediff-color-display-p)))
-    (copy-face 'modeline 'ediff-current-diff-face-C))
-
-
-(defface ediff-current-diff-face-Ancestor
-  '((((class color)) (:foreground "Black" :background "VioletRed"))
-    (t (:inverse-video t)))
+(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
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "Black" :background "VioletRed"))
+       (((class color))
+        (:foreground "black" :background "magenta3"))
+       (t (:inverse-video t)))
+    '((((type tty))    (:foreground "black" :background "magenta3"))
+      (((class color)) (:foreground "Black" :background "VioletRed"))
+      (t (:inverse-video t))))
   "Face for highlighting the selected difference in buffer Ancestor."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-current-diff-face-Ancestor 'ediff-current-diff-face-Ancestor
+(defvar ediff-current-diff-face-Ancestor 'ediff-current-diff-Ancestor
   "Face for highlighting the selected difference in buffer Ancestor.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-current-diff-face-Ancestor'
+widget to customize the actual face object `ediff-current-diff-Ancestor'
 this variable represents.")
-(ediff-hide-face 'ediff-current-diff-face-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 ediff-xemacs-p
-        (ediff-has-face-support-p)
-        (not (ediff-color-display-p)))
-    (copy-face 'modeline 'ediff-current-diff-face-Ancestor))
-
-
-(defface ediff-fine-diff-face-A
-  '((((class color)) (:foreground "Navy" :background "sky blue"))
-    (t (:underline t :stipple "gray3")))
+(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
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "Navy" :background "sky blue"))
+       (((class color))
+        (:foreground "white" :background "sky blue" :weight bold))
+       (t (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "white" :background "sky blue" :weight bold))
+      (((class color)) (:foreground "Navy" :background "sky blue"))
+      (t (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-fine-diff-face-A 'ediff-fine-diff-face-A
+(defvar ediff-fine-diff-face-A 'ediff-fine-diff-A
   "Face for highlighting the fine differences in buffer A.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-fine-diff-face-A'
+widget to customize the actual face object `ediff-fine-diff-A'
 this variable represents.")
-(ediff-hide-face 'ediff-fine-diff-face-A)
-
-(defface ediff-fine-diff-face-B
-  '((((class color)) (:foreground "Black" :background "cyan"))
-    (t (:underline t :stipple "gray3")))
+(ediff-hide-face ediff-fine-diff-face-A)
+
+(defface ediff-fine-diff-B
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "Black" :background "cyan"))
+       (((class color))
+        (:foreground "magenta3" :background "cyan3"))
+       (t                   (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "magenta3" :background "cyan3"))
+      (((class color)) (:foreground "Black" :background "cyan"))
+      (t                    (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-fine-diff-face-B 'ediff-fine-diff-face-B
+(defvar ediff-fine-diff-face-B 'ediff-fine-diff-B
   "Face for highlighting the fine differences in buffer B.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-fine-diff-face-B'
+widget to customize the actual face object `ediff-fine-diff-B'
 this variable represents.")
-(ediff-hide-face 'ediff-fine-diff-face-B)
-
-(defface ediff-fine-diff-face-C
-  '((((class color)) (:foreground "Black" :background "Turquoise"))
-    (t (:underline t :stipple "gray3")))
+(ediff-hide-face ediff-fine-diff-face-B)
+
+(defface ediff-fine-diff-C
+  (if (featurep 'emacs)
+      '((((type pc))
+        (:foreground "white" :background "Turquoise"))
+       (((class color) (min-colors 16))
+        (:foreground "Black" :background "Turquoise"))
+       (((class color))
+        (:foreground "yellow3" :background "Turquoise"
+                     :weight bold))
+       (t (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "yellow3" :background "Turquoise"
+                                   :weight bold))
+      (((type pc))     (:foreground "white" :background "Turquoise"))
+      (((class color)) (:foreground "Black" :background "Turquoise"))
+      (t (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-fine-diff-face-C 'ediff-fine-diff-face-C
+(defvar ediff-fine-diff-face-C 'ediff-fine-diff-C
   "Face for highlighting the fine differences in buffer C.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-fine-diff-face-C'
+widget to customize the actual face object `ediff-fine-diff-C'
 this variable represents.")
-(ediff-hide-face 'ediff-fine-diff-face-C)
-
-(defface ediff-fine-diff-face-Ancestor
-  '((((class color)) (:foreground "Black" :background "Green"))
-    (t (:underline t :stipple "gray3")))
+(ediff-hide-face ediff-fine-diff-face-C)
+
+(defface ediff-fine-diff-Ancestor
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "Black" :background "Green"))
+       (((class color))
+        (:foreground "red3" :background "green"))
+       (t                   (:underline t :stipple "gray3")))
+    '((((type tty))    (:foreground "red3" :background "green"))
+      (((class color)) (:foreground "Black" :background "Green"))
+      (t                    (:underline t :stipple "gray3"))))
   "Face for highlighting the refinement of the selected diff in the ancestor buffer.
 At present, this face is not used and no fine differences are computed for the
 ancestor buffer."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-fine-diff-face-Ancestor 'ediff-fine-diff-face-Ancestor
+(defvar ediff-fine-diff-face-Ancestor 'ediff-fine-diff-Ancestor
   "Face for highlighting the fine differences in buffer Ancestor.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-fine-diff-face-Ancestor'
+widget to customize the actual face object `ediff-fine-diff-Ancestor'
 this variable represents.")
-(ediff-hide-face 'ediff-fine-diff-face-Ancestor)
+(ediff-hide-face ediff-fine-diff-face-Ancestor)
 
 ;; Some installs don't have stipple or Stipple. So, try them in turn.
 (defvar stipple-pixmap
@@ -1053,148 +1081,228 @@ this variable represents.")
              (locate-library "stipple" t mswindowsx-bitmap-file-path)) "stipple")
        (t "Stipple")))
 
-(defface ediff-even-diff-face-A
-  `((((class color)) (:foreground "Black" :background "light grey"))
-    (t (:italic t :stipple ,stipple-pixmap)))
+(defface ediff-even-diff-A
+  (if (featurep 'emacs)
+      `((((type pc))
+        (:foreground "green3" :background "light grey"))
+       (((class color) (min-colors 16))
+        (:foreground "Black" :background "light grey"))
+       (((class color))
+        (:foreground "red3" :background "light grey"
+                     :weight bold))
+       (t                   (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "red3" :background "light grey"
+                                   :weight bold))
+      (((type pc))     (:foreground "green3" :background "light grey"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t                    (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-even-diff-face-A 'ediff-even-diff-face-A
+(defvar ediff-even-diff-face-A 'ediff-even-diff-A
   "Face for highlighting even-numbered non-current differences in buffer A.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-even-diff-face-A'
+widget to customize the actual face object `ediff-even-diff-A'
 this variable represents.")
-(ediff-hide-face 'ediff-even-diff-face-A)
-
-(defface ediff-even-diff-face-B
-  `((((class color)) (:foreground "White" :background "Grey"))
-    (t (:italic t :stipple ,stipple-pixmap)))
+(ediff-hide-face ediff-even-diff-face-A)
+
+(defface ediff-even-diff-B
+  (if (featurep 'emacs)
+      `((((class color) (min-colors 16))
+        (:foreground "White" :background "Grey"))
+       (((class color))
+        (:foreground "blue3" :background "Grey" :weight bold))
+       (t                   (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "blue3" :background "Grey" :weight bold))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t                    (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-even-diff-face-B 'ediff-even-diff-face-B
+(defvar ediff-even-diff-face-B 'ediff-even-diff-B
   "Face for highlighting even-numbered non-current differences in buffer B.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-even-diff-face-B'
+widget to customize the actual face object `ediff-even-diff-B'
 this variable represents.")
-(ediff-hide-face 'ediff-even-diff-face-B)
-
-(defface ediff-even-diff-face-C
-  `((((class color)) (:foreground "Black" :background "light grey"))
-    (t (:italic t :stipple ,stipple-pixmap)))
+(ediff-hide-face ediff-even-diff-face-B)
+
+(defface ediff-even-diff-C
+  (if (featurep 'emacs)
+      `((((type pc))
+        (:foreground "yellow3" :background "light grey"))
+       (((class color) (min-colors 16))
+        (:foreground "Black" :background "light grey"))
+       (((class color))
+        (:foreground "yellow3" :background "light grey"
+                     :weight bold))
+       (t                   (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "yellow3" :background "light grey"
+                                   :weight bold))
+      (((type pc))     (:foreground "yellow3" :background "light grey"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t                    (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-even-diff-face-C 'ediff-even-diff-face-C
+(defvar ediff-even-diff-face-C 'ediff-even-diff-C
   "Face for highlighting even-numbered non-current differences in buffer C.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-even-diff-face-C'
+widget to customize the actual face object `ediff-even-diff-C'
 this variable represents.")
-(ediff-hide-face 'ediff-even-diff-face-C)
-
-(defface ediff-even-diff-face-Ancestor
-  `((((class color)) (:foreground "White" :background "Grey"))
-    (t (:italic t :stipple ,stipple-pixmap)))
+(ediff-hide-face ediff-even-diff-face-C)
+
+(defface ediff-even-diff-Ancestor
+  (if (featurep 'emacs)
+      `((((type pc))
+        (:foreground "cyan3" :background "light grey"))
+       (((class color) (min-colors 16))
+        (:foreground "White" :background "Grey"))
+       (((class color))
+        (:foreground "cyan3" :background "light grey"
+                     :weight bold))
+       (t (:italic t :stipple ,stipple-pixmap)))
+    `((((type tty))    (:foreground "cyan3" :background "light grey"
+                                   :weight bold))
+      (((type pc))     (:foreground "cyan3" :background "light grey"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t (:italic t :stipple ,stipple-pixmap))))
   "Face for highlighting even-numbered non-current differences in the ancestor buffer."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-even-diff-face-Ancestor 'ediff-even-diff-face-Ancestor
+(defvar ediff-even-diff-face-Ancestor 'ediff-even-diff-Ancestor
   "Face for highlighting even-numbered non-current differences in buffer Ancestor.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-even-diff-face-Ancestor'
+widget to customize the actual face object `ediff-even-diff-Ancestor'
 this variable represents.")
-(ediff-hide-face 'ediff-even-diff-face-Ancestor)
+(ediff-hide-face ediff-even-diff-face-Ancestor)
 
 ;; Association between buffer types and even-diff-face symbols
 (defconst ediff-even-diff-face-alist
-  '((A . ediff-even-diff-face-A)
-    (B . ediff-even-diff-face-B)
-    (C . ediff-even-diff-face-C)
-    (Ancestor . ediff-even-diff-face-Ancestor)))
-
-(defface ediff-odd-diff-face-A
-  '((((class color)) (:foreground "White" :background "Grey"))
-    (t (:italic t :stipple "gray1")))
+  '((A . ediff-even-diff-A)
+    (B . ediff-even-diff-B)
+    (C . ediff-even-diff-C)
+    (Ancestor . ediff-even-diff-Ancestor)))
+
+(defface ediff-odd-diff-A
+  (if (featurep 'emacs)
+      '((((type pc))
+        (:foreground "green3" :background "gray40"))
+       (((class color) (min-colors 16))
+        (:foreground "White" :background "Grey"))
+       (((class color))
+        (:foreground "red3" :background "black" :weight bold))
+       (t                   (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "red3" :background "black" :weight bold))
+      (((type pc))     (:foreground "green3" :background "gray40"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t                    (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer A."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-odd-diff-face-A 'ediff-odd-diff-face-A
+(defvar ediff-odd-diff-face-A 'ediff-odd-diff-A
   "Face for highlighting odd-numbered non-current differences in buffer A.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-odd-diff-face-A'
+widget to customize the actual face object `ediff-odd-diff-A'
 this variable represents.")
-(ediff-hide-face 'ediff-odd-diff-face-A)
-
-
-(defface ediff-odd-diff-face-B
-  '((((class color)) (:foreground "Black" :background "light grey"))
-    (t (:italic t :stipple "gray1")))
+(ediff-hide-face ediff-odd-diff-face-A)
+
+
+(defface ediff-odd-diff-B
+  (if (featurep 'emacs)
+      '((((type pc))
+        (:foreground "White" :background "gray40"))
+       (((class color) (min-colors 16))
+        (:foreground "Black" :background "light grey"))
+       (((class color))
+        (:foreground "cyan3" :background "black" :weight bold))
+       (t                   (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "cyan3" :background "black" :weight bold))
+      (((type pc))     (:foreground "White" :background "gray40"))
+      (((class color)) (:foreground "Black" :background "light grey"))
+      (t                    (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer B."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-odd-diff-face-B 'ediff-odd-diff-face-B
+(defvar ediff-odd-diff-face-B 'ediff-odd-diff-B
   "Face for highlighting odd-numbered non-current differences in buffer B.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-odd-diff-face-B'
+widget to customize the actual face object `ediff-odd-diff-B'
 this variable represents.")
-(ediff-hide-face 'ediff-odd-diff-face-B)
-
-(defface ediff-odd-diff-face-C
-  '((((class color)) (:foreground "White" :background "Grey"))
-    (t (:italic t :stipple "gray1")))
+(ediff-hide-face ediff-odd-diff-face-B)
+
+(defface ediff-odd-diff-C
+  (if (featurep 'emacs)
+      '((((type pc))
+        (:foreground "yellow3" :background "gray40"))
+       (((class color) (min-colors 16))
+        (:foreground "White" :background "Grey"))
+       (((class color))
+        (:foreground "yellow3" :background "black" :weight bold))
+       (t                   (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "yellow3" :background "black" :weight bold))
+      (((type pc))     (:foreground "yellow3" :background "gray40"))
+      (((class color)) (:foreground "White" :background "Grey"))
+      (t                    (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in buffer C."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-odd-diff-face-C 'ediff-odd-diff-face-C
+(defvar ediff-odd-diff-face-C 'ediff-odd-diff-C
   "Face for highlighting odd-numbered non-current differences in buffer C.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-odd-diff-face-C'
+widget to customize the actual face object `ediff-odd-diff-C'
 this variable represents.")
-(ediff-hide-face 'ediff-odd-diff-face-C)
-
-(defface ediff-odd-diff-face-Ancestor
-  '((((class color)) (:foreground "Black" :background "light grey"))
-    (t (:italic t :stipple "gray1")))
+(ediff-hide-face ediff-odd-diff-face-C)
+
+(defface ediff-odd-diff-Ancestor
+  (if (featurep 'emacs)
+      '((((class color) (min-colors 16))
+        (:foreground "cyan3" :background "gray40"))
+       (((class color))
+        (:foreground "green3" :background "black" :weight bold))
+       (t                   (:italic t :stipple "gray1")))
+    '((((type tty))    (:foreground "green3" :background "black" :weight bold))
+      (((class color)) (:foreground "cyan3" :background "gray40"))
+      (t                    (:italic t :stipple "gray1"))))
   "Face for highlighting odd-numbered non-current differences in the ancestor buffer."
   :group 'ediff-highlighting)
 ;; An internal variable.  Ediff takes the face from here.  When unhighlighting,
 ;; this variable is set to nil, then again to the appropriate face.
-(defvar ediff-odd-diff-face-Ancestor 'ediff-odd-diff-face-Ancestor
+(defvar ediff-odd-diff-face-Ancestor 'ediff-odd-diff-Ancestor
   "Face for highlighting odd-numbered non-current differences in buffer Ancestor.
 DO NOT CHANGE this variable.  Instead, use the customization
-widget to customize the actual face object `ediff-odd-diff-face-Ancestor'
+widget to customize the actual face object `ediff-odd-diff-Ancestor'
 this variable represents.")
-(ediff-hide-face 'ediff-odd-diff-face-Ancestor)
+(ediff-hide-face ediff-odd-diff-face-Ancestor)
 
 ;; Association between buffer types and odd-diff-face symbols
 (defconst ediff-odd-diff-face-alist
-  '((A . ediff-odd-diff-face-A)
-    (B . ediff-odd-diff-face-B)
-    (C . ediff-odd-diff-face-C)
-    (Ancestor . ediff-odd-diff-face-Ancestor)))
+  '((A . ediff-odd-diff-A)
+    (B . ediff-odd-diff-B)
+    (C . ediff-odd-diff-C)
+    (Ancestor . ediff-odd-diff-Ancestor)))
 
 ;; A-list of fine-diff face symbols associated with buffer types
 (defconst ediff-fine-diff-face-alist
-  '((A . ediff-fine-diff-face-A)
-    (B . ediff-fine-diff-face-B)
-    (C . ediff-fine-diff-face-C)
-    (Ancestor . ediff-fine-diff-face-Ancestor)))
+  '((A . ediff-fine-diff-A)
+    (B . ediff-fine-diff-B)
+    (C . ediff-fine-diff-C)
+    (Ancestor . ediff-fine-diff-Ancestor)))
 
 ;; Help echo
-(put 'ediff-fine-diff-face-A 'ediff-help-echo
+(put ediff-fine-diff-face-A 'ediff-help-echo
      "A `refinement' of the current difference region")
-(put 'ediff-fine-diff-face-B 'ediff-help-echo
+(put ediff-fine-diff-face-B 'ediff-help-echo
      "A `refinement' of the current difference region")
-(put 'ediff-fine-diff-face-C 'ediff-help-echo
+(put ediff-fine-diff-face-C 'ediff-help-echo
      "A `refinement' of the current difference region")
-(put 'ediff-fine-diff-face-Ancestor 'ediff-help-echo
+(put ediff-fine-diff-face-Ancestor 'ediff-help-echo
      "A `refinement' of the current difference region")
 
 (add-hook 'ediff-quit-hook 'ediff-cleanup-mess)
@@ -1216,33 +1324,28 @@ this variable represents.")
 (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
@@ -1261,13 +1364,14 @@ This property can be toggled interactively."
 ;;; Misc
 
 ;; if nil, this silences some messages
-(defconst ediff-verbose-p t)
+(defvar ediff-verbose-p t)
 
 (defcustom ediff-autostore-merges  'group-jobs-only
   "*Save the results of merge jobs automatically.
-nil means don't save automatically.  t means always save.  Anything else
-means save automatically only if the merge job is part of a group of jobs, such
-as `ediff-merge-directory' or `ediff-merge-directory-revisions'."
+With value nil, don't save automatically.  With value t, always
+save.  Anything else means save automatically only if the merge
+job is part of a group of jobs, such as `ediff-merge-directory'
+or `ediff-merge-directory-revisions'."
   :type '(choice (const nil) (const t) (const group-jobs-only))
   :group 'ediff-merge)
 (make-variable-buffer-local 'ediff-autostore-merges)
@@ -1296,8 +1400,6 @@ Instead, C-h would jump to previous difference."
 ;;;  (file-name-as-directory
 ;;;   (cond ((memq system-type '(ms-dos windows-nt))
 ;;;      (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
-;;;     ((memq system-type '(vax-vms axp-vms))
-;;;      (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "SYS$SCRATCH:"))
 ;;;     (t
 ;;;      (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp"))))
   "*Prefix to put on Ediff temporary file names.
@@ -1319,7 +1421,7 @@ This default should work without changes."
   :group 'ediff)
 
 ;; needed to simulate frame-char-width in XEmacs.
-(defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H")))
+(defvar ediff-H-glyph (if (featurep 'xemacs) (make-glyph "H")))
 
 
 ;; Temporary file used for refining difference regions in buffer A.
@@ -1330,11 +1432,8 @@ This default should work without changes."
 (ediff-defvar-local ediff-temp-file-C nil "")
 
 
-;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
-;; if find-file-name-handler is defined for 'file-local-copy
 (defun ediff-file-remote-p (file-name)
-  (or (and (fboundp 'file-remote-p) (file-remote-p file-name))
-      (find-file-name-handler file-name 'file-local-copy)))
+  (file-remote-p file-name))
 
 ;; File for which we can get attributes, such as size or date
 (defun ediff-listable-file (file-name)
@@ -1346,10 +1445,10 @@ This default should work without changes."
   (cdr (assq 'unsplittable (frame-parameters frame))))
 
 (defsubst ediff-get-next-window (wind prev-wind)
-  (or (window-live-p wind)
-      (setq wind (if prev-wind
-                    (next-window wind)
-                  (selected-window)))))
+  (cond ((window-live-p wind) wind)
+       (prev-wind (next-window wind))
+       (t (selected-window))
+       ))
 
 
 (defsubst ediff-kill-buffer-carefully (buf)
@@ -1402,8 +1501,8 @@ This default should work without changes."
 ;; 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))
@@ -1417,54 +1516,45 @@ This default should work without changes."
 
 
 (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 nil))))
+       (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 nil))))
+       (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
@@ -1474,16 +1564,15 @@ This default should work without changes."
 
 
 (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)))
   (if (ediff-window-display-p)
       (let ((frame-or-wind frame))
-       (if ediff-xemacs-p
+       (if (featurep 'xemacs)
            (setq frame-or-wind (frame-selected-window frame)))
        (or do-not-grab-mouse
            ;; don't set mouse if the user said to never do this
@@ -1522,29 +1611,23 @@ This default should work without changes."
            (t nil))))
 
 (defsubst ediff-frame-char-height (frame)
-  (ediff-cond-compile-for-xemacs-or-emacs 
-   (glyph-height ediff-H-glyph (selected-window frame)) ; xemacs cse
-   (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)))
@@ -1552,18 +1635,16 @@ This default should work without changes."
 ;; 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
@@ -1573,10 +1654,9 @@ This default should work without changes."
 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)))))
@@ -1585,10 +1665,9 @@ Checks if overlay's buffer exists before actually doing the move."
   "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
@@ -1598,12 +1677,10 @@ Checks if overlay's buffer exists."
         (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,
@@ -1666,7 +1743,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
         "Merge dir versions via ancestors")
        (t
         (capitalize
-         (subst-char-in-string ?- ?\  (substring (symbol-name jobname) 6))))
+         (subst-char-in-string ?- ?\s (substring (symbol-name jobname) 6))))
        ))
 
 
@@ -1684,9 +1761,6 @@ Unless optional argument INPLACE is non-nil, return a new string."
   "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)))
@@ -1708,31 +1782,34 @@ Unless optional argument INPLACE is non-nil, return a new string."
       (convert-standard-filename fname)
     fname))
 
+(if (featurep 'emacs)
+    (defalias 'ediff-with-syntax-table 'with-syntax-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))))))))
 
-(if (fboundp 'with-syntax-table)
-    (fset '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)
 
 
-;;; Local Variables:
-;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
-;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
-;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
-;;; End:
 
-(provide 'ediff-init)
+;; Local Variables:
+;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
+;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
+;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
+;; End:
 
+;; arch-tag: fa31d384-1e70-4d4b-82a7-3e96307c46f5
 ;;; ediff-init.el ends here