Mercurial > hg > xemacs-beta
comparison lisp/startup.el @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | c6ad4a798ab9 |
children | 79940b592197 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
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 | 7 |
7 ;; Maintainer: XEmacs Development Team | 8 ;; Maintainer: XEmacs Development Team |
8 ;; Keywords: internal, dumped | 9 ;; Keywords: internal, dumped |
9 | 10 |
10 ;; This file is part of XEmacs. | 11 ;; This file is part of XEmacs. |
212 | 213 |
213 | 214 |
214 | 215 |
215 (defvar command-switch-alist | 216 (defvar command-switch-alist |
216 '(("-help" . command-line-do-help) | 217 '(("-help" . command-line-do-help) |
217 ("-version". command-line-do-version) | 218 ("-version" . command-line-do-version) |
218 ("-V" . command-line-do-version) | 219 ("-V" . command-line-do-version) |
219 ("-funcall". command-line-do-funcall) | 220 ("-funcall" . command-line-do-funcall) |
220 ("-f" . command-line-do-funcall) | 221 ("-f" . command-line-do-funcall) |
221 ("-e" . command-line-do-funcall-1) | 222 ("-e" . command-line-do-funcall-1) |
222 ("-eval" . command-line-do-eval) | 223 ("-eval" . command-line-do-eval) |
223 ("-load" . command-line-do-load) | 224 ("-load" . command-line-do-load) |
224 ("-l" . command-line-do-load) | 225 ("-l" . command-line-do-load) |
225 ("-insert" . command-line-do-insert) | 226 ("-insert" . command-line-do-insert) |
226 ("-i" . command-line-do-insert) | 227 ("-i" . command-line-do-insert) |
227 ("-kill" . command-line-do-kill) | 228 ("-kill" . command-line-do-kill) |
229 ("-eol" . command-line-do-enable-eol-detection) | |
228 ;; Options like +35 are handled specially. | 230 ;; Options like +35 are handled specially. |
229 ;; Window-system, site, or package-specific code might add to this. | 231 ;; Window-system, site, or package-specific code might add to this. |
230 ;; X11 handles its options by letting Xt remove args from this list. | 232 ;; X11 handles its options by letting Xt remove args from this list. |
231 ) | 233 ) |
232 "Alist of command-line switches. | 234 "Alist of command-line switches. |
252 -cr <color> Use color as the text-cursor foregound color. | 254 -cr <color> Use color as the text-cursor foregound color. |
253 -private Install a private colormap. | 255 -private Install a private colormap. |
254 | 256 |
255 In addition, the") | 257 In addition, the") |
256 "The")) | 258 "The")) |
257 (princ " following options are accepted: | 259 (let ((l command-switch-alist) |
260 (options " following options are accepted: | |
261 | |
262 Display options: | |
263 | |
264 -nw Open the initial frame on the current TTY, instead of | |
265 a window system. | |
266 -t <device> Use TTY <device> instead of the current TTY for input | |
267 and output. This implies the -nw option. | |
268 -display <display> Standard X option, to specify the display connection. | |
269 If this option is given, or if the environment | |
270 variable DISPLAY is set, an initial X frame will be | |
271 created. Otherwise, an initial Windows frame will be | |
272 created if Windows support exists and neither -nw nor | |
273 -t is given. Otherwise, a TTY frame is created. | |
274 -unmapped Do not display the initial frame. Useful to create | |
275 a \"server\" that can accept `gnuclient' connections. | |
276 | |
277 Noninteractive options: | |
278 | |
279 {-help} | |
280 {-version} | |
281 {-V} | |
282 -batch Execute noninteractively (messages go to stderr, no | |
283 initial frame created). | |
284 {-funcall} | |
285 (The function may parse the rest of the command line | |
286 for its arguments.) | |
287 {-f} | |
288 {-eval} | |
289 {-load} | |
290 {-l} | |
291 {-insert} | |
292 {-i} | |
293 {-kill} | |
258 -sd Show dump ID. Ignored when configured without --pdump. | 294 -sd Show dump ID. Ignored when configured without --pdump. |
259 -nd Don't load the dump file. Roughly like old temacs. | 295 -nd Don't load the dump file. Roughly like old temacs. |
260 Ignored when configured without --pdump. | 296 Ignored when configured without --pdump. |
261 -t <device> Use TTY <device> instead of the terminal for input | 297 |
262 and output. This implies the -nw option. | 298 Initialization files: |
263 -nw Inhibit the use of any window-system-specific | 299 |
264 display code: use the current tty. | 300 -no-init-file Do not load the user-specific init file. |
265 -batch Execute noninteractively (messages go to stderr). | 301 -q Same as -no-init-file. |
266 -debug-init Enter the debugger if an error in the init file occurs. | 302 -debug-init Enter the debugger if an error in the init file occurs. |
267 -unmapped Do not map the initial frame. | 303 -user-init-file <file> |
268 -no-site-file Do not load the site-specific init file (site-start.el). | 304 Use <file> as init file. |
269 -no-init-file Do not load the user-specific init file. | 305 -user-init-directory <directory> |
306 Use <directory> as init directory. | |
307 -user <user> Load user's init file instead of your own. | |
308 -u <user> Same as -user. | |
309 -no-site-file Do not load the site-specific init file | |
310 (site-start.el). | |
311 | |
312 Package/module options: | |
313 | |
270 -no-early-packages Do not process early packages. | 314 -no-early-packages Do not process early packages. |
315 -vanilla Equivalent to -q -no-site-file -no-early-packages. | |
271 -no-autoloads Do not load global symbol files (auto-autoloads) at | 316 -no-autoloads Do not load global symbol files (auto-autoloads) at |
272 startup. Also implies `-vanilla'. | 317 startup. Also implies `-vanilla'. |
273 -vanilla Equivalent to -q -no-site-file -no-early-packages. | 318 -debug-paths Display info about the runtime values of various |
274 -q Same as -no-init-file. | 319 directory variables (e.g. for loading packages). |
275 -user-init-file <file> Use <file> as init file. | 320 -no-site-modules Do not search site-modules directories for modules |
276 -user-init-directory <directory> Use <directory> as init directory. | 321 at startup. Only applies when modules support is |
277 -user <user> Load user's init file instead of your own. | 322 compiled into XEmacs. |
278 -u <user> Same as -user.\n") | 323 |
279 (let ((l command-switch-alist) | 324 Encoding options: |
325 | |
326 -eol Turn on EOL detection (only applies to Unix, no | |
327 international support; otherwise EOL detection is | |
328 already on). | |
329 -nuni Under MS Windows, disable use of the Unicode versions | |
330 of API calls. Not for Windows 95/98/ME. This is | |
331 mostly only useful for debugging purposes. | |
332 | |
333 Misc: | |
334 | |
335 +N <file> Start displaying <file> at line N. | |
336 ") | |
280 (insert (lambda (&rest x) | 337 (insert (lambda (&rest x) |
281 (princ " ") | |
282 (let ((len 2)) | 338 (let ((len 2)) |
283 (while x | 339 (while x |
284 (princ (car x)) | 340 (princ (car x)) |
285 (incf len (length (car x))) | 341 (incf len (length (car x))) |
286 (setq x (cdr x))) | 342 (setq x (cdr x))) |
287 (when (>= len 24) | 343 (when (>= len 24) |
288 (terpri) (setq len 0)) | 344 (terpri) (setq len 0)) |
289 (while (< len 24) | 345 (while (< len 24) |
290 (princ " ") | 346 (princ " ") |
291 (incf len)))))) | 347 (incf len)))))) |
292 (while l | 348 (princ |
293 (let ((name (car (car l))) | 349 (with-temp-buffer |
294 (fn (cdr (car l))) | 350 (insert options) |
295 doc arg cons) | 351 (while l |
296 (cond | 352 (let ((name (car (car l))) |
297 ((and (symbolp fn) (get fn 'undocumented)) nil) | 353 (fn (cdr (car l))) |
298 (t | 354 doc arg cons) |
299 (setq doc (documentation fn)) | 355 (cond |
300 (if (member doc '(nil "")) (setq doc "(undocumented)")) | 356 ((and (symbolp fn) (get fn 'undocumented)) nil) |
301 (cond ((string-match "\n\\(<.*>\\)\n?\\'" doc) | 357 (t |
302 ;; Doc of the form "The frobber switch\n<arg1> <arg2>" | 358 (setq doc (documentation fn)) |
303 (setq arg (substring doc (match-beginning 1) (match-end 1)) | 359 (if (member doc '(nil "")) (setq doc "(undocumented)")) |
304 doc (substring doc 0 (match-beginning 0)))) | 360 (cond ((string-match "\n\\(<.*>\\)\n?\\'" doc) |
305 ((string-match "\n+\\'" doc) | 361 ;; Doc of the form "The frobber switch\n<arg1> <arg2>" |
306 (setq doc (substring doc 0 (match-beginning 0))))) | 362 (setq arg (substring doc (match-beginning 1) (match-end 1)) |
307 (if (and (setq cons (rassq fn command-switch-alist)) | 363 doc (substring doc 0 (match-beginning 0)))) |
308 (not (eq cons (car l)))) | 364 ((string-match "\n+\\'" doc) |
309 (setq doc (format "Same as %s." (car cons)))) | 365 (setq doc (substring doc 0 (match-beginning 0))))) |
310 (if arg | 366 (if (and (setq cons (rassq fn command-switch-alist)) |
311 (funcall insert name " " arg) | 367 (not (eq cons (car l)))) |
312 (funcall insert name)) | 368 (setq doc (format "Same as %s." (car cons)))) |
313 (princ doc) | 369 (goto-char (point-min)) |
314 (terpri)))) | 370 (when (search-forward (format "{%s}" name) nil t) |
315 (setq l (cdr l)))) | 371 (delete-region (match-beginning 0) (match-end 0)) |
372 (let ((standard-output (current-buffer))) | |
373 (if arg | |
374 (funcall insert name " " arg) | |
375 (funcall insert name)) | |
376 (princ doc)))))) | |
377 (setq l (cdr l))) | |
378 (buffer-string)))) | |
316 (princ (concat "\ | 379 (princ (concat "\ |
317 +N <file> Start displaying <file> at line N. | |
318 | 380 |
319 Anything else is considered a file name, and is placed into a buffer for | 381 Anything else is considered a file name, and is placed into a buffer for |
320 editing. | 382 editing. |
321 | 383 |
322 " (emacs-name) " has an online tutorial and manuals. Type ^Ht (Control-h t) after | 384 " (emacs-name) " has an online tutorial and manuals. Type ^Ht (Control-h t) after |
323 starting XEmacs to run the tutorial. Type ^Hi to enter the manual browser. | 385 starting XEmacs to run the tutorial. Type ^Hi to enter the manual browser. |
324 Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n") | 386 Type ^H^H^H (Control-h Control-h Control-h) to get more help options.\n")) |
325 | 387 |
326 (kill-emacs 0)))) | 388 (kill-emacs 0) |
389 )) | |
327 | 390 |
328 (defun command-line-do-funcall (arg) | 391 (defun command-line-do-funcall (arg) |
329 "Invoke the named lisp function with no arguments. | 392 "Invoke the named lisp function with no arguments. |
330 <function>" | 393 <function>" |
331 (funcall (intern (pop command-line-args-left)))) | 394 (funcall (intern (pop command-line-args-left)))) |
358 | 421 |
359 (defun command-line-do-version (arg) | 422 (defun command-line-do-version (arg) |
360 "Print version info and exit." | 423 "Print version info and exit." |
361 (princ (concat (emacs-version) "\n")) | 424 (princ (concat (emacs-version) "\n")) |
362 (kill-emacs 0)) | 425 (kill-emacs 0)) |
426 | |
427 (defun command-line-do-enable-eol-detection (arg) | |
428 "Turn on EOL detection (only applies to Unix)." | |
429 (set-eol-detection t)) | |
363 | 430 |
364 | 431 |
365 ;;; Processing the command line and loading various init files | 432 ;;; Processing the command line and loading various init files |
366 | 433 |
367 (defun early-error-handler (&rest debugger-args) | 434 (defun early-error-handler (&rest debugger-args) |
415 | 482 |
416 (defun normal-top-level () | 483 (defun normal-top-level () |
417 (if command-line-processed | 484 (if command-line-processed |
418 (message "Back to top level.") | 485 (message "Back to top level.") |
419 (setq command-line-processed t) | 486 (setq command-line-processed t) |
487 ;; Do this first for maximum likelihood of catching errors. The main | |
488 ;; purpose of this is so that debug-on-error can be set to catch errors | |
489 ;; during normal noninteractive running. | |
490 (when (getenv "XEMACSDEBUG") | |
491 (eval (read (getenv "XEMACSDEBUG")))) | |
420 ;; Canonicalize HOME (PWD is canonicalized by init_buffer in buffer.c) | 492 ;; Canonicalize HOME (PWD is canonicalized by init_buffer in buffer.c) |
421 (let ((value (user-home-directory))) | 493 (let ((value (user-home-directory))) |
422 (if (and value | 494 (if (and value |
423 (< (length value) (length default-directory)) | 495 (< (length value) (length default-directory)) |
424 (equal (file-attributes default-directory) | 496 (equal (file-attributes default-directory) |
627 ;; Reinitialize faces if necessary. This function changes face if | 699 ;; Reinitialize faces if necessary. This function changes face if |
628 ;; it is created during auto-autoloads loading. Otherwise, it | 700 ;; it is created during auto-autoloads loading. Otherwise, it |
629 ;; does nothing. | 701 ;; does nothing. |
630 (startup-initialize-custom-faces) | 702 (startup-initialize-custom-faces) |
631 | 703 |
704 ;; A couple of other things need to be initted. | |
705 ;; (RMS writes about internally using hooks for this, in reference | |
706 ;; to frame-initialize and frame-notice-user-settings: | |
707 ;; | |
708 ;; These are now called explicitly at the proper times, | |
709 ;; since that is easier to understand. | |
710 ;; Actually using hooks within Emacs is bad for future maintenance. --rms. | |
711 ;; | |
712 ;; In this case, I completely agree. --ben | |
713 (init-menubar-at-startup) | |
714 ;; perhaps this should go earlier in the proecess? | |
715 (if (featurep 'mule) | |
716 (declare-fboundp (init-mule-at-startup))) | |
717 | |
632 ;; | 718 ;; |
633 ;; We have normality, I repeat, we have normality. Anything you still | 719 ;; We have normality, I repeat, we have normality. Anything you still |
634 ;; can't cope with is therefore your own problem. (And we don't need | 720 ;; can't cope with is therefore your own problem. (And we don't need |
635 ;; to kill XEmacs for it.) | 721 ;; to kill XEmacs for it.) |
636 ;; | 722 ;; |
1168 | 1254 |
1169 ((face (blue bold underline) "\nUseful stuff:\n\n") | 1255 ((face (blue bold underline) "\nUseful stuff:\n\n") |
1170 "Things that you should know rather quickly...\n\n" | 1256 "Things that you should know rather quickly...\n\n" |
1171 ((key find-file) ": visit a file\n") | 1257 ((key find-file) ": visit a file\n") |
1172 ((key save-buffer) ": save changes\n") | 1258 ((key save-buffer) ": save changes\n") |
1173 ((key advertised-undo) ": undo changes\n") | 1259 ((key undo) ": undo changes\n") |
1174 ((key save-buffers-kill-emacs) ": exit XEmacs\n")) | 1260 ((key save-buffers-kill-emacs) ": exit XEmacs\n")) |
1175 ]) | 1261 ]) |
1176 | 1262 |
1177 ;; I really hate global variables, oh well. | 1263 ;; I really hate global variables, oh well. |
1178 ;(defvar xemacs-startup-logo-function nil | 1264 ;(defvar xemacs-startup-logo-function nil |