home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / emacs / 2926 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  1.9 KB

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