From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jason Rumney Newsgroups: gmane.emacs.devel Subject: Re: $USERPROFILE for $HOME on W32 Date: Mon, 22 Nov 2004 08:44:26 +0000 Message-ID: References: <87vfbycsgj.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1101113128 30586 80.91.229.6 (22 Nov 2004 08:45:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Nov 2004 08:45:28 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 22 09:45:19 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CW9p1-0002iY-00 for ; Mon, 22 Nov 2004 09:45:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CW9y3-0004b1-Lh for ged-emacs-devel@m.gmane.org; Mon, 22 Nov 2004 03:54:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CW9xh-0004as-HT for emacs-devel@gnu.org; Mon, 22 Nov 2004 03:54:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CW9xf-0004aL-DE for emacs-devel@gnu.org; Mon, 22 Nov 2004 03:54:15 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CW9xc-0004aH-3O for emacs-devel@gnu.org; Mon, 22 Nov 2004 03:54:14 -0500 Original-Received: from [194.106.33.237] (helo=outmail.freedom2surf.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CW9oP-0007ab-Os for emacs-devel@gnu.org; Mon, 22 Nov 2004 03:44:42 -0500 Original-Received: from wanchan.jasonrumney.net (i-195-137-77-250.freedom2surf.net [195.137.77.250]) by outmail.freedom2surf.net (8.12.10/8.12.10) with ESMTP id iAM8ienF022620; Mon, 22 Nov 2004 08:44:40 GMT Original-Received: from TONKOTSU-RAMEN (tonkotsu-ramen.jasonrumney.net [10.0.0.28]) by wanchan.jasonrumney.net (Postfix) with ESMTP id C55DEDDD55; Mon, 22 Nov 2004 08:44:39 +0000 (GMT) Original-To: Stefan Monnier In-Reply-To: <87vfbycsgj.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 22 Nov 2004 01:26:51 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30232 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30232 Stefan Monnier writes: > To follow up on the thread, here is a suggested patch. > Any objection? I'd rather put the code in init_environment() in w32.c, and keep all hacking of environment variables in one place. > --- startup.el 17 oct 2004 18:58:12 -0400 1.333 > +++ startup.el 22 nov 2004 01:23:05 -0500 > @@ -340,6 +340,14 @@ > (if command-line-processed > (message "Back to top level.") > (setq command-line-processed t) > + ;; On W32, try to use $USERPROFILE if $HOME isn't properly set. > + (when (and (memq system-type '(windows-nt)) > + (equal (getenv "HOME") "C:/") > + (not (file-exists-p "~/.emacs")) > + (not (file-exists-p "~/_emacs")) > + (getenv "USERPROFILE") > + (file-writable-p (getenv "USERPROFILE"))) > + (setenv "HOME" (getenv "USERPROFILE"))) > ;; Give *Messages* the same default-directory as *scratch*, > ;; just to keep things predictable. > (let ((dir default-directory))