aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/ediff-diff.el
diff options
context:
space:
mode:
authorMichael Kifer2006-06-18 17:08:24 +0000
committerMichael Kifer2006-06-18 17:08:24 +0000
commitec6aebe8337fdd6dc218609a3ff86ccc0232fb4a (patch)
treecbcaecf8692fb0ba1bcb4dbeeac96d471b1ba2be /lisp/ediff-diff.el
parent9e363b8991ea4c52e18b59d0679689cd6a1c0d1b (diff)
downloademacs-ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a.tar.gz
emacs-ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a.zip
2006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-special-read-and-insert-char): use read-key-sequence. (viper-after-change-undo-hook): enhancements. (viper-after-change-undo-hook): new hook. (viper-undo): use viper-after-change-undo-hook. (viper-add-newline-at-eob-if-necessary): widen before making changes. (viper-next-line-at-bol): If point is on a widget or a button, simulate clicking on that widget/button. * viper.el (viper-mode): allow for a separate cursor color in Emacs state. * ediff-diff (ediff-test-patch-utility): catch errors. (ediff-actual-diff-options, ediff-actual-diff3-options): new variables. (ediff-set-actual-diff-options): new function. (ediff-reset-diff-options, ediff-toggle-ignore-case): use ediff-set-actual-diff-options. (ediff-extract-diffs): catch errors. (ediff-whitespace): add nonbreakable space. (ediff-same-file-contents): catch errors. * ediff-mult.el (ediff-collect-custom-diffs): save coding-system-for-read. * ediff-vers.el (ediff-keep-tmp-versions): new var. (ediff-vc-internal, ediff-vc-merge-internal): use ediff-delete-version-file. (ediff-delete-version-file): new function. * ediff-wind.el (ediff-control-frame-parameters): set frame fringes. * ediff.el (ediff-directories, ediff-directory-revisions, ediff-merge-directories, ediff-merge-directories-with-ancestor, ediff-directories-internal, ediff-merge-directory-revisions, ediff-merge-directory-revisions-with-ancestor, ediff-directories3): use read-directory-name.
Diffstat (limited to 'lisp/ediff-diff.el')
-rw-r--r--lisp/ediff-diff.el74
1 files changed, 45 insertions, 29 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 7746954292d..e3675064010 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -65,10 +65,11 @@ Must produce output compatible with Unix's diff3 program."
65;; The following functions needed for setting diff/diff3 options 65;; The following functions needed for setting diff/diff3 options
66;; test if diff supports the --binary option 66;; test if diff supports the --binary option
67(defsubst ediff-test-utility (diff-util option &optional files) 67(defsubst ediff-test-utility (diff-util option &optional files)
68 (condition-case () 68 (condition-case nil
69 (eq 0 (apply 'call-process 69 (eq 0 (apply 'call-process
70 (append (list diff-util nil nil nil option) files))) 70 (append (list diff-util nil nil nil option) files)))
71 (file-error nil))) 71 (error (format "Cannot execute program %S." diff-util)))
72 )
72 73
73(defun ediff-diff-mandatory-option (diff-util) 74(defun ediff-diff-mandatory-option (diff-util)
74 (let ((file (if (boundp 'null-device) null-device "/dev/null"))) 75 (let ((file (if (boundp 'null-device) null-device "/dev/null")))
@@ -77,13 +78,17 @@ Must produce output compatible with Unix's diff3 program."
77 ((and (string= diff-util ediff-diff-program) 78 ((and (string= diff-util ediff-diff-program)
78 (ediff-test-utility 79 (ediff-test-utility
79 ediff-diff-program "--binary" (list file file))) 80 ediff-diff-program "--binary" (list file file)))
80 "--binary") 81 "--binary ")
81 ((and (string= diff-util ediff-diff3-program) 82 ((and (string= diff-util ediff-diff3-program)
82 (ediff-test-utility 83 (ediff-test-utility
83 ediff-diff3-program "--binary" (list file file file))) 84 ediff-diff3-program "--binary" (list file file file)))
84 "--binary") 85 "--binary ")
85 (t "")))) 86 (t ""))))
86 87
88
89;; must be before ediff-reset-diff-options to avoid compiler errors
90(fset 'ediff-set-actual-diff-options '(lambda () nil))
91
87;; make sure that mandatory options are added even if the user changes 92;; make sure that mandatory options are added even if the user changes
88;; ediff-diff-options or ediff-diff3-options in the customization widget 93;; ediff-diff-options or ediff-diff3-options in the customization widget
89(defun ediff-reset-diff-options (symb val) 94(defun ediff-reset-diff-options (symb val)
@@ -91,12 +96,9 @@ Must produce output compatible with Unix's diff3 program."
91 (if (eq symb 'ediff-diff-options) 96 (if (eq symb 'ediff-diff-options)
92 ediff-diff-program 97 ediff-diff-program
93 ediff-diff3-program)) 98 ediff-diff3-program))
94 (mandatory-option (ediff-diff-mandatory-option diff-program)) 99 (mandatory-option (ediff-diff-mandatory-option diff-program)))
95 (spacer (if (string-equal mandatory-option "") "" " "))) 100 (set symb (concat mandatory-option val))
96 (set symb 101 (ediff-set-actual-diff-options)
97 (if (string-match mandatory-option val)
98 val
99 (concat mandatory-option spacer val)))
100 )) 102 ))
101 103
102 104
@@ -155,7 +157,7 @@ GNU diff3 doesn't have such an option."
155 :group 'ediff-diff) 157 :group 'ediff-diff)
156 158
157;; the actual options used in comparison 159;; the actual options used in comparison
158(ediff-defvar-local ediff-actual-diff-options "" "") 160(ediff-defvar-local ediff-actual-diff-options ediff-diff-options "")
159 161
160(defcustom ediff-custom-diff-program ediff-diff-program 162(defcustom ediff-custom-diff-program ediff-diff-program
161 "*Program to use for generating custom diff output for saving it in a file. 163 "*Program to use for generating custom diff output for saving it in a file.
@@ -178,7 +180,7 @@ This output is not used by Ediff internally."
178 :group 'ediff-diff) 180 :group 'ediff-diff)
179 181
180;; the actual options used in comparison 182;; the actual options used in comparison
181(ediff-defvar-local ediff-actual-diff3-options "" "") 183(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "")
182 184
183(defcustom ediff-diff3-ok-lines-regexp 185(defcustom ediff-diff3-ok-lines-regexp
184 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" 186 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
@@ -1272,7 +1274,9 @@ delimiter regions"))
1272 ;; Similarly for Windows-* 1274 ;; Similarly for Windows-*
1273 ;; In DOS, must synchronize because DOS doesn't have 1275 ;; In DOS, must synchronize because DOS doesn't have
1274 ;; asynchronous processes. 1276 ;; asynchronous processes.
1275 (apply 'call-process program nil buffer nil args) 1277 (condition-case nil
1278 (apply 'call-process program nil buffer nil args)
1279 (error (format "Cannot execute program %S." program)))
1276 ;; On other systems, do it asynchronously. 1280 ;; On other systems, do it asynchronously.
1277 (setq proc (get-buffer-process buffer)) 1281 (setq proc (get-buffer-process buffer))
1278 (if proc (kill-process proc)) 1282 (if proc (kill-process proc))
@@ -1328,7 +1332,8 @@ delimiter regions"))
1328Used for splitting difference regions into individual words.") 1332Used for splitting difference regions into individual words.")
1329(make-variable-buffer-local 'ediff-forward-word-function) 1333(make-variable-buffer-local 'ediff-forward-word-function)
1330 1334
1331(defvar ediff-whitespace " \n\t\f" 1335;; \240 is unicode symbol for nonbreakable whitespace
1336(defvar ediff-whitespace " \n\t\f\r\240"
1332 "*Characters constituting white space. 1337 "*Characters constituting white space.
1333These characters are ignored when differing regions are split into words.") 1338These characters are ignored when differing regions are split into words.")
1334(make-variable-buffer-local 'ediff-whitespace) 1339(make-variable-buffer-local 'ediff-whitespace)
@@ -1442,11 +1447,13 @@ arguments to `skip-chars-forward'."
1442 "Return t if files F1 and F2 have identical contents." 1447 "Return t if files F1 and F2 have identical contents."
1443 (if (and (not (file-directory-p f1)) 1448 (if (and (not (file-directory-p f1))
1444 (not (file-directory-p f2))) 1449 (not (file-directory-p f2)))
1445 (let ((res 1450 (condition-case nil
1446 (apply 'call-process ediff-cmp-program nil nil nil 1451 (let ((res
1447 (append ediff-cmp-options (list f1 f2))))) 1452 (apply 'call-process ediff-cmp-program nil nil nil
1448 (and (numberp res) (eq res 0)))) 1453 (append ediff-cmp-options (list f1 f2)))))
1449 ) 1454 (and (numberp res) (eq res 0)))
1455 (error (format "Cannot execute program %S." ediff-cmp-program)))
1456 ))
1450 1457
1451 1458
1452(defun ediff-same-contents (d1 d2 &optional filter-re) 1459(defun ediff-same-contents (d1 d2 &optional filter-re)
@@ -1521,21 +1528,30 @@ affects only files whose names match the expression."
1521 (setq file-list-list (cdr file-list-list))) 1528 (setq file-list-list (cdr file-list-list)))
1522 (reverse result))) 1529 (reverse result)))
1523 1530
1531
1532(defun ediff-set-actual-diff-options ()
1533 (if ediff-ignore-case
1534 (setq ediff-actual-diff-options
1535 (concat ediff-diff-options " " ediff-ignore-case-option)
1536 ediff-actual-diff3-options
1537 (concat ediff-diff3-options " " ediff-ignore-case-option3))
1538 (setq ediff-actual-diff-options ediff-diff-options
1539 ediff-actual-diff3-options ediff-diff3-options)
1540 )
1541 (setq-default ediff-actual-diff-options ediff-actual-diff-options
1542 ediff-actual-diff3-options ediff-actual-diff3-options)
1543 )
1544
1545
1524;; Ignore case handling - some ideas from drew.adams@@oracle.com 1546;; Ignore case handling - some ideas from drew.adams@@oracle.com
1525(defun ediff-toggle-ignore-case () 1547(defun ediff-toggle-ignore-case ()
1526 (interactive) 1548 (interactive)
1527 (ediff-barf-if-not-control-buffer) 1549 (ediff-barf-if-not-control-buffer)
1528 (setq ediff-ignore-case (not ediff-ignore-case)) 1550 (setq ediff-ignore-case (not ediff-ignore-case))
1529 (cond (ediff-ignore-case 1551 (ediff-set-actual-diff-options)
1530 (setq ediff-actual-diff-options 1552 (if ediff-ignore-case
1531 (concat ediff-diff-options " " ediff-ignore-case-option) 1553 (message "Ignoring regions that differ only in case")
1532 ediff-actual-diff3-options 1554 (message "Ignoring case differences turned OFF"))
1533 (concat ediff-diff3-options " " ediff-ignore-case-option3))
1534 (message "Ignoring regions that differ only in case"))
1535 (t
1536 (setq ediff-actual-diff-options ediff-diff-options
1537 ediff-actual-diff3-options ediff-diff3-options)
1538 (message "Ignoring case differences turned OFF")))
1539 (cond (ediff-merge-job 1555 (cond (ediff-merge-job
1540 (message "Ignoring letter case is too dangerous in merge jobs")) 1556 (message "Ignoring letter case is too dangerous in merge jobs"))
1541 ((and ediff-diff3-job (string= ediff-ignore-case-option3 "")) 1557 ((and ediff-diff3-job (string= ediff-ignore-case-option3 ""))