emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in copy-directory


From: Chong Yidong
Subject: Re: bug in copy-directory
Date: Thu, 27 Jan 2011 20:13:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Thierry Volpiatto <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]