home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.004 / xemacs-1 / xemacs-19.13 / lisp / prim / loadup.el < prev    next >
Encoding:
Text File  |  1995-08-04  |  11.5 KB  |  360 lines

  1. ;;; loadup.el --- load up standardly loaded Lisp files for XEmacs.
  2. ;; Keywords: internal
  3.  
  4. ;; It is not a good idea to edit this file.  Use site-init.el or site-load.el
  5. ;; instead.
  6. ;;
  7. ;; This is loaded into a bare XEmacs to make a dumpable one.
  8. ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
  9.  
  10. ;; This file is part of XEmacs.
  11.  
  12. ;; XEmacs is free software; you can redistribute it and/or modify it
  13. ;; under the terms of the GNU General Public License as published by
  14. ;; the Free Software Foundation; either version 2, or (at your option)
  15. ;; any later version.
  16.  
  17. ;; XEmacs is distributed in the hope that it will be useful, but
  18. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20. ;; General Public License for more details.
  21.  
  22. ;; You should have received a copy of the GNU General Public License
  23. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  24. ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  25.  
  26. (if (fboundp 'error)
  27.     (error "loadup.el already loaded!"))
  28.  
  29. (call-with-condition-handler
  30.       ;; This is awfully damn early to be getting an error, right?
  31.       'really-early-error-handler
  32.  #'(lambda ()
  33.      ;; We don't want to have any undo records in the dumped XEmacs.
  34.      (buffer-disable-undo (get-buffer "*scratch*"))
  35.  
  36.      ;; lread.c (or src/Makefile.in.in) has prepended "${srcdir}/../lisp/prim"
  37.      ;; to load-path, which is how this file has been found.  At this point,
  38.      ;; enough of emacs has been initialized that we can call directory-files
  39.      ;; and get the rest of the dirs (so that we can dump stuff from modes/
  40.      ;; and packages/.)
  41.      ;;
  42.      (let ((temp-path (expand-file-name ".." (car load-path))))
  43.        (setq load-path (nconc (directory-files temp-path t "^[^-.]"
  44.                            nil 'dirs-only)
  45.                   (cons temp-path load-path))))
  46.  
  47.      (setq load-warn-when-source-newer t ; set to nil at the end
  48.        load-warn-when-source-only t)
  49.  
  50.      (load "version.el")    ;Ignore compiled-by-mistake version.elc
  51.      ;; garbage collect after loading every file in an attempt to
  52.      ;; minimize the size of the dumped image (if we don't do this,
  53.      ;; there will be lots of extra space in the data segment filled
  54.      ;; with garbage-collected junk)
  55.      (garbage-collect)
  56.      (load "backquote") ; needed for defsubst etc.
  57.      (garbage-collect)
  58.      (load "bytecomp-runtime")    ; define defsubst
  59.      (garbage-collect)
  60.      (load "subr") ;; now load the most basic Lisp functions
  61.      (garbage-collect)
  62.      (load "cmdloop")
  63.      (or (fboundp 'recursive-edit) (load "cmdloop1"))
  64.      (garbage-collect)
  65.      (load "keymap")
  66.      (garbage-collect)
  67.      (load "syntax")
  68.      (garbage-collect)
  69.      (load "minibuf")
  70.      (garbage-collect)
  71.      (load "specifier")
  72.      (garbage-collect)
  73.      (load "faces")        ; must be loaded before any make-face call
  74.      (garbage-collect)
  75.      (load "glyphs")
  76.      (garbage-collect)
  77.      (load "objects")
  78.      (garbage-collect)
  79.      (load "extents")
  80.      (garbage-collect)
  81.      (load "process")
  82.      (garbage-collect)
  83.      (load "device")
  84.      (garbage-collect)
  85.      (load "obsolete")
  86.      (garbage-collect)
  87.      (load "keydefs.el")    ; Before loaddefs so that keymap vars exist.
  88.      (garbage-collect)
  89.      ;; If SparcWorks support is included some additional packages are
  90.      ;; dumped which would normally have autoloads.  To avoid
  91.      ;; duplicate doc string warnings, SparcWorks uses a separate
  92.      ;; autoloads file with the dumped packages removed.
  93.      (if (featurep 'sparcworks)
  94.      (load "eos/loaddefs-eos.el")
  95.        (load "loaddefs.el"))    ; don't get confused if loaddefs compiled.
  96.      (garbage-collect)
  97.      (load "simple")
  98.      (garbage-collect)
  99.      (load "misc")
  100.      (garbage-collect)
  101.      (load "help")
  102.      (garbage-collect)
  103.      ;; (load "hyper-apropos")  Soon...
  104.      ;; (garbage-collect)
  105.      (load "files")
  106.      (garbage-collect)
  107.      (load "indent")
  108.      (garbage-collect)
  109.      (load "window")
  110.      (garbage-collect)
  111.      (load "paths.el")        ; don't get confused if paths compiled.
  112.      (garbage-collect)
  113.      (load "startup")
  114.      (garbage-collect)
  115.      (load "lisp")
  116.      (garbage-collect)
  117.      (load "page")
  118.      (garbage-collect)
  119.      (load "register")
  120.      (garbage-collect)
  121.      (load "iso8859-1")        ; This must be before any modes
  122.                 ; (sets standard syntax table.)
  123.      (garbage-collect)
  124.      (load "paragraphs")
  125.      (garbage-collect)
  126.      (load "lisp-mode")
  127.      (garbage-collect)
  128.      (load "text-mode")
  129.      (garbage-collect)
  130.      (load "fill")
  131.      (garbage-collect)
  132.      (load "isearch-mode")
  133.      (garbage-collect)
  134.      (load "cc-mode")
  135.      (garbage-collect)
  136.      (load "vc-hooks")
  137.      (garbage-collect)
  138.      (load "ediff-hook")
  139.      (garbage-collect)
  140.      (load "replace")
  141.      (garbage-collect)
  142.      (if (eq system-type 'vax-vms)
  143.      (progn
  144.        (load "vmsproc")
  145.        (garbage-collect)))
  146.      (load "abbrev")
  147.      (garbage-collect)
  148.      (load "buff-menu")
  149.      (garbage-collect)
  150.      (if (eq system-type 'vax-vms)
  151.      (progn
  152.        (load "vms-patch")
  153.        (garbage-collect)))
  154.      (if (featurep 'lisp-float-type)    ; preload some constants and 
  155.      (progn                ; floating pt. functions if 
  156.        (load "float-sup")        ; we have float support.
  157.        (garbage-collect)))
  158.  
  159.      (load "itimer")    ; for vars auto-save-timeout and auto-gc-threshold
  160.      (garbage-collect)
  161.      (load "frame")
  162.      (garbage-collect)
  163.      (load "toolbar")
  164.      (garbage-collect)
  165.      (load "scrollbar")
  166.      (garbage-collect)
  167.      ;; At some point we hope that this will not be necessary.
  168.      (if (featurep 'x)
  169.      (progn
  170.        (load "menubar")
  171.        (garbage-collect)))
  172.      (if (featurep 'x)
  173.      ;; preload the X code, for faster startup.
  174.      (progn
  175.        (load "x-menubar")
  176.        (garbage-collect)
  177. ;;; autoload this.
  178. ;;;            (load "x-font-menu")
  179. ;;;            (garbage-collect)
  180.        (if (featurep 'dialog)
  181.            (progn
  182.          (load "dialog")
  183.          (garbage-collect)))
  184.        (load "x-faces")
  185.        (garbage-collect)
  186.        (load "x-iso8859-1")
  187.        (garbage-collect)
  188.        (load "x-mouse")
  189.        (garbage-collect)
  190.        (load "x-select")
  191.        (garbage-collect)
  192.        (load "x-scrollbar")
  193.        (garbage-collect)
  194.        (load "x-misc")
  195.        (garbage-collect)
  196.        ))
  197.  
  198.      (if (featurep 'tooltalk)
  199.      (progn
  200.        (load "tooltalk/tooltalk-load")
  201.        (garbage-collect)))
  202.  
  203.      (if (featurep 'energize)
  204.      (progn
  205.        (load "energize/energize-load.el")
  206.        (garbage-collect)))
  207.  
  208.      (if (featurep 'sparcworks)
  209.      (progn
  210.        (load "sunpro/sunpro-load.el")
  211.        (garbage-collect)))
  212.  
  213.      )) ;; end of call-with-condition-handler
  214.  
  215.  
  216. (setq load-warn-when-source-newer nil ; set to t at top of file
  217.       load-warn-when-source-only nil)
  218.  
  219. (setq debugger 'debug)
  220.  
  221. (if (or (equal (nth 4 command-line-args) "no-site-file")
  222.     (equal (nth 5 command-line-args) "no-site-file"))
  223.     (setq site-start-file nil))
  224.  
  225. ;;; If you want additional libraries to be preloaded and their
  226. ;;; doc strings kept in the DOC file rather than in core,
  227. ;;; you may load them with a "site-load.el" file.
  228. ;;; But you must also cause them to be scanned when the DOC file
  229. ;;; is generated.  For VMS, you must edit ../../vms/makedoc.com.
  230. ;;; For other systems, you must edit ../../src/Makefile.in.in.
  231. (if (load "site-load" t)
  232.     (garbage-collect))
  233.  
  234. ;;; Note: all compiled Lisp files loaded above this point
  235. ;;; must be among the ones parsed by make-docfile
  236. ;;; to construct DOC.  Any that are not processed
  237. ;;; for DOC will not have doc strings in the dumped XEmacs.
  238.  
  239. ;;; Don't bother with these if we're running temacs, i.e. if we're
  240. ;;; just debugging don't waste time finding doc strings.
  241.  
  242. (if (or (equal (nth 3 command-line-args) "dump")
  243.     (equal (nth 4 command-line-args) "dump"))
  244.     (progn
  245.       (message "Finding pointers to doc strings...")
  246.       (if (fboundp 'dump-emacs)
  247.       (let ((name emacs-version))
  248.          (string-match " Lucid" name)
  249.          (setq name (concat (substring name 0 (match-beginning 0))
  250.                     (substring name (match-end 0))))
  251.         (while (string-match "[^-+_.a-zA-Z0-9]+" name)
  252.           (setq name (concat
  253.               (downcase (substring name 0 (match-beginning 0)))
  254.               "-"
  255.               (substring name (match-end 0)))))
  256.         (if (string-match "-+\\'" name)
  257.         (setq name (substring name 0 (match-beginning 0))))
  258.         (copy-file (expand-file-name "DOC" "../lib-src")
  259.                (expand-file-name (concat "DOC-" name) "../lib-src")
  260.                t)
  261.         (Snarf-documentation (concat "DOC-" name)))
  262.     (Snarf-documentation "DOC"))
  263.       (message "Finding pointers to doc strings...done")
  264.       (Verify-documentation)
  265.       ))
  266.  
  267. ;;; Note: You can cause additional libraries to be preloaded
  268. ;;; by writing a site-init.el that loads them.
  269. ;;; See also "site-load" above.
  270. (if (stringp site-start-file)
  271.     (load "site-init" t))
  272.  
  273. ;;; At this point, we're ready to resume undo recording for scratch.
  274. (buffer-enable-undo "*scratch*")
  275.  
  276. (if (and (eq system-type 'vax-vms)
  277.      (or (equal (nth 3 command-line-args) "dump")
  278.          (equal (nth 4 command-line-args) "dump")))
  279.     (progn
  280.       (setq command-line-args nil)
  281.       (message "Dumping data as file temacs.dump")
  282.       (dump-emacs "temacs.dump" "temacs")
  283.       (kill-emacs)))
  284.  
  285. (if (or (equal (nth 3 command-line-args) "dump")
  286.     (equal (nth 4 command-line-args) "dump"))
  287.     (progn
  288.       (let ((name (concat "emacs-" emacs-version)))
  289.      (string-match " Lucid" name)
  290.      (setq name (concat (substring name 0 (match-beginning 0))
  291.                 (substring name (match-end 0))))
  292.     (while (string-match "[^-+_.a-zA-Z0-9]+" name)
  293.       (setq name (concat (downcase (substring name 0 (match-beginning 0)))
  294.                  "-"
  295.                  (substring name (match-end 0)))))
  296.     (if (string-match "-+\\'" name)
  297.         (setq name (substring name 0 (match-beginning 0))))
  298.     (message "Dumping under names xemacs and %s" name))
  299.       (condition-case ()
  300.       (delete-file "xemacs")
  301.     (file-error nil))
  302.       (if (fboundp 'really-free)
  303.       (really-free))
  304.       (dump-emacs "xemacs" "temacs")
  305.       ;; Recompute NAME now, so that it isn't set when we dump.
  306.       (let ((name (concat "emacs-" emacs-version)))
  307.      (string-match " Lucid" name)
  308.      (setq name (concat (substring name 0 (match-beginning 0))
  309.                 (substring name (match-end 0))))
  310.     (while (string-match "[^-+_.a-zA-Z0-9]+" name)
  311.       (setq name (concat (downcase (substring name 0 (match-beginning 0)))
  312.                  "-"
  313.                  (substring name (match-end 0)))))
  314.     (if (string-match "-+\\'" name)
  315.         (setq name (substring name 0 (match-beginning 0))))
  316.     (add-name-to-file "xemacs" name t))
  317.       (kill-emacs)))
  318.  
  319. (if (or (equal (nth 3 command-line-args) "run-temacs")
  320.     (equal (nth 4 command-line-args) "run-temacs"))
  321.     (progn
  322.       ;; purify-flag is nil if called from loadup-el.el.
  323.       (if purify-flag
  324.       (progn
  325.         (message "\nSnarfing doc...")
  326.         (Snarf-documentation "DOC")
  327.         (Verify-documentation)))
  328.       (message "\nBootstrapping from temacs...")
  329.       (setq purify-flag nil)
  330.       (apply #'run-emacs-from-temacs
  331.          (nthcdr (if (equal (nth 3 command-line-args) "run-temacs")
  332.              4 5)
  333.              command-line-args))
  334.       ;; run-emacs-from-temacs doesn't actually return anyway.
  335.       (kill-emacs)))
  336.  
  337. ;;; Avoid error if user loads some more libraries now.
  338. (setq purify-flag nil)
  339.  
  340. ;;; If you are using 'recompile', then you should have used -l loadup-el.el
  341. ;;; so that the .el files always get loaded (the .elc files may be out-of-
  342. ;;; date or bad).
  343. (if (or (equal (nth 3 command-line-args) "recompile")
  344.     (equal (nth 4 command-line-args) "recompile"))
  345.     (progn
  346.       (let ((command-line-args-left
  347.          (nthcdr (if (equal (nth 3 command-line-args) "recompile")
  348.              4 5)
  349.              command-line-args)))
  350.     (batch-byte-recompile-directory)
  351.     (kill-emacs))))
  352.  
  353.  
  354. ;;; For machines with CANNOT_DUMP defined in config.h,
  355. ;;; this file must be loaded each time XEmacs is run.
  356. ;;; So run the startup code now.
  357.  
  358. (or (fboundp 'dump-emacs)
  359.     (eval top-level))
  360.