From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Harry Putnam Newsgroups: gmane.emacs.help Subject: Re: how to make dired-do-rename more friendly? Date: Thu, 20 Nov 2003 04:20:37 -0600 Organization: Still searching... Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069323728 25470 80.91.224.253 (20 Nov 2003 10:22:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2003 10:22:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 20 11:21:59 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMlwl-00067G-00 for ; Thu, 20 Nov 2003 11:21:59 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMmtu-0000zi-1s for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Nov 2003 06:23:06 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AMmtV-0000zS-4E for help-gnu-emacs@gnu.org; Thu, 20 Nov 2003 06:22:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AMmsy-0000tB-5A for help-gnu-emacs@gnu.org; Thu, 20 Nov 2003 06:22:40 -0500 Original-Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMmsx-0000se-8O for help-gnu-emacs@gnu.org; Thu, 20 Nov 2003 06:22:07 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AMlvU-00022S-00 for ; Thu, 20 Nov 2003 11:20:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMlvS-00022I-00 for ; Thu, 20 Nov 2003 11:20:38 +0100 Original-Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1AMlvR-0006Zb-00 for ; Thu, 20 Nov 2003 11:20:37 +0100 Original-Lines: 37 Original-X-Complaints-To: usenet@sea.gmane.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:lCjhGIkVFBC4kK4Dzc2QuEx2EtM= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:14416 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:14416 "leo" 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)