summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1992-07-28 19:38:08 +0000
committerRichard M. Stallman <rms@gnu.org>1992-07-28 19:38:08 +0000
commit2d051399770c312b514081780e514fdabee2183d (patch)
treecc107d6ba710dab3e9155cbc36df457e1aa46b5b /lisp/files.el
parentb6df3e11b27d4aad739d89001d1d8d18b82528b6 (diff)
downloademacs-2d051399770c312b514081780e514fdabee2183d.tar.gz
*** empty log message ***
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el20
1 files changed, 14 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index f1fde0575e0..c16581f60b4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -836,6 +836,19 @@ This is a separate function so you can redefine it for customization.
You may need to redefine `file-name-sans-versions' as well."
(string-match "~$" file))
+;; This is used in various files.
+;; The usage of bv-length is not very clean,
+;; but I can't see a good alternative,
+;; so as of now I am leaving it alone.
+(defun backup-extract-version (fn)
+ "Given the name of a numeric backup file, return the backup number.
+Uses the free variable `bv-length', whose value should be
+the index in the name where the version number begins."
+ (if (and (string-match "[0-9]+~$" fn bv-length)
+ (= (match-beginning 0) bv-length))
+ (string-to-int (substring fn bv-length -1))
+ 0))
+
;; I believe there is no need to alter this behavior for VMS;
;; since backup files are not made on VMS, it should not get called.
(defun find-backup-file-name (fn)
@@ -850,12 +863,7 @@ Value is a list whose car is the name for the backup file
base-versions
(file-name-directory fn)))
(versions (sort (mapcar
- (function
- (lambda (fn)
- (if (and (string-match "[0-9]+~$" fn bv-length)
- (= (match-beginning 0) bv-length))
- (string-to-int (substring fn bv-length -1))
- 0)))
+ (function backup-extract-version)
possibilities)
'<))
(high-water-mark (apply 'max 0 versions))