diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-05-04 05:30:37 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-05-04 05:30:37 +0000 |
commit | bb7d57d58b1b795eee2e9e902bc2a8b5d63da246 (patch) | |
tree | 4ee724cd2721323798ca7c84d2691c0e0d88458a /lisp/dired-aux.el | |
parent | 532aa8413557e74a6debbc6c08837c7b29400c6c (diff) | |
download | emacs-bb7d57d58b1b795eee2e9e902bc2a8b5d63da246.tar.gz |
(dired-handle-overwrite): `find-backup-file-name'
may return nil, so handle that.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r-- | lisp/dired-aux.el | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index dca2ca488ed..69ea15922c4 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -925,14 +925,16 @@ Special value `always' suppresses confirmation.") ;; 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) |