[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#30624: 27.0.50; dired-create-destination-dirs doesn't work when rena
From: |
Tino Calancha |
Subject: |
bug#30624: 27.0.50; dired-create-destination-dirs doesn't work when renaming more than one file |
Date: |
Sun, 1 Apr 2018 20:08:07 +0900 (JST) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
On Mon, 19 Mar 2018, Eli Zaretskii wrote:
From: Amos Bird <amosbird@gmail.com>
Date: Tue, 27 Feb 2018 10:29:09 +0800
I'm using emacs 27.0.50 and have dired-create-destination-dirs set
to 'always.
When renaming more than one files to a new directory, dired throws
an error at
/usr/local/share/emacs/27.0.50/lisp/dired-aux.el.gz:1891 . It
fails early before
it has time to check whether a new directory should be created.
Thank you very much for your report Amos!
I would be enough to call `dired-maybe-create-dirs' right before
binding `into-dir', as follows:
--8<-----------------------------cut here---------------start------------->8---
commit a89518cfb2f57509d3f0e31ddfe097f56e95c484
Author: Tino Calancha <tino.calancha@gmail.com>
Date: Sun Apr 1 19:54:23 2018 +0900
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).
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index e8b5e6755e..821b7d7975 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1864,29 +1864,31 @@ dired-do-create-files
(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))
--8<-----------------------------cut here---------------end--------------->8---
In GNU Emacs 27.0.50 (build 10, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2018-03-30 built on calancha-pc
Repository revision: f759c5cfe4651af5f64fac2492fa362f8d383bd5