diff options
| author | Karoly Lorentey | 2005-02-20 18:47:54 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-02-20 18:47:54 +0000 |
| commit | b5d78df397f8cdcd20f3bcfbed2eb71d522abddd (patch) | |
| tree | cedfc1db69595526c12da068ea7ff5bdf3b806f2 /lisp/ediff-diff.el | |
| parent | 60c73d2ed638e5d51643c65a0fc6dea618fc72c8 (diff) | |
| parent | eedeacb3074baad8ce752a506f9f435c98e42ff4 (diff) | |
| download | emacs-b5d78df397f8cdcd20f3bcfbed2eb71d522abddd.tar.gz emacs-b5d78df397f8cdcd20f3bcfbed2eb71d522abddd.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 17-26, 107-116)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-107
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-108
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-109
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114
<no summary provided>
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-116
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-18
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21
More work on moving images to etc/images
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23
Fix errors with image-file installation
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24
etc/Makefile.in (install): Put gnus-tut.txt in the right place.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25
etc/Makefile.in (install, uninstall): Fix installed image dirs.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26
etc/Makefile.in (install): Create $(etcdir)/images/gnus dir.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-296
Diffstat (limited to 'lisp/ediff-diff.el')
| -rw-r--r-- | lisp/ediff-diff.el | 84 |
1 files changed, 72 insertions, 12 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index 4ba4ab316f8..c41d733aaca 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el | |||
| @@ -534,6 +534,7 @@ one optional arguments, diff-number to refine.") | |||
| 534 | (defun ediff-set-diff-overlays-in-one-buffer (buf-type diff-list) | 534 | (defun ediff-set-diff-overlays-in-one-buffer (buf-type diff-list) |
| 535 | (let* ((current-diff -1) | 535 | (let* ((current-diff -1) |
| 536 | (buff (ediff-get-buffer buf-type)) | 536 | (buff (ediff-get-buffer buf-type)) |
| 537 | (ctl-buf ediff-control-buffer) | ||
| 537 | ;; ediff-extract-diffs puts the type of diff-list as the first elt | 538 | ;; ediff-extract-diffs puts the type of diff-list as the first elt |
| 538 | ;; of this list. The type is either 'points or 'words | 539 | ;; of this list. The type is either 'points or 'words |
| 539 | (diff-list-type (car diff-list)) | 540 | (diff-list-type (car diff-list)) |
| @@ -580,8 +581,9 @@ one optional arguments, diff-number to refine.") | |||
| 580 | (if (eq diff-list-type 'words) | 581 | (if (eq diff-list-type 'words) |
| 581 | (progn | 582 | (progn |
| 582 | (ediff-with-current-buffer buff (goto-char pt-saved)) | 583 | (ediff-with-current-buffer buff (goto-char pt-saved)) |
| 583 | (setq begin (ediff-goto-word (1+ begin) buff) | 584 | (ediff-with-current-buffer ctl-buf |
| 584 | end (ediff-goto-word end buff 'end)) | 585 | (setq begin (ediff-goto-word (1+ begin) buff) |
| 586 | end (ediff-goto-word end buff 'end))) | ||
| 585 | (if (> end limit) (setq end limit)) | 587 | (if (> end limit) (setq end limit)) |
| 586 | (if (> begin end) (setq begin end)) | 588 | (if (> begin end) (setq begin end)) |
| 587 | (setq pt-saved (ediff-with-current-buffer buff (point))))) | 589 | (setq pt-saved (ediff-with-current-buffer buff (point))))) |
| @@ -864,6 +866,7 @@ delimiter regions")) | |||
| 864 | (let* ((current-diff -1) | 866 | (let* ((current-diff -1) |
| 865 | (reg-start (ediff-get-diff-posn buf-type 'beg region-num)) | 867 | (reg-start (ediff-get-diff-posn buf-type 'beg region-num)) |
| 866 | (buff (ediff-get-buffer buf-type)) | 868 | (buff (ediff-get-buffer buf-type)) |
| 869 | (ctl-buf ediff-control-buffer) | ||
| 867 | combined-merge-diff-list | 870 | combined-merge-diff-list |
| 868 | diff-overlay-list list-element | 871 | diff-overlay-list list-element |
| 869 | begin end overlay) | 872 | begin end overlay) |
| @@ -892,8 +895,9 @@ delimiter regions")) | |||
| 892 | () ; skip this diff | 895 | () ; skip this diff |
| 893 | ;; Put overlays at appropriate places in buffers | 896 | ;; Put overlays at appropriate places in buffers |
| 894 | ;; convert lines to points, if necessary | 897 | ;; convert lines to points, if necessary |
| 895 | (setq begin (ediff-goto-word (1+ begin) buff) | 898 | (ediff-with-current-buffer ctl-buf |
| 896 | end (ediff-goto-word end buff 'end)) | 899 | (setq begin (ediff-goto-word (1+ begin) buff) |
| 900 | end (ediff-goto-word end buff 'end))) | ||
| 897 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) | 901 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) |
| 898 | ;; record all overlays for this difference region | 902 | ;; record all overlays for this difference region |
| 899 | (setq diff-overlay-list (nconc diff-overlay-list (list overlay)))) | 903 | (setq diff-overlay-list (nconc diff-overlay-list (list overlay)))) |
| @@ -1326,17 +1330,73 @@ arguments to `skip-chars-forward'." | |||
| 1326 | (while (> n 1) | 1330 | (while (> n 1) |
| 1327 | (funcall fwd-word-fun) | 1331 | (funcall fwd-word-fun) |
| 1328 | (skip-chars-forward ediff-whitespace) | 1332 | (skip-chars-forward ediff-whitespace) |
| 1329 | (setq n (1- n)))) | 1333 | (setq n (1- n))) |
| 1330 | (if (and flag (> n 0)) | 1334 | (if (and flag (> n 0)) |
| 1331 | (funcall fwd-word-fun)) | 1335 | (funcall fwd-word-fun))) |
| 1332 | (point)))) | 1336 | (point)))) |
| 1333 | 1337 | ||
| 1334 | (defun ediff-same-file-contents (f1 f2) | 1338 | (defun ediff-same-file-contents (f1 f2) |
| 1335 | "Return t if F1 and F2 have identical contents." | 1339 | "Return t if files F1 and F2 have identical contents." |
| 1336 | (let ((res | 1340 | (if (and (not (file-directory-p f1)) |
| 1337 | (apply 'call-process ediff-cmp-program nil nil nil | 1341 | (not (file-directory-p f2))) |
| 1338 | (append ediff-cmp-options (list f1 f2))))) | 1342 | (let ((res |
| 1339 | (and (numberp res) (eq res 0)))) | 1343 | (apply 'call-process ediff-cmp-program nil nil nil |
| 1344 | (append ediff-cmp-options (list f1 f2))))) | ||
| 1345 | (and (numberp res) (eq res 0)))) | ||
| 1346 | ) | ||
| 1347 | |||
| 1348 | |||
| 1349 | (defun ediff-same-contents (d1 d2 &optional filter-re) | ||
| 1350 | "Returns t iff D1 and D2 have the same content. | ||
| 1351 | D1 and D2 can either be both directories or both regular files. | ||
| 1352 | Symlinks and the likes are not handled. | ||
| 1353 | If FILTER-RE is non-nil, recursive checking in directories | ||
| 1354 | affects only files whose names match the expression." | ||
| 1355 | ;; Normalize empty filter RE to nil. | ||
| 1356 | (unless (length filter-re) (setq filter-re nil)) | ||
| 1357 | ;; Indicate progress | ||
| 1358 | (message "Comparing '%s' and '%s' modulo '%s'" d1 d2 filter-re) | ||
| 1359 | (cond | ||
| 1360 | ;; D1 & D2 directories => recurse | ||
| 1361 | ((and (file-directory-p d1) | ||
| 1362 | (file-directory-p d2)) | ||
| 1363 | (if (null ediff-recurse-to-subdirectories) | ||
| 1364 | (if (y-or-n-p "Compare subdirectories recursively? ") | ||
| 1365 | (setq ediff-recurse-to-subdirectories 'yes) | ||
| 1366 | (setq ediff-recurse-to-subdirectories 'no))) | ||
| 1367 | (if (eq ediff-recurse-to-subdirectories 'yes) | ||
| 1368 | (let* ((all-entries-1 (directory-files d1 t filter-re)) | ||
| 1369 | (all-entries-2 (directory-files d2 t filter-re)) | ||
| 1370 | (entries-1 (remove-if (lambda (s) | ||
| 1371 | (string-match "^\\.\\.?$" | ||
| 1372 | (file-name-nondirectory s))) | ||
| 1373 | all-entries-1)) | ||
| 1374 | (entries-2 (remove-if (lambda (s) | ||
| 1375 | (string-match "^\\.\\.?$" | ||
| 1376 | (file-name-nondirectory s))) | ||
| 1377 | all-entries-2)) | ||
| 1378 | ) | ||
| 1379 | ;; First, check only the names (works quickly and ensures a | ||
| 1380 | ;; precondition for subsequent code) | ||
| 1381 | (if (and (= (length entries-1) (length entries-2)) | ||
| 1382 | (every (lambda (a b) (equal (file-name-nondirectory a) | ||
| 1383 | (file-name-nondirectory b))) | ||
| 1384 | entries-1 entries-2)) | ||
| 1385 | ;; With name equality established, compare the entries | ||
| 1386 | ;; through recursion. | ||
| 1387 | (every (lambda (a b) | ||
| 1388 | (ediff-same-contents a b filter-re)) | ||
| 1389 | entries-1 entries-2) | ||
| 1390 | ) | ||
| 1391 | )) | ||
| 1392 | ) ; end of the directories case | ||
| 1393 | ;; D1 & D2 are both files => compare directly | ||
| 1394 | ((and (file-regular-p d1) | ||
| 1395 | (file-regular-p d2)) | ||
| 1396 | (ediff-same-file-contents d1 d2)) | ||
| 1397 | ;; Otherwise => false: unequal contents | ||
| 1398 | ) | ||
| 1399 | ) | ||
| 1340 | 1400 | ||
| 1341 | 1401 | ||
| 1342 | ;;; Local Variables: | 1402 | ;;; Local Variables: |