unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* rename file in dired based on current [T2C round 3]
@ 2020-10-28  3:53 Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-28  4:23 ` Drew Adams
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-28  3:53 UTC (permalink / raw)
  To: help-gnu-emacs

T2C - The Emacs Challenge Competition - round 3

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) ))

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




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-30 16:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28  3:53 rename file in dired based on current [T2C round 3] Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-28  4:23 ` Drew Adams
2020-10-28  4:46   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-28  4:32 ` Stefan Kangas
2020-10-28  4:53   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-28  5:34 ` Yuri Khan
2020-10-28  5:51   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-29  9:22 ` Michael Albinus
2020-10-30 16:12   ` H. Dieter Wilhelm
2020-10-30 16:29     ` Michael Albinus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).