comparison lisp/diff.el @ 1110:f165d900e06e

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Sep 1992 06:01:19 +0000
parents 48ca3bf4b5f8
children 1dba066c1e0a
comparison
equal deleted inserted replaced
1109:c9feb3e64805 1110:f165d900e06e
164 (mapconcat 'identity diff-switches " ")))) 164 (mapconcat 'identity diff-switches " "))))
165 nil))) 165 nil)))
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)
187 "Diff this file with its backup file or vice versa. 214 "Diff this file with its backup file or vice versa.
188 Uses the latest backup, if there are several numerical backups. 215 Uses the latest backup, if there are several numerical backups.