comparison lisp/prim/startup.el @ 177:6075d714658b r20-3b15

Import from CVS: tag r20-3b15
author cvs
date Mon, 13 Aug 2007 09:51:16 +0200
parents 929b76928fce
children 9ad43877534d
comparison
equal deleted inserted replaced
176:6866abce6aaf 177:6075d714658b
467 (push (pop args) new-args))) 467 (push (pop args) new-args)))
468 (t (push arg new-args)))) 468 (t (push arg new-args))))
469 469
470 (nreverse new-args))) 470 (nreverse new-args)))
471 471
472 (defconst initial-scratch-message "\
473 ;; If you want to create a file, don't type the text in this buffer.
474 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
475 ;; If you want to create a file, first visit that file with C-x C-f,
476 ;; then enter the text in that file's own buffer.
477
478 "
479 "Initial message displayed in *scratch* buffer at startup.")
480
472 (defun command-line () 481 (defun command-line ()
473 (let ((command-line-args-left (cdr command-line-args))) 482 (let ((command-line-args-left (cdr command-line-args)))
474 483
475 (let ((debugger 'early-error-handler) 484 (let ((debugger 'early-error-handler)
476 (debug-on-error t)) 485 (debug-on-error t))
510 ;; 519 ;;
511 520
512 ;;; Load init files. 521 ;;; Load init files.
513 (load-init-file) 522 (load-init-file)
514 523
515 ;; If *scratch* exists and init file didn't change its mode, initialize it. 524 (with-current-buffer (get-buffer "*scratch*")
516 (when (get-buffer "*scratch*") 525 (erase-buffer)
517 (save-excursion 526 ;; (insert initial-scratch-message)
518 (set-buffer "*scratch*") 527 (set-buffer-modified-p nil)
519 (when (eq major-mode 'fundamental-mode) 528 (when (eq major-mode 'fundamental-mode)
520 (funcall initial-major-mode)))) 529 (funcall initial-major-mode)))
521 530
522 ;; Load library for our terminal type. 531 ;; Load library for our terminal type.
523 ;; User init file can set term-file-prefix to nil to prevent this. 532 ;; User init file can set term-file-prefix to nil to prevent this.
524 ;; Note that for any TTY's opened subsequently, the TTY init 533 ;; Note that for any TTY's opened subsequently, the TTY init
525 ;; code will run this. 534 ;; code will run this.
673 (or nil;; (pos-visible-in-window-p (point-min)) 682 (or nil;; (pos-visible-in-window-p (point-min))
674 (goto-char (point-min))) 683 (goto-char (point-min)))
675 (sit-for 0) 684 (sit-for 0)
676 (setq unread-command-event (next-command-event))) 685 (setq unread-command-event (next-command-event)))
677 (when timeout (disable-timeout timeout)) 686 (when timeout (disable-timeout timeout))
678 (save-excursion 687 (with-current-buffer (get-buffer "*scratch*")
688 (erase-buffer)
689 (insert initial-scratch-message)
679 ;; In case the XEmacs server has already selected 690 ;; In case the XEmacs server has already selected
680 ;; another buffer, erase the one our message is in. 691 ;; another buffer, erase the one our message is in.
681 (set-buffer (get-buffer "*scratch*"))
682 (erase-buffer)
683 (set-buffer-modified-p nil))))) 692 (set-buffer-modified-p nil)))))
684 693
685 ;; Command-line-options exist 694 ;; Command-line-options exist
686 (let ((dir command-line-default-directory) 695 (let ((dir command-line-default-directory)
687 (file-count 0) 696 (file-count 0)
999 (substring emacs-version (match-beginning 1) 1008 (substring emacs-version (match-beginning 1)
1000 (match-end 1))))) 1009 (match-end 1)))))
1001 (concat "lib/xemacs-" version))) 1010 (concat "lib/xemacs-" version)))
1002 1011
1003 (defun find-emacs-root-internal-1 (path lisp-p) 1012 (defun find-emacs-root-internal-1 (path lisp-p)
1013 (prin1 (format "f-e-r-i-1: %s\n" path))
1004 (let ((dir (file-name-directory path))) 1014 (let ((dir (file-name-directory path)))
1005 (or 1015 (or
1006 ;; 1016 ;;
1007 ;; If this directory is a plausible root of the XEmacs tree, return it. 1017 ;; If this directory is a plausible root of the XEmacs tree, return it.
1008 ;; 1018 ;;
1087 ;; (send-string-to-terminal (format "FINDING ROOT FOR %S\n" path)) 1097 ;; (send-string-to-terminal (format "FINDING ROOT FOR %S\n" path))
1088 ;; first look for lisp/prim and lib-src; then just look for lib-src. 1098 ;; first look for lisp/prim and lib-src; then just look for lib-src.
1089 ;; XEmacs can run (kind of) if the lisp directory is omitted, which 1099 ;; XEmacs can run (kind of) if the lisp directory is omitted, which
1090 ;; some people might want to do for space reasons. 1100 ;; some people might want to do for space reasons.
1091 (or (find-emacs-root-internal-1 path t) 1101 (or (find-emacs-root-internal-1 path t)
1092 (find-emacs-root-internal-1 path nil) 1102 ;; (find-emacs-root-internal-1 path nil)
1093 ;; If we don't succeed we are going to crash and burn for sure. 1103 ;; If we don't succeed we are going to crash and burn for sure.
1094 ;; Try some paths relative to prefix-directory if it isn't nil. 1104 ;; Try some paths relative to prefix-directory if it isn't nil.
1095 ;; This is definitely necessary in cases such as when we're used 1105 ;; This is definitely necessary in cases such as when we're used
1096 ;; as a login shell since we can't determine the invocation 1106 ;; as a login shell since we can't determine the invocation
1097 ;; directory in that case. 1107 ;; directory in that case.
1108
1098 (find-emacs-root-internal-1 1109 (find-emacs-root-internal-1
1099 (format "%s/bin/%s" prefix-directory invocation-name) t) 1110 (format "%s/bin/%s" prefix-directory invocation-name) t)
1100 (find-emacs-root-internal-1 1111 (find-emacs-root-internal-1
1101 (format "%s/bin/%s" prefix-directory invocation-name) nil) 1112 (format "%s/bin/%s" prefix-directory invocation-name) nil)
1102 (find-emacs-root-internal-1 1113 (find-emacs-root-internal-1
1103 (format "%s/lib/%s" prefix-directory invocation-name) t) 1114 (format "%s/lib/%s" prefix-directory invocation-name) t)
1104 (find-emacs-root-internal-1 1115 (find-emacs-root-internal-1
1105 (format "%s/lib/%s" prefix-directory invocation-name) nil) 1116 (format "%s/lib/%s" prefix-directory invocation-name) nil)
1117
1118 ;; We're desperate -- try the prefix-directory correctly.
1119 (find-emacs-root-internal-1
1120 (format "%s/%s/foo" prefix-directory (startup-make-version-dir)) t)
1121 (find-emacs-root-internal-1
1122 (format "%s/%s/foo" prefix-directory (startup-make-version-dir)) nil)
1106 )) 1123 ))
1107 1124
1108 (defun set-default-load-path () 1125 (defun set-default-load-path ()
1109 ;; XEmacs -- Steven Baur says invocation directory is nil if you 1126 ;; XEmacs -- Steven Baur says invocation directory is nil if you
1110 ;; try to use XEmacs as a login shell. 1127 ;; try to use XEmacs as a login shell.
1225 (list site-lisp)) 1242 (list site-lisp))
1226 (if lisp 1243 (if lisp
1227 (list lisp) 1244 (list lisp)
1228 ) 1245 )
1229 )) 1246 ))
1230 1247
1231 ;; 1997/03/06 by Jeff Miller <jmiller@bayserve.net> 1248 ;; 1997/03/06 by Jeff Miller <jmiller@bayserve.net>
1232 ;; initialize 'site-directory'. This is the site-lisp dir used by 1249 ;; initialize 'site-directory'. This is the site-lisp dir used by
1233 ;; XEmacs 1250 ;; XEmacs
1234 (if site-lisp 1251 (if site-lisp
1235 (setq site-directory (file-name-as-directory site-lisp)) 1252 (setq site-directory (file-name-as-directory site-lisp))
1251 (when (or (and (null data-directory) etc) 1268 (when (or (and (null data-directory) etc)
1252 (and (string= etc (expand-file-name "etc" root)) 1269 (and (string= etc (expand-file-name "etc" root))
1253 (not (string= data-directory etc)))) 1270 (not (string= data-directory etc))))
1254 (setq data-directory (file-name-as-directory etc))) 1271 (setq data-directory (file-name-as-directory etc)))
1255 1272
1256
1257
1258 ;; If `configure' specified an info dir, use it. 1273 ;; If `configure' specified an info dir, use it.
1259 (or (boundp 'Info-default-directory-list) 1274 (or (boundp 'Info-default-directory-list)
1260 (setq Info-default-directory-list nil)) 1275 (setq Info-default-directory-list nil))
1261 (cond (configure-info-directory 1276 (cond (configure-info-directory
1262 (setq configure-info-directory (file-name-as-directory 1277 (setq configure-info-directory (file-name-as-directory
1282 (file-name-directory superlock-file)))) 1297 (file-name-directory superlock-file))))
1283 (setq superlock-file 1298 (setq superlock-file
1284 (expand-file-name "!!!SuperLock!!!" 1299 (expand-file-name "!!!SuperLock!!!"
1285 lock-directory))))) 1300 lock-directory)))))
1286 1301
1287 (set-default-load-path-warning))) 1302 (set-default-load-path-warning)
1303 (when (and data-directory Info-default-directory-list)
1304 (setq data-directory-list (list data-directory))
1305 (packages-find-packages package-path nil))))
1288 1306
1289 1307
1290 (defun set-default-load-path-warning () 1308 (defun set-default-load-path-warning ()
1291 (let ((lock (if (boundp 'lock-directory) lock-directory 't)) 1309 (let ((lock (if (boundp 'lock-directory) lock-directory 't))
1292 warnings message guess) 1310 warnings message guess)