comparison lisp/startup.el @ 776:79940b592197

[xemacs-hg @ 2002-03-15 07:43:14 by ben] .cvsignore: ignore .tmp files that are getting auto-created by VC. Makefile.in.in: Use -no-packages to avoid problems with package files shadowing core files (e.g. unicode.el in mule-ucs). alloc.c, emacs.c, lisp.h: add new -no-packages. make sure list of args for sorting is actually correct. clean up arg parsing code. xemacs.mak: Use -no-packages to avoid problems with package files shadowing core files (e.g. unicode.el in mule-ucs). Makefile: Use -no-packages to avoid problems with package files shadowing core files (e.g. unicode.el in mule-ucs). mule\chinese.el, mule\japan-util.el: fix warnings. behavior-defs.el: fix errors with require. bytecomp-runtime.el: add new funs {when,and}-{f}boundp, clean up docs. cus-edit.el: pretty-print values. dump-paths.el, find-paths.el, startup.el, setup-paths.el: fix problems/inconsistencies parsing options. support new -no-packages option. merge code duplication in dump-paths and startup. lisp-mode.el: indent macrolet and labels correctly. update comments about lisp-indent-function. flet already handled in cl. apropos.el, auto-save.el, buff-menu.el, cl-extra.el, dragdrop.el, faces.el, files.el, fill.el, font-lock.el, font.el, gtk-faces.el, gui.el, help.el, hyper-apropos.el, info.el, isearch-mode.el, keymap.el, lisp-mnt.el, mouse.el, package-admin.el, package-get.el, printer.el, process.el, resize-minibuffer.el, simple.el, toolbar-items.el, wid-edit.el, win32-native.el: fix warnings. very-early-lisp.el: update docs. mule\chinese.el, mule\japan-util.el: fix warnings. mule\chinese.el, mule\japan-util.el: fix warnings. behavior-defs.el: fix errors with require. bytecomp-runtime.el: add new funs {when,and}-{f}boundp, clean up docs. cus-edit.el: pretty-print values. dump-paths.el, find-paths.el, startup.el, setup-paths.el: fix problems/inconsistencies parsing options. support new -no-packages option. merge code duplication in dump-paths and startup. lisp-mode.el: indent macrolet and labels correctly. update comments about lisp-indent-function. flet already handled in cl. apropos.el, auto-save.el, buff-menu.el, cl-extra.el, dragdrop.el, faces.el, files.el, fill.el, font-lock.el, font.el, gtk-faces.el, gui.el, help.el, hyper-apropos.el, info.el, isearch-mode.el, keymap.el, lisp-mnt.el, mouse.el, package-admin.el, package-get.el, printer.el, process.el, resize-minibuffer.el, simple.el, toolbar-items.el, wid-edit.el, win32-native.el: fix warnings. very-early-lisp.el: update docs. mule\chinese.el, mule\japan-util.el: fix warnings. Makefile.in.in: Use -no-packages to avoid problems with package files shadowing core files (e.g. unicode.el in mule-ucs). Makefile.in.in: Use -no-packages to avoid problems with package files shadowing core files (e.g. unicode.el in mule-ucs).
author ben
date Fri, 15 Mar 2002 07:43:43 +0000
parents 943eaba38521
children 2923009caf47
comparison
equal deleted inserted replaced
775:7d972c3de90a 776:79940b592197
225 ("-l" . command-line-do-load) 225 ("-l" . command-line-do-load)
226 ("-insert" . command-line-do-insert) 226 ("-insert" . command-line-do-insert)
227 ("-i" . command-line-do-insert) 227 ("-i" . command-line-do-insert)
228 ("-kill" . command-line-do-kill) 228 ("-kill" . command-line-do-kill)
229 ("-eol" . command-line-do-enable-eol-detection) 229 ("-eol" . command-line-do-enable-eol-detection)
230 ("-enable-eol-detection" . command-line-do-enable-eol-detection)
230 ;; Options like +35 are handled specially. 231 ;; Options like +35 are handled specially.
231 ;; Window-system, site, or package-specific code might add to this. 232 ;; Window-system, site, or package-specific code might add to this.
232 ;; X11 handles its options by letting Xt remove args from this list. 233 ;; X11 handles its options by letting Xt remove args from this list.
233 ) 234 )
234 "Alist of command-line switches. 235 "Alist of command-line switches.
309 -no-site-file Do not load the site-specific init file 310 -no-site-file Do not load the site-specific init file
310 (site-start.el). 311 (site-start.el).
311 312
312 Package/module options: 313 Package/module options:
313 314
314 -no-early-packages Do not process early packages.
315 -vanilla Equivalent to -q -no-site-file -no-early-packages. 315 -vanilla Equivalent to -q -no-site-file -no-early-packages.
316 Useful if you think some user-init or site-init code
317 is messing things up, or when running XEmacs in
318 batch mode.
316 -no-autoloads Do not load global symbol files (auto-autoloads) at 319 -no-autoloads Do not load global symbol files (auto-autoloads) at
317 startup. Also implies `-vanilla'. 320 startup. Also implies `-vanilla'.
321 -no-packages Pretend like the packages don't exist. Don't put
322 any packages in the load path or set up any package
323 autoloads. Also Implies `-vanilla'. Use this when
324 running XEmacs in batch mode when you aren't using
325 any functionality in packages and want to make sure
326 that you get no interference from packages
327 (e.g. Lisp files that shadow core Lisp files).
328 -no-early-packages Do not process early packages.
318 -debug-paths Display info about the runtime values of various 329 -debug-paths Display info about the runtime values of various
319 directory variables (e.g. for loading packages). 330 directory variables (e.g. for loading packages).
320 -no-site-modules Do not search site-modules directories for modules 331 -no-site-modules Do not search site-modules directories for modules
321 at startup. Only applies when modules support is 332 at startup. Only applies when modules support is
322 compiled into XEmacs. 333 compiled into XEmacs.
514 525
515 (if (null emacs-roots) 526 (if (null emacs-roots)
516 (startup-find-roots-warning)) 527 (startup-find-roots-warning))
517 (startup-setup-paths emacs-roots 528 (startup-setup-paths emacs-roots
518 user-init-directory 529 user-init-directory
519 inhibit-early-packages 530 (cond (inhibit-all-packages t)
531 (inhibit-early-packages '(early))
532 (t nil))
520 inhibit-site-lisp 533 inhibit-site-lisp
521 debug-paths) 534 debug-paths
535 nil)
522 (startup-setup-paths-warning)) 536 (startup-setup-paths-warning))
523 537
524 (startup-load-autoloads) 538 (startup-load-autoloads)
525 539
526 (unwind-protect 540 (unwind-protect
588 ;; (and ctype 602 ;; (and ctype
589 ;; (string-match iso-8859-1-locale-regexp ctype))) 603 ;; (string-match iso-8859-1-locale-regexp ctype)))
590 ;; (progn 604 ;; (progn
591 ;; (standard-display-european t) 605 ;; (standard-display-european t)
592 ;; (require 'iso-syntax))) 606 ;; (require 'iso-syntax)))
593 607
594 (setq load-user-init-file-p (not (noninteractive))) 608 (if vanilla-inhibiting ;; set in main_1()
595 609 (setq load-user-init-file-p nil
610 site-start-file nil)
611 (setq load-user-init-file-p (not (noninteractive))))
612
596 ;; Allow (at least) these arguments anywhere in the command line 613 ;; Allow (at least) these arguments anywhere in the command line
597 (let ((new-args nil) 614 (macrolet ((long-argmatch (match)
598 (arg nil)) 615 ;; use a macro to avoid lots of concatting at runtime
599 (while args 616 `(or (string= arg ,match)
600 (setq arg (pop args)) 617 (string= arg ,(concat "-" match)))))
618 (let ((new-args nil)
619 (arg nil))
620 (while args
621 (setq arg (pop args))
601 (cond 622 (cond
602 ((or (string= arg "-q") 623 ((or (string= arg "-q")
603 (string= arg "-no-init-file")) 624 (long-argmatch "-no-init-file"))
604 (setq load-user-init-file-p nil)) 625 (setq load-user-init-file-p nil))
605 ((string= arg "-no-site-file") 626 ((long-argmatch "-no-site-file")
606 (setq site-start-file nil)) 627 (setq site-start-file nil))
607 ((or (string= arg "-no-early-packages") 628 ((long-argmatch "-user-init-file")
608 (string= arg "--no-early-packages"))
609 (setq inhibit-early-packages t))
610 ((or (string= arg "-vanilla")
611 (string= arg "--vanilla")
612 ;; Some work on this one already done in emacs.c.
613 (string= arg "-no-autoloads")
614 (string= arg "--no-autoloads"))
615 (setq load-user-init-file-p nil
616 site-start-file nil))
617 ((string= arg "-user-init-file")
618 (setq user-init-file (pop args))) 629 (setq user-init-file (pop args)))
619 ((string= arg "-user-init-directory") 630 ((long-argmatch "-user-init-directory")
620 (setq user-init-directory (file-name-as-directory (pop args)))) 631 (setq user-init-directory (file-name-as-directory (pop args))))
621 ((or (string= arg "-u") 632 ((or (string= arg "-u")
622 (string= arg "-user")) 633 (long-argmatch "-user"))
623 (let* ((user (pop args)) 634 (let* ((user (pop args))
624 (home-user (concat "~" user))) 635 (home-user (concat "~" user)))
625 (setq user-init-directory (file-name-as-directory 636 (setq user-init-directory (file-name-as-directory
626 (paths-construct-path 637 (paths-construct-path
627 (list home-user user-init-directory-base)))) 638 (list home-user user-init-directory-base))))
628 (setq user-init-file 639 (setq user-init-file
629 (find-user-init-file user-init-directory home-user)) 640 (find-user-init-file user-init-directory home-user))
630 (setq custom-file 641 (setq custom-file
631 (make-custom-file-name user-init-file)))) 642 (make-custom-file-name user-init-file))))
632 ((string= arg "-debug-init") 643 ((long-argmatch "-debug-init")
633 (setq init-file-debug t)) 644 (setq init-file-debug t))
634 ((string= arg "-unmapped") 645 ((long-argmatch "-unmapped")
635 (setq initial-frame-unmapped-p t)) 646 (setq initial-frame-unmapped-p t))
636 ((or (string= arg "-debug-paths")
637 (string= arg "--debug-paths"))
638 t)
639 ((or (string= arg "--") (string= arg "-")) 647 ((or (string= arg "--") (string= arg "-"))
640 (while args 648 (while args
641 (push (pop args) new-args))) 649 (push (pop args) new-args)))
642 (t (push arg new-args)))) 650 (t (push arg new-args))))
643 651
644 (with-obsolete-variable 'init-file-user 652 (with-obsolete-variable 'init-file-user
645 (setq init-file-user (and load-user-init-file-p ""))) 653 (setq init-file-user (and load-user-init-file-p "")))
646 654
647 (nreverse new-args))) 655 (nreverse new-args))))
648 656
649 (defconst initial-scratch-message "\ 657 (defconst initial-scratch-message "\
650 ;; This buffer is for notes you don't want to save, and for Lisp evaluation. 658 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
651 ;; If you want to create a file, first visit that file with C-x C-f, 659 ;; If you want to create a file, first visit that file with C-x C-f,
652 ;; then enter the text in that file's own buffer. (C-x is the standard 660 ;; then enter the text in that file's own buffer. (C-x is the standard
671 ;; the X connection, and maybe someday things like -nw can be 679 ;; the X connection, and maybe someday things like -nw can be
672 ;; handled here instead of down in C. 680 ;; handled here instead of down in C.
673 (setq command-line-args-left (command-line-early command-line-args-left)) 681 (setq command-line-args-left (command-line-early command-line-args-left))
674 682
675 (when (eq system-type 'windows-nt) 683 (when (eq system-type 'windows-nt)
676 (init-mswindows-at-startup)) 684 (declare-fboundp (init-mswindows-at-startup)))
677 685
678 ;; Setup the toolbar icon directory 686 ;; Setup the toolbar icon directory
679 (when (featurep 'toolbar) 687 (when (featurep 'toolbar)
680 (init-toolbar-location)) 688 (init-toolbar-location))
681 689
1333 (or invocation-directory (setq invocation-directory default-directory)) 1341 (or invocation-directory (setq invocation-directory default-directory))
1334 (setq invocation-directory 1342 (setq invocation-directory
1335 ;; don't let /tmp_mnt/... get into the load-path or exec-path. 1343 ;; don't let /tmp_mnt/... get into the load-path or exec-path.
1336 (abbreviate-file-name invocation-directory))) 1344 (abbreviate-file-name invocation-directory)))
1337 1345
1338 (defun startup-setup-paths (roots user-init-directory
1339 &optional
1340 inhibit-early-packages inhibit-site-lisp
1341 debug-paths)
1342 "Setup all the various paths.
1343 ROOTS is a list of plausible roots of the XEmacs directory hierarchy.
1344 If INHIBIT-PACKAGES is non-NIL, don't do packages.
1345 If INHIBIT-SITE-LISP is non-NIL, don't do site-lisp.
1346 If DEBUG-PATHS is non-NIL, print paths as they are detected.
1347 It's idempotent, so call this as often as you like!"
1348
1349 (apply #'(lambda (early late last)
1350 (setq early-packages (and (not inhibit-early-packages)
1351 early))
1352 (setq late-packages late)
1353 (setq last-packages last))
1354 (packages-find-packages
1355 roots
1356 (packages-compute-package-locations user-init-directory)))
1357
1358 (setq early-package-load-path (packages-find-package-load-path early-packages))
1359 (setq late-package-load-path (packages-find-package-load-path late-packages))
1360 (setq last-package-load-path (packages-find-package-load-path last-packages))
1361
1362 (if debug-paths
1363 (progn
1364 (princ (format "configure-package-path:\n%S\n" configure-package-path)
1365 'external-debugging-output)
1366 (princ (format "early-packages and early-package-load-path:\n%S\n%S\n"
1367 early-packages early-package-load-path)
1368 'external-debugging-output)
1369 (princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
1370 late-packages late-package-load-path)
1371 'external-debugging-output)
1372 (princ (format "last-packages and last-package-load-path:\n%S\n%S\n"
1373 last-packages last-package-load-path)
1374 'external-debugging-output)))
1375
1376 (setq lisp-directory (paths-find-lisp-directory roots))
1377
1378 (if debug-paths
1379 (princ (format "lisp-directory:\n%S\n" lisp-directory)
1380 'external-debugging-output))
1381
1382 (if (featurep 'mule)
1383 (progn
1384 (setq mule-lisp-directory
1385 (paths-find-mule-lisp-directory roots
1386 lisp-directory))
1387 (if debug-paths
1388 (princ (format "mule-lisp-directory:\n%S\n"
1389 mule-lisp-directory)
1390 'external-debugging-output)))
1391 (setq mule-lisp-directory '()))
1392
1393 (setq site-directory (and (null inhibit-site-lisp)
1394 (paths-find-site-lisp-directory roots)))
1395
1396 (if (and debug-paths (null inhibit-site-lisp))
1397 (princ (format "site-directory:\n%S\n" site-directory)
1398 'external-debugging-output))
1399
1400 (setq load-path (paths-construct-load-path roots
1401 early-package-load-path
1402 late-package-load-path
1403 last-package-load-path
1404 lisp-directory
1405 site-directory
1406 mule-lisp-directory))
1407
1408 (setq Info-directory-list
1409 (paths-construct-info-path roots
1410 early-packages late-packages last-packages))
1411
1412
1413 (if debug-paths
1414 (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
1415 'external-debugging-output))
1416
1417 (setq exec-directory (paths-find-exec-directory roots))
1418
1419 (if debug-paths
1420 (princ (format "exec-directory:\n%s\n" exec-directory)
1421 'external-debugging-output))
1422
1423 (setq exec-path
1424 (paths-construct-exec-path roots exec-directory
1425 early-packages late-packages last-packages))
1426
1427 (if debug-paths
1428 (princ (format "exec-path:\n%S\n" exec-path)
1429 'external-debugging-output))
1430
1431 (setq doc-directory (paths-find-doc-directory roots))
1432
1433 (if debug-paths
1434 (princ (format "doc-directory:\n%S\n" doc-directory)
1435 'external-debugging-output))
1436
1437 (setq data-directory (paths-find-data-directory roots))
1438
1439 (if debug-paths
1440 (princ (format "data-directory:\n%S\n" data-directory)
1441 'external-debugging-output))
1442
1443 (setq data-directory-list (paths-construct-data-directory-list data-directory
1444 early-packages
1445 late-packages
1446 last-packages))
1447 (if debug-paths
1448 (princ (format "data-directory-list:\n%S\n" data-directory-list)
1449 'external-debugging-output)))
1450
1451 (defun startup-find-roots-warning () 1346 (defun startup-find-roots-warning ()
1452 (save-excursion 1347 (save-excursion
1453 (set-buffer (get-buffer-create " *warning-tmp*")) 1348 (set-buffer (get-buffer-create " *warning-tmp*"))
1454 (erase-buffer) 1349 (erase-buffer)
1455 (buffer-disable-undo (current-buffer)) 1350 (buffer-disable-undo (current-buffer))
1496 (if (and (not inhibit-autoloads) 1391 (if (and (not inhibit-autoloads)
1497 lisp-directory) 1392 lisp-directory)
1498 (load (expand-file-name (file-name-sans-extension autoload-file-name) 1393 (load (expand-file-name (file-name-sans-extension autoload-file-name)
1499 lisp-directory) nil t)) 1394 lisp-directory) nil t))
1500 1395
1501 (if (not inhibit-autoloads) 1396 (if (and (not inhibit-autoloads) (not inhibit-all-packages))
1502 (progn 1397 (progn
1503 (if (not inhibit-early-packages) 1398 (if (not inhibit-early-packages)
1504 (packages-load-package-auto-autoloads early-package-load-path)) 1399 (packages-load-package-auto-autoloads early-package-load-path))
1505 (packages-load-package-auto-autoloads late-package-load-path) 1400 (packages-load-package-auto-autoloads late-package-load-path)
1506 (packages-load-package-auto-autoloads last-package-load-path)))) 1401 (packages-load-package-auto-autoloads last-package-load-path))))