diff options
| author | Roland McGrath | 1994-03-02 10:27:36 +0000 |
|---|---|---|
| committer | Roland McGrath | 1994-03-02 10:27:36 +0000 |
| commit | 34c46d8756ce293a07f711e361c7869693b87d3f (patch) | |
| tree | 2a7c5c76cceec9a9cdeb2e24e0561a522105dcb6 /lisp/diff.el | |
| parent | b8ca7cc378582397657c3a825131612d4eb2e80f (diff) | |
| download | emacs-34c46d8756ce293a07f711e361c7869693b87d3f.tar.gz emacs-34c46d8756ce293a07f711e361c7869693b87d3f.zip | |
(diff-latest-backup-file): Check for a file-name-handler and run it.
Diffstat (limited to 'lisp/diff.el')
| -rw-r--r-- | lisp/diff.el | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/lisp/diff.el b/lisp/diff.el index 3f35c1167b2..a6793dca51f 100644 --- a/lisp/diff.el +++ b/lisp/diff.el | |||
| @@ -1,6 +1,6 @@ | |||
| 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 | ||
| @@ -254,26 +254,29 @@ The backup file is the first file given to `diff'." | |||
| 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 | ||