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

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

Re: rename file in dired based on current [T2C round 3]


From: Emanuel Berg
Subject: Re: rename file in dired based on current [T2C round 3]
Date: Wed, 28 Oct 2020 05:46:07 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Drew Adams wrote:

>> How do you rename a file in dired, and get the previous/current as
>> a suggestion?
>> 
>> Let's say it is called salma-hayek.png and you want to rename it
>> salma-hayek-bandidas-2006.png, it is useful to get the first part
>> spelled out, right?
>> 
>> (defun dired-do-rename-suggest ()
>>   (interactive)
>>   (let*((file     (dired-get-filename))
>>         (old-name (dired-get-filename 'no-dir))
>>         (new-name (read-from-minibuffer "rename to: " old-name)) )
>>     (dired-rename-file file new-name nil) ; (NOT) OK-IF-ALREADY-EXISTS
>>     (revert-buffer) ))
>
> In Dired?
>
> `R M-n'

You are right! Thanks, I'll remove that piece of Elisp :)

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




reply via email to

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