aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/diff.el
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-13 06:01:19 +0000
committerRichard M. Stallman1992-09-13 06:01:19 +0000
commitbfe81e789a0838e336f71f182cf500e5068765fd (patch)
tree04a3122fc833515fb83145bfd9ca3c5d876ba6ff /lisp/diff.el
parentc3554e95658a0ea4b90cc4d6110664c12d463b5a (diff)
downloademacs-bfe81e789a0838e336f71f182cf500e5068765fd.tar.gz
emacs-bfe81e789a0838e336f71f182cf500e5068765fd.zip
*** empty log message ***
Diffstat (limited to 'lisp/diff.el')
-rw-r--r--lisp/diff.el57
1 files changed, 42 insertions, 15 deletions
diff --git a/lisp/diff.el b/lisp/diff.el
index 347bbb75d35..c317baf3281 100644
--- a/lisp/diff.el
+++ b/lisp/diff.el
@@ -166,21 +166,48 @@ With prefix arg, prompt for diff switches."
166 (message "Comparing files %s %s..." new old) 166 (message "Comparing files %s %s..." new old)
167 (setq new (expand-file-name new) 167 (setq new (expand-file-name new)
168 old (expand-file-name old)) 168 old (expand-file-name old))
169 (let ((buf (compile-internal (mapconcat 'identity 169 (let ((old-alt (diff-prepare old new))
170 (append '("diff") 170 (new-alt (diff-prepare new old))
171 (if (consp diff-switches) 171 buf)
172 diff-switches 172 (unwind-protect
173 (list diff-switches)) 173 (let ((command
174 (list old) 174 (mapconcat 'identity
175 (list new)) 175 (append '("diff")
176 " ") 176 (if (consp diff-switches)
177 "No more differences" "Diff" 177 diff-switches
178 'diff-parse-differences))) 178 (list diff-switches))
179 (save-excursion 179 (if (or old-alt new-alt)
180 (set-buffer buf) 180 (list "-L" old "-L" new))
181 (set (make-local-variable 'diff-old-file) old) 181 (list (or old-alt old))
182 (set (make-local-variable 'diff-new-file) new)) 182 (list (or new-alt new)))
183 buf)) 183 " ")))
184 (setq buf
185 (compile-internal command
186 "No more differences" "Diff"
187 'diff-parse-differences)))
188 (save-excursion
189 (set-buffer buf)
190 (set (make-local-variable 'diff-old-file) old)
191 (set (make-local-variable 'diff-new-file) new))
192 buf)
193 (if old-alt (delete-file old-alt))
194 (if new-alt (delete-file new-alt)))))
195
196;; Copy the file FILE into a temporary file if that is necessary
197;; for comparison. (This is only necessary if the file name has a handler.)
198;; OTHER is the other file to be compared.
199(defun diff-prepare (file other)
200 (let (handler handlers)
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)))
184 211
185;;;###autoload 212;;;###autoload
186(defun diff-backup (file &optional switches) 213(defun diff-backup (file &optional switches)