123 |
(setq top-level '(normal-top-level)) |
(setq top-level '(normal-top-level)) |
124 |
|
|
125 |
(defvar command-line-processed nil |
(defvar command-line-processed nil |
126 |
"Non-nil once command line has been processed") |
"Non-nil once command line has been processed.") |
127 |
|
|
128 |
(defgroup initialization nil |
(defgroup initialization nil |
129 |
"Emacs start-up procedure" |
"Emacs start-up procedure" |
344 |
More precisely, this uses only the subdirectories whose names |
More precisely, this uses only the subdirectories whose names |
345 |
start with letters or digits; it excludes any subdirectory named `RCS' |
start with letters or digits; it excludes any subdirectory named `RCS' |
346 |
or `CVS', and any subdirectory that contains a file named `.nosearch'." |
or `CVS', and any subdirectory that contains a file named `.nosearch'." |
347 |
(let (dirs |
(let (dirs |
348 |
attrs |
attrs |
349 |
(pending (list default-directory))) |
(pending (list default-directory))) |
350 |
;; This loop does a breadth-first tree walk on DIR's subtree, |
;; This loop does a breadth-first tree walk on DIR's subtree, |
463 |
(make-directory |
(make-directory |
464 |
(file-name-directory auto-save-list-file-prefix) |
(file-name-directory auto-save-list-file-prefix) |
465 |
t) |
t) |
466 |
(concat |
(concat |
467 |
(make-temp-name |
(make-temp-name |
468 |
(expand-file-name |
(expand-file-name |
469 |
auto-save-list-file-prefix)) |
auto-save-list-file-prefix)) |
848 |
;; Run the site-start library if it exists. The point of this file is |
;; Run the site-start library if it exists. The point of this file is |
849 |
;; that it is run before .emacs. There is no point in doing this after |
;; that it is run before .emacs. There is no point in doing this after |
850 |
;; .emacs; that is useless. |
;; .emacs; that is useless. |
851 |
(if site-run-file |
(if site-run-file |
852 |
(load site-run-file t t)) |
(load site-run-file t t)) |
853 |
|
|
854 |
;; Sites should not disable this. Only individuals should disable |
;; Sites should not disable this. Only individuals should disable |
868 |
(lambda () |
(lambda () |
869 |
(if init-file-user |
(if init-file-user |
870 |
(let ((user-init-file-1 |
(let ((user-init-file-1 |
871 |
(cond |
(cond |
872 |
((eq system-type 'ms-dos) |
((eq system-type 'ms-dos) |
873 |
(concat "~" init-file-user "/_emacs")) |
(concat "~" init-file-user "/_emacs")) |
874 |
((eq system-type 'windows-nt) |
((eq system-type 'windows-nt) |
875 |
(if (directory-files "~" nil "^\\.emacs\\(\\.elc?\\)?$") |
(if (directory-files "~" nil "^\\.emacs\\(\\.elc?\\)?$") |
876 |
"~/.emacs" |
"~/.emacs" |
877 |
"~/_emacs")) |
"~/_emacs")) |
878 |
((eq system-type 'vax-vms) |
((eq system-type 'vax-vms) |
879 |
"sys$login:.emacs") |
"sys$login:.emacs") |
880 |
(t |
(t |
881 |
(concat "~" init-file-user "/.emacs"))))) |
(concat "~" init-file-user "/.emacs"))))) |
882 |
;; This tells `load' to store the file name found |
;; This tells `load' to store the file name found |
883 |
;; into user-init-file. |
;; into user-init-file. |
884 |
(setq user-init-file t) |
(setq user-init-file t) |
885 |
(load user-init-file-1 t t) |
(load user-init-file-1 t t) |
886 |
|
|
887 |
;; If we did not find the user's init file, |
;; If we did not find the user's init file, |
888 |
;; set user-init-file conclusively to nil; |
;; set user-init-file conclusively to nil; |
889 |
;; don't let it be set from default.el. |
;; don't let it be set from default.el. |
890 |
(if (eq user-init-file t) |
(if (eq user-init-file t) |
891 |
(setq user-init-file nil)) |
(setq user-init-file nil)) |
892 |
|
|
893 |
;; If we loaded a compiled file, set |
;; If we loaded a compiled file, set |
894 |
;; `user-init-file' to the source version if that |
;; `user-init-file' to the source version if that |
895 |
;; exists. |
;; exists. |
907 |
source user-init-file) |
source user-init-file) |
908 |
(sit-for 1)) |
(sit-for 1)) |
909 |
(setq user-init-file source)))) |
(setq user-init-file source)))) |
910 |
|
|
911 |
(or inhibit-default-init |
(or inhibit-default-init |
912 |
(let ((inhibit-startup-message nil)) |
(let ((inhibit-startup-message nil)) |
913 |
;; Users are supposed to be told their rights. |
;; Users are supposed to be told their rights. |
966 |
;; originally done before unibyte was set and is sensitive to |
;; originally done before unibyte was set and is sensitive to |
967 |
;; unibyte (display table, terminal coding system &c). |
;; unibyte (display table, terminal coding system &c). |
968 |
(set-language-environment current-language-environment))) |
(set-language-environment current-language-environment))) |
969 |
|
|
970 |
;; Do this here in case the init file sets mail-host-address. |
;; Do this here in case the init file sets mail-host-address. |
971 |
(or user-mail-address |
(or user-mail-address |
972 |
(setq user-mail-address (concat (user-login-name) "@" |
(setq user-mail-address (concat (user-login-name) "@" |
980 |
(eq font-list-limit old-font-list-limit) |
(eq font-list-limit old-font-list-limit) |
981 |
(eq face-ignored-fonts old-face-ignored-fonts)) |
(eq face-ignored-fonts old-face-ignored-fonts)) |
982 |
(clear-face-cache))) |
(clear-face-cache))) |
983 |
|
|
984 |
(run-hooks 'after-init-hook) |
(run-hooks 'after-init-hook) |
985 |
|
|
986 |
;; If *scratch* exists and init file didn't change its mode, initialize it. |
;; If *scratch* exists and init file didn't change its mode, initialize it. |
989 |
(set-buffer "*scratch*") |
(set-buffer "*scratch*") |
990 |
(if (eq major-mode 'fundamental-mode) |
(if (eq major-mode 'fundamental-mode) |
991 |
(funcall initial-major-mode)))) |
(funcall initial-major-mode)))) |
992 |
|
|
993 |
;; Load library for our terminal type. |
;; Load library for our terminal type. |
994 |
;; User init file can set term-file-prefix to nil to prevent this. |
;; User init file can set term-file-prefix to nil to prevent this. |
995 |
(and term-file-prefix (not noninteractive) (not window-system) |
(and term-file-prefix (not noninteractive) (not window-system) |
1181 |
|
|
1182 |
|
|
1183 |
(defun fancy-splash-default-action () |
(defun fancy-splash-default-action () |
1184 |
"Default action for events in the splash screen buffer." |
"Stop displaying the splash screen buffer. |
1185 |
|
This is an internal function used to turn off the splash screen after |
1186 |
|
the user caused an input event by hitting a key or clicking with the |
1187 |
|
mouse." |
1188 |
(interactive) |
(interactive) |
1189 |
(push last-command-event unread-command-events) |
(push last-command-event unread-command-events) |
1190 |
(throw 'exit nil)) |
(throw 'exit nil)) |
1210 |
display-hourglass nil |
display-hourglass nil |
1211 |
minor-mode-map-alist nil |
minor-mode-map-alist nil |
1212 |
buffer-undo-list t |
buffer-undo-list t |
1213 |
mode-line-format (propertize "---- %b %-" |
mode-line-format (propertize "---- %b %-" |
1214 |
'face '(:weight bold)) |
'face '(:weight bold)) |
1215 |
fancy-splash-stop-time (+ (float-time) |
fancy-splash-stop-time (+ (float-time) |
1216 |
(max 60 fancy-splash-max-time)) |
(max 60 fancy-splash-max-time)) |
1304 |
(when window-setup-hook |
(when window-setup-hook |
1305 |
(run-hooks 'window-setup-hook) |
(run-hooks 'window-setup-hook) |
1306 |
(setq window-setup-hook nil)) |
(setq window-setup-hook nil)) |
1307 |
|
|
1308 |
(when (display-popup-menus-p) |
(when (display-popup-menus-p) |
1309 |
(precompute-menubar-bindings)) |
(precompute-menubar-bindings)) |
1310 |
(setq menubar-bindings-done t) |
(setq menubar-bindings-done t) |
1311 |
|
|
1312 |
;; Do this now to avoid an annoying delay if the user |
;; Do this now to avoid an annoying delay if the user |
1313 |
;; clicks the menu bar during the sit-for. |
;; clicks the menu bar during the sit-for. |
1314 |
(when (= (buffer-size) 0) |
(when (= (buffer-size) 0) |
1325 |
(if (eq system-type 'gnu/linux) |
(if (eq system-type 'gnu/linux) |
1326 |
(insert ", one component of a Linux-based GNU system.")) |
(insert ", one component of a Linux-based GNU system.")) |
1327 |
(insert "\n") |
(insert "\n") |
1328 |
|
|
1329 |
(if (assq 'display (frame-parameters)) |
(if (assq 'display (frame-parameters)) |
1330 |
|
|
1331 |
(if (use-fancy-splash-screens-p) |
(if (use-fancy-splash-screens-p) |
1332 |
(progn |
(progn |
1333 |
(setq wait-for-input nil) |
(setq wait-for-input nil) |
1351 |
(insert "\n\n" (emacs-version) |
(insert "\n\n" (emacs-version) |
1352 |
" |
" |
1353 |
Copyright (C) 2001 Free Software Foundation, Inc."))) |
Copyright (C) 2001 Free Software Foundation, Inc."))) |
1354 |
|
|
1355 |
;; If keys have their default meanings, |
;; If keys have their default meanings, |
1356 |
;; use precomputed string to save lots of time. |
;; use precomputed string to save lots of time. |
1357 |
(if (and (eq (key-binding "\C-h") 'help-command) |
(if (and (eq (key-binding "\C-h") 'help-command) |
1417 |
(if (and (eq (key-binding "\C-h\C-c") 'describe-copying) |
(if (and (eq (key-binding "\C-h\C-c") 'describe-copying) |
1418 |
(eq (key-binding "\C-h\C-d") 'describe-distribution) |
(eq (key-binding "\C-h\C-d") 'describe-distribution) |
1419 |
(eq (key-binding "\C-h\C-w") 'describe-no-warranty)) |
(eq (key-binding "\C-h\C-w") 'describe-no-warranty)) |
1420 |
(insert |
(insert |
1421 |
"\n |
"\n |
1422 |
GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details. |
GNU Emacs comes with ABSOLUTELY NO WARRANTY; type C-h C-w for full details. |
1423 |
Emacs is Free Software--Free as in Freedom--so you can redistribute copies |
Emacs is Free Software--Free as in Freedom--so you can redistribute copies |
1434 |
(set-buffer-modified-p nil) |
(set-buffer-modified-p nil) |
1435 |
(when wait-for-input |
(when wait-for-input |
1436 |
(sit-for 120))) |
(sit-for 120))) |
1437 |
|
|
1438 |
(with-current-buffer (get-buffer "*scratch*") |
(with-current-buffer (get-buffer "*scratch*") |
1439 |
(erase-buffer) |
(erase-buffer) |
1440 |
(when initial-scratch-message |
(when initial-scratch-message |
1441 |
(insert initial-scratch-message)) |
(insert initial-scratch-message)) |
1442 |
(set-buffer-modified-p nil))))))) |
(set-buffer-modified-p nil))))))) |
1443 |
|
|
1444 |
;; Delay 2 seconds after the init file error message |
;; Delay 2 seconds after the init file error message |
1445 |
;; was displayed, so user can read it. |
;; was displayed, so user can read it. |
1446 |
(if init-file-had-error |
(if init-file-had-error |
1508 |
(cons argval command-line-args-left))) |
(cons argval command-line-args-left))) |
1509 |
(funcall (cdr tem) argi)) |
(funcall (cdr tem) argi)) |
1510 |
(funcall (cdr tem) argi))) |
(funcall (cdr tem) argi))) |
1511 |
|
|
1512 |
((or (string-equal argi "-f") ;what the manual claims |
((or (string-equal argi "-f") ;what the manual claims |
1513 |
(string-equal argi "-funcall") |
(string-equal argi "-funcall") |
1514 |
(string-equal argi "-e")) ; what the source used to say |
(string-equal argi "-e")) ; what the source used to say |
1519 |
(if (arrayp (symbol-function tem)) |
(if (arrayp (symbol-function tem)) |
1520 |
(command-execute tem) |
(command-execute tem) |
1521 |
(funcall tem))) |
(funcall tem))) |
1522 |
|
|
1523 |
((or (string-equal argi "-eval") |
((or (string-equal argi "-eval") |
1524 |
(string-equal argi "-execute")) |
(string-equal argi "-execute")) |
1525 |
(if argval |
(if argval |
1528 |
(setq command-line-args-left (cdr command-line-args-left))) |
(setq command-line-args-left (cdr command-line-args-left))) |
1529 |
(eval (read tem))) |
(eval (read tem))) |
1530 |
;; Set the default directory as specified in -L. |
;; Set the default directory as specified in -L. |
1531 |
|
|
1532 |
((or (string-equal argi "-L") |
((or (string-equal argi "-L") |
1533 |
(string-equal argi "-directory")) |
(string-equal argi "-directory")) |
1534 |
(if argval |
(if argval |
1540 |
(cons (expand-file-name tem) extra-load-path)) |
(cons (expand-file-name tem) extra-load-path)) |
1541 |
(setq load-path (append (nreverse extra-load-path) |
(setq load-path (append (nreverse extra-load-path) |
1542 |
initial-load-path))) |
initial-load-path))) |
1543 |
|
|
1544 |
((or (string-equal argi "-l") |
((or (string-equal argi "-l") |
1545 |
(string-equal argi "-load")) |
(string-equal argi "-load")) |
1546 |
(if argval |
(if argval |
1553 |
(if (file-exists-p (expand-file-name file)) |
(if (file-exists-p (expand-file-name file)) |
1554 |
(setq file (expand-file-name file))) |
(setq file (expand-file-name file))) |
1555 |
(load file nil t))) |
(load file nil t))) |
1556 |
|
|
1557 |
((string-equal argi "-insert") |
((string-equal argi "-insert") |
1558 |
(if argval |
(if argval |
1559 |
(setq tem argval) |
(setq tem argval) |
1562 |
(or (stringp tem) |
(or (stringp tem) |
1563 |
(error "File name omitted from `-insert' option")) |
(error "File name omitted from `-insert' option")) |
1564 |
(insert-file-contents (command-line-normalize-file-name tem))) |
(insert-file-contents (command-line-normalize-file-name tem))) |
1565 |
|
|
1566 |
((string-equal argi "-kill") |
((string-equal argi "-kill") |
1567 |
(kill-emacs t)) |
(kill-emacs t)) |
1568 |
|
|
1569 |
((string-match "^\\+[0-9]+\\'" argi) |
((string-match "^\\+[0-9]+\\'" argi) |
1570 |
(setq line (string-to-int argi))) |
(setq line (string-to-int argi))) |
1571 |
|
|
1572 |
((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi) |
((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi) |
1573 |
(setq line (string-to-int (match-string 1 argi)) |
(setq line (string-to-int (match-string 1 argi)) |
1574 |
column (string-to-int (match-string 2 argi)))) |
column (string-to-int (match-string 2 argi)))) |
1577 |
;; Ignore X-windows options and their args if not using X. |
;; Ignore X-windows options and their args if not using X. |
1578 |
(setq command-line-args-left |
(setq command-line-args-left |
1579 |
(nthcdr (nth 1 tem) command-line-args-left))) |
(nthcdr (nth 1 tem) command-line-args-left))) |
1580 |
|
|
1581 |
((or (string-equal argi "-find-file") |
((or (string-equal argi "-find-file") |
1582 |
(string-equal argi "-file") |
(string-equal argi "-file") |
1583 |
(string-equal argi "-visit")) |
(string-equal argi "-visit")) |
1600 |
(unless (< column 1) |
(unless (< column 1) |
1601 |
(move-to-column (1- column))) |
(move-to-column (1- column))) |
1602 |
(setq column 0)) |
(setq column 0)) |
1603 |
|
|
1604 |
((equal argi "--") |
((equal argi "--") |
1605 |
(setq just-files t)) |
(setq just-files t)) |
1606 |
(t |
(t |