home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.emacs
- Subject: Re: small question about going into directories with find-file
- Date: 21 Aug 1992 21:36:45 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 29
- Message-ID: <173nldINNmrv@early-bird.think.com>
- References: <1992Aug21.153958.3937@colorado.edu>
- NNTP-Posting-Host: telecaster.think.com
-
- In article <1992Aug21.153958.3937@colorado.edu> ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
- >This is somethng I've been curious about for some time. If I do a
- >C-x C-f (find file) right after I start emacs, I get Find File: ~/
- >in the minibuffer, and if I hit return, I get into dired with my
- >home directory listed. If I then open a file in that directory,
- >then do a C-x C-f again, I get the same Find File: ~/ in the
- >minibuffer, but if I hit return, I don't go back into dired, I get
- >nowhere. I have to edit the minibuffer and remove the / before it
- >will let me open that directory in dired again.
-
- Despite what the prompt implies, the default that's used when you don't
- type anything (actually, if your response is identical to the initial
- value) is the current buffer's pathname.
-
- When you use find-file right after starting Emacs, the current buffer
- doesn't have a pathname, so your response is used as is. But when you're
- in a buffer with a file it defaults to the buffer pathname.
-
- This behavior is implemented in the C routine that implements the
- read-file-name function. It occurs whenever the third argument (the
- default value) is nil, as it is when it's called from call-interactively's
- processing of the interactive "F" argument type. To fix it from Lisp you
- can change find-file so that it calls read-file-name explicitly to get its
- argument, and passes an explicit third argument of the current directory.
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-