emacs-devel
[Top][All Lists]
Advanced

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

$USERPROFILE for $HOME on W32


From: Stefan Monnier
Subject: $USERPROFILE for $HOME on W32
Date: Mon, 22 Nov 2004 01:26:51 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

To follow up on the thread, here is a suggested patch.
Any objection?
If anybody wants to install it (with or without adjustments), please feel
free to do it: I'd rather not spend any more time on this.


        Stefan


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




reply via email to

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