Mercurial > emacs
changeset 4965:dad86ab54e36
(find-backup-file-name): Don't fatal-error on
directories that are hard to read; fall back on ~/%backup%.
(file-truename): Treat ~USER like just ~.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 10 Nov 1993 20:41:17 +0000 |
parents | 78c13f3054e5 |
children | 82353ffa44b7 |
files | lisp/files.el |
diffstat | 1 files changed, 23 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/files.el Wed Nov 10 20:30:32 1993 +0000 +++ b/lisp/files.el Wed Nov 10 20:41:17 1993 +0000 @@ -330,7 +330,9 @@ The truename of a file name is found by chasing symbolic links both at the level of the file and at the level of the directories containing it, until no links are left at any level." - (if (string= filename "~") + (if (or (string= filename "~") + (and (string= (substring filename 0 1) "~") + (string-match "~[^/]*" filename))) (progn (setq filename (expand-file-name filename)) (if (string= filename "") @@ -1298,19 +1300,26 @@ (list (make-backup-file-name fn)) (let* ((base-versions (concat (file-name-nondirectory fn) ".~")) (bv-length (length base-versions)) - (possibilities (file-name-all-completions - base-versions - (file-name-directory fn))) - (versions (sort (mapcar - (function backup-extract-version) - possibilities) - '<)) - (high-water-mark (apply 'max 0 versions)) - (deserve-versions-p - (or version-control - (> high-water-mark 0))) - (number-to-delete (- (length versions) - kept-old-versions kept-new-versions -1))) + possibilities + (versions nil) + (high-water-mark 0) + (deserve-versions-p nil) + (number-to-delete 0)) + (condition-case () + (setq possibilities (file-name-all-completions + base-versions + (file-name-directory fn)) + versions (sort (mapcar + (function backup-extract-version) + possibilities) + '<) + high-water-mark (apply 'max 0 versions) + deserve-versions-p (or version-control + (> high-water-mark 0)) + number-to-delete (- (length versions) + kept-old-versions kept-new-versions -1)) + (file-error + (setq possibilities nil))) (if (not deserve-versions-p) (list (make-backup-file-name fn)) (cons (concat fn ".~" (int-to-string (1+ high-water-mark)) "~")