Emacs Bug: v24.3 copy-directory Change (2013-04-07)
emacs 24.3 made incompatible changes to copy-directory
again. Caused me 3 hours.
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.
you can read about it by Alt+x view-emacs-news
then search for “copy-directory”.
so, now i have this complex code in my script.
(cond ((< emacs-major-version 24) (copy-directory fromDir toDir)) ((= emacs-major-version 24) (if (>= emacs-minor-version 3) (progn (copy-directory fromDir toDir "KEEP-TIME" "PARENTS" "COPY-CONTENTS") ) (if (file-exists-p toDir) (copy-directory fromDir (concat toDir "/../")) (copy-directory fromDir toDir) ) ) ) )
Complexer and Complexer.
copying a dir is like grafting a tree. For such a function, there are these design issues:
- whether to copy the dir itself or its children.
- whether things are moved to as children of dest dir, or dest dir itself replaced.
- whether the dest dir exist, and what to do in each case.
the unix “cp” command is the most idiotic. Its behavior changes depending on whether the destination node exist. Emacs's copy command started to follow the unix ways.
emacs 23's copy-directory
was perfect, but they had to change.