Search code examples
fileemacsrenamedired

name conflict in renaming multiple files in wdired mode


In wdired mode, if I try to rename file A to B, and file B to C in one step, the part of changing of A to B may be rejected because it conflicts with the existing file B, and only B to C will be done. But that actually depends on the order; if B to C is done earlier, it should not cause a problem. Is there an easy way to let wdired look for such smart ordering of operations and let it do A to B and B to C in one step? Some additions to wdired, alternative to wdired, or some hack?


Solution

  • edit: I thought at first that "Improved renaming order" at http://www.emacswiki.org/emacs/WDired#toc4 looked like a solution, but the following comment suggests that this has been taken care of in the standard code, so I guess it doesn't cover your situation.

    edit 2: Which version of Emacs are you using?

    After looking again at the description for that obsolete patch, and then doing some testing in Emacs 23.2.1, it seems pretty smart about this sort of thing, and I got the message "Circular renaming: using temporary file name" when duplicates would be generated, and the end result was correct.