(update-ideograph-radical-table): Use `char-ideograph-strokes' to put
[chise/xemacs-chise.git-] / lisp / startup.el
index 0f28447..4d1c751 100644 (file)
@@ -20,7 +20,7 @@
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with XEmacs; see the file COPYING.  If not, write to the 
+;; along with XEmacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
@@ -107,10 +107,11 @@ the user's init file.")
 (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
@@ -368,11 +369,10 @@ Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
        (princ "\n\n" stream)))
     (when (not suppress-early-error-handler-backtrace)
       (backtrace stream t)))
+  (if (fboundp 'mswindows-message-box)
+      (mswindows-message-box "Initialization error"))
   (kill-emacs -1))
 
-(defvar lock-directory)
-(defvar superlock-file)
-
 (defun normal-top-level ()
   (if command-line-processed
       (message "Back to top level.")
@@ -409,10 +409,15 @@ Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
                             debug-paths))
       (startup-setup-paths-warning))
 
-    (if (and (not inhibit-autoloads)
-            lisp-directory)
-       (load (expand-file-name (file-name-sans-extension autoload-file-name)
-                               lisp-directory) nil t))
+    (when (and (not inhibit-autoloads)
+              lisp-directory)
+      (load (expand-file-name (file-name-sans-extension autoload-file-name)
+                             lisp-directory) nil t)
+      (if (featurep 'utf-2000)
+         (load (expand-file-name
+                (file-name-sans-extension autoload-file-name)
+                (expand-file-name "utf-2000" lisp-directory))
+               nil t)))
 
     (if (not inhibit-autoloads)
        (progn
@@ -530,11 +535,10 @@ Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")
            (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 +593,11 @@ If this is nil, no message will be displayed.")
       ;; 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,12 +642,20 @@ If this is nil, no message will be displayed.")
            (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))))
-  (load user-init-file t t t)
+  (if (or user-init-file
+          (setq user-init-file (find-user-init-file)))
+      (load user-init-file t t t))
   (unless inhibit-default-init
     (let ((inhibit-startup-message nil))
       ;; Users are supposed to be told their rights.
@@ -764,7 +781,7 @@ a new format, when variables have changed, etc."
          (file-count 0)
          (line nil)
          (end-of-options nil)
-         first-file-buffer file-p arg tem)
+         file-p arg tem)
       (while command-line-args-left
        (setq arg (pop command-line-args-left))
        (cond
@@ -791,8 +808,8 @@ a new format, when variables have changed, etc."
          (incf file-count)
          (setq arg (expand-file-name arg dir))
          (cond
-          ((= file-count 1) (setq first-file-buffer
-                                  (progn (find-file arg) (current-buffer))))
+          ((= file-count 1)
+           (find-file arg))
           (noninteractive (find-file arg))
           (t (find-file-other-window arg)))
          (when line
@@ -962,7 +979,9 @@ Copyright (C) 1985-1999 Free Software Foundation, Inc.
 Copyright (C) 1990-1994 Lucid, Inc.
 Copyright (C) 1993-1997 Sun Microsystems, Inc. All Rights Reserved.
 Copyright (C) 1994-1996 Board of Trustees, University of Illinois
-Copyright (C) 1995-1996 Ben Wing\n"))
+Copyright (C) 1995-1996 Ben Wing
+Copyright (C) 1996-2000 MORIOKA Tomohiko
+"))
 
     ((face (blue bold underline) "\nInformation, on-line help:\n\n")
      "XEmacs comes with plenty of documentation...\n\n"
@@ -1017,7 +1036,7 @@ Copyright (C) 1995-1996 Ben Wing\n"))
              (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)
@@ -1133,18 +1152,6 @@ It's idempotent, so call this as often as you like!"
       (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
             'external-debugging-output))
 
-  (if (boundp 'lock-directory)
-      (progn
-       (setq lock-directory (paths-find-lock-directory roots))
-       (setq superlock-file (paths-find-superlock-file lock-directory))
-
-       (if debug-paths
-           (progn
-             (princ (format "lock-directory:\n%S\n" lock-directory)
-                    'external-debugging-output)
-             (princ (format "superlock-file:\n%S\n" superlock-file)
-                    'external-debugging-output)))))
-
   (setq exec-directory (paths-find-exec-directory roots))
 
   (if debug-paths
@@ -1192,20 +1199,15 @@ It's idempotent, so call this as often as you like!"
     (princ (buffer-string) 'external-debugging-output)))
 
 (defun startup-setup-paths-warning ()
-  (let ((lock (if (boundp 'lock-directory) lock-directory 't))
-       (warnings '()))
-    (if (and (stringp lock) (null (file-directory-p lock)))
-       (setq lock nil))
+  (let ((warnings '()))
     (cond
      ((null (and lisp-directory exec-directory data-directory doc-directory
-                load-path
-                lock))
+                load-path))
       (save-excursion
        (set-buffer (get-buffer-create " *warning-tmp*"))
        (erase-buffer)
        (buffer-disable-undo (current-buffer))
        (if (null lisp-directory) (push "lisp-directory" warnings))
-       (if (null lock)           (push "lock-directory" warnings))
        (if (null exec-directory) (push "exec-directory" warnings))
        (if (null data-directory) (push "data-directory" warnings))
        (if (null doc-directory)  (push "doc-directory"  warnings))