emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")


From: Eli Zaretskii
Subject: Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")
Date: Tue, 03 Mar 2015 20:09:56 +0200

> From: Michal Nazarewicz <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Tue, 03 Mar 2015 18:48:24 +0100
> 
> > It's a lie, and one that's tricky to untangle: you need to know that
> > to get a _real_ file name, you need to run it through
> > expand-file-name.  If you don't, things will subtly fail, e.g., if you
> > compare this with some other file name.
> 
> This is already a problem on *all* systems and it happens if user init
> file is not found.  If you run ‘emacs -u foo’ on GNU/Linux, you’ll end
> up with `user-init-file" equal to "~foo/.emacs".

I don't understand how what you say is a contradiction to what I said.

> > Another important piece of the puzzle is that if USER is not
> > recognized as a valid user by the getpwnam emulation on
> > MS-Windows/MS-DOS, you get this:
> >
> >   (expand-file-name "~USER") => /current/directory/~USER
> >
> > And it is possible to have a literal "~USER" directory, in which case
> > the warning will be incorrectly skipped.
> 
> This also happens on UNIX-like systems.

Of course, it does.  So what?

> Based on all that, I think the most consistent option is to:
> 
> 1) always check if ~USER/ directory exists for the ‘User foo has no home
>    directory’ warning;
> 
> 2) user ~USER/.emacs and ~USER/_emacs on MS-Windows; and
> 
> 3) use `expand-file-name' when setting `user-init-file' if init file has
>    not been loaded.

Sorry, I cannot follow the logic that led to these 3 conclusions.
Please explain.  (And don't we already do all that?)

> The below untested patch does that plus stops Emacs from attempting to
> load init file if `init-file-user' is ‘invalid’, i.e. contains ~, /, :
> or \n.

Why?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]