[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to make dired-do-rename more friendly?
From: |
Harry Putnam |
Subject: |
Re: how to make dired-do-rename more friendly? |
Date: |
Thu, 20 Nov 2003 04:20:37 -0600 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
"leo" <halloleo@noospaam.myrealbox.com> writes:
> example: sitting on the file
> /Users/leo/my-text-with-a-long-name
> i invoke dired-do-rename (by key "R") and get a minibuffer just with:
> /Users/leo/
> and i want some easy to get to
> /Users/leo/my-text-with-a-long-name
> so that i can quickly change it to:
> /Users/leo/my-text-with-a-long-name-two
I picked this code up in this group long ago... no longer remember
its author. But it does what you describe. I use it all the time.
WARNING: Being one of the lisp impaired... I'm not sure what all this
does USE AT YOUR OWN RISK.
(defadvice dired-mark-read-file-name (around tiad act)
"Instead of asking directory, offer full filename for editing.
This advice is enabled only upon request."
(if (and dir (string-match "/" dir))
(setq dir (dired-get-filename)))
ad-do-it)
(defadvice dired-do-rename (around joc-tiad-dired-rename act)
"Offer editing the current filename.
Without this advice you don't get the old filename for editing.
Activates advice 'dired-mark-read-file-name 'my 'around during call."
(let* ((ADVICE 'dired-mark-read-file-name))
(ad-enable-advice ADVICE 'around 'tiad)
(ad-activate ADVICE)
ad-do-it
(ad-disable-advice ADVICE 'around 'tiad)
(ad-activate ADVICE)))
(require 'macro)
(put 'narrow-to-region 'disabled nil)