(command-line): Use `custom-reevaluate-setting' for
[bpt/emacs.git] / lisp / startup.el
index 3315e72..d63e2b9 100644 (file)
@@ -121,7 +121,7 @@ This is normally copied from `default-directory' when Emacs starts.")
     ("-bg" 1 x-handle-switch background-color)
     ("-background" 1 x-handle-switch background-color)
     ("-ms" 1 x-handle-switch mouse-color)
-    ("-nb" 0 x-handle-switch icon-type nil)
+    ("-nbi" 0 x-handle-switch icon-type nil)
     ("-iconic" 0 x-handle-iconic)
     ("-xrm" 1 x-handle-xrm-switch)
     ("-cr" 1 x-handle-switch cursor-color)
@@ -641,6 +641,17 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
 
   (set-locale-environment nil)
 
+  ;; Convert preloaded file names to absolute.
+  (setq load-history
+       (mapcar (lambda (elt)
+                 (if (and (stringp (car elt))
+                          (not (file-name-absolute-p (car elt))))
+                     (cons (locate-file (car elt) load-path
+                                        load-suffixes)
+                           (cdr elt))
+                   elt))
+               load-history))
+
   ;; Convert the arguments to Emacs internal representation.
   (let ((args (cdr command-line-args)))
     (while args
@@ -720,6 +731,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
     (and command-line-args
          (setcdr command-line-args args)))
 
+  (run-hooks 'before-init-hook)
+
   ;; Under X Window, this creates the X frame and deletes the terminal frame.
   (when (fboundp 'frame-initialize)
     (frame-initialize))
@@ -752,6 +765,8 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
   (custom-reevaluate-setting 'blink-cursor-mode)
   (custom-reevaluate-setting 'normal-erase-is-backspace)
   (custom-reevaluate-setting 'tooltip-mode)
+  (custom-reevaluate-setting 'mouse-wheel-down-event)
+  (custom-reevaluate-setting 'mouse-wheel-up-event)
 
   ;; Register default TTY colors for the case the terminal hasn't a
   ;; terminal init file.
@@ -777,8 +792,6 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
        (old-font-list-limit font-list-limit)
        (old-face-ignored-fonts face-ignored-fonts))
 
-    (run-hooks 'before-init-hook)
-
     ;; Run the site-start library if it exists.  The point of this file is
     ;; that it is run before .emacs.  There is no point in doing this after
     ;; .emacs; that is useless.
@@ -790,12 +803,18 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
     (setq inhibit-startup-message nil)
 
     ;; Warn for invalid user name.
-    (and init-file-user
-        (not (file-directory-p (expand-file-name (concat "~" init-file-user))))
-        (display-warning 'initialization
-                         (format "User %s has no home directory"
-                                 init-file-user)
-                         :error))
+    (when init-file-user
+      (if (string-match "[~/:\n]" init-file-user)
+         (display-warning 'initialization
+                          (format "Invalid user name %s"
+                                  init-file-user)
+                          :error)
+       (if (file-directory-p (expand-file-name (concat "~" init-file-user)))
+           nil
+         (display-warning 'initialization
+                          (format "User %s has no home directory"
+                                  init-file-user)
+                          :error))))
 
     ;; Load that user's init file, or the default one, or none.
     (let (debug-on-error-from-init-file
@@ -833,14 +852,12 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
 
                      (when (eq user-init-file t)
                        ;; If we did not find ~/.emacs, try
-                       ;; ~/.emacs.d/.emacs.
+                       ;; ~/.emacs.d/init.el.
                        (let ((otherfile
                               (expand-file-name
-                               (file-name-nondirectory user-init-file-1)
+                               "init"
                                (file-name-as-directory
-                                (expand-file-name
-                                 ".emacs.d"
-                                 (file-name-directory user-init-file-1))))))
+                                (concat "~" init-file-user "/.emacs.d")))))
                          (load otherfile t t)
 
                          ;; If we did not find the user's init file,
@@ -1250,7 +1267,13 @@ This is an internal function used to turn off the splash screen after
 the user caused an input event by hitting a key or clicking with the
 mouse."
   (interactive)
-  (push last-command-event unread-command-events)
+  (if (and (consp last-command-event)
+          (eq (posn-window (event-start last-command-event))
+              (selected-window)))
+      ;; This is a mouse-down event in the spash screen window.
+      ;; Ignore it and consume the corresponding mouse-up event.
+      (read-event)
+    (push last-command-event unread-command-events))
   (throw 'exit nil))