In Emacs 24: Any Elisp Script Using copy-directory is now Broken
in emacs 24, there's this major backward-incompatable change
** `copy-directory' now copies the source directory as a subdirectory of the target directory, if the latter is an existing directory. The new optional arg COPY-CONTENTS, if non-nil, makes the function copy the contents directly into a pre-existing target directory.
this means, all existing elisp scripts will break. (it broke mine)
basically, it's trying to follow the behavior of unix “cp” command. There are 2 problems:
- ① this is a fundamental change on a language function. It will break any emacs lisp script that uses “copy-directory”.
- ② the behavior of unix “cp” is actually worse. Emacs's original behavior is more logical and predictable. (See: Idiocy Of Unix Copy Command.)
here's a workaround:
(if (>= emacs-major-version 24) (if (file-exists-p toDir) (copy-directory fromDir (concat toDir "/../")) (copy-directory fromDir toDir) ) (copy-directory fromDir toDir) )