]> code.delx.au - gnu-emacs/blobdiff - lisp/ediff-init.el
(customize-changed-options): Doc addition. Load the
[gnu-emacs] / lisp / ediff-init.el
index ae6d05ab40a9fb4d8c5562c4d930a7b5da33cd6b..58a37e2566d0eec48bea85bec0f4340e0c8de613 100644 (file)
@@ -78,7 +78,8 @@ that Ediff doesn't know about.")
        (ediff-force-faces)
        ((ediff-color-display-p))
        (ediff-emacs-p (memq (ediff-device-type) '(pc)))
-       (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))
+       (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))
+       ))
 
 ;; toolbar support for emacs hasn't been implemented in ediff
 (defun ediff-has-toolbar-support-p ()
@@ -289,6 +290,9 @@ It needs to be killed when we quit the session.")
       ediff-merge-revisions-with-ancestor)))
 (ediff-defvar-local ediff-merge-job nil "")
 
+(defmacro ediff-patch-job ()
+  `(eq ediff-job-name 'epatch))
+
 (defmacro ediff-merge-with-ancestor-job ()
   `(memq
     ediff-job-name
@@ -344,12 +348,13 @@ It needs to be killed when we quit the session.")
       (ediff-patch-metajob metajob)
       ;; add more here
       ))
+;; jobs suitable for the operation of collecting diffs into a multifile patch
 (defsubst ediff-collect-diffs-metajob (&optional metajob)
   (memq (or metajob ediff-metajob-name)
        '(ediff-directories
-         ediff-directory-revisions
          ediff-merge-directories
          ediff-merge-directories-with-ancestor
+         ediff-directory-revisions
          ediff-merge-directory-revisions
          ediff-merge-directory-revisions-with-ancestor
          ;; add more here
@@ -629,11 +634,6 @@ shown in brighter colors."
   :type 'boolean
   :group 'ediff-highlighting)
 
-;; A var local to each control panel buffer.  Indicates highlighting style
-;; in effect for this buffer: `face', `ascii', nil -- temporarily
-;; unhighlighted, `off' -- turned off \(on a dumb terminal only\).
-(ediff-defvar-local ediff-highlighting-style nil "")
-
 
 ;; The suffix of the control buffer name.
 (ediff-defvar-local ediff-control-buffer-suffix nil "")
@@ -758,15 +758,15 @@ to temp files when Ediff needs to find fine differences."
 
 (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)))
+   (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
-   (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)))
+   (defalias 'ediff-read-event 'read-event)
+   (defalias 'ediff-overlayp 'overlayp)
+   (defalias 'ediff-make-overlay 'make-overlay)
+   (defalias 'ediff-delete-overlay 'delete-overlay))
  )
 
 ;; Check the current version against the major and minor version numbers
@@ -808,6 +808,14 @@ to temp files when Ediff needs to find fine differences."
     (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 
+  (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
@@ -823,18 +831,17 @@ to temp files when Ediff needs to find fine differences."
 (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)))
+       (defalias 'ediff-display-pixel-width 'device-pixel-width)
+       (defalias 'ediff-display-pixel-height 'device-pixel-height))
      (progn   ; emacs
-       (fset 'ediff-display-pixel-width
+       (defalias '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
+                'display-pixel-width
+              'x-display-pixel-width))
+       (defalias 'ediff-display-pixel-height
             (if (fboundp 'display-pixel-height)
-                (symbol-function 'display-pixel-height)
-              (symbol-function 'x-display-pixel-height))))
+                'display-pixel-height
+              'x-display-pixel-height)))
      ))
 
 ;; A-list of current-diff-overlay symbols associated with buf types
@@ -894,8 +901,9 @@ to temp files when Ediff needs to find fine differences."
 
 
 (defface ediff-current-diff-face-A
-  '((((class color)) (:foreground "firebrick" :background "pale green"))
-    (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,
@@ -916,8 +924,10 @@ this variable represents.")
 
 
 (defface ediff-current-diff-face-B
-  '((((class color)) (:foreground "DarkOrchid" :background "Yellow"))
-    (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,
@@ -937,8 +947,9 @@ this variable represents.")
 
 
 (defface ediff-current-diff-face-C
-  '((((class color)) (:foreground "Navy" :background "Pink"))
-    (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,
@@ -958,7 +969,8 @@ this variable represents.")
 
 
 (defface ediff-current-diff-face-Ancestor
-  '((((class color)) (:foreground "Black" :background "VioletRed"))
+  '((((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)
@@ -979,7 +991,8 @@ this variable represents.")
 
 
 (defface ediff-fine-diff-face-A
-  '((((class color)) (:foreground "Navy" :background "sky blue"))
+  '((((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)
@@ -993,8 +1006,9 @@ 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")))
+  '((((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,
@@ -1007,7 +1021,10 @@ this variable represents.")
 (ediff-hide-face 'ediff-fine-diff-face-B)
 
 (defface ediff-fine-diff-face-C
-  '((((class color)) (:foreground "Black" :background "Turquoise"))
+  '((((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)
@@ -1021,8 +1038,9 @@ 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")))
+  '((((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."
@@ -1046,8 +1064,11 @@ this variable represents.")
        (t "Stipple")))
 
 (defface ediff-even-diff-face-A
-  `((((class color)) (:foreground "Black" :background "light grey"))
-    (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,
@@ -1060,8 +1081,9 @@ 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)))
+  `((((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,
@@ -1074,8 +1096,11 @@ 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)))
+  `((((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,
@@ -1088,7 +1113,10 @@ this variable represents.")
 (ediff-hide-face 'ediff-even-diff-face-C)
 
 (defface ediff-even-diff-face-Ancestor
-  `((((class color)) (:foreground "White" :background "Grey"))
+  `((((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)
@@ -1109,8 +1137,10 @@ this variable represents.")
     (Ancestor . ediff-even-diff-face-Ancestor)))
 
 (defface ediff-odd-diff-face-A
-  '((((class color)) (:foreground "White" :background "Grey"))
-    (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,
@@ -1124,8 +1154,10 @@ this variable represents.")
 
 
 (defface ediff-odd-diff-face-B
-  '((((class color)) (:foreground "Black" :background "light grey"))
-    (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,
@@ -1138,8 +1170,10 @@ 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")))
+  '((((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,
@@ -1152,8 +1186,9 @@ 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")))
+  '((((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,
@@ -1338,10 +1373,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)
@@ -1515,7 +1550,7 @@ This default should work without changes."
 
 (defsubst ediff-frame-char-height (frame)
   (ediff-cond-compile-for-xemacs-or-emacs 
-   (glyph-height ediff-H-glyph (selected-window frame)) ; xemacs cse
+   (glyph-height ediff-H-glyph (frame-selected-window frame)) ; xemacs case
    (frame-char-height frame) ; emacs case
    )
   )
@@ -1702,7 +1737,7 @@ Unless optional argument INPLACE is non-nil, return a new string."
 
 
 (if (fboundp 'with-syntax-table)
-    (fset 'ediff-with-syntax-table '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"))