Subject: RE: bug#13033: 24.3.50; regression: read-file-name-internal handles "~" wrong

From: "Drew Adams" <[email-masked]>
Date: Fri, 30 Nov 2012 11:50:36 -0800

> Are you really sure that
>   (read-file-name-internal "~" 'file-exists-p nil) returns 
> "~/dradams/" even though
>   (completion--file-name-table "~" 'file-exists-p nil) 
> returns "~dradams/"

No, sorry; my bad.  They both return "~dradams/".

> > And there is no such directory ~dradams either.
> 
> Actually, there should be (in the same sense that there is a directory
> named ~, i.e. it's a shorthand expanded by Emacs, more specifically by
> `expand-file-name').
> What does C-x C-f ~dradams/.emacs RET do?  It should open 
> your ~/.emacs file.

It does.  Now.  But it does not in older releases.

Is this change documented for Emacs on MS Windows?  Is it even documented (for
Emacs) for other platforms?  Emacs' handling of `~' is documented, but `~'
followed by `user-login-name'?

Well, searching, I do see something about it in (emacs) `Minibuffer File'.  And
surprisingly, that text is also there in Emacs 23, even though this behavior
seems new - it is not even in 24.2 (for Windows).

And I see nothing about it in NEWS, but perhaps I'm not looking in the right
places.  This is a user-visible change, AFAICT, so it should be called out in
the (Emacs 23) NEWS, I would think.

> > I do not see why user-name completion (whatever that might mean for
> > Unix/GNU/Linux file-name completion) is involved at all on 
> > Windows.  The user login name has nothing to do with the user's home
> > directory.
> 
> `expand-file-name's docstring says:
> 
>    An initial `~USER/' expands to USER's home directory.

That's OK for an Emacs convention.  I just was not aware of it.  (And for MS
Windows itself there is still no association between HOME and the user login
name, AFAIK.  This is an Emacs-only convention.  Nothing wrong with that,
obviously.)