[Top][All Lists]

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

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

From: Michal Nazarewicz
Subject: Re: [PATCH] for review - Allow expansion of "~" (as opposed to "~user")
Date: Tue, 03 Mar 2015 22:03:38 +0100
User-agent: Notmuch/0.19+53~g2e63a09 (http://notmuchmail.org) Emacs/ (x86_64-unknown-linux-gnu)

On Tue, Mar 03 2015, Eli Zaretskii wrote:
>> Date: Tue, 03 Mar 2015 20:09:56 +0200
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden, address@hidden
>> > 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?)

> Btw, I'd like to reiterate something I already suggested near the
> beginning: just error out if "-u USER" is used on DOS/Windows.  I
> think this should put all this issue to rest, and avoid unneeded
> complexity, FAQs, etc.

OK.  I was looking at the code with an assumption that it’s desired to
have ‘-u USER’ working in some way.  If that is not the case, much of
what I wrote is irrelevant.

Still, for the third point, if no init file has been loaded,
`expand-file-name' is *not* used on `user-init-file' which ends up being
something like "~/.emacs" (i.e. not an absolute path but one which needs
expanding).  Since you’ve suggested this is undesired, we should start
expanding the path.

>>> 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.

On Tue, Mar 03 2015, Eli Zaretskii wrote:
> Of course, it does.  So what?

If the situation you’ve described is incorrect, then it needs to be
fixed for *NIX.  If it is correct, why are you mentioning it?

>> 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?

So… why are we checking if user name is valid if we then just gonna read
the files anyway?  What’s the point of this:

      (if (string-match "[~/:\n]" init-file-user)
          (display-warning 'initialization
                           (format "Invalid user name %s"

Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<address@hidden>--<xmpp:address@hidden>--ooO--(_)--Ooo--

reply via email to

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