Commit bbfe2308 authored by Chong Yidong's avatar Chong Yidong
Browse files

(dired-overwrite-confirmed): Supply initial value.

parent 6bf99ef3
...@@ -1179,23 +1179,22 @@ Special value `always' suppresses confirmation." ...@@ -1179,23 +1179,22 @@ Special value `always' suppresses confirmation."
(other :tag "ask" t)) (other :tag "ask" t))
:group 'dired) :group 'dired)
(defvar dired-overwrite-confirmed) (defvar dired-overwrite-confirmed nil)
(defun dired-handle-overwrite (to) (defun dired-handle-overwrite (to)
;; Save old version of file TO that is to be overwritten. ;; Save old version of file TO that is to be overwritten.
;; `dired-overwrite-confirmed' and `overwrite-backup-query' are fluid vars ;; `dired-overwrite-confirmed' and `overwrite-backup-query' are fluid vars
;; from dired-create-files. ;; from dired-create-files.
(let (backup) (let (backup)
(if (and dired-backup-overwrite (when (and dired-backup-overwrite
dired-overwrite-confirmed dired-overwrite-confirmed
(setq backup (car (find-backup-file-name to))) (setq backup (car (find-backup-file-name to)))
(or (eq 'always dired-backup-overwrite) (or (eq 'always dired-backup-overwrite)
(dired-query 'overwrite-backup-query (dired-query 'overwrite-backup-query
"Make backup for existing file `%s'? " "Make backup for existing file `%s'? "
to))) to)))
(progn (rename-file to backup 0) ; confirm overwrite of old backup
(rename-file to backup 0) ; confirm overwrite of old backup (dired-relist-entry backup))))
(dired-relist-entry backup)))))
;;;###autoload ;;;###autoload
(defun dired-copy-file (from to ok-flag) (defun dired-copy-file (from to ok-flag)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment