diff lisp/files.el @ 890:bad1b9af86a1

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 28 Jul 1992 19:38:08 +0000
parents 0b4f3a91f207
children f7de428cb8bf
line wrap: on
line diff
--- a/lisp/files.el	Tue Jul 28 03:39:30 1992 +0000
+++ b/lisp/files.el	Tue Jul 28 19:38:08 1992 +0000
@@ -836,6 +836,19 @@
 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 @@
 			   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))