aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-04-06 20:11:47 +0000
committerChong Yidong2008-04-06 20:11:47 +0000
commit61bfceb690027ab160f191bce30b9b2f0358ca5b (patch)
tree2c9e1f42a545f5a0325652a9b77f512e4a2b8206
parentbf0de14ded16c751f9423dc6cb17d2ee972ca0a6 (diff)
downloademacs-61bfceb690027ab160f191bce30b9b2f0358ca5b.tar.gz
emacs-61bfceb690027ab160f191bce30b9b2f0358ca5b.zip
(dired-dnd-handle-local-file): Obey dired-backup-overwrite.
-rw-r--r--lisp/dired.el70
1 files changed, 42 insertions, 28 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 4efb091f277..080d34a90b1 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3284,34 +3284,48 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3284 (to (if from (concat (dired-current-directory) 3284 (to (if from (concat (dired-current-directory)
3285 (file-name-nondirectory from)) 3285 (file-name-nondirectory from))
3286 nil))) 3286 nil)))
3287 (if from 3287 (when from
3288 (cond ((or (eq action 'copy) 3288 (cond ((or (eq action 'copy)
3289 (eq action 'private)) ; Treat private as copy. 3289 (eq action 'private)) ; Treat private as copy.
3290 3290 ;; If copying a directory and dired-recursive-copies is nil,
3291 ;; If copying a directory and dired-recursive-copies is nil, 3291 ;; dired-copy-file silently fails. Pop up a notice.
3292 ;; dired-copy-file silently fails. Pop up a notice. 3292 (cond ((and (file-directory-p from)
3293 (if (and (file-directory-p from) 3293 (not dired-recursive-copies))
3294 (not dired-recursive-copies)) 3294 (dired-dnd-popup-notice))
3295 (dired-dnd-popup-notice) 3295 ((file-exists-p to)
3296 (progn 3296 (let ((overwrite
3297 (dired-copy-file from to 1) 3297 (y-or-n-p (format "Overwrite existing file `%s'? " to)))
3298 (dired-relist-entry to) 3298 ;; We avoid dired-handle-overwrite and use
3299 action))) 3299 ;; y-or-n-p, which pops a graphical menu.
3300 3300 dired-overwrite-confirmed backup-file)
3301 ((eq action 'move) 3301 (when (and overwrite
3302 (dired-rename-file from to 1) 3302 dired-backup-overwrite
3303 (dired-relist-entry to) 3303 (setq backup-file
3304 action) 3304 (car (find-backup-file-name to)))
3305 3305 (or (eq dired-backup-overwrite 'always)
3306 ((eq action 'link) 3306 (y-or-n-p
3307 (make-symbolic-link from to 1) 3307 (format
3308 (dired-relist-entry to) 3308 "Make backup for existing file `%s'? " to))))
3309 action) 3309 (rename-file to backup-file 0)
3310 3310 (dired-relist-entry backup-file))
3311 ((eq action 'ask) 3311 (dired-copy-file from to overwrite)))
3312 (dired-dnd-do-ask-action uri)) 3312 (t (dired-copy-file from to nil)))
3313 3313 (dired-relist-entry to)
3314 (t nil))))) 3314 action)
3315 ((eq action 'move)
3316 (dired-rename-file from to 1)
3317 (dired-relist-entry to)
3318 action)
3319
3320 ((eq action 'link)
3321 (make-symbolic-link from to 1)
3322 (dired-relist-entry to)
3323 action)
3324
3325 ((eq action 'ask)
3326 (dired-dnd-do-ask-action uri))
3327
3328 (t nil)))))
3315 3329
3316(defun dired-dnd-handle-file (uri action) 3330(defun dired-dnd-handle-file (uri action)
3317 "Copy, move or link a file to the dired directory if it is a local file. 3331 "Copy, move or link a file to the dired directory if it is a local file.