changeset 15160:bc35b62c3798

(dired-handle-overwrite): `find-backup-file-name' may return nil, so handle that.
author Richard M. Stallman <rms@gnu.org>
date Sat, 04 May 1996 05:30:37 +0000
parents b22de331ee43
children ea07411f268e
files lisp/dired-aux.el
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Sat May 04 00:50:49 1996 +0000
+++ b/lisp/dired-aux.el	Sat May 04 05:30:37 1996 +0000
@@ -925,14 +925,16 @@
   ;; Save old version of a to be overwritten file TO.
   ;; `dired-overwrite-confirmed' and `overwrite-backup-query' are fluid vars
   ;; from dired-create-files.
-  (if (and dired-backup-overwrite
-	   dired-overwrite-confirmed
-	   (or (eq 'always dired-backup-overwrite)
-	       (dired-query 'overwrite-backup-query
-			(format "Make backup for existing file `%s'? " to))))
-      (let ((backup (car (find-backup-file-name to))))
-	(rename-file to backup 0)	; confirm overwrite of old backup
-	(dired-relist-entry backup))))
+  (let (backup)
+    (if (and dired-backup-overwrite
+	     dired-overwrite-confirmed
+	     (setq backup (car (find-backup-file-name to)))
+	     (or (eq 'always dired-backup-overwrite)
+		 (dired-query 'overwrite-backup-query
+			      (format "Make backup for existing file `%s'? " to))))
+	(progn
+	  (rename-file to backup 0)	; confirm overwrite of old backup
+	  (dired-relist-entry backup)))))
 
 ;;;###autoload
 (defun dired-copy-file (from to ok-flag)