summaryrefslogtreecommitdiff
path: root/lisp/dired-aux.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2018-04-05 12:15:54 +0900
committerTino Calancha <tino.calancha@gmail.com>2018-04-05 12:15:54 +0900
commit0b690a83f674a160ccbaa9f374226b1fcfb2d535 (patch)
tree5ee8b18e03eeb6cc6d8e7eb59c2fda6654ab54f5 /lisp/dired-aux.el
parent17788644e62954110c62b29ff2662f2ea58438c9 (diff)
downloademacs-0b690a83f674a160ccbaa9f374226b1fcfb2d535.tar.gz
Honor dired-create-destination-dirs if copying/renaming >1 files
Check `dired-create-destination-dirs' when the user wants to copy/rename several files. * lisp/dired-aux.el (dired-do-create-files): Call `dired-maybe-create-dirs' right before bind `into-dir' (Bug#30624). * test/lisp/dired-aux-tests.el (dired-test-bug30624): Add test.
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r--lisp/dired-aux.el47
1 files changed, 25 insertions, 22 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index e8b5e6755ea..821b7d79759 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1864,28 +1864,31 @@ Optional arg HOW-TO determines how to treat the target.
(dired-mark-read-file-name
(concat (if dired-one-file op1 operation) " %s to: ")
target-dir op-symbol arg rfn-list default))))
- (into-dir (cond ((null how-to)
- ;; Allow users to change the letter case of
- ;; a directory on a case-insensitive
- ;; filesystem. If we don't test these
- ;; conditions up front, file-directory-p
- ;; below will return t on a case-insensitive
- ;; filesystem, and Emacs will try to move
- ;; foo -> foo/foo, which fails.
- (if (and (file-name-case-insensitive-p (car fn-list))
- (eq op-symbol 'move)
- dired-one-file
- (string= (downcase
- (expand-file-name (car fn-list)))
- (downcase
- (expand-file-name target)))
- (not (string=
- (file-name-nondirectory (car fn-list))
- (file-name-nondirectory target))))
- nil
- (file-directory-p target)))
- ((eq how-to t) nil)
- (t (funcall how-to target)))))
+ (into-dir
+ (progn
+ (unless dired-one-file (dired-maybe-create-dirs target))
+ (cond ((null how-to)
+ ;; Allow users to change the letter case of
+ ;; a directory on a case-insensitive
+ ;; filesystem. If we don't test these
+ ;; conditions up front, file-directory-p
+ ;; below will return t on a case-insensitive
+ ;; filesystem, and Emacs will try to move
+ ;; foo -> foo/foo, which fails.
+ (if (and (file-name-case-insensitive-p (car fn-list))
+ (eq op-symbol 'move)
+ dired-one-file
+ (string= (downcase
+ (expand-file-name (car fn-list)))
+ (downcase
+ (expand-file-name target)))
+ (not (string=
+ (file-name-nondirectory (car fn-list))
+ (file-name-nondirectory target))))
+ nil
+ (file-directory-p target)))
+ ((eq how-to t) nil)
+ (t (funcall how-to target))))))
(if (and (consp into-dir) (functionp (car into-dir)))
(apply (car into-dir) operation rfn-list fn-list target (cdr into-dir))
(if (not (or dired-one-file into-dir))