diff options
| author | Juanma Barranquero | 2003-02-04 11:26:42 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2003-02-04 11:26:42 +0000 |
| commit | 71296446d3cec5bb2a27bc5ad6da574df38d0ec8 (patch) | |
| tree | 0204c3c252547a44e2404959409034406f7680cd /lisp/ediff-diff.el | |
| parent | 693ff6134cb2ec65c7d188696f012662edadfbf0 (diff) | |
| download | emacs-71296446d3cec5bb2a27bc5ad6da574df38d0ec8.tar.gz emacs-71296446d3cec5bb2a27bc5ad6da574df38d0ec8.zip | |
Trailing whitespace deleted.
Diffstat (limited to 'lisp/ediff-diff.el')
| -rw-r--r-- | lisp/ediff-diff.el | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el index 37ac8c0e13d..99b9a23f7c0 100644 --- a/lisp/ediff-diff.el +++ b/lisp/ediff-diff.el | |||
| @@ -126,7 +126,7 @@ are `-I REGEXP', to ignore changes whose lines match the REGEXP." | |||
| 126 | :group 'ediff-diff) | 126 | :group 'ediff-diff) |
| 127 | 127 | ||
| 128 | (defcustom ediff-diff-options "" | 128 | (defcustom ediff-diff-options "" |
| 129 | "*Options to pass to `ediff-diff-program'. | 129 | "*Options to pass to `ediff-diff-program'. |
| 130 | If Unix diff is used as `ediff-diff-program', then the most useful options are | 130 | If Unix diff is used as `ediff-diff-program', then the most useful options are |
| 131 | `-w', to ignore space, and `-i', to ignore case of letters. | 131 | `-w', to ignore space, and `-i', to ignore case of letters. |
| 132 | At present, the option `-c' is not allowed." | 132 | At present, the option `-c' is not allowed." |
| @@ -164,7 +164,7 @@ Lines that do not match are assumed to be error messages." | |||
| 164 | ;; the status can be =diff(A), =diff(B), or =diff(A+B) | 164 | ;; the status can be =diff(A), =diff(B), or =diff(A+B) |
| 165 | (ediff-defvar-local ediff-diff-status "" "") | 165 | (ediff-defvar-local ediff-diff-status "" "") |
| 166 | 166 | ||
| 167 | 167 | ||
| 168 | ;;; Fine differences | 168 | ;;; Fine differences |
| 169 | 169 | ||
| 170 | (ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix) | 170 | (ediff-defvar-local ediff-auto-refine (if (ediff-has-face-support-p) 'on 'nix) |
| @@ -182,7 +182,7 @@ Use `setq-default' if setting it in .emacs") | |||
| 182 | 182 | ||
| 183 | (ediff-defvar-local ediff-auto-refine-limit 1400 | 183 | (ediff-defvar-local ediff-auto-refine-limit 1400 |
| 184 | "*Auto-refine only the regions of this size \(in bytes\) or less.") | 184 | "*Auto-refine only the regions of this size \(in bytes\) or less.") |
| 185 | 185 | ||
| 186 | ;;; General | 186 | ;;; General |
| 187 | 187 | ||
| 188 | (defvar ediff-diff-ok-lines-regexp | 188 | (defvar ediff-diff-ok-lines-regexp |
| @@ -215,7 +215,7 @@ The function should take three mandatory arguments, file-A, file-B, and | |||
| 215 | file-C. It may ignore file C for diff2 jobs. It should also take | 215 | file-C. It may ignore file C for diff2 jobs. It should also take |
| 216 | one optional arguments, diff-number to refine.") | 216 | one optional arguments, diff-number to refine.") |
| 217 | 217 | ||
| 218 | 218 | ||
| 219 | ;;; Functions | 219 | ;;; Functions |
| 220 | 220 | ||
| 221 | ;; Generate the difference vector and overlays for the two files | 221 | ;; Generate the difference vector and overlays for the two files |
| @@ -228,7 +228,7 @@ one optional arguments, diff-number to refine.") | |||
| 228 | ;; looking either for '-c' or a 'c' in a set of clustered non-long options | 228 | ;; looking either for '-c' or a 'c' in a set of clustered non-long options |
| 229 | (if (string-match "^-c\\| -c\\|-[^- ]+c" ediff-diff-options) | 229 | (if (string-match "^-c\\| -c\\|-[^- ]+c" ediff-diff-options) |
| 230 | (error "Option `-c' is not allowed in `ediff-diff-options'")) | 230 | (error "Option `-c' is not allowed in `ediff-diff-options'")) |
| 231 | 231 | ||
| 232 | ;; create, if it doesn't exist | 232 | ;; create, if it doesn't exist |
| 233 | (or (ediff-buffer-live-p ediff-diff-buffer) | 233 | (or (ediff-buffer-live-p ediff-diff-buffer) |
| 234 | (setq ediff-diff-buffer | 234 | (setq ediff-diff-buffer |
| @@ -268,9 +268,9 @@ one optional arguments, diff-number to refine.") | |||
| 268 | (message "") | 268 | (message "") |
| 269 | (ediff-with-current-buffer diff-buffer | 269 | (ediff-with-current-buffer diff-buffer |
| 270 | (buffer-size)))))) | 270 | (buffer-size)))))) |
| 271 | |||
| 272 | 271 | ||
| 273 | 272 | ||
| 273 | |||
| 274 | ;; If file-A/B/C is nil, do 2-way comparison with the non-nil buffers | 274 | ;; If file-A/B/C is nil, do 2-way comparison with the non-nil buffers |
| 275 | ;; This function works for diff3 and diff2 jobs | 275 | ;; This function works for diff3 and diff2 jobs |
| 276 | (defun ediff-setup-fine-diff-regions (file-A file-B file-C reg-num) | 276 | (defun ediff-setup-fine-diff-regions (file-A file-B file-C reg-num) |
| @@ -278,7 +278,7 @@ one optional arguments, diff-number to refine.") | |||
| 278 | (setq ediff-fine-diff-buffer | 278 | (setq ediff-fine-diff-buffer |
| 279 | (get-buffer-create | 279 | (get-buffer-create |
| 280 | (ediff-unique-buffer-name "*ediff-fine-diff" "*")))) | 280 | (ediff-unique-buffer-name "*ediff-fine-diff" "*")))) |
| 281 | 281 | ||
| 282 | (let (diff3-job diff-program diff-options ok-regexp diff-list) | 282 | (let (diff3-job diff-program diff-options ok-regexp diff-list) |
| 283 | (setq diff3-job ediff-3way-job | 283 | (setq diff3-job ediff-3way-job |
| 284 | diff-program (if diff3-job ediff-diff3-program ediff-diff-program) | 284 | diff-program (if diff3-job ediff-diff3-program ediff-diff-program) |
| @@ -286,7 +286,7 @@ one optional arguments, diff-number to refine.") | |||
| 286 | ok-regexp (if diff3-job | 286 | ok-regexp (if diff3-job |
| 287 | ediff-diff3-ok-lines-regexp | 287 | ediff-diff3-ok-lines-regexp |
| 288 | ediff-diff-ok-lines-regexp)) | 288 | ediff-diff-ok-lines-regexp)) |
| 289 | 289 | ||
| 290 | (ediff-message-if-verbose "Refining difference region %d ..." (1+ reg-num)) | 290 | (ediff-message-if-verbose "Refining difference region %d ..." (1+ reg-num)) |
| 291 | (ediff-exec-process diff-program ediff-fine-diff-buffer 'synchronize | 291 | (ediff-exec-process diff-program ediff-fine-diff-buffer 'synchronize |
| 292 | diff-options | 292 | diff-options |
| @@ -298,12 +298,12 @@ one optional arguments, diff-number to refine.") | |||
| 298 | (if diff3-job | 298 | (if diff3-job |
| 299 | (if file-C file-C file-B)) | 299 | (if file-C file-C file-B)) |
| 300 | ) ; exec process | 300 | ) ; exec process |
| 301 | 301 | ||
| 302 | (ediff-prepare-error-list ok-regexp ediff-fine-diff-buffer) | 302 | (ediff-prepare-error-list ok-regexp ediff-fine-diff-buffer) |
| 303 | (ediff-message-if-verbose | 303 | (ediff-message-if-verbose |
| 304 | "") | 304 | "") |
| 305 | ;; "Refining difference region %d ... done" (1+ reg-num)) | 305 | ;; "Refining difference region %d ... done" (1+ reg-num)) |
| 306 | 306 | ||
| 307 | (setq diff-list | 307 | (setq diff-list |
| 308 | (if diff3-job | 308 | (if diff3-job |
| 309 | (ediff-extract-diffs3 | 309 | (ediff-extract-diffs3 |
| @@ -327,11 +327,11 @@ one optional arguments, diff-number to refine.") | |||
| 327 | (aset elt 5 nil)) | 327 | (aset elt 5 nil)) |
| 328 | (cdr diff-list))) | 328 | (cdr diff-list))) |
| 329 | )) | 329 | )) |
| 330 | 330 | ||
| 331 | (ediff-convert-fine-diffs-to-overlays diff-list reg-num) | 331 | (ediff-convert-fine-diffs-to-overlays diff-list reg-num) |
| 332 | )) | 332 | )) |
| 333 | 333 | ||
| 334 | 334 | ||
| 335 | (defun ediff-prepare-error-list (ok-regexp diff-buff) | 335 | (defun ediff-prepare-error-list (ok-regexp diff-buff) |
| 336 | (or (ediff-buffer-live-p ediff-error-buffer) | 336 | (or (ediff-buffer-live-p ediff-error-buffer) |
| 337 | (setq ediff-error-buffer | 337 | (setq ediff-error-buffer |
| @@ -368,7 +368,7 @@ one optional arguments, diff-number to refine.") | |||
| 368 | (c-prev 1) | 368 | (c-prev 1) |
| 369 | diff-list shift-A shift-B | 369 | diff-list shift-A shift-B |
| 370 | ) | 370 | ) |
| 371 | 371 | ||
| 372 | ;; diff list contains word numbers, unless changed later | 372 | ;; diff list contains word numbers, unless changed later |
| 373 | (setq diff-list (cons (if word-mode 'words 'points) | 373 | (setq diff-list (cons (if word-mode 'words 'points) |
| 374 | diff-list)) | 374 | diff-list)) |
| @@ -380,7 +380,7 @@ one optional arguments, diff-number to refine.") | |||
| 380 | shift-B | 380 | shift-B |
| 381 | (ediff-overlay-start | 381 | (ediff-overlay-start |
| 382 | (ediff-get-value-according-to-buffer-type 'B bounds)))) | 382 | (ediff-get-value-according-to-buffer-type 'B bounds)))) |
| 383 | 383 | ||
| 384 | ;; reset point in buffers A/B/C | 384 | ;; reset point in buffers A/B/C |
| 385 | (ediff-with-current-buffer A-buffer | 385 | (ediff-with-current-buffer A-buffer |
| 386 | (goto-char (if shift-A shift-A (point-min)))) | 386 | (goto-char (if shift-A shift-A (point-min)))) |
| @@ -389,7 +389,7 @@ one optional arguments, diff-number to refine.") | |||
| 389 | (if (ediff-buffer-live-p C-buffer) | 389 | (if (ediff-buffer-live-p C-buffer) |
| 390 | (ediff-with-current-buffer C-buffer | 390 | (ediff-with-current-buffer C-buffer |
| 391 | (goto-char (point-min)))) | 391 | (goto-char (point-min)))) |
| 392 | 392 | ||
| 393 | (ediff-with-current-buffer diff-buffer | 393 | (ediff-with-current-buffer diff-buffer |
| 394 | (goto-char (point-min)) | 394 | (goto-char (point-min)) |
| 395 | (while (re-search-forward ediff-match-diff-line nil t) | 395 | (while (re-search-forward ediff-match-diff-line nil t) |
| @@ -423,13 +423,13 @@ one optional arguments, diff-number to refine.") | |||
| 423 | ;; (string-equal diff-type "c") | 423 | ;; (string-equal diff-type "c") |
| 424 | (setq a-end (1+ a-end) | 424 | (setq a-end (1+ a-end) |
| 425 | b-end (1+ b-end)))) | 425 | b-end (1+ b-end)))) |
| 426 | 426 | ||
| 427 | (if (eq ediff-default-variant 'default-B) | 427 | (if (eq ediff-default-variant 'default-B) |
| 428 | (setq c-begin b-begin | 428 | (setq c-begin b-begin |
| 429 | c-end b-end) | 429 | c-end b-end) |
| 430 | (setq c-begin a-begin | 430 | (setq c-begin a-begin |
| 431 | c-end a-end)) | 431 | c-end a-end)) |
| 432 | 432 | ||
| 433 | ;; compute main diff vector | 433 | ;; compute main diff vector |
| 434 | (if word-mode | 434 | (if word-mode |
| 435 | ;; make diff-list contain word numbers | 435 | ;; make diff-list contain word numbers |
| @@ -500,11 +500,11 @@ one optional arguments, diff-number to refine.") | |||
| 500 | nil ; dummy state of ancestor | 500 | nil ; dummy state of ancestor |
| 501 | ))) | 501 | ))) |
| 502 | ))) | 502 | ))) |
| 503 | 503 | ||
| 504 | ))) ; end ediff-with-current-buffer | 504 | ))) ; end ediff-with-current-buffer |
| 505 | diff-list | 505 | diff-list |
| 506 | )) | 506 | )) |
| 507 | 507 | ||
| 508 | 508 | ||
| 509 | (defun ediff-convert-diffs-to-overlays (diff-list) | 509 | (defun ediff-convert-diffs-to-overlays (diff-list) |
| 510 | (ediff-set-diff-overlays-in-one-buffer 'A diff-list) | 510 | (ediff-set-diff-overlays-in-one-buffer 'A diff-list) |
| @@ -530,7 +530,7 @@ one optional arguments, diff-number to refine.") | |||
| 530 | ))) | 530 | ))) |
| 531 | (message "Processing difference regions ... done")) | 531 | (message "Processing difference regions ... done")) |
| 532 | 532 | ||
| 533 | 533 | ||
| 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)) |
| @@ -548,10 +548,10 @@ one optional arguments, diff-number to refine.") | |||
| 548 | 548 | ||
| 549 | (setq diff-list (cdr diff-list)) ; discard diff list type | 549 | (setq diff-list (cdr diff-list)) ; discard diff list type |
| 550 | (setq total-diffs (length diff-list)) | 550 | (setq total-diffs (length diff-list)) |
| 551 | 551 | ||
| 552 | ;; shift, if necessary | 552 | ;; shift, if necessary |
| 553 | (ediff-with-current-buffer buff (setq pt-saved shift)) | 553 | (ediff-with-current-buffer buff (setq pt-saved shift)) |
| 554 | 554 | ||
| 555 | (while diff-list | 555 | (while diff-list |
| 556 | (setq current-diff (1+ current-diff) | 556 | (setq current-diff (1+ current-diff) |
| 557 | list-element (car diff-list) | 557 | list-element (car diff-list) |
| @@ -565,7 +565,7 @@ one optional arguments, diff-number to refine.") | |||
| 565 | (t 7))) ; Ancestor | 565 | (t 7))) ; Ancestor |
| 566 | state-of-diff (aref list-element 8) | 566 | state-of-diff (aref list-element 8) |
| 567 | ) | 567 | ) |
| 568 | 568 | ||
| 569 | (cond ((and (not (eq buf-type state-of-diff)) | 569 | (cond ((and (not (eq buf-type state-of-diff)) |
| 570 | (not (eq buf-type 'Ancestor)) | 570 | (not (eq buf-type 'Ancestor)) |
| 571 | (memq state-of-diff '(A B C))) | 571 | (memq state-of-diff '(A B C))) |
| @@ -574,7 +574,7 @@ one optional arguments, diff-number to refine.") | |||
| 574 | (setq state-of-diff (format "=diff(%S)" state-of-diff)) | 574 | (setq state-of-diff (format "=diff(%S)" state-of-diff)) |
| 575 | ) | 575 | ) |
| 576 | (t (setq state-of-diff nil))) | 576 | (t (setq state-of-diff nil))) |
| 577 | 577 | ||
| 578 | ;; Put overlays at appropriate places in buffer | 578 | ;; Put overlays at appropriate places in buffer |
| 579 | ;; convert word numbers to points, if necessary | 579 | ;; convert word numbers to points, if necessary |
| 580 | (if (eq diff-list-type 'words) | 580 | (if (eq diff-list-type 'words) |
| @@ -586,7 +586,7 @@ one optional arguments, diff-number to refine.") | |||
| 586 | (if (> begin end) (setq begin end)) | 586 | (if (> begin end) (setq begin end)) |
| 587 | (setq pt-saved (ediff-with-current-buffer buff (point))))) | 587 | (setq pt-saved (ediff-with-current-buffer buff (point))))) |
| 588 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) | 588 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) |
| 589 | 589 | ||
| 590 | (ediff-overlay-put overlay 'priority ediff-shadow-overlay-priority) | 590 | (ediff-overlay-put overlay 'priority ediff-shadow-overlay-priority) |
| 591 | (ediff-overlay-put overlay 'ediff-diff-num current-diff) | 591 | (ediff-overlay-put overlay 'ediff-diff-num current-diff) |
| 592 | (if (and (ediff-has-face-support-p) | 592 | (if (and (ediff-has-face-support-p) |
| @@ -609,7 +609,7 @@ one optional arguments, diff-number to refine.") | |||
| 609 | diff-list | 609 | diff-list |
| 610 | (cdr diff-list)) | 610 | (cdr diff-list)) |
| 611 | ) ; while | 611 | ) ; while |
| 612 | 612 | ||
| 613 | (set (ediff-get-symbol-from-alist buf-type ediff-difference-vector-alist) | 613 | (set (ediff-get-symbol-from-alist buf-type ediff-difference-vector-alist) |
| 614 | (vconcat diff-overlay-list)) | 614 | (vconcat diff-overlay-list)) |
| 615 | )) | 615 | )) |
| @@ -620,14 +620,14 @@ one optional arguments, diff-number to refine.") | |||
| 620 | ;; if `flag' is 'skip then don't compute fine diffs for this region. | 620 | ;; if `flag' is 'skip then don't compute fine diffs for this region. |
| 621 | (defun ediff-make-fine-diffs (&optional n flag) | 621 | (defun ediff-make-fine-diffs (&optional n flag) |
| 622 | (or n (setq n ediff-current-difference)) | 622 | (or n (setq n ediff-current-difference)) |
| 623 | 623 | ||
| 624 | (if (< ediff-number-of-differences 1) | 624 | (if (< ediff-number-of-differences 1) |
| 625 | (error ediff-NO-DIFFERENCES)) | 625 | (error ediff-NO-DIFFERENCES)) |
| 626 | 626 | ||
| 627 | (if ediff-word-mode | 627 | (if ediff-word-mode |
| 628 | (setq flag 'skip | 628 | (setq flag 'skip |
| 629 | ediff-auto-refine 'nix)) | 629 | ediff-auto-refine 'nix)) |
| 630 | 630 | ||
| 631 | (or (< n 0) | 631 | (or (< n 0) |
| 632 | (>= n ediff-number-of-differences) | 632 | (>= n ediff-number-of-differences) |
| 633 | ;; n is within the range | 633 | ;; n is within the range |
| @@ -642,7 +642,7 @@ one optional arguments, diff-number to refine.") | |||
| 642 | (whitespace-B (ediff-whitespace-diff-region-p n 'B)) | 642 | (whitespace-B (ediff-whitespace-diff-region-p n 'B)) |
| 643 | (whitespace-C (ediff-whitespace-diff-region-p n 'C)) | 643 | (whitespace-C (ediff-whitespace-diff-region-p n 'C)) |
| 644 | cumulative-fine-diff-length) | 644 | cumulative-fine-diff-length) |
| 645 | 645 | ||
| 646 | (cond ;; If one of the regions is empty (or 2 in 3way comparison) | 646 | (cond ;; If one of the regions is empty (or 2 in 3way comparison) |
| 647 | ;; then don't refine. | 647 | ;; then don't refine. |
| 648 | ;; If the region happens to be entirely whitespace or empty then | 648 | ;; If the region happens to be entirely whitespace or empty then |
| @@ -706,7 +706,7 @@ one optional arguments, diff-number to refine.") | |||
| 706 | ediff-control-buffer) | 706 | ediff-control-buffer) |
| 707 | (setq file-A | 707 | (setq file-A |
| 708 | (ediff-make-temp-file tmp-buffer "fineDiffA" file-A)) | 708 | (ediff-make-temp-file tmp-buffer "fineDiffA" file-A)) |
| 709 | 709 | ||
| 710 | (ediff-wordify | 710 | (ediff-wordify |
| 711 | (ediff-get-diff-posn 'B 'beg n) | 711 | (ediff-get-diff-posn 'B 'beg n) |
| 712 | (ediff-get-diff-posn 'B 'end n) | 712 | (ediff-get-diff-posn 'B 'end n) |
| @@ -715,7 +715,7 @@ one optional arguments, diff-number to refine.") | |||
| 715 | ediff-control-buffer) | 715 | ediff-control-buffer) |
| 716 | (setq file-B | 716 | (setq file-B |
| 717 | (ediff-make-temp-file tmp-buffer "fineDiffB" file-B)) | 717 | (ediff-make-temp-file tmp-buffer "fineDiffB" file-B)) |
| 718 | 718 | ||
| 719 | (if ediff-3way-job | 719 | (if ediff-3way-job |
| 720 | (progn | 720 | (progn |
| 721 | (ediff-wordify | 721 | (ediff-wordify |
| @@ -727,12 +727,12 @@ one optional arguments, diff-number to refine.") | |||
| 727 | (setq file-C | 727 | (setq file-C |
| 728 | (ediff-make-temp-file | 728 | (ediff-make-temp-file |
| 729 | tmp-buffer "fineDiffC" file-C)))) | 729 | tmp-buffer "fineDiffC" file-C)))) |
| 730 | 730 | ||
| 731 | ;; save temp file names. | 731 | ;; save temp file names. |
| 732 | (setq ediff-temp-file-A file-A | 732 | (setq ediff-temp-file-A file-A |
| 733 | ediff-temp-file-B file-B | 733 | ediff-temp-file-B file-B |
| 734 | ediff-temp-file-C file-C) | 734 | ediff-temp-file-C file-C) |
| 735 | 735 | ||
| 736 | ;; set the new vector of fine diffs, if none exists | 736 | ;; set the new vector of fine diffs, if none exists |
| 737 | (cond ((and ediff-3way-job whitespace-A) | 737 | (cond ((and ediff-3way-job whitespace-A) |
| 738 | (ediff-setup-fine-diff-regions nil file-B file-C n)) | 738 | (ediff-setup-fine-diff-regions nil file-B file-C n)) |
| @@ -745,7 +745,7 @@ one optional arguments, diff-number to refine.") | |||
| 745 | (ediff-setup-fine-diff-regions file-A file-B nil n)) | 745 | (ediff-setup-fine-diff-regions file-A file-B nil n)) |
| 746 | (t | 746 | (t |
| 747 | (ediff-setup-fine-diff-regions file-A file-B file-C n))) | 747 | (ediff-setup-fine-diff-regions file-A file-B file-C n))) |
| 748 | 748 | ||
| 749 | (setq cumulative-fine-diff-length | 749 | (setq cumulative-fine-diff-length |
| 750 | (+ (length (ediff-get-fine-diff-vector n 'A)) | 750 | (+ (length (ediff-get-fine-diff-vector n 'A)) |
| 751 | (length (ediff-get-fine-diff-vector n 'B)) | 751 | (length (ediff-get-fine-diff-vector n 'B)) |
| @@ -753,7 +753,7 @@ one optional arguments, diff-number to refine.") | |||
| 753 | (if (and file-C (not ediff-merge-job)) | 753 | (if (and file-C (not ediff-merge-job)) |
| 754 | (length (ediff-get-fine-diff-vector n 'C)) | 754 | (length (ediff-get-fine-diff-vector n 'C)) |
| 755 | 0))) | 755 | 0))) |
| 756 | 756 | ||
| 757 | (cond ((or | 757 | (cond ((or |
| 758 | ;; all regions are white space | 758 | ;; all regions are white space |
| 759 | (and whitespace-A whitespace-B whitespace-C) | 759 | (and whitespace-A whitespace-B whitespace-C) |
| @@ -781,7 +781,7 @@ one optional arguments, diff-number to refine.") | |||
| 781 | ) ; end cond | 781 | ) ; end cond |
| 782 | (ediff-set-fine-diff-properties n) | 782 | (ediff-set-fine-diff-properties n) |
| 783 | ))) | 783 | ))) |
| 784 | 784 | ||
| 785 | ;; Interface to ediff-make-fine-diffs. Checks for auto-refine limit, etc. | 785 | ;; Interface to ediff-make-fine-diffs. Checks for auto-refine limit, etc. |
| 786 | (defun ediff-install-fine-diff-if-necessary (n) | 786 | (defun ediff-install-fine-diff-if-necessary (n) |
| 787 | (cond ((and (eq ediff-auto-refine 'on) | 787 | (cond ((and (eq ediff-auto-refine 'on) |
| @@ -797,12 +797,12 @@ one optional arguments, diff-number to refine.") | |||
| 797 | (ediff-get-diff-posn 'B 'beg n)))) | 797 | (ediff-get-diff-posn 'B 'beg n)))) |
| 798 | (ediff-make-fine-diffs n 'noforce) | 798 | (ediff-make-fine-diffs n 'noforce) |
| 799 | (ediff-make-fine-diffs n 'skip))) | 799 | (ediff-make-fine-diffs n 'skip))) |
| 800 | 800 | ||
| 801 | ;; highlight iff fine diffs already exist | 801 | ;; highlight iff fine diffs already exist |
| 802 | ((eq ediff-auto-refine 'off) | 802 | ((eq ediff-auto-refine 'off) |
| 803 | (ediff-make-fine-diffs n 'skip)))) | 803 | (ediff-make-fine-diffs n 'skip)))) |
| 804 | 804 | ||
| 805 | 805 | ||
| 806 | ;; if fine diff vector is not set for diff N, then do nothing | 806 | ;; if fine diff vector is not set for diff N, then do nothing |
| 807 | (defun ediff-set-fine-diff-properties (n &optional default) | 807 | (defun ediff-set-fine-diff-properties (n &optional default) |
| 808 | (or (not (ediff-has-face-support-p)) | 808 | (or (not (ediff-has-face-support-p)) |
| @@ -814,7 +814,7 @@ one optional arguments, diff-number to refine.") | |||
| 814 | (ediff-set-fine-diff-properties-in-one-buffer 'B n default) | 814 | (ediff-set-fine-diff-properties-in-one-buffer 'B n default) |
| 815 | (if ediff-3way-job | 815 | (if ediff-3way-job |
| 816 | (ediff-set-fine-diff-properties-in-one-buffer 'C n default))))) | 816 | (ediff-set-fine-diff-properties-in-one-buffer 'C n default))))) |
| 817 | 817 | ||
| 818 | (defun ediff-set-fine-diff-properties-in-one-buffer (buf-type | 818 | (defun ediff-set-fine-diff-properties-in-one-buffer (buf-type |
| 819 | n &optional default) | 819 | n &optional default) |
| 820 | (let ((fine-diff-vector (ediff-get-fine-diff-vector n buf-type)) | 820 | (let ((fine-diff-vector (ediff-get-fine-diff-vector n buf-type)) |
| @@ -836,7 +836,7 @@ one optional arguments, diff-number to refine.") | |||
| 836 | (ediff-set-overlay-face overl face) | 836 | (ediff-set-overlay-face overl face) |
| 837 | (ediff-overlay-put overl 'priority priority)) | 837 | (ediff-overlay-put overl 'priority priority)) |
| 838 | fine-diff-vector))) | 838 | fine-diff-vector))) |
| 839 | 839 | ||
| 840 | ;; Set overlays over the regions that denote delimiters | 840 | ;; Set overlays over the regions that denote delimiters |
| 841 | (defun ediff-set-fine-overlays-for-combined-merge (diff-list reg-num) | 841 | (defun ediff-set-fine-overlays-for-combined-merge (diff-list reg-num) |
| 842 | (let (overlay overlay-list) | 842 | (let (overlay overlay-list) |
| @@ -856,8 +856,8 @@ delimiter regions")) | |||
| 856 | (ediff-set-fine-diff-vector | 856 | (ediff-set-fine-diff-vector |
| 857 | reg-num 'C (apply 'vector overlay-list)) | 857 | reg-num 'C (apply 'vector overlay-list)) |
| 858 | )) | 858 | )) |
| 859 | 859 | ||
| 860 | 860 | ||
| 861 | ;; Convert diff list to overlays for a given DIFF-REGION | 861 | ;; Convert diff list to overlays for a given DIFF-REGION |
| 862 | ;; in buffer of type BUF-TYPE | 862 | ;; in buffer of type BUF-TYPE |
| 863 | (defun ediff-set-fine-overlays-in-one-buffer (buf-type diff-list region-num) | 863 | (defun ediff-set-fine-overlays-in-one-buffer (buf-type diff-list region-num) |
| @@ -871,7 +871,7 @@ delimiter regions")) | |||
| 871 | (ediff-clear-fine-differences-in-one-buffer region-num buf-type) | 871 | (ediff-clear-fine-differences-in-one-buffer region-num buf-type) |
| 872 | (setq diff-list (cdr diff-list)) ; discard list type (words or points) | 872 | (setq diff-list (cdr diff-list)) ; discard list type (words or points) |
| 873 | (ediff-with-current-buffer buff (goto-char reg-start)) | 873 | (ediff-with-current-buffer buff (goto-char reg-start)) |
| 874 | 874 | ||
| 875 | ;; if it is a combined merge then set overlays in buff C specially | 875 | ;; if it is a combined merge then set overlays in buff C specially |
| 876 | (if (and ediff-merge-job (eq buf-type 'C) | 876 | (if (and ediff-merge-job (eq buf-type 'C) |
| 877 | (setq combined-merge-diff-list | 877 | (setq combined-merge-diff-list |
| @@ -897,7 +897,7 @@ delimiter regions")) | |||
| 897 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) | 897 | (setq overlay (ediff-make-bullet-proof-overlay begin end buff)) |
| 898 | ;; record all overlays for this difference region | 898 | ;; record all overlays for this difference region |
| 899 | (setq diff-overlay-list (nconc diff-overlay-list (list overlay)))) | 899 | (setq diff-overlay-list (nconc diff-overlay-list (list overlay)))) |
| 900 | 900 | ||
| 901 | (setq diff-list (cdr diff-list)) | 901 | (setq diff-list (cdr diff-list)) |
| 902 | ) ; while | 902 | ) ; while |
| 903 | ;; convert the list of difference information into a vector | 903 | ;; convert the list of difference information into a vector |
| @@ -964,7 +964,7 @@ delimiter regions")) | |||
| 964 | (anc-prev 1) | 964 | (anc-prev 1) |
| 965 | diff-list shift-A shift-B shift-C | 965 | diff-list shift-A shift-B shift-C |
| 966 | ) | 966 | ) |
| 967 | 967 | ||
| 968 | ;; diff list contains word numbers or points, depending on word-mode | 968 | ;; diff list contains word numbers or points, depending on word-mode |
| 969 | (setq diff-list (cons (if word-mode 'words 'points) | 969 | (setq diff-list (cons (if word-mode 'words 'points) |
| 970 | diff-list)) | 970 | diff-list)) |
| @@ -979,7 +979,7 @@ delimiter regions")) | |||
| 979 | (if three-way-comp | 979 | (if three-way-comp |
| 980 | (ediff-overlay-start | 980 | (ediff-overlay-start |
| 981 | (ediff-get-value-according-to-buffer-type 'C bounds))))) | 981 | (ediff-get-value-according-to-buffer-type 'C bounds))))) |
| 982 | 982 | ||
| 983 | ;; reset point in buffers A, B, C | 983 | ;; reset point in buffers A, B, C |
| 984 | (ediff-with-current-buffer A-buffer | 984 | (ediff-with-current-buffer A-buffer |
| 985 | (goto-char (if shift-A shift-A (point-min)))) | 985 | (goto-char (if shift-A shift-A (point-min)))) |
| @@ -991,7 +991,7 @@ delimiter regions")) | |||
| 991 | (if (ediff-buffer-live-p anc-buffer) | 991 | (if (ediff-buffer-live-p anc-buffer) |
| 992 | (ediff-with-current-buffer anc-buffer | 992 | (ediff-with-current-buffer anc-buffer |
| 993 | (goto-char (point-min)))) | 993 | (goto-char (point-min)))) |
| 994 | 994 | ||
| 995 | (ediff-with-current-buffer diff-buffer | 995 | (ediff-with-current-buffer diff-buffer |
| 996 | (goto-char (point-min)) | 996 | (goto-char (point-min)) |
| 997 | (while (re-search-forward ediff-match-diff3-line nil t) | 997 | (while (re-search-forward ediff-match-diff3-line nil t) |
| @@ -1023,7 +1023,7 @@ delimiter regions")) | |||
| 1023 | b-begin-pt b-end-pt | 1023 | b-begin-pt b-end-pt |
| 1024 | c-begin-pt c-end-pt | 1024 | c-begin-pt c-end-pt |
| 1025 | anc-begin-pt anc-end-pt) | 1025 | anc-begin-pt anc-end-pt) |
| 1026 | 1026 | ||
| 1027 | (setq state-of-ancestor | 1027 | (setq state-of-ancestor |
| 1028 | (= c-or-anc-begin c-or-anc-end)) | 1028 | (= c-or-anc-begin c-or-anc-end)) |
| 1029 | 1029 | ||
| @@ -1036,7 +1036,7 @@ delimiter regions")) | |||
| 1036 | (t | 1036 | (t |
| 1037 | (setq c-begin a-begin | 1037 | (setq c-begin a-begin |
| 1038 | c-end a-end))) | 1038 | c-end a-end))) |
| 1039 | 1039 | ||
| 1040 | ;; compute main diff vector | 1040 | ;; compute main diff vector |
| 1041 | (if word-mode | 1041 | (if word-mode |
| 1042 | ;; make diff-list contain word numbers | 1042 | ;; make diff-list contain word numbers |
| @@ -1105,11 +1105,11 @@ delimiter regions")) | |||
| 1105 | ))) | 1105 | ))) |
| 1106 | ))) | 1106 | ))) |
| 1107 | )) | 1107 | )) |
| 1108 | 1108 | ||
| 1109 | ))) ; end ediff-with-current-buffer | 1109 | ))) ; end ediff-with-current-buffer |
| 1110 | diff-list | 1110 | diff-list |
| 1111 | )) | 1111 | )) |
| 1112 | 1112 | ||
| 1113 | ;; Generate the difference vector and overlays for three files | 1113 | ;; Generate the difference vector and overlays for three files |
| 1114 | ;; File-C is either the third file to compare (in case of 3-way comparison) | 1114 | ;; File-C is either the third file to compare (in case of 3-way comparison) |
| 1115 | ;; or it is the ancestor file. | 1115 | ;; or it is the ancestor file. |
| @@ -1117,11 +1117,11 @@ delimiter regions")) | |||
| 1117 | (or (ediff-buffer-live-p ediff-diff-buffer) | 1117 | (or (ediff-buffer-live-p ediff-diff-buffer) |
| 1118 | (setq ediff-diff-buffer | 1118 | (setq ediff-diff-buffer |
| 1119 | (get-buffer-create (ediff-unique-buffer-name "*ediff-diff" "*")))) | 1119 | (get-buffer-create (ediff-unique-buffer-name "*ediff-diff" "*")))) |
| 1120 | 1120 | ||
| 1121 | (message "Computing differences ...") | 1121 | (message "Computing differences ...") |
| 1122 | (ediff-exec-process ediff-diff3-program ediff-diff-buffer 'synchronize | 1122 | (ediff-exec-process ediff-diff3-program ediff-diff-buffer 'synchronize |
| 1123 | ediff-diff3-options file-A file-B file-C) | 1123 | ediff-diff3-options file-A file-B file-C) |
| 1124 | 1124 | ||
| 1125 | (ediff-prepare-error-list ediff-diff3-ok-lines-regexp ediff-diff-buffer) | 1125 | (ediff-prepare-error-list ediff-diff3-ok-lines-regexp ediff-diff-buffer) |
| 1126 | ;;(message "Computing differences ... done") | 1126 | ;;(message "Computing differences ... done") |
| 1127 | (ediff-convert-diffs-to-overlays | 1127 | (ediff-convert-diffs-to-overlays |
| @@ -1129,7 +1129,7 @@ delimiter regions")) | |||
| 1129 | ediff-diff-buffer | 1129 | ediff-diff-buffer |
| 1130 | ediff-word-mode ediff-3way-comparison-job ediff-narrow-bounds) | 1130 | ediff-word-mode ediff-3way-comparison-job ediff-narrow-bounds) |
| 1131 | )) | 1131 | )) |
| 1132 | 1132 | ||
| 1133 | 1133 | ||
| 1134 | ;; Execute PROGRAM asynchronously, unless OS/2, Windows-*, or DOS, or unless | 1134 | ;; Execute PROGRAM asynchronously, unless OS/2, Windows-*, or DOS, or unless |
| 1135 | ;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive. The | 1135 | ;; SYNCH is non-nil. BUFFER must be a buffer object, and must be alive. The |
| @@ -1176,7 +1176,7 @@ delimiter regions")) | |||
| 1176 | (set-process-filter proc 'ediff-process-filter) | 1176 | (set-process-filter proc 'ediff-process-filter) |
| 1177 | ))) | 1177 | ))) |
| 1178 | (store-match-data data)))) | 1178 | (store-match-data data)))) |
| 1179 | 1179 | ||
| 1180 | ;; This is shell-command-filter from simple.el in Emacs. | 1180 | ;; This is shell-command-filter from simple.el in Emacs. |
| 1181 | ;; Copied here because XEmacs doesn't have it. | 1181 | ;; Copied here because XEmacs doesn't have it. |
| 1182 | (defun ediff-process-filter (proc string) | 1182 | (defun ediff-process-filter (proc string) |
| @@ -1200,7 +1200,7 @@ delimiter regions")) | |||
| 1200 | (if opoint | 1200 | (if opoint |
| 1201 | (goto-char opoint)) | 1201 | (goto-char opoint)) |
| 1202 | (set-buffer obuf)))) | 1202 | (set-buffer obuf)))) |
| 1203 | 1203 | ||
| 1204 | ;; like shell-command-sentinel but doesn't print an exit status message | 1204 | ;; like shell-command-sentinel but doesn't print an exit status message |
| 1205 | ;; we do this because diff always exits with status 1, if diffs are found | 1205 | ;; we do this because diff always exits with status 1, if diffs are found |
| 1206 | ;; so shell-command-sentinel displays a confusing message to the user | 1206 | ;; so shell-command-sentinel displays a confusing message to the user |
| @@ -1212,7 +1212,7 @@ delimiter regions")) | |||
| 1212 | (set-buffer (process-buffer process)) | 1212 | (set-buffer (process-buffer process)) |
| 1213 | (setq mode-line-process nil)) | 1213 | (setq mode-line-process nil)) |
| 1214 | (delete-process process)))) | 1214 | (delete-process process)))) |
| 1215 | 1215 | ||
| 1216 | 1216 | ||
| 1217 | ;;; Word functions used to refine the current diff | 1217 | ;;; Word functions used to refine the current diff |
| 1218 | 1218 | ||
| @@ -1297,14 +1297,14 @@ arguments to `skip-chars-forward'." | |||
| 1297 | (goto-char (point-min)) | 1297 | (goto-char (point-min)) |
| 1298 | (skip-chars-forward ediff-whitespace) | 1298 | (skip-chars-forward ediff-whitespace) |
| 1299 | (delete-region (point-min) (point)) | 1299 | (delete-region (point-min) (point)) |
| 1300 | 1300 | ||
| 1301 | (while (not (eobp)) | 1301 | (while (not (eobp)) |
| 1302 | (funcall forward-word-function) | 1302 | (funcall forward-word-function) |
| 1303 | (setq sv-point (point)) | 1303 | (setq sv-point (point)) |
| 1304 | (skip-chars-forward ediff-whitespace) | 1304 | (skip-chars-forward ediff-whitespace) |
| 1305 | (delete-region sv-point (point)) | 1305 | (delete-region sv-point (point)) |
| 1306 | (insert "\n"))))) | 1306 | (insert "\n"))))) |
| 1307 | 1307 | ||
| 1308 | ;; copy string specified as BEG END from IN-BUF to OUT-BUF | 1308 | ;; copy string specified as BEG END from IN-BUF to OUT-BUF |
| 1309 | (defun ediff-copy-to-buffer (beg end in-buffer out-buffer) | 1309 | (defun ediff-copy-to-buffer (beg end in-buffer out-buffer) |
| 1310 | (with-current-buffer out-buffer | 1310 | (with-current-buffer out-buffer |