]> code.delx.au - gnu-emacs/blobdiff - lisp/ediff-diff.el
(vc-annotate-display): Delete old overlays. Fix check for major-mode.
[gnu-emacs] / lisp / ediff-diff.el
index 6a9bc8d51f8bb55817c9d7cfa5429f4bf017f29b..e773ba44e04351e8cb22c011d4e2a5d9c89715b4 100644 (file)
@@ -59,6 +59,11 @@ to a shell that you are not using or, better, fix your shell's startup file."
   :type 'string
   :group 'ediff-diff)
 
+(defcustom ediff-cmp-program "cmp"
+  "*Utility to use to determine if two files are identical.
+It must return code 0, if its arguments are identical files."
+  :type 'string
+  :group 'ediff-diff)
 
 (defcustom ediff-diff-program "diff"
   "*Program to use for generating the differential of the two files."
@@ -68,8 +73,7 @@ to a shell that you are not using or, better, fix your shell's startup file."
   "*Options to pass to `ediff-diff-program'. 
 If diff\(1\) is used as `ediff-diff-program', then the most useful options are
 `-w', to ignore space, and `-i', to ignore case of letters.
-At present, the option `-c' is ignored, since Ediff doesn't understand this
-type of output."
+At present, the option `-c' is not allowed."
   :type 'string
   :group 'ediff-diff)
 
@@ -129,14 +133,24 @@ Use `setq-default' if setting it in .emacs")
 ;;; General
 
 (defvar ediff-diff-ok-lines-regexp  
-  "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|.*Warning *:\\|.*No +newline\\|.*missing +newline\\|^\C-m$\\)"
+  (concat
+   "^\\("
+   "[0-9,]+[acd][0-9,]+\C-m?$"
+   "\\|[<>] "
+   "\\|---"
+   "\\|.*Warning *:"
+   "\\|.*No +newline"
+   "\\|.*missing +newline"
+   "\\|^\C-m?$"
+   "\\)")
   "Regexp that matches normal output lines from `ediff-diff-program'.
 This is mostly lifted from Emerge, except that Ediff also considers
 warnings and `Missing newline'-type messages to be normal output.
 Lines that do not match are assumed to be error messages.")
 
-(defvar ediff-match-diff-line (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
-                               (concat "^" x "\\([acd]\\)" x "$"))
+(defvar ediff-match-diff-line
+  (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
+    (concat "^" x "\\([acd]\\)" x "\C-m?$"))
   "Pattern to match lines produced by diff that describe differences.")
 
 (ediff-defvar-local ediff-setup-diff-regions-function nil
@@ -158,9 +172,8 @@ one optional arguments, diff-number to refine.")
 ;; ediff-setup-diff-regions-function, which can also have the value
 ;; ediff-setup-diff-regions3, which takes 4 arguments.
 (defun ediff-setup-diff-regions (file-A file-B file-C)
-;;;  ;; Force all minibuffers to display ediff's messages.
-;;;  ;; When xemacs implements minibufferless frames, this won't be necessary
-;;;  (if ediff-xemacs-p (setq synchronize-minibuffers t))
+  (if (string-match "c" ediff-diff-options)
+      (error "Option `-c' is not allowed in `ediff-diff-options'"))
                                                  
   ;; create, if it doesn't exist
   (or (ediff-buffer-live-p ediff-diff-buffer)
@@ -210,7 +223,6 @@ one optional arguments, diff-number to refine.")
                                 diff-buffer
                                 'synchronize
                                 ediff-diff-options file1 file2)
-            ;;(message "Computing differences ... done")
             (message "")
             (ediff-with-current-buffer diff-buffer
               (buffer-size))))))
@@ -1043,11 +1055,6 @@ one optional arguments, diff-number to refine.")
 ;; File-C is either the third file to compare (in case of 3-way comparison)
 ;; or it is the ancestor file.
 (defun ediff-setup-diff-regions3 (file-A file-B file-C)
-  
-;;;  ;; force all minibuffers to display ediff's messages.
-;;;  ;; when xemacs implements minibufferless frames, this won't be necessary
-;;;  (if ediff-xemacs-p (setq synchronize-minibuffers t))
-                                                 
   (or (ediff-buffer-live-p ediff-diff-buffer)
       (setq ediff-diff-buffer
            (get-buffer-create (ediff-unique-buffer-name "*ediff-diff" "*"))))
@@ -1243,6 +1250,11 @@ argument to `skip-chars-forward'."
          (funcall fwd-word-fun))
       (point))))
 
+(defun ediff-same-file-contents (f1 f2)
+  "T if F1 and F2 have identical contents."
+  (let ((res (call-process ediff-cmp-program nil nil nil f1 f2)))
+    (and (numberp res) (eq res 0))))
+
 
 ;;; Local Variables:
 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)