comparison lisp/diff.el @ 6147:f89879182407

(diff-latest-backup-file): Check for a file-name-handler and run it.
author Roland McGrath <roland@gnu.org>
date Wed, 02 Mar 1994 10:27:36 +0000
parents 004856d1b311
children 8c667dc4566e
comparison
equal deleted inserted replaced
6146:1a2a8ef9b4af 6147:f89879182407
1 ;;; diff.el --- Run `diff' in compilation-mode. 1 ;;; diff.el --- Run `diff' in compilation-mode.
2 2
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
4 4
5 ;; Keywords: unix, tools 5 ;; Keywords: unix, tools
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
252 ori file)) 252 ori file))
253 (diff bak ori switches))) 253 (diff bak ori switches)))
254 254
255 (defun diff-latest-backup-file (fn) ; actually belongs into files.el 255 (defun diff-latest-backup-file (fn) ; actually belongs into files.el
256 "Return the latest existing backup of FILE, or nil." 256 "Return the latest existing backup of FILE, or nil."
257 ;; First try simple backup, then the highest numbered of the 257 (let ((handler (find-file-name-handler fn)))
258 ;; numbered backups. 258 (if handler
259 ;; Ignore the value of version-control because we look for existing 259 (funcall handler fn)
260 ;; backups, which maybe were made earlier or by another user with 260 ;; First try simple backup, then the highest numbered of the
261 ;; a different value of version-control. 261 ;; numbered backups.
262 (setq fn (file-chase-links (expand-file-name fn))) 262 ;; Ignore the value of version-control because we look for existing
263 (or 263 ;; backups, which maybe were made earlier or by another user with
264 (let ((bak (make-backup-file-name fn))) 264 ;; a different value of version-control.
265 (if (file-exists-p bak) bak)) 265 (setq fn (file-chase-links (expand-file-name fn)))
266 (let* ((dir (file-name-directory fn)) 266 (or
267 (base-versions (concat (file-name-nondirectory fn) ".~")) 267 (let ((bak (make-backup-file-name fn)))
268 (bv-length (length base-versions))) 268 (if (file-exists-p bak) bak))
269 (concat dir 269 (let* ((dir (file-name-directory fn))
270 (car (sort 270 (base-versions (concat (file-name-nondirectory fn) ".~"))
271 (file-name-all-completions base-versions dir) 271 (bv-length (length base-versions)))
272 ;; bv-length is a fluid var for backup-extract-version: 272 (concat dir
273 (function 273 (car (sort
274 (lambda (fn1 fn2) 274 (file-name-all-completions base-versions dir)
275 (> (backup-extract-version fn1) 275 ;; bv-length is a fluid var for backup-extract-version:
276 (backup-extract-version fn2)))))))))) 276 (function
277 (lambda (fn1 fn2)
278 (> (backup-extract-version fn1)
279 (backup-extract-version fn2))))))))))))
277 280
278 (provide 'diff) 281 (provide 'diff)
279 282
280 ;;; diff.el ends here 283 ;;; diff.el ends here