From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: M-g in dired Date: Tue, 23 May 2006 08:16:14 +0300 Organization: JURTA Message-ID: <87bqtpibul.fsf@jurta.org> References: <446C7B73.60907@earthlink.net> <87u07md91o.fsf@jurta.org> <87sln44y1q.fsf@jurta.org> <87lksw58k1.fsf@jurta.org> <87psi6cgv1.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1148361731 5526 80.91.229.2 (23 May 2006 05:22:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 May 2006 05:22:11 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 23 07:22:02 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 1FiPLD-00087y-JV for ged-emacs-devel@m.gmane.org; Tue, 23 May 2006 07:21:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FiPLC-0002ZJ-WE for ged-emacs-devel@m.gmane.org; Tue, 23 May 2006 01:21:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FiPKz-0002Z3-L3 for emacs-devel@gnu.org; Tue, 23 May 2006 01:21:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FiPKy-0002YW-IQ for emacs-devel@gnu.org; Tue, 23 May 2006 01:21:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FiPKy-0002YO-Dx for emacs-devel@gnu.org; Tue, 23 May 2006 01:21:44 -0400 Original-Received: from [217.25.160.1] (helo=relay1.binet.com.ua) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FiPP5-00082G-PO; Tue, 23 May 2006 01:26:00 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by relay1.binet.com.ua (Postfix) with ESMTP id B3F4077E11; Tue, 23 May 2006 08:21:40 +0300 (EEST) Original-Received: from mail.binet.com.ua (i23.dialup.binet.com.ua [217.25.161.87]) by relay1.binet.com.ua (Postfix) with ESMTP id EA15477D39; Tue, 23 May 2006 08:21:38 +0300 (EEST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Mon, 22 May 2006 16:37:36 -0400") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) X-Virus-Scanned: by ClamAv at binet.com.ua 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:55098 Archived-At: > Oops, this default was inserted by ffap. When ffap-read-file-or-url > reads a directory/file name it uses the current buffer's file name as > default. dired could do the same. > > The visited file name should not be the default for C-x d. But it > would be nice if the visited file name were easily accessible > when you want it. That's why I suggest putting it in the "future > history" list. For reading a directory/file name, ffap uses the function `completing-read' with the value of the `initial-input' arg set to the directory name, and the `default' arg set to the current buffer's file name. This has the effect that typing RET returns the directory name, not the file name from the default value. And only after typing `M-n RET' it returns the default file name. Is it possible to achieve the same effect by `read-file-name' (which is used by dired)? Essentially, what is used by ffap is: (completing-read "Dired file: " nil "~/" nil '("~/" . 2) 'file-name-history "~/.emacs") Typing `C-x C-e RET' returns "~/" Typing `C-x C-e M-n RET' returns "~/.emacs" But trying to do the same for `read-file-name': (read-file-name "Dired file: " "~/" "~/.emacs" nil nil nil) Typing `C-x C-e RET' returns "~/.emacs", not "~/" Typing `C-x C-e M-n RET' returns "~/.emacs" -- Juri Linkov http://www.jurta.org/emacs/