aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/ediff-diff.el
diff options
context:
space:
mode:
authorMichael Kifer1997-05-31 01:10:39 +0000
committerMichael Kifer1997-05-31 01:10:39 +0000
commitddc90f39b06e390109df09d7c0a76d42fa7c6e26 (patch)
treeede1a9b155a2bf0f2b31cad39db716e5b7473bc2 /lisp/ediff-diff.el
parent70bc91bcec0a22c3f7548941716c6c4c2b4cd023 (diff)
downloademacs-ddc90f39b06e390109df09d7c0a76d42fa7c6e26.tar.gz
emacs-ddc90f39b06e390109df09d7c0a76d42fa7c6e26.zip
new version
Diffstat (limited to 'lisp/ediff-diff.el')
-rw-r--r--lisp/ediff-diff.el103
1 files changed, 73 insertions, 30 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 31e126c2292..fc288bf933a 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -1,6 +1,6 @@
1;;; ediff-diff.el --- diff-related utilities 1;;; ediff-diff.el --- diff-related utilities
2 2
3;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. 3;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
4 4
5;; Author: Michael Kifer <kifer@cs.sunysb.edu> 5;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6 6
@@ -23,10 +23,29 @@
23 23
24;;; Code: 24;;; Code:
25 25
26(provide 'ediff-diff)
27
28;; compiler pacifier
29(defvar ediff-default-variant)
30
31(eval-when-compile
32 (let ((load-path (cons (expand-file-name ".") load-path)))
33 (or (featurep 'ediff-init)
34 (load "ediff-init.el" nil nil 'nosuffix))
35 (or (featurep 'ediff-util)
36 (load "ediff-util.el" nil nil 'nosuffix))
37 ))
38;; end pacifier
39
26(require 'ediff-init) 40(require 'ediff-init)
27 41
42(defgroup ediff-diff nil
43 "Diff related utilities"
44 :prefix "ediff-"
45 :group 'ediff)
46
28 47
29(defvar ediff-shell 48(defcustom ediff-shell
30 (cond ((eq system-type 'emx) "cmd") ; OS/2 49 (cond ((eq system-type 'emx) "cmd") ; OS/2
31 ((memq system-type '(ms-dos windows-nt windows-95)) 50 ((memq system-type '(ms-dos windows-nt windows-95))
32 shell-file-name) ; no standard name on MS-DOS 51 shell-file-name) ; no standard name on MS-DOS
@@ -36,37 +55,53 @@
36.cshrc files are set up correctly, any shell will do. However, some people 55.cshrc files are set up correctly, any shell will do. However, some people
37set $prompt or other things incorrectly, which leads to undesirable output 56set $prompt or other things incorrectly, which leads to undesirable output
38messages. These may cause Ediff to fail. In such a case, set ediff-shell 57messages. These may cause Ediff to fail. In such a case, set ediff-shell
39to a shell that you are not using or, better, fix your shell's startup file.") 58to a shell that you are not using or, better, fix your shell's startup file."
59 :type 'string
60 :group 'ediff-diff)
40 61
41 62
42(defvar ediff-diff-program "diff" 63(defcustom ediff-diff-program "diff"
43 "*Program to use for generating the differential of the two files.") 64 "*Program to use for generating the differential of the two files."
44(defvar ediff-diff-options "" 65 :type 'string
66 :group 'ediff-diff)
67(defcustom ediff-diff-options ""
45 "*Options to pass to `ediff-diff-program'. 68 "*Options to pass to `ediff-diff-program'.
46If diff\(1\) is used as `ediff-diff-program', then the most useful options are 69If diff\(1\) is used as `ediff-diff-program', then the most useful options are
47`-w', to ignore space, and `-i', to ignore case of letters. 70`-w', to ignore space, and `-i', to ignore case of letters.
48At present, the option `-c' is ignored, since Ediff doesn't understand this 71At present, the option `-c' is ignored, since Ediff doesn't understand this
49type of output.") 72type of output."
73 :type 'string
74 :group 'ediff-diff)
50 75
51(defvar ediff-custom-diff-program ediff-diff-program 76(defcustom ediff-custom-diff-program ediff-diff-program
52 "*Program to use for generating custom diff output for saving it in a file. 77 "*Program to use for generating custom diff output for saving it in a file.
53This output is not used by Ediff internally.") 78This output is not used by Ediff internally."
54(defvar ediff-custom-diff-options "-c" 79 :type 'string
55 "*Options to pass to `ediff-custom-diff-program'.") 80 :group 'ediff-diff)
81(defcustom ediff-custom-diff-options "-c"
82 "*Options to pass to `ediff-custom-diff-program'."
83 :type 'string
84 :group 'ediff-diff)
56 85
57;;; Support for diff3 86;;; Support for diff3
58 87
59(defvar ediff-match-diff3-line "^====\\(.?\\)$" 88(defvar ediff-match-diff3-line "^====\\(.?\\)$"
60 "Pattern to match lines produced by diff3 that describe differences.") 89 "Pattern to match lines produced by diff3 that describe differences.")
61(defvar ediff-diff3-program "diff3" 90(defcustom ediff-diff3-program "diff3"
62 "*Program to be used for three-way comparison. 91 "*Program to be used for three-way comparison.
63Must produce output compatible with Unix's diff3 program.") 92Must produce output compatible with Unix's diff3 program."
64(defvar ediff-diff3-options "" 93 :type 'string
65 "*Options to pass to `ediff-diff3-program'.") 94 :group 'ediff-diff)
66(defvar ediff-diff3-ok-lines-regexp 95(defcustom ediff-diff3-options ""
96 "*Options to pass to `ediff-diff3-program'."
97 :type 'string
98 :group 'ediff-diff)
99(defcustom ediff-diff3-ok-lines-regexp
67 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" 100 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
68 "*Regexp that matches normal output lines from `ediff-diff3-program'. 101 "*Regexp that matches normal output lines from `ediff-diff3-program'.
69Lines that do not match are assumed to be error messages.") 102Lines that do not match are assumed to be error messages."
103 :type 'regexp
104 :group 'ediff-diff)
70 105
71;; keeps the status of the current diff in 3-way jobs. 106;; keeps the status of the current diff in 3-way jobs.
72;; the status can be =diff(A), =diff(B), or =diff(A+B) 107;; the status can be =diff(A), =diff(B), or =diff(A+B)
@@ -551,13 +586,7 @@ one optional arguments, diff-number to refine.")
551 (whitespace-C (ediff-whitespace-diff-region-p n 'C)) 586 (whitespace-C (ediff-whitespace-diff-region-p n 'C))
552 cumulative-fine-diff-length) 587 cumulative-fine-diff-length)
553 588
554 (cond ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A)) 589 (cond ;; If one of the regions is empty (or 2 in 3way comparison)
555 ;; don't compute fine diffs if diff vector exists
556 (if (ediff-no-fine-diffs-p n)
557 ;;(ediff-message-if-verbose
558 (message
559 "Only white-space differences in region %d" (1+ n))))
560 ;; If one of the regions is empty (or 2 in 3way comparison)
561 ;; then don't refine. 590 ;; then don't refine.
562 ;; If the region happens to be entirely whitespace or empty then 591 ;; If the region happens to be entirely whitespace or empty then
563 ;; mark as such. 592 ;; mark as such.
@@ -586,6 +615,20 @@ one optional arguments, diff-number to refine.")
586 ;; if some regions are white and others don't, then mark as 615 ;; if some regions are white and others don't, then mark as
587 ;; non-white-space-only 616 ;; non-white-space-only
588 (ediff-mark-diff-as-space-only n nil))) 617 (ediff-mark-diff-as-space-only n nil)))
618
619 ;; don't compute fine diffs if diff vector exists
620 ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n 'A))
621 (if (ediff-no-fine-diffs-p n)
622 (message
623 "Only white-space differences in region %d %s"
624 (1+ n)
625 (cond ((eq (ediff-no-fine-diffs-p n) 'A)
626 "in buffers B & C")
627 ((eq (ediff-no-fine-diffs-p n) 'B)
628 "in buffers A & C")
629 ((eq (ediff-no-fine-diffs-p n) 'C)
630 "in buffers A & B")
631 (t "")))))
589 ;; don't compute fine diffs for this region 632 ;; don't compute fine diffs for this region
590 ((eq flag 'skip) 633 ((eq flag 'skip)
591 (or (ediff-get-fine-diff-vector n 'A) 634 (or (ediff-get-fine-diff-vector n 'A)
@@ -666,13 +709,15 @@ one optional arguments, diff-number to refine.")
666 (ediff-message-if-verbose 709 (ediff-message-if-verbose
667 "Only white-space differences in region %d" (1+ n))) 710 "Only white-space differences in region %d" (1+ n)))
668 ((eq cumulative-fine-diff-length 0) 711 ((eq cumulative-fine-diff-length 0)
669 (ediff-mark-diff-as-space-only n t)
670 (ediff-message-if-verbose 712 (ediff-message-if-verbose
671 "Only white-space differences in region %d %s" 713 "Only white-space differences in region %d %s"
672 (1+ n) 714 (1+ n)
673 (cond (whitespace-A "in buffers B & C") 715 (cond (whitespace-A (ediff-mark-diff-as-space-only n 'A)
674 (whitespace-B "in buffers A & C") 716 "in buffers B & C")
675 (whitespace-C "in buffers A & B")))) 717 (whitespace-B (ediff-mark-diff-as-space-only n 'B)
718 "in buffers A & C")
719 (whitespace-C (ediff-mark-diff-as-space-only n 'C)
720 "in buffers A & B"))))
676 (t 721 (t
677 (ediff-mark-diff-as-space-only n nil))) 722 (ediff-mark-diff-as-space-only n nil)))
678 ) 723 )
@@ -1204,7 +1249,5 @@ argument to `skip-chars-forward'."
1204;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) 1249;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1205;;; End: 1250;;; End:
1206 1251
1207(provide 'ediff-diff)
1208
1209 1252
1210;; ediff-diff.el ends here 1253;; ediff-diff.el ends here