From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Find file in Dired - let M-n yank name at point? Date: Sun, 20 Aug 2006 13:17:38 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156105105 9041 80.91.229.2 (20 Aug 2006 20:18:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 20 Aug 2006 20:18:25 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 20 22:18:23 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GEtkS-0002AK-IW for ged-emacs-devel@m.gmane.org; Sun, 20 Aug 2006 22:18:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEtkR-0001g1-Ux for ged-emacs-devel@m.gmane.org; Sun, 20 Aug 2006 16:18:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GEtkD-0001cc-36 for emacs-devel@gnu.org; Sun, 20 Aug 2006 16:18:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GEtkB-0001Za-KC for emacs-devel@gnu.org; Sun, 20 Aug 2006 16:18:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GEtkB-0001ZT-D6 for emacs-devel@gnu.org; Sun, 20 Aug 2006 16:18:03 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1GEtrP-0006kV-LB for emacs-devel@gnu.org; Sun, 20 Aug 2006 16:25:31 -0400 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k7KKI0Jm010234 for ; Sun, 20 Aug 2006 14:18:01 -0600 Original-Received: from dradamslap (dhcp-amer-rmdc-csvpn-gw6-141-144-112-186.vpn.oracle.com [141.144.112.186]) by rgmgw1.us.oracle.com (Switch-3.1.7/Switch-3.1.7) with SMTP id k7KKHxQU028127 for ; Sun, 20 Aug 2006 14:18:00 -0600 Original-To: "Emacs-Devel" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58569 Archived-At: What about binding `C-x C-f', `C-x 4 f', `C-x C-v', and so on, in Dired, to Dired-specific commands that let you use `M-n' to yank (append) `dired-get-file-for-visit' onto the directory name that is the `default-filename' arg for `read-file-name'? That is, not change the default value for these commands, which is the directory name, but let you add the file name under the cursor to that directory name via `M-n'. `a', `f', `RET', `o', `e', and `mouse-2' visit the file under the cursor quickly, but they don't let you edit the name first. I haven't tried this yet; it just occurred to me. Don't know if it would be a good idea, but I can't see why not. Currently, `M-n' just says there is nothing available. Why not make this name available, and give `M-n' something useful to do in this situation? This suggestion got no uptake either way, for or against. FWIW, I've played with it now, and I like it. It takes nothing away from the current behavior, I believe; it just lets you easily grab the file name that the cursor is on. The implementation can be trivial. This is one way to do it (in case you want to play with it): (defun find-file-read-args (prompt mustmatch) (list (let ((find-file-default (if (eq major-mode 'dired-mode) (abbreviate-file-name (dired-get-file-for-visit)) (and buffer-file-name (abbreviate-file-name buffer-file-name))))) (minibuffer-with-setup-hook (lambda () (setq minibuffer-default find-file-default)) (read-file-name prompt nil default-directory mustmatch))) t)) Again, the advantage over using, say, RET (`dired-find-file'), is that you can edit the file name.