diff options
| author | Richard M. Stallman | 1992-09-14 01:39:31 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-09-14 01:39:31 +0000 |
| commit | 5d68c2c227eb79f3eca2323f86780f8b7b178c49 (patch) | |
| tree | f9aaa08b1cd91de4a330699a6769ab0d52c0f3ff /lisp/diff.el | |
| parent | 6c43f2f9e97b5dbaa9f582444c9c905cda9b29f1 (diff) | |
| download | emacs-5d68c2c227eb79f3eca2323f86780f8b7b178c49.tar.gz emacs-5d68c2c227eb79f3eca2323f86780f8b7b178c49.zip | |
*** empty log message ***
Diffstat (limited to 'lisp/diff.el')
| -rw-r--r-- | lisp/diff.el | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/lisp/diff.el b/lisp/diff.el index 615d64d5fa8..ae49cf1f371 100644 --- a/lisp/diff.el +++ b/lisp/diff.el | |||
| @@ -53,6 +53,15 @@ subexpression gives the line number in the old file, and NEW-IDX'th | |||
| 53 | subexpression gives the line number in the new file. If OLD-IDX or NEW-IDX | 53 | subexpression gives the line number in the new file. If OLD-IDX or NEW-IDX |
| 54 | is nil, REGEXP matches only half a section.") | 54 | is nil, REGEXP matches only half a section.") |
| 55 | 55 | ||
| 56 | (defvar diff-old-file nil | ||
| 57 | "This is the old file name in the comparison in this buffer.") | ||
| 58 | (defvar diff-new-file nil | ||
| 59 | "This is the new file name in the comparison in this buffer.") | ||
| 60 | (defvar diff-old-temp-file nil | ||
| 61 | "This is the name of a temp file to be deleted after diff finishes.") | ||
| 62 | (defvar diff-new-temp-file nil | ||
| 63 | "This is the name of a temp file to be deleted after diff finishes.") | ||
| 64 | |||
| 56 | ;; See compilation-parse-errors-function (compile.el). | 65 | ;; See compilation-parse-errors-function (compile.el). |
| 57 | (defun diff-parse-differences (limit-search find-at-least) | 66 | (defun diff-parse-differences (limit-search find-at-least) |
| 58 | (setq compilation-error-list nil) | 67 | (setq compilation-error-list nil) |
| @@ -118,7 +127,8 @@ is nil, REGEXP matches only half a section.") | |||
| 118 | (if (nth 2 g) ;NEW-IDX | 127 | (if (nth 2 g) ;NEW-IDX |
| 119 | (funcall new-error diff-new-file (nth 2 g))) | 128 | (funcall new-error diff-new-file (nth 2 g))) |
| 120 | 129 | ||
| 121 | (if (or (and find-at-least (>= nfound find-at-least)) | 130 | (if (or (and find-at-least |
| 131 | (>= compilation-num-errors-found find-at-least)) | ||
| 122 | (and limit-search (>= (point) limit-search))) | 132 | (and limit-search (>= (point) limit-search))) |
| 123 | ;; We have found as many new errors as the user wants, | 133 | ;; We have found as many new errors as the user wants, |
| 124 | ;; or the user wanted a specific diff, and we're past it. | 134 | ;; or the user wanted a specific diff, and we're past it. |
| @@ -166,8 +176,8 @@ With prefix arg, prompt for diff switches." | |||
| 166 | (message "Comparing files %s %s..." new old) | 176 | (message "Comparing files %s %s..." new old) |
| 167 | (setq new (expand-file-name new) | 177 | (setq new (expand-file-name new) |
| 168 | old (expand-file-name old)) | 178 | old (expand-file-name old)) |
| 169 | (let ((old-alt (diff-prepare old new)) | 179 | (let ((old-alt (file-local-copy old)) |
| 170 | (new-alt (diff-prepare new old)) | 180 | (new-alt (file-local-copy new)) |
| 171 | buf) | 181 | buf) |
| 172 | (unwind-protect | 182 | (unwind-protect |
| 173 | (let ((command | 183 | (let ((command |
| @@ -188,26 +198,16 @@ With prefix arg, prompt for diff switches." | |||
| 188 | (save-excursion | 198 | (save-excursion |
| 189 | (set-buffer buf) | 199 | (set-buffer buf) |
| 190 | (set (make-local-variable 'diff-old-file) old) | 200 | (set (make-local-variable 'diff-old-file) old) |
| 191 | (set (make-local-variable 'diff-new-file) new)) | 201 | (set (make-local-variable 'diff-new-file) new) |
| 192 | buf) | 202 | (set (make-local-variable 'diff-old-temp-file) old-alt) |
| 193 | (if old-alt (delete-file old-alt)) | 203 | (set (make-local-variable 'diff-new-temp-file) new-alt) |
| 194 | (if new-alt (delete-file new-alt))))) | 204 | (set (make-local-variable 'compilation-finish-function) |
| 195 | 205 | (function (lambda (buff msg) | |
| 196 | ;; Copy the file FILE into a temporary file if that is necessary | 206 | (if diff-old-temp-file |
| 197 | ;; for comparison. (This is only necessary if the file name has a handler.) | 207 | (delete-file diff-old-temp-file)) |
| 198 | ;; OTHER is the other file to be compared. | 208 | (if diff-new-temp-file |
| 199 | (defun diff-prepare (file other) | 209 | (delete-file diff-new-temp-file)))))) |
| 200 | (let (handler handlers) | 210 | buf)))) |
| 201 | (setq handlers file-name-handler-alist) | ||
| 202 | (while (and (consp handlers) (null handler)) | ||
| 203 | (if (and (consp (car handlers)) | ||
| 204 | (stringp (car (car handlers))) | ||
| 205 | (string-match (car (car handlers)) file)) | ||
| 206 | (setq handler (cdr (car handlers)))) | ||
| 207 | (setq handlers (cdr handlers))) | ||
| 208 | (if handler | ||
| 209 | (funcall handler 'diff-prepare file other) | ||
| 210 | nil))) | ||
| 211 | 211 | ||
| 212 | ;;;###autoload | 212 | ;;;###autoload |
| 213 | (defun diff-backup (file &optional switches) | 213 | (defun diff-backup (file &optional switches) |