changeset 9978:5b5406fbd833

(dired-collect-file-versions): Discard version #s from arg; then do nothing if already in dired-file-version-alist.
author Richard M. Stallman <rms@gnu.org>
date Wed, 16 Nov 1994 14:26:42 +0000
parents c5c2a86432a4
children 8c24b6db3fa3
files lisp/dired-aux.el
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Wed Nov 16 14:15:54 1994 +0000
+++ b/lisp/dired-aux.el	Wed Nov 16 14:26:42 1994 +0000
@@ -246,19 +246,24 @@
 	(forward-line 1)))))
 
 (defun dired-collect-file-versions (fn)
-  ;;  "If it looks like file FN has versions, return a list of the versions.
-  ;;That is a list of strings which are file names.
-  ;;The caller may want to flag some of these files for deletion."
-    (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 (mapcar 'backup-extract-version possibilities)))
-      (if versions
-	  (setq dired-file-version-alist (cons (cons fn versions)
-					       dired-file-version-alist)))))
+  (let ((fn (file-name-sans-versions fn)))
+    ;; Only do work if this file is not already in the alist.
+    (if (assoc fn dired-file-version-alist)
+	nil
+      ;; If it looks like file FN has versions, return a list of the versions.
+      ;;That is a list of strings which are file names.
+      ;;The caller may want to flag some of these files for deletion."
+      (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 (mapcar 'backup-extract-version possibilities)))
+	(if versions
+	    (setq dired-file-version-alist
+		  (cons (cons fn versions)
+			dired-file-version-alist)))))))
 
 (defun dired-trample-file-versions (fn)
   (let* ((start-vn (string-match "\\.~[0-9]+~$" fn))