diff lisp/startup.el @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 84b14dcb0985
children abe6d1db359e
line wrap: on
line diff
--- a/lisp/startup.el	Mon Aug 13 11:32:27 2007 +0200
+++ b/lisp/startup.el	Mon Aug 13 11:33:38 2007 +0200
@@ -107,10 +107,11 @@
 (defvar user-init-directory-base ".xemacs"
   "Base of directory where user-installed init files may go.")
 
-(defvar user-init-file-base (cond
-			     ((eq system-type 'ms-dos) "_emacs")
-			     (t ".emacs"))
-  "Base of init file.")
+(defvar user-init-file-base-list (append
+				  '(".emacs.elc" ".emacs.el" ".emacs")
+				  (and (eq system-type 'windows-nt)
+				       '("_emacs.elc" "_emacs.el" "_emacs")))
+  "List of allowed init files.  The first one found takes precedence.")
 
 (defvar user-init-directory
   (file-name-as-directory
@@ -530,11 +531,10 @@
  	    (string= arg "-user"))
 	(let* ((user (pop args))
 	       (home-user (concat "~" user)))
-	  (setq user-init-file
-		(paths-construct-path (list home-user user-init-file-base)))
-	  (setq user-init-directory
-		(file-name-as-directory
-		 (paths-construct-path (list home-user user-init-directory-base))))))
+	  (setq user-init-file (find-user-init-file home-user)
+		user-init-directory (file-name-as-directory
+				     (paths-construct-path
+				      (list home-user user-init-directory-base))))))
        ((string= arg "-debug-init")
 	(setq init-file-debug t))
        ((string= arg "-unmapped")
@@ -589,6 +589,11 @@
       ;; and deletes the stdio device.
       (frame-initialize))
 
+    ;; Reinitialize faces if necessary.  This function changes face if
+    ;; it is created during auto-autoloads loading.  Otherwise, it
+    ;; does nothing.
+    (startup-initialize-custom-faces)
+
     ;;
     ;; We have normality, I repeat, we have normality.  Anything you still
     ;; can't cope with is therefore your own problem.  (And we don't need
@@ -633,11 +638,19 @@
 	    (setq term (substring term 0 hyphend))
 	  (setq term nil))))))
 
+(defun find-user-init-file (&optional directory)
+  "Determine the user's init file."
+  (unless directory
+    (setq directory "~"))
+  (dolist (file user-init-file-base-list)
+    (let ((expanded (paths-construct-path (list directory file))))
+      (when (file-exists-p expanded)
+	(return expanded)))))
+
 (defun load-user-init-file ()
   "This function actually reads the init file, .emacs."
   (if (not user-init-file)
-      (setq user-init-file
-	    (paths-construct-path (list "~" user-init-file-base))))
+      (setq user-init-file (find-user-init-file)))
   (load user-init-file t t t)
   (unless inhibit-default-init
     (let ((inhibit-startup-message nil))
@@ -1017,7 +1030,7 @@
 	      (1+ indice )))
       )))
 
-;; ### This function now returns the (possibly nil) timeout circulating the
+;; #### This function now returns the (possibly nil) timeout circulating the
 ;; splash-frame elements
 (defun display-splash-frame ()
   (let ((logo xemacs-logo)