From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.devel Subject: Re: bug in copy-directory Date: Fri, 28 Jan 2011 10:05:59 +0100 Message-ID: <87bp31ieiw.fsf@gmail.com> References: <87ipxaidea.fsf@gmail.com> <87k4hp96g0.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296205617 6703 80.91.229.12 (28 Jan 2011 09:06:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 28 Jan 2011 09:06:57 +0000 (UTC) Cc: Michael Albinus , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 28 10:06:52 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 1PikI0-0002Sa-TE for ged-emacs-devel@m.gmane.org; Fri, 28 Jan 2011 10:06:45 +0100 Original-Received: from localhost ([127.0.0.1]:53418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PikI0-0002ep-4u for ged-emacs-devel@m.gmane.org; Fri, 28 Jan 2011 04:06:44 -0500 Original-Received: from [140.186.70.92] (port=51741 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PikHl-0002dO-O3 for emacs-devel@gnu.org; Fri, 28 Jan 2011 04:06:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PikHk-0001Yi-If for emacs-devel@gnu.org; Fri, 28 Jan 2011 04:06:29 -0500 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:40005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PikHk-0001YT-Di for emacs-devel@gnu.org; Fri, 28 Jan 2011 04:06:28 -0500 Original-Received: by fxm12 with SMTP id 12so3677517fxm.0 for ; Fri, 28 Jan 2011 01:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=halG4Q+85Z36OPoYT1+QoAVNLoq+KJkcfAFHVTRPuFM=; b=ZZNBYX3USI//6pQB7s5s4PUGYYcq2JR2UK5JuNvUEi/uigE0JIQ0p4+olGYHLh7UzS jmMiYTa8IIMW4IqYYD1U/SNbKgcTTxIVxVH2zRzEKQ4rJUEHyIGzpKwJaESO3OLzthyX XYo8kG3XT77E/dOKwi8ufXB9OyQQt8WYqXtc0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=aWs/c3kwgMUKIOLWv30vbKhGOTBJgaIxGqlAMZbpEU7mfRru5hCsYnEgGh1C4BK5iw JYDybYB7O+w9TkktBO09RXn1NfaRc7BQpWN463cX6G/yxBJqYIuyz5I9W1iQizzMF4t3 FtZjROCwKLsfwKDZsSR7Xhw/pMvEazzOxajKw= Original-Received: by 10.223.87.68 with SMTP id v4mr2080751fal.98.1296205562116; Fri, 28 Jan 2011 01:06:02 -0800 (PST) Original-Received: from thierry-MM061 ([79.85.211.94]) by mx.google.com with ESMTPS id f24sm6321957fak.0.2011.01.28.01.06.00 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 Jan 2011 01:06:01 -0800 (PST) In-Reply-To: <87k4hp96g0.fsf@stupidchicken.com> (Chong Yidong's message of "Thu, 27 Jan 2011 20:13:03 -0500") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 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:135136 Archived-At: Chong Yidong writes: > 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? Yes it works, thanks. > The trouble is that Lisp callers might depend on the old behavior. In > particular, I don't understand how Tramp interacts with copy-directory. This part of code call the tramp handler ,----[ files.el copy-directory ] | ;; If default-directory is a remote directory, make sure we find its | ;; copy-directory handler. | (let ((handler (or (find-file-name-handler directory 'copy-directory) | (find-file-name-handler newname 'copy-directory)))) | (if handler | (funcall handler 'copy-directory directory newname keep-time parents) `---- [EVAL] (assoc 'copy-directory tramp-file-name-handler-alist) > 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. It should prompt also to copy recursively dir. Please could you send git-style patchs? --- lisp/files.el | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index ee77975..9eac9a3 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4756,7 +4756,16 @@ this happens by default." ;; 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 (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 -- A+ Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997