changeset 60151:905bf9de87af

* ediff.el (ediff-set-diff-overlays-in-one-buffer, ediff-set-fine-overlays-in-one-buffer,ediff-goto-word) make sure we use the syntax table of the correct buffer. (ediff-same-file-contents,ediff-same-contents): enhancements thanks to Felix Gatzemeier. * ediff-init.el (ediff-hide-face): checks for definedness of functions. (ediff-file-remote-p): make synonymous with file-remote-p. In all deffaces ediff-*-face-*, use min-colors. * ediff-mult.el (ediff-meta-mark-equal-files): make use of ediff-recurse-to-subdirectories. (ediff-mark-if-equal): check that the arguments are strings, use ediff-same-contents (after to Felix Gatzemeier). * ediff.el (ediff-merge-on-startup): don't set buffer-modified-p to nil.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Sat, 19 Feb 2005 04:46:24 +0000
parents ffb5cb773521
children 9034298c06c1
files lisp/ChangeLog lisp/ediff-diff.el lisp/ediff-init.el lisp/ediff-mult.el lisp/ediff.el man/ediff.texi
diffstat 6 files changed, 127 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Feb 18 22:55:53 2005 +0000
+++ b/lisp/ChangeLog	Sat Feb 19 04:46:24 2005 +0000
@@ -1,3 +1,23 @@
+2005-02-19  Michael Kifer  <kifer@cs.stonybrook.edu>
+	
+	* ediff.el (ediff-set-diff-overlays-in-one-buffer,
+	ediff-set-fine-overlays-in-one-buffer,ediff-goto-word) make sure
+	we use the syntax table of the correct buffer.
+	(ediff-same-file-contents,ediff-same-contents): enhancements thanks to
+	Felix Gatzemeier.
+	
+	* ediff-init.el (ediff-hide-face): checks for definedness of functions.
+	(ediff-file-remote-p): make synonymous with file-remote-p.
+	In all deffaces ediff-*-face-*, use min-colors.
+	
+	* ediff-mult.el (ediff-meta-mark-equal-files): make use of
+        ediff-recurse-to-subdirectories.
+	(ediff-mark-if-equal): check that the arguments are strings, use
+	ediff-same-contents (after to Felix Gatzemeier).
+	
+	* ediff.el (ediff-merge-on-startup): don't set buffer-modified-p to
+	nil.
+	
 2005-02-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* log-view.el (log-view-message-re): Fix up Subversion regexp.
--- a/lisp/ediff-diff.el	Fri Feb 18 22:55:53 2005 +0000
+++ b/lisp/ediff-diff.el	Sat Feb 19 04:46:24 2005 +0000
@@ -534,6 +534,7 @@
 (defun ediff-set-diff-overlays-in-one-buffer (buf-type diff-list)
   (let* ((current-diff -1)
 	 (buff (ediff-get-buffer buf-type))
+	 (ctl-buf ediff-control-buffer)
 	 ;; ediff-extract-diffs puts the type of diff-list as the first elt
 	 ;; of this list. The type is either 'points or 'words
 	 (diff-list-type (car diff-list))
@@ -580,8 +581,9 @@
       (if (eq diff-list-type 'words)
 	  (progn
 	    (ediff-with-current-buffer buff (goto-char pt-saved))
-	    (setq begin (ediff-goto-word (1+ begin) buff)
-		  end (ediff-goto-word end buff 'end))
+	    (ediff-with-current-buffer ctl-buf
+	      (setq begin (ediff-goto-word (1+ begin) buff)
+		    end (ediff-goto-word end buff 'end)))
 	    (if (> end limit) (setq end limit))
 	    (if (> begin end) (setq begin end))
 	    (setq pt-saved (ediff-with-current-buffer buff (point)))))
@@ -864,6 +866,7 @@
   (let* ((current-diff -1)
 	 (reg-start (ediff-get-diff-posn buf-type 'beg region-num))
 	 (buff (ediff-get-buffer buf-type))
+	 (ctl-buf ediff-control-buffer)
 	 combined-merge-diff-list
 	 diff-overlay-list list-element
 	 begin end overlay)
@@ -892,8 +895,9 @@
 	    () ; skip this diff
 	  ;; Put overlays at appropriate places in buffers
 	  ;; convert lines to points, if necessary
-	  (setq begin (ediff-goto-word (1+ begin) buff)
-		end (ediff-goto-word end buff 'end))
+	  (ediff-with-current-buffer ctl-buf
+	    (setq begin (ediff-goto-word (1+ begin) buff)
+		  end (ediff-goto-word end buff 'end)))
 	  (setq overlay (ediff-make-bullet-proof-overlay begin end buff))
 	  ;; record all overlays for this difference region
 	  (setq diff-overlay-list (nconc diff-overlay-list (list overlay))))
@@ -1326,17 +1330,73 @@
 	(while (> n 1)
 	  (funcall fwd-word-fun)
 	  (skip-chars-forward ediff-whitespace)
-	  (setq n (1- n))))
-      (if (and flag (> n 0))
-	  (funcall fwd-word-fun))
+	  (setq n (1- n)))
+	(if (and flag (> n 0))
+	    (funcall fwd-word-fun)))
       (point))))
 
 (defun ediff-same-file-contents (f1 f2)
-  "Return t if F1 and F2 have identical contents."
-  (let ((res
-	 (apply 'call-process ediff-cmp-program nil nil nil
- 		(append ediff-cmp-options (list f1 f2)))))
-    (and (numberp res) (eq res 0))))
+  "Return t if files F1 and F2 have identical contents."
+  (if (and (not (file-directory-p f1))
+           (not (file-directory-p f2)))
+      (let ((res
+	     (apply 'call-process ediff-cmp-program nil nil nil
+		    (append ediff-cmp-options (list f1 f2)))))
+	(and (numberp res) (eq res 0))))
+  )
+
+
+(defun ediff-same-contents (d1 d2 &optional filter-re)
+  "Returns t iff D1 and D2 have the same content.
+D1 and D2 can either be both directories or both regular files.
+Symlinks and the likes are not handled.
+If FILTER-RE is non-nil, recursive checking in directories
+affects only files whose names match the expression."
+  ;; Normalize empty filter RE to nil.
+  (unless (length filter-re) (setq filter-re nil))
+  ;; Indicate progress
+  (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re)
+  (cond
+   ;; D1 & D2 directories => recurse
+   ((and (file-directory-p d1)
+         (file-directory-p d2))
+    (if (null ediff-recurse-to-subdirectories)
+	(if (y-or-n-p "Compare subdirectories recursively? ")
+	    (setq ediff-recurse-to-subdirectories 'yes)
+	  (setq ediff-recurse-to-subdirectories 'no)))
+    (if (eq ediff-recurse-to-subdirectories 'yes)
+	(let* ((all-entries-1 (directory-files d1 t filter-re))
+	       (all-entries-2 (directory-files d2 t filter-re))
+	       (entries-1 (remove-if (lambda (s)
+				       (string-match "^\\.\\.?$"
+						     (file-name-nondirectory s))) 
+				     all-entries-1))
+	       (entries-2 (remove-if (lambda (s)
+				       (string-match "^\\.\\.?$"
+						     (file-name-nondirectory s)))
+				     all-entries-2))
+	       )
+	  ;; First, check only the names (works quickly and ensures a
+	  ;; precondition for subsequent code)
+	  (if (and (= (length entries-1) (length entries-2))
+		   (every (lambda (a b) (equal (file-name-nondirectory a)
+					       (file-name-nondirectory b)))
+			  entries-1 entries-2))
+	      ;; With name equality established, compare the entries
+	      ;; through recursion.
+	      (every (lambda (a b)
+		       (ediff-same-contents a b filter-re))
+		     entries-1 entries-2)
+	    )
+	  ))
+    ) ; end of the directories case
+   ;; D1 & D2 are both files => compare directly
+   ((and (file-regular-p d1)
+         (file-regular-p d2))
+    (ediff-same-file-contents d1 d2))
+   ;; Otherwise => false: unequal contents
+   )
+  )
 
 
 ;;; Local Variables:
--- a/lisp/ediff-init.el	Fri Feb 18 22:55:53 2005 +0000
+++ b/lisp/ediff-init.el	Sat Feb 19 04:46:24 2005 +0000
@@ -895,7 +895,8 @@
 	 (sit-for 1)))))
 
 (defun ediff-hide-face (face)
-  (if (and (ediff-has-face-support-p) (boundp 'add-to-list)
+  (if (and (ediff-has-face-support-p)
+	   (boundp 'add-to-list)
 	   (boundp 'facemenu-unlisted-faces))
       (add-to-list 'facemenu-unlisted-faces face)))
 
@@ -1404,7 +1405,7 @@
 ;;; Misc
 
 ;; if nil, this silences some messages
-(defvar ediff-verbose-p t)
+(defconst ediff-verbose-p t)
 
 (defcustom ediff-autostore-merges  'group-jobs-only
   "*Save the results of merge jobs automatically.
@@ -1473,11 +1474,8 @@
 (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)
--- a/lisp/ediff-mult.el	Fri Feb 18 22:55:53 2005 +0000
+++ b/lisp/ediff-mult.el	Sat Feb 19 04:46:24 2005 +0000
@@ -1,6 +1,6 @@
 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
 
-;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 05 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 
@@ -167,6 +167,9 @@
 ;; buffer used to collect custom diffs from individual sessions in the group
 (ediff-defvar-local ediff-meta-diff-buffer nil "")
 
+;; t means recurse into subdirs when deciding which files have same contents
+(ediff-defvar-local ediff-recurse-to-subdirectories nil "")
+
 ;; history var to use for filtering groups of files
 (defvar ediff-filtering-regexp-history nil "")
 
@@ -2349,6 +2352,7 @@
 		))
       (setq list (cdr list)))
     (message "Comparing files ... Done"))
+  (setq ediff-recurse-to-subdirectories nil)
   (ediff-update-meta-buffer (current-buffer) 'must-redraw))
 
 ;; mark files 1 and 2 as equal, if they are.
@@ -2356,12 +2360,11 @@
 (defun ediff-mark-if-equal (fileinfo1 fileinfo2)
   (let ((f1 (car fileinfo1))
 	(f2 (car fileinfo2)))
-    (cond ((file-directory-p f1) nil)
-	  ((file-directory-p f2) nil)
-	  ((ediff-same-file-contents f1 f2)
-	   (ediff-set-file-eqstatus fileinfo1 t)
-	   (ediff-set-file-eqstatus fileinfo2 t)
-	   t))
+    (if (and (stringp f1) (stringp f2) (ediff-same-contents f1 f2))
+	(progn
+	  (ediff-set-file-eqstatus fileinfo1 t)
+	  (ediff-set-file-eqstatus fileinfo2 t)
+	  ))
     ))
 
 
--- a/lisp/ediff.el	Fri Feb 18 22:55:53 2005 +0000
+++ b/lisp/ediff.el	Sat Feb 19 04:46:24 2005 +0000
@@ -1,13 +1,13 @@
 ;;; ediff.el --- a comprehensive visual interface to diff & patch
 
-;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03, 05 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Created: February 2, 1994
 ;; Keywords: comparing, merging, patching, tools, unix
 
-(defconst ediff-version "2.78" "The current version of Ediff")
-(defconst ediff-date "May 18, 2003" "Date of last update")  
+(defconst ediff-version "2.80" "The current version of Ediff")
+(defconst ediff-date "February 19, 2005" "Date of last update")  
 
 
 ;; This file is part of GNU Emacs.
@@ -1080,8 +1080,11 @@
 
 (defsubst ediff-merge-on-startup ()
   (ediff-do-merge 0)
-  (ediff-with-current-buffer ediff-buffer-C
-    (set-buffer-modified-p nil)))
+  ;; Can't remember why this is here, but it may cause the automatically merged
+  ;; buffer to be lost. So, keep the buffer modified.
+  ;;(ediff-with-current-buffer ediff-buffer-C
+  ;;  (set-buffer-modified-p nil))
+  )
 
 ;;;###autoload
 (defun ediff-merge-files (file-A file-B
--- a/man/ediff.texi	Fri Feb 18 22:55:53 2005 +0000
+++ b/man/ediff.texi	Sat Feb 19 04:46:24 2005 +0000
@@ -1106,10 +1106,18 @@
 many ways to create diff output, and it is easier to handle by running
 Ediff on the inactive sessions.
 
-Last, but not least, by typing @kbd{=}, you can quickly find out which
-sessions have identical files, so you won't have to run Ediff on those
+Last, but not least, by typing @kbd{==}, you can quickly find out which
+sessions have identical entries, so you won't have to run Ediff on those
 sessions.  This, however, works only on local, uncompressed files.
 For compressed or remote files, this command won't report anything.
+Likewise, you can use @kbd{=h} to mark sessions with identical entries
+for hiding or, with @kbd{=m}, for further operations.
+
+The comparison operations @kbd{==}, @kbd{=h}, and @kbd{=m} can recurse into
+subdirectories to see if they have identical contents (so the user will not
+need to descend into those subdirectories manually). These commands ask the
+user whether or not to do a recursive descent.
+
 
 
 @node Remote and Compressed Files, Customization, Session Groups, Top
@@ -2395,11 +2403,13 @@
 Xavier Fornari (xavier@@europe.cma.fr),
 Eric Freudenthal (freudent@@jan.ultra.nyu.edu),
 Job Ganzevoort (Job.Ganzevoort@@cwi.nl),
+Felix Heinrich Gatzemeier (felix.g@@tzemeier.info),
 Boris Goldowsky (boris@@cs.rochester.edu),
 Allan Gottlieb (gottlieb@@allan.ultra.nyu.edu),
 Aaron Gross (aaron@@bfr.co.il),
 Thorbjoern Hansen (thorbjoern.hansen@@mchp.siemens.de),
 Marcus Harnisch (marcus_harnisch@@mint-tech.com),
+Steven E. Harris (seh@@panix.com),
 Xiaoli Huang (hxl@@epic.com),
 Andreas Jaeger (aj@@suse.de),
 Lars Magne Ingebrigtsen (larsi@@ifi.uio.no),
@@ -2428,6 +2438,7 @@
 Erik Naggum (erik@@naggum.no),
 Eyvind Ness (Eyvind.Ness@@hrp.no),
 Ray Nickson (nickson@@cs.uq.oz.au),
+Dan Nicolaescu (dann@@ics.uci.edu),
 David Petchey (petchey_david@@jpmorgan.com),
 Benjamin Pierce (benjamin.pierce@@cl.cam.ac.uk),
 Francois Pinard (pinard@@iro.umontreal.ca),