all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Eli Zaretskii" <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: $USERPROFILE for $HOME on W32
Date: Fri, 26 Nov 2004 12:29:26 +0200	[thread overview]
Message-ID: <01c4d3a2$Blat.v2.2.2$f32d2000@zahav.net.il> (raw)
In-Reply-To: <jwv8y8p8pom.fsf-monnier+emacs@gnu.org> (message from Stefan Monnier on Thu, 25 Nov 2004 18:43:36 -0500)

> Cc: jasonr@gnu.org, emacs-devel@gnu.org
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Thu, 25 Nov 2004 18:43:36 -0500
> 
> > Lisp means, e.g., that temacs will have different ideas about HOME
> > etc. than the dumped Emacs, which I think might confuse someone some
> 
> Huh?  Of course HOME is different before and after the dump.
> How could it be otherwise?

We are emulating a Posix system where HOME's value is something
determined outside Emacs.  If you set HOME in init_environment, it
will be the same before and after dumping, as it is on a Posix system,
since init_environment is called unconditionally in the W32 port, and
called very early in the initialization process, way before the Lisp
interpreter is started and any application-level code runs.

The way you suggested to do it, not only will it be different before
and after the dumping, but it also changes its value in the middle of
loadup, because startup.el is loaded after many other Lisp files.
Such a change is unexpected by any reasonable Emacs hacker, and could
cost someone several hours of useless ``debugging'', or even real bugs
if some preloaded Lisp file references HOME's value.  Why insist on
doing that when there's a cleaner way?  For that matter, is there any
reason at all to favor doing this in Lisp?  I don't think I've heard
even a single reason in favor; did I miss something?

> > This change means that we run this code every time getpwuid is called.
> 
> Right.  Just as we do it on Unix (except on Unix we only do it for HOME
> and not for SHELL).

Unix is a different matter.  The W32 port emulates a single user, so
the values are guaranteed to be constant.  The right way to impement
such emulations is to use static variables initialized only once.

> > and could be avoided if all the
> > environment frobbing were done in C.
> 
> There are many ways to avoid such repetition if it's a problem.
> Moving the initialization to C is one way among many others, so I don't
> think it's a particularly compelling reason.

It's just one of several minor reasons.  I never said your suggestion
was a catastrophe, only that there's a slightly better way.  But if
what I said, and the fact that Jason also preferred doing that in C,
don't convince you, then probably nothing will; I give up.

  reply	other threads:[~2004-11-26 10:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22  6:26 $USERPROFILE for $HOME on W32 Stefan Monnier
2004-11-22  8:44 ` Jason Rumney
2004-11-22 13:04   ` Stefan Monnier
2004-11-25 16:00   ` Stefan Monnier
2004-11-25 16:34     ` Jason Rumney
2004-11-25 16:54       ` Stefan
2004-11-25 21:52         ` Eli Zaretskii
2004-11-25 22:46           ` Jason Rumney
2004-11-26 10:32             ` Eli Zaretskii
2004-11-25 16:57     ` Andreas Schwab
2004-11-25 17:45       ` Stefan
2004-11-25 17:49         ` Andreas Schwab
2004-11-25 21:45         ` Eli Zaretskii
2004-11-26 20:56           ` Eli Zaretskii
2004-11-26 23:42             ` Andreas Schwab
2004-11-27  9:33               ` Eli Zaretskii
2004-11-27 13:26                 ` Andreas Schwab
2004-11-27 16:40                   ` Eli Zaretskii
2004-11-27 17:46                     ` Andreas Schwab
2004-11-25 22:04     ` Eli Zaretskii
2004-11-25 23:43       ` Stefan Monnier
2004-11-26 10:29         ` Eli Zaretskii [this message]
2004-11-26 14:47           ` Stefan Monnier
2004-11-26 20:50             ` Eli Zaretskii
2004-11-26 22:03               ` Stefan Monnier
2004-11-27 11:36                 ` Eli Zaretskii
2004-12-06 23:17   ` Lennart Borgman
2004-11-22 15:46 ` Eli Zaretskii
2004-11-22 16:47   ` Stefan Monnier
2004-11-23 11:49     ` Eli Zaretskii
2004-11-23  8:30   ` Jason Rumney
2004-11-23 11:32     ` Eli Zaretskii
2004-11-23 20:47       ` Jason Rumney
2004-11-23 20:57         ` Eli Zaretskii
2004-11-24  8:17 ` John Paul Wallington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='01c4d3a2$Blat.v2.2.2$f32d2000@zahav.net.il' \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.