diff options
| author | Richard M. Stallman | 1996-04-03 05:55:12 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-04-03 05:55:12 +0000 |
| commit | cf7e94a0dfbdb1e8b9bcb97e838a3f708f3cd0bb (patch) | |
| tree | 62b08d6ae868f13d155c76e036bf27cb6f5c1c93 | |
| parent | 3943fa098eb21ae5f536a9dcd81b5b59aa37df80 (diff) | |
| download | emacs-cf7e94a0dfbdb1e8b9bcb97e838a3f708f3cd0bb.tar.gz emacs-cf7e94a0dfbdb1e8b9bcb97e838a3f708f3cd0bb.zip | |
(file-newest-backup): Return the newest backup for the
exact file name specified, not the newest backup of all files
whose names start with that substring.
| -rw-r--r-- | lisp/files.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/files.el b/lisp/files.el index 584aef9f456..6839fcf27dc 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2058,13 +2058,17 @@ saying what text to write." | |||
| 2058 | (file (file-name-nondirectory filename)) | 2058 | (file (file-name-nondirectory filename)) |
| 2059 | (dir (file-name-directory filename)) | 2059 | (dir (file-name-directory filename)) |
| 2060 | (comp (file-name-all-completions file dir)) | 2060 | (comp (file-name-all-completions file dir)) |
| 2061 | newest) | 2061 | (newest nil) |
| 2062 | tem) | ||
| 2062 | (while comp | 2063 | (while comp |
| 2063 | (setq file (concat dir (car comp)) | 2064 | (setq tem (car comp) |
| 2064 | comp (cdr comp)) | 2065 | comp (cdr comp)) |
| 2065 | (if (and (backup-file-name-p file) | 2066 | (cond ((and (backup-file-name-p tem) |
| 2066 | (or (null newest) (file-newer-than-file-p file newest))) | 2067 | (string= (file-name-sans-versions tem) file)) |
| 2067 | (setq newest file))) | 2068 | (setq tem (concat dir tem)) |
| 2069 | (if (or (null newest) | ||
| 2070 | (file-newer-than-file-p tem newest)) | ||
| 2071 | (setq newest tem))))) | ||
| 2068 | newest)) | 2072 | newest)) |
| 2069 | 2073 | ||
| 2070 | (defun rename-uniquely () | 2074 | (defun rename-uniquely () |