3

I often use the command C-x C-q in dired (bound to dired-toggle-read-only) to rename files.

When I use this to change only capitalisation (eg, Foo.bar to foo.bar) then I use C-c C-c to apply the changes (wdired-finish-edit), I get a warning saying

File /../../foo.bar already exists; rename to it anyway? (y or n)

I get that I couldn't create two files with the same name if the difference is just the capitalisation, but I believe this warning is not necessary if I am just renaming a file. I think WDired could be made aware of the fact that it is just renaming a file and not creating a new one with the same name. Is there a way to fix this so I don't get the warning if I am just renaming a file with dired-toggle-read-only?

(I am aware that I can use R on dired to rename a file, but I often change names in bulk, even using the rectangular selection to remove blocks of characters from many file names at once).

7
  • Are you, perhaps, using OS X?
    – Dan
    Sep 16, 2015 at 2:16
  • @Dan Yes, I am... So I gather it has to do with that. Any way to work around it somehow?
    – Vivi
    Sep 16, 2015 at 2:34
  • 2
    I believe OS X file names are case insensitive, which is probably why dired is warning you that the file already exists.
    – Dan
    Sep 16, 2015 at 2:36
  • 4
    M-x report-emacs-bug. This seems like a reasonable thing for Emacs to handle by default, in cases where it can ascertain that the already-existing "new" file is actually the same file as the "old" one.
    – phils
    Sep 16, 2015 at 3:09
  • 1
    For the layman or hobbyists (such as myself), rename-file is a C-source code function that is beyond the reach of mere mortals -- probably the reason why a bug report has been suggested, rather than an elisp modification/tweak.
    – lawlist
    Sep 16, 2015 at 6:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.