From: Tino Calancha <tino.calancha@gmail.com>
To: Mathieu Basille <mathieu.web@basille.net>
Cc: 25609@debbugs.gnu.org, tino.calancha@gmail.com
Subject: bug#25609: 25.1; Dired: Copy folder with 'dired-dwim-target t' results in nested copy
Date: Sat, 04 Feb 2017 20:59:53 +0900 [thread overview]
Message-ID: <87mve2qi86.fsf@calancha-pc> (raw)
In-Reply-To: <4cee1f04-3644-ba9f-1542-d29108cd2472@basille.net> (Mathieu Basille's message of "Thu, 2 Feb 2017 11:54:00 -0500")
Mathieu Basille <mathieu.web@basille.net> writes:
> Dear Emacs maintainers,
>
> The behavior I have is odd at best, but the situation is simple: given a
> folder 'test', I want to make a copy of it in another folder.
>
> In practice (keyboard commands are between <>):
>
> * Open Emacs, <M-x dired> in any folder.
> * <+ test> to create a folder 'test'.
> * <+ target> to create a folder 'target'.
> * Move on 'test' then <C target/> to copy it in 'target', <yes> to copy
> recursively.
>
> So far so good, the empty 'test' folder is copied as expected. Assuming
> there is some change in this folder, we want to copy it again to the
> same place:
>
> * Move on 'test' then <C target/> to copy it in 'target'.
> * Dired asks for confirmation to overwrite it, and if yes copies it
> again.
>
> Now the weird behavior. With '(setq dired-dwim-target t)':
>
> * Open a second window <C-x 3>.
> * Move to 'target' in this window, as to have 'target' on the right
> window, but the initial folder on the left window.
> * In the left window, move on 'test' and <C> to copy it again, DWIM will
> suggest directly 'target/', so all that is needed is <Enter>.
>
> Note that there is no question to overwrite it or not. Visiting 'target'
> now shows the 'test' folder, but inside it a second copy of 'test'!
>
> Even weirder:
>
> * Create an empty file in the original folder (<C-x C-f bla>, then <C-x
> C-s> to save it, and <C-x k> to kill it).
> * Select in the left window both 'test' and 'bla' with <m>.
> * <C> to copy them, DWIM will suggest directly 'target/', so all that is
> needed is <Enter>.
>
> Now it asks for confirmation to overwrite and copies 'test' together
> with 'bla' in 'target' as expected!
Same behaviour in Emacs-24 and master branch.
Following patch works to me:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 796a13469ac9f0084416a8b0bc0b3355b67e9d12 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Sat, 4 Feb 2017 20:59:06 +0900
Subject: [PATCH] Fix Bug#25609
* lisp/dired-aux.el (dired-do-create-files):
If 'dired-dwim-target is non-nil, then bind 'default' to nil.
---
lisp/dired-aux.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index caa3b45705..bc44f036e5 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1791,6 +1791,7 @@ dired-do-create-files
(and (consp fn-list) (null (cdr fn-list)) (car fn-list)))
(target-dir (dired-dwim-target-directory))
(default (and dired-one-file
+ (not dired-dwim-target)
(expand-file-name (file-name-nondirectory (car fn-list))
target-dir)))
(defaults (dired-dwim-target-defaults fn-list target-dir))
--
2.11.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.7)
of 2017-02-04
Repository revision: c8f91b168b0955e1e21acbf291171af1f70725ec
next prev parent reply other threads:[~2017-02-04 11:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 16:54 bug#25609: 25.1; Dired: Copy folder with 'dired-dwim-target t' results in nested copy Mathieu Basille
2017-02-04 11:59 ` Tino Calancha [this message]
2017-02-04 18:13 ` Mathieu Basille
2017-02-04 18:23 ` Tino Calancha
2017-02-04 18:26 ` Mathieu Basille
2017-02-20 5:32 ` Tino Calancha
2017-02-27 7:35 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mve2qi86.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=25609@debbugs.gnu.org \
--cc=mathieu.web@basille.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.