From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: bug in copy-directory Date: Thu, 27 Jan 2011 20:13:03 -0500 Message-ID: <87k4hp96g0.fsf@stupidchicken.com> References: <87ipxaidea.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296197972 2689 80.91.229.12 (28 Jan 2011 06:59:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Jan 2011 06:59:32 +0000 (UTC) To: Michael Albinus , Thierry Volpiatto , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 28 07:59:27 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PiiIp-0003Mo-0X for ged-emacs-devel@m.gmane.org; Fri, 28 Jan 2011 07:59:27 +0100 Original-Received: from localhost ([127.0.0.1]:51845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiiIo-00089c-AW for ged-emacs-devel@m.gmane.org; Fri, 28 Jan 2011 01:59:26 -0500 Original-Received: from [140.186.70.92] (port=55455 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiiIZ-000897-Dg for emacs-devel@gnu.org; Fri, 28 Jan 2011 01:59:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiiIT-0004dL-IU for emacs-devel@gnu.org; Fri, 28 Jan 2011 01:59:11 -0500 Original-Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]:58081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiiIT-0004dH-G0 for emacs-devel@gnu.org; Fri, 28 Jan 2011 01:59:05 -0500 Original-Received: from furball (dhcp128036014143.central.yale.edu [128.36.14.143]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p0S1D234014868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 27 Jan 2011 20:13:02 -0500 Original-Received: by furball (Postfix, from userid 1000) id C3198160197; Thu, 27 Jan 2011 20:13:03 -0500 (EST) In-Reply-To: <87ipxaidea.fsf@gmail.com> (Thierry Volpiatto's message of "Thu, 27 Jan 2011 16:18:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.132.50.146 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:135117 Archived-At: Thierry Volpiatto writes: > Actually on 23.2.92.1, copy-directory, called interactively or not copy > the files of directory A to existing directory B instead of copying > directory A inside directory B.(as a subdirectory of B). Hmm, this is a bit problematic. The attached patch should fix the problem---Thierry, could you test? The trouble is that Lisp callers might depend on the old behavior. In particular, I don't understand how Tramp interacts with copy-directory. Michael, could you take a look and see if there is any problem? Also, I noticed that the command doesn't prompt for overwriting files. It probably ought to, at least when called interactively. *** lisp/files.el 2011-01-24 20:34:44 +0000 --- lisp/files.el 2011-01-28 01:05:58 +0000 *************** *** 4756,4762 **** ;; Compute target name. (setq directory (directory-file-name (expand-file-name directory)) newname (directory-file-name (expand-file-name newname))) ! (if (not (file-directory-p newname)) (make-directory newname parents)) ;; Copy recursively. (mapc --- 4756,4771 ---- ;; Compute target name. (setq directory (directory-file-name (expand-file-name directory)) newname (directory-file-name (expand-file-name newname))) ! ! (if (not (file-directory-p newname)) ! (make-directory newname parents) ! ;; If NEWNAME is an existing directory, we want to copy into ! ;; NEWNAME/DIRECTORY. ! (setq newname (expand-file-name ! (file-name-nondirectory ! (directory-file-name directory)) ! newname)) ! (make-directory newname t)) ;; Copy recursively. (mapc