changeset 93761:673422b6cd01

(dired-overwrite-confirmed): Supply initial value.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 06 Apr 2008 00:03:38 +0000
parents dbd33455757e
children 46d39c0f7bf9
files lisp/dired-aux.el
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Sun Apr 06 00:03:24 2008 +0000
+++ b/lisp/dired-aux.el	Sun Apr 06 00:03:38 2008 +0000
@@ -1179,23 +1179,22 @@
 		 (other :tag "ask" t))
   :group 'dired)
 
-(defvar dired-overwrite-confirmed)
+(defvar dired-overwrite-confirmed nil)
 
 (defun dired-handle-overwrite (to)
   ;; Save old version of file TO that is to be overwritten.
   ;; `dired-overwrite-confirmed' and `overwrite-backup-query' are fluid vars
   ;; from dired-create-files.
   (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
-			      "Make backup for existing file `%s'? "
-			      to)))
-	(progn
-	  (rename-file to backup 0)	; confirm overwrite of old backup
-	  (dired-relist-entry backup)))))
+    (when (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
+				"Make backup for existing file `%s'? "
+				to)))
+      (rename-file to backup 0)	; confirm overwrite of old backup
+      (dired-relist-entry backup))))
 
 ;;;###autoload
 (defun dired-copy-file (from to ok-flag)