aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Kifer2005-02-19 04:46:24 +0000
committerMichael Kifer2005-02-19 04:46:24 +0000
commit17561e4ffa9a46cf3149cd299cc7e4a5354007b7 (patch)
tree2e54ef22cdc4f99ed116f18f226c27f53c7d86c1 /lisp
parent91c212f159577c0be32ec8fcc1f8e6a23777ee6d (diff)
downloademacs-17561e4ffa9a46cf3149cd299cc7e4a5354007b7.tar.gz
emacs-17561e4ffa9a46cf3149cd299cc7e4a5354007b7.zip
* 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/ediff-diff.el84
-rw-r--r--lisp/ediff-init.el10
-rw-r--r--lisp/ediff-mult.el17
-rw-r--r--lisp/ediff.el13
5 files changed, 114 insertions, 30 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7207d267f2c..1a162ee9168 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
12005-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
2
3 * ediff.el (ediff-set-diff-overlays-in-one-buffer,
4 ediff-set-fine-overlays-in-one-buffer,ediff-goto-word) make sure
5 we use the syntax table of the correct buffer.
6 (ediff-same-file-contents,ediff-same-contents): enhancements thanks to
7 Felix Gatzemeier.
8
9 * ediff-init.el (ediff-hide-face): checks for definedness of functions.
10 (ediff-file-remote-p): make synonymous with file-remote-p.
11 In all deffaces ediff-*-face-*, use min-colors.
12
13 * ediff-mult.el (ediff-meta-mark-equal-files): make use of
14 ediff-recurse-to-subdirectories.
15 (ediff-mark-if-equal): check that the arguments are strings, use
16 ediff-same-contents (after to Felix Gatzemeier).
17
18 * ediff.el (ediff-merge-on-startup): don't set buffer-modified-p to
19 nil.
20
12005-02-18 Stefan Monnier <monnier@iro.umontreal.ca> 212005-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 22
3 * log-view.el (log-view-message-re): Fix up Subversion regexp. 23 * log-view.el (log-view-message-re): Fix up Subversion regexp.
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.
1351D1 and D2 can either be both directories or both regular files.
1352Symlinks and the likes are not handled.
1353If FILTER-RE is non-nil, recursive checking in directories
1354affects 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:
diff --git a/lisp/ediff-init.el b/lisp/ediff-init.el
index 80beb4a872d..46e94e935f7 100644
--- a/lisp/ediff-init.el
+++ b/lisp/ediff-init.el
@@ -895,7 +895,8 @@ to temp files when Ediff needs to find fine differences."
895 (sit-for 1))))) 895 (sit-for 1)))))
896 896
897(defun ediff-hide-face (face) 897(defun ediff-hide-face (face)
898 (if (and (ediff-has-face-support-p) (boundp 'add-to-list) 898 (if (and (ediff-has-face-support-p)
899 (boundp 'add-to-list)
899 (boundp 'facemenu-unlisted-faces)) 900 (boundp 'facemenu-unlisted-faces))
900 (add-to-list 'facemenu-unlisted-faces face))) 901 (add-to-list 'facemenu-unlisted-faces face)))
901 902
@@ -1404,7 +1405,7 @@ This property can be toggled interactively."
1404;;; Misc 1405;;; Misc
1405 1406
1406;; if nil, this silences some messages 1407;; if nil, this silences some messages
1407(defvar ediff-verbose-p t) 1408(defconst ediff-verbose-p t)
1408 1409
1409(defcustom ediff-autostore-merges 'group-jobs-only 1410(defcustom ediff-autostore-merges 'group-jobs-only
1410 "*Save the results of merge jobs automatically. 1411 "*Save the results of merge jobs automatically.
@@ -1473,11 +1474,8 @@ This default should work without changes."
1473(ediff-defvar-local ediff-temp-file-C nil "") 1474(ediff-defvar-local ediff-temp-file-C nil "")
1474 1475
1475 1476
1476;; If file-remote-p is defined (as in XEmacs, use it. Otherwise, check
1477;; if find-file-name-handler is defined for 'file-local-copy
1478(defun ediff-file-remote-p (file-name) 1477(defun ediff-file-remote-p (file-name)
1479 (or (and (fboundp 'file-remote-p) (file-remote-p file-name)) 1478 (file-remote-p file-name))
1480 (find-file-name-handler file-name 'file-local-copy)))
1481 1479
1482;; File for which we can get attributes, such as size or date 1480;; File for which we can get attributes, such as size or date
1483(defun ediff-listable-file (file-name) 1481(defun ediff-listable-file (file-name)
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el
index cf6edc2d129..41a7699cfdc 100644
--- a/lisp/ediff-mult.el
+++ b/lisp/ediff-mult.el
@@ -1,6 +1,6 @@
1;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff 1;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
2 2
3;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 96, 97, 98, 99, 2000, 01, 02, 05 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 5;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
6 6
@@ -167,6 +167,9 @@ directories.")
167;; buffer used to collect custom diffs from individual sessions in the group 167;; buffer used to collect custom diffs from individual sessions in the group
168(ediff-defvar-local ediff-meta-diff-buffer nil "") 168(ediff-defvar-local ediff-meta-diff-buffer nil "")
169 169
170;; t means recurse into subdirs when deciding which files have same contents
171(ediff-defvar-local ediff-recurse-to-subdirectories nil "")
172
170;; history var to use for filtering groups of files 173;; history var to use for filtering groups of files
171(defvar ediff-filtering-regexp-history nil "") 174(defvar ediff-filtering-regexp-history nil "")
172 175
@@ -2349,6 +2352,7 @@ last-command-char is used to decide which action to take."
2349 )) 2352 ))
2350 (setq list (cdr list))) 2353 (setq list (cdr list)))
2351 (message "Comparing files ... Done")) 2354 (message "Comparing files ... Done"))
2355 (setq ediff-recurse-to-subdirectories nil)
2352 (ediff-update-meta-buffer (current-buffer) 'must-redraw)) 2356 (ediff-update-meta-buffer (current-buffer) 'must-redraw))
2353 2357
2354;; mark files 1 and 2 as equal, if they are. 2358;; mark files 1 and 2 as equal, if they are.
@@ -2356,12 +2360,11 @@ last-command-char is used to decide which action to take."
2356(defun ediff-mark-if-equal (fileinfo1 fileinfo2) 2360(defun ediff-mark-if-equal (fileinfo1 fileinfo2)
2357 (let ((f1 (car fileinfo1)) 2361 (let ((f1 (car fileinfo1))
2358 (f2 (car fileinfo2))) 2362 (f2 (car fileinfo2)))
2359 (cond ((file-directory-p f1) nil) 2363 (if (and (stringp f1) (stringp f2) (ediff-same-contents f1 f2))
2360 ((file-directory-p f2) nil) 2364 (progn
2361 ((ediff-same-file-contents f1 f2) 2365 (ediff-set-file-eqstatus fileinfo1 t)
2362 (ediff-set-file-eqstatus fileinfo1 t) 2366 (ediff-set-file-eqstatus fileinfo2 t)
2363 (ediff-set-file-eqstatus fileinfo2 t) 2367 ))
2364 t))
2365 )) 2368 ))
2366 2369
2367 2370
diff --git a/lisp/ediff.el b/lisp/ediff.el
index c98974923f1..2a2b481ec59 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -1,13 +1,13 @@
1;;; ediff.el --- a comprehensive visual interface to diff & patch 1;;; ediff.el --- a comprehensive visual interface to diff & patch
2 2
3;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03, 05 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 5;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
6;; Created: February 2, 1994 6;; Created: February 2, 1994
7;; Keywords: comparing, merging, patching, tools, unix 7;; Keywords: comparing, merging, patching, tools, unix
8 8
9(defconst ediff-version "2.78" "The current version of Ediff") 9(defconst ediff-version "2.80" "The current version of Ediff")
10(defconst ediff-date "May 18, 2003" "Date of last update") 10(defconst ediff-date "February 19, 2005" "Date of last update")
11 11
12 12
13;; This file is part of GNU Emacs. 13;; This file is part of GNU Emacs.
@@ -1080,8 +1080,11 @@ lines. For small regions, use `ediff-regions-wordwise'."
1080 1080
1081(defsubst ediff-merge-on-startup () 1081(defsubst ediff-merge-on-startup ()
1082 (ediff-do-merge 0) 1082 (ediff-do-merge 0)
1083 (ediff-with-current-buffer ediff-buffer-C 1083 ;; Can't remember why this is here, but it may cause the automatically merged
1084 (set-buffer-modified-p nil))) 1084 ;; buffer to be lost. So, keep the buffer modified.
1085 ;;(ediff-with-current-buffer ediff-buffer-C
1086 ;; (set-buffer-modified-p nil))
1087 )
1085 1088
1086;;;###autoload 1089;;;###autoload
1087(defun ediff-merge-files (file-A file-B 1090(defun ediff-merge-files (file-A file-B