help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: dired rename backup file too


From: Xah Lee
Subject: Re: dired rename backup file too
Date: Mon, 21 Mar 2011 07:51:18 -0700 (PDT)
User-agent: G2/1.0

On Mar 20, 5:20 pm, Kevin Ryde <use...@zip.com.au> wrote:
> When renaming a file with dired "R" (dired-do-rename), I'd like it to
> rename the backup file too.  So foo -> bar and foo~ -> bar~.  Is there a
> secret option or other command to do that?
>
> I only use the single foo~ backup style, not the numbered backups, if
> that makes it easier.

not a solution to your question, but these days hardly call R anymore,
but use wdired-change-to-wdired-mode. It has a shortcut since emacs
23.1 (Ctrl+x Ctrl+q). (for me, i just aliased it to “rn”).

this lets you rename current file or any file, and directly in dired
(as opposed to the tiny line in minibuffer). When done, just press Ctrl
+c Ctrl+c. To cancel the rename, press Ctrl+Esc.

this mechanism also replaced my use of rename by regex (% R), because
once in the wdired mode, you can just do normal regex replace.

if you use wdired, it can solve your problem too, since you can rename
by find/replace all files, which will also rename the same named
backup files.

warning: there was a bug in emacs 22. If you rename a file to the same
name (e.g. swap 2 files), it will end up delete one of them.

for emacs newbs, i've wrote some tutorial on renaming files here
http://xahlee.org/emacs/rename_file_pattern.html

 Xah


reply via email to

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