From xemacs-m  Wed Jul  9 11:09:24 1997
Received: from bittersweet.inetarena.com (karlheg@bittersweet.inetarena.com [206.129.216.38])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id LAA13747
	for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 11:09:17 -0500 (CDT)
Received: (from karlheg@localhost)
	by bittersweet.inetarena.com (8.8.5/8.8.5) id JAA11948;
	Wed, 9 Jul 1997 09:08:48 -0700
To: XEmacs Beta <xemacs-beta@xemacs.org>
Subject: [PATCH] Possible fix for startup.el
X-Face: /Q}=yl}1_v7nP)xXo5XjG8+tl@=uVu7o5u6)f]zN?+<hB!K.m9:[|*p34jVN`O;:XZXVSy>/\R>qDt(t8w!-i{(y0"`jFw^uk8inzO9wXabd'CdjUWfC\GHi:6nO*YC89#-qD>Q4r%9!V"<RYJ=7D#$";q=zML5'!=wvXk^$`6FT=5CMofQX)WUKt0p:OKl.mFOXx/D
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: multipart/mixed;
 boundary="Multipart_Wed_Jul__9_09:08:46_1997-1"
Content-Transfer-Encoding: 7bit
From: karlheg+xemacs@inetarena.com (Karl M. Hegbloom)
Date: 09 Jul 1997 09:08:47 -0700
Message-ID: <872058rywg.fsf@bittersweet.inetarena.com>
Lines: 114
X-Mailer: Gnus v5.4.62/XEmacs 20.3(beta12) - "Helsinki"

--Multipart_Wed_Jul__9_09:08:46_1997-1
Content-Type: text/plain; charset=US-ASCII


 This is working for me, and finding ~/.xemacs/{init,options}.el now.

 Is this what yous guys all had in mind?  Or is there a better
solution?

 It looks like custom is set up so that Emacs can use "~/.emacs" as
the `custom-file'.  I inserted a (external-debugging-output...
statement to find out what `custom-file's value was.  It is always
"~/.emacs", unless I set it in "site-start.el".  I guess that's what
the site file is for though...



--Multipart_Wed_Jul__9_09:08:46_1997-1
Content-Type: text/plain; charset=US-ASCII

1997-07-09  Karl M. Hegbloom  <karlheg@inetarena.com>

	* prim/startup.el: (load-user-init-file) look for user init
	file under `emacs-user-extension-dir'/init.el, then in
	~/.xemacs, then in ~/.emacs.  Also load `custom-file', unless
	it is the same as the first one.


--Multipart_Wed_Jul__9_09:08:46_1997-1
Content-Type: text/plain; charset=US-ASCII

--- lisp/prim/startup.el.orig	Wed Jul  9 08:12:26 1997
+++ lisp/prim/startup.el	Wed Jul  9 08:51:25 1997
@@ -551,8 +551,38 @@
   "Directory where user initialization and user-installed packages may go.")
 
 (defun load-user-init-file (init-file-user)
-  "This function actually reads the init files.
-First try .xemacs, then try .emacs, but only load one of the two."
+
+  "This function actually reads the user initialization files.
+At this point, \"site-start.el\" has already been loaded, unless
+-no-site-file was specified on the commandline.
+
+This will first try:
+
+	~`init-file-user'/`emacs-user-extension-dir'/init.el
+
+then will look for:
+
+	~`init-file-user'/.xemacs
+
+and lastly will seek and load:
+
+	~`init-file-user'/.emacs
+
+... if neither of the first two files are found.  Only the first of
+these three files to be found will be loaded.
+
+ Next, if it is not the same file that was just loaded, `custom-file'
+is loaded. `custom-file' defaults to ~`init-file-user'/.emacs.  Its
+value may be set by one of the user's own initialization files, or by
+the XEmacs installer, in site-start.el.  We recommend placing:
+
+(custom-set-variables
+ \'(custom-file (concat \"~\"
+			init-file-user
+			emacs-user-extension-dir
+			\"options.el\")))
+
+... in your site-start.el for XEmacs-20.3"
   (when init-file-user
     (setq user-init-file
 	  (cond
@@ -564,18 +594,20 @@
       (setq user-init-file
 	    (cond
 	     ((eq system-type 'ms-dos)
+	      (concat "~" init-file-user "/_xemacs"))
+	     (t
+	      (concat "~" init-file-user "/.xemacs")))))
+    (unless (file-exists-p (expand-file-name user-init-file))
+      (setq user-init-file
+	    (cond
+	     ((eq system-type 'ms-dos)
 	      (concat "~" init-file-user "/_emacs"))
 	     (t
 	      (concat "~" init-file-user "/.emacs")))))
     (load user-init-file t t t)
-    (when (string= custom-file (concat "~"
-				       init-file-user
-				       emacs-user-extension-dir
-				       "options.el"))
-      (load (concat "~"
-		    init-file-user
-		    emacs-user-extension-dir
-		    "options.el") t t))
+    (when (and (not (equal user-init-file custom-file))
+	       (file-exists-p custom-file))
+      (load custom-file t t t))
     (unless inhibit-default-init
       (let ((inhibit-startup-message nil))
 	;; Users are supposed to be told their rights.


--Multipart_Wed_Jul__9_09:08:46_1997-1
Content-Type: text/plain; charset=US-ASCII

mailto:karlheg+sig@inetarena.com (Karl M. Hegbloom)
http://www.inetarena.com/~karlheg
Portland, OR  USA
Debian GNU 1.3  Linux 2.1.36 AMD K5 PR-133

--Multipart_Wed_Jul__9_09:08:46_1997-1--

