comparison lisp/startup.el @ 1330:4542b72c005e

[xemacs-hg @ 2003-03-01 07:25:26 by ben] build patch Makefile.in.in: Move src deletions to src/Makefile.in.in. dump-paths.el, dumped-lisp.el: Delete. Combine stuff into setup-paths.el. find-paths.el: Removed. Make this file contain generic routines only. Move stuff to compute Emacs roots to setup-paths.el. startup.el: Removed. Move these variables into setup-paths.el. setup-paths.el, startup.el: Removed. Combine all high-level code for computing the paths into setup-paths.el. Create new function startup-find-load-path to encapsulate all logic for computing `load-path'. Eliminate invocation-directory and invocation-name parameters since there is no point (false generality) -- the code references other globals, which cannot be specified. Eliminate some code duplicated between setup-paths.el and startup.el. Clean up the debug-paths code and output load-path in addition. Add logic to paths-emacs-root-p to support separated source and build trees. loadup.el, make-docfile.el, update-elc-2.el, update-elc.el: Rewrite to allow for separated source and build trees, as may occur in MS Windows. NOTE TO BUILD HACKERS: loadup.el, make-docfile.el, update-elc.el and update-elc-2.el made two assumptions that are no longer correct: (1) The source and build trees are in the same place. (2) They can make assumptions about where `.' is. These files now compute the locations of the source and build roots at the top of the file. *ALL* constant file names or path snippets must now be made absolute using expand-file-name and one of these roots. dumped-lisp.el, packages.el: Removed. Remove some unused lists of Lisp files. packages-hardcoded-lisp (empty, in any case) moved to dumped-lisp.el. startup.el: When a compiled init file is out-of-date wrt the uncompiled version, load the uncompiled version and issue a nasty warning. update-elc-2.el: Force touching of auto-autoloads files when REBUILD_AUTOLOADS was set. update-elc.el: Fix code that checks whether dumping is necessary to check against xemacs.dmp, not xemacs.exe, when Unix and pdump. lwlib-Xm.c: Fix compile warning. README, config.inc.samp, xemacs.mak: -- Major reorganization and cleanup. -- Add support for separated build tree and source tree. -- Delete all support for X Windows building, since it's totally bit-rotten and will never be fixed up. Instruct people to use Cygwin if they want such support. make-build-dir: New script to create a skeleton build tree for use with separated build and source tree compilation. m/acorn.h, m/alliant-2800.h, m/alliant.h, m/altos.h, m/amdahl.h, m/arm.h, m/att3b.h, m/aviion.h, m/clipper.h, m/cnvrgnt.h, m/convex.h, m/cydra5.h, m/delta.h, m/delta88k.h, m/dpx2.h, m/elxsi.h, m/ews4800r.h, m/gould.h, m/hp800.h, m/hp9000s300.h, m/i860.h, m/ibmps2-aix.h, m/ibmrs6000.h, m/ibmrt-aix.h, m/ibmrt.h, m/intel386.h, m/iris4d.h, m/iris5d.h, m/iris6d.h, m/irist.h, m/m68k.h, m/masscomp.h, m/mg1.h, m/mips-nec.h, m/mips-siemens.h, m/mips.h, m/nh3000.h, m/nh4000.h, m/ns32000.h, m/plexus.h, m/powerpc.h, m/sequent-ptx.h, m/sequent.h, m/sgi-challenge.h, m/stride.h, m/tad68k.h, m/targon31.h, m/tekxd88.h, m/template.h, m/tower32.h, m/tower32v3.h, m/ustation.h, m/wicat.h, m/xps100.h, data.c, doc.c, editfns.c, emacs.c, lrecord.h, ntheap.c, process-unix.c, sysdep.c, unexec.c: Delete all support for bit-rotten CANNOT_DUMP. Just use pdump. Makefile.in.in: Lots o' cleanup. Use names like LISP, SRC instead of lispdir, srcdir, for consistency with xemacs.mak and the conventions in the rest of the file. Eliminate use of ${...} in favor of $(...), to make it easier to move code between this file and xemacs.mak. Fix dependency handling wrt NEEDTODUMP to eliminate problems some people (e.g. Vin) have been seeing with non-GNU makes. Write a long section about the subtle but oh-so-important differences in dependency processing between nmake, make, and GNU make. Add unicode-encapsulate target, from xemacs.mak. chartab.c, lrecord.h: Fix crash due to attempt to free objects across dump/undump.
author ben
date Sat, 01 Mar 2003 07:25:56 +0000
parents c08a6fa181d1
children 6355bae896e3
comparison
equal deleted inserted replaced
1329:389741884c65 1330:4542b72c005e
1 ;;; startup.el --- process XEmacs shell arguments 1 ;;; startup.el --- process XEmacs shell arguments
2 2
3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985-1986, 1990, 1992-1997 Free Software Foundation, Inc.
4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc. 4 ;; Copyright (c) 1993, 1994 Sun Microsystems, Inc.
5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois 5 ;; Copyright (C) 1995 Board of Trustees, University of Illinois
6 ;; Copyright (C) 2001, 2002 Ben Wing. 6 ;; Copyright (C) 2001, 2002, 2003 Ben Wing.
7 7
8 ;; Maintainer: XEmacs Development Team 8 ;; Maintainer: XEmacs Development Team
9 ;; Keywords: internal, dumped 9 ;; Keywords: internal, dumped
10 10
11 ;; This file is part of XEmacs. 11 ;; This file is part of XEmacs.
127 XEmacs runs this hook after processing the command line arguments and loading 127 XEmacs runs this hook after processing the command line arguments and loading
128 the user's init file.") 128 the user's init file.")
129 129
130 (defconst initial-major-mode 'lisp-interaction-mode 130 (defconst initial-major-mode 'lisp-interaction-mode
131 "Major mode command symbol to use for the initial *scratch* buffer.") 131 "Major mode command symbol to use for the initial *scratch* buffer.")
132
133 (defvar emacs-roots nil
134 "List of plausible roots of the XEmacs hierarchy.")
135
136 (defvar emacs-data-roots nil
137 "List of plausible data roots of the XEmacs hierarchy.")
138
139 (defvar user-init-directory-base ".xemacs"
140 "Base of directory where user-installed init files may go.")
141
142 (defvar user-init-directory
143 (file-name-as-directory
144 (paths-construct-path (list "~" user-init-directory-base)))
145 "Directory where user-installed init files may go.")
146
147 (defvar user-init-file-base "init.el"
148 "Default name of the user init file if uncompiled.
149 This should be used for migration purposes only.")
150
151 (defvar user-init-file-base-list '("init.elc" "init.el")
152 "List of allowed init files in the user's init directory.
153 The first one found takes precedence.")
154
155 (defvar user-home-init-file-base-list
156 (append '(".emacs.elc" ".emacs.el" ".emacs")
157 (and (eq system-type 'windows-nt)
158 '("_emacs.elc" "_emacs.el" "_emacs")))
159 "List of allowed init files in the user's home directory.
160 The first one found takes precedence.")
161
162 (defvar load-home-init-file nil
163 "Non-nil if XEmacs should load the init file from the home directory.
164 Otherwise, XEmacs will offer migration to the init directory.")
165
166 (defvar load-user-init-file-p t
167 "Non-nil if XEmacs should load the user's init file.")
168 132
169 ;; #### called `site-run-file' in FSFmacs 133 ;; #### called `site-run-file' in FSFmacs
170 134
171 (defvar site-start-file "site-start" 135 (defvar site-start-file "site-start"
172 "File containing site-wide run-time initializations. 136 "File containing site-wide run-time initializations.
512 (setq default-directory (file-name-as-directory value)))) 476 (setq default-directory (file-name-as-directory value))))
513 (setq default-directory (abbreviate-file-name default-directory)) 477 (setq default-directory (abbreviate-file-name default-directory))
514 (initialize-xemacs-paths) 478 (initialize-xemacs-paths)
515 479
516 (startup-set-invocation-environment) 480 (startup-set-invocation-environment)
517 481 (startup-setup-paths (cond (inhibit-all-packages t)
518 (let ((debug-paths (or debug-paths 482 (inhibit-early-packages '(early))
519 (and (getenv "EMACSDEBUGPATHS") 483 (t nil))
520 t)))) 484 nil)
521 485 (startup-setup-paths-warning)
522 (setq emacs-roots (paths-find-emacs-roots invocation-directory
523 invocation-name
524 #'paths-emacs-root-p))
525 (setq emacs-data-roots (paths-find-emacs-roots invocation-directory
526 invocation-name
527 #'paths-emacs-data-root-p))
528
529 (if debug-paths
530 (princ (format "emacs-roots:\n%S\n" emacs-roots)
531 'external-debugging-output))
532
533 (if (null emacs-roots)
534 (startup-find-roots-warning))
535 (startup-setup-paths emacs-roots emacs-data-roots
536 user-init-directory
537 (cond (inhibit-all-packages t)
538 (inhibit-early-packages '(early))
539 (t nil))
540 inhibit-site-lisp
541 debug-paths
542 nil)
543 (startup-setup-paths-warning))
544 486
545 ;; Either we need to inhibit messages from do_autoloads, or this 487 ;; Either we need to inhibit messages from do_autoloads, or this
546 ;; should go into (command-line) after the initialization of the 488 ;; should go into (command-line) after the initialization of the
547 ;; frame? 489 ;; frame?
548 (startup-load-autoloads) 490 (startup-load-autoloads)
796 ;; Strip off last hyphen and what follows, then try again 738 ;; Strip off last hyphen and what follows, then try again
797 (if (setq hyphend (string-match "[-_][^-_]+\\'" term)) 739 (if (setq hyphend (string-match "[-_][^-_]+\\'" term))
798 (setq term (substring term 0 hyphend)) 740 (setq term (substring term 0 hyphend))
799 (setq term nil)))))) 741 (setq term nil))))))
800 742
743 (defun find-init-file-1 (dir base-list)
744 (catch 'found
745 (dolist (file base-list)
746 (let ((expanded (expand-file-name file dir)))
747 (if (string-match "el$" expanded)
748 (let* ((elc (concat expanded "c"))
749 (el-ok (file-readable-p expanded))
750 (elc-ok (file-readable-p elc)))
751 (cond
752 ((and el-ok elc-ok (file-newer-than-file-p expanded elc))
753 (lwarn 'initialization 'warning
754 "\
755 The compiled initialization file `%s' exists
756 but is out-of-date with respect to the uncompiled initialization
757 file `%s'. XEmacs will load the uncompiled
758 version. You should correct the problem as soon as possible by
759 loading the uncompiled version and compiling it using
760 `M-x byte-compile-file' (or `Lisp->Byte-Compile This File' on
761 the menubar)."
762 elc expanded)
763 (throw 'found expanded))
764 (elc-ok (throw 'found elc))
765 (el-ok (throw 'found expanded))))
766 (when (file-readable-p
767 (when (file-readable-p expanded)
768 (throw 'found expanded)))))))))
769
801 (defun find-user-init-directory-init-file (&optional init-directory) 770 (defun find-user-init-directory-init-file (&optional init-directory)
802 "Determine the user's init file if in the init directory." 771 "Determine the user's init file if in the init directory."
803 (let ((init-directory (or init-directory user-init-directory))) 772 (find-init-file-1 (or init-directory user-init-directory)
804 (catch 'found 773 user-init-file-base-list))
805 (dolist (file user-init-file-base-list)
806 (let ((expanded (expand-file-name file init-directory)))
807 (when (file-readable-p expanded)
808 (throw 'found expanded)))))))
809 774
810 (defun find-user-home-directory-init-file (&optional home-directory) 775 (defun find-user-home-directory-init-file (&optional home-directory)
811 "Determine the user's init file if in the home directory." 776 "Determine the user's init file if in the home directory."
812 (let ((home-directory (or home-directory "~"))) 777 (find-init-file-1 (or home-directory "~")
813 (catch 'found 778 user-home-init-file-base-list))
814 (dolist (file user-home-init-file-base-list)
815 (let ((expanded (expand-file-name file home-directory)))
816 (when (file-readable-p expanded)
817 (throw 'found expanded))))
818 nil)))
819 779
820 (defun find-user-init-file (&optional init-directory home-directory) 780 (defun find-user-init-file (&optional init-directory home-directory)
821 "Determine the user's init file." 781 "Determine the user's init file."
822 (if load-home-init-file 782 (if load-home-init-file
823 (find-user-home-directory-init-file home-directory) 783 (find-user-home-directory-init-file home-directory)
1386 (or invocation-directory (setq invocation-directory default-directory)) 1346 (or invocation-directory (setq invocation-directory default-directory))
1387 (setq invocation-directory 1347 (setq invocation-directory
1388 ;; don't let /tmp_mnt/... get into the load-path or exec-path. 1348 ;; don't let /tmp_mnt/... get into the load-path or exec-path.
1389 (abbreviate-file-name invocation-directory))) 1349 (abbreviate-file-name invocation-directory)))
1390 1350
1391 (defun startup-find-roots-warning ()
1392 (save-excursion
1393 (set-buffer (get-buffer-create " *warning-tmp*"))
1394 (erase-buffer)
1395 (buffer-disable-undo (current-buffer))
1396
1397 (insert "Couldn't find an obvious default for the root of the\n"
1398 "XEmacs hierarchy.")
1399
1400 (princ "\nWARNING:\n" 'external-debugging-output)
1401 (princ (buffer-string) 'external-debugging-output)))
1402
1403 (defun startup-setup-paths-warning () 1351 (defun startup-setup-paths-warning ()
1404 (let ((warnings '())) 1352 (let ((warnings '()))
1405 (cond 1353 (cond
1406 ((null (and lisp-directory exec-directory data-directory doc-directory 1354 ((null (and lisp-directory exec-directory data-directory doc-directory
1407 load-path)) 1355 load-path))