From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs 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 Message-ID: <87mve2qi86.fsf@calancha-pc> References: <4cee1f04-3644-ba9f-1542-d29108cd2472@basille.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486209675 20839 195.159.176.226 (4 Feb 2017 12:01:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 4 Feb 2017 12:01:15 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25609@debbugs.gnu.org, tino.calancha@gmail.com To: Mathieu Basille Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 04 13:01:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZz1i-0005D8-By for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Feb 2017 13:01:10 +0100 Original-Received: from localhost ([::1]:38906 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZz1n-0005wz-Um for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Feb 2017 07:01:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZz1g-0005wB-1T for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2017 07:01:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZz1a-0007no-6h for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2017 07:01:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cZz1a-0007nb-3t for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2017 07:01:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cZz1Z-0000qb-Rk for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2017 07:01:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2017 12:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25609 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25609-submit@debbugs.gnu.org id=B25609.14862096063182 (code B ref 25609); Sat, 04 Feb 2017 12:01:01 +0000 Original-Received: (at 25609) by debbugs.gnu.org; 4 Feb 2017 12:00:06 +0000 Original-Received: from localhost ([127.0.0.1]:55566 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZz0f-0000om-NH for submit@debbugs.gnu.org; Sat, 04 Feb 2017 07:00:06 -0500 Original-Received: from mail-pf0-f193.google.com ([209.85.192.193]:35189) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZz0d-0000na-Ql for 25609@debbugs.gnu.org; Sat, 04 Feb 2017 07:00:04 -0500 Original-Received: by mail-pf0-f193.google.com with SMTP id f144so3445489pfa.2 for <25609@debbugs.gnu.org>; Sat, 04 Feb 2017 04:00:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=PGpJcH/hPocv8B/KlCGV9ISDIWj+/eYaj3x7iLJD2vY=; b=addrHOR8fz+PkzuquR47paK6uEbcwSD6WdvyfexksvH1Cz0dPOfrjleXGfvGicLAp/ 1ktbUaZGb5YNsqThm2HrxQ53lWsHzGLWESzpeFSh0P0BOqTWwqVj2znXoNqKAbXWiIVU tMAdsaTgDZsF6dZ+//JiF04RA+B0FdjkeFsOfa12ly2KYDc75yiw1Mk8O/VvcAxV2ISt RXY+q/LJRKgNCp1aAJYpOD4bHWrIrqIujZ0f2aMWc5nxbo80s2HGgw0ZxUTy3pPrsZ7a STpOQb5M/vRyBamn51xnE/FYFt30gQR77WPGycu/Iq2dqrJhk97GQaHNaXt47xwjcuKi poWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=PGpJcH/hPocv8B/KlCGV9ISDIWj+/eYaj3x7iLJD2vY=; b=DuFDmjTnCW6tzuS87Fn2j5oXGyVRf//ZHiF5SKY3FxMZA9hyAMMxINXxJ21UHW+mtU RSCEEWtsIpRwxmopfgDFABuh0jaFje10gXurAXS5Z1HEOduS44fDNWdtrOuL8nWo/BXh 76YZuxcQpJCqn9HJe00dNSIImBePOXLdhZ5DfDyJqOmUUHqrksnv0cnrSu5LM0j92svq Mt8xStAeLOnHxZ1hw1Dh55cbMMyoF7VOA5zYzVs/oWsk7LhKZyWVovEIyBDN8BvZ1PKe VEmWbmh4/0/m2aVRvx7Yji6FLvIZM99H0VloNKEcRtWhJlCn5O6w+Kb92htW31n5UQ8h Sbtg== X-Gm-Message-State: AIkVDXIscPVsFdFBjPRIt6oo4sUcr+R2i8lbSfpZ++ofQ62LLSqQkD6TJXf92OVkTvUYNg== X-Received: by 10.99.51.76 with SMTP id z73mr2139956pgz.137.1486209597945; Sat, 04 Feb 2017 03:59:57 -0800 (PST) Original-Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id u14sm74639473pfg.18.2017.02.04.03.59.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Feb 2017 03:59:57 -0800 (PST) In-Reply-To: <4cee1f04-3644-ba9f-1542-d29108cd2472@basille.net> (Mathieu Basille's message of "Thu, 2 Feb 2017 11:54:00 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128948 Archived-At: Mathieu Basille 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, in any folder. > * <+ test> to create a folder 'test'. > * <+ target> to create a folder 'target'. > * Move on 'test' then to copy it in 'target', 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 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 . > * 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 to copy it again, DWIM will > suggest directly 'target/', so all that is needed is . > > 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 (, then C-s> to save it, and to kill it). > * Select in the left window both 'test' and 'bla' with . > * to copy them, DWIM will suggest directly 'target/', so all that is > needed is . > > 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 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