diff options
| -rw-r--r-- | lisp/startup.el | 133 |
1 files changed, 62 insertions, 71 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 69bc8fa7816..4105c1db2d6 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -123,15 +123,17 @@ the remaining command-line args are in the variable `command-line-args-left'.") | |||
| 123 | (defvar command-line-args-left nil | 123 | (defvar command-line-args-left nil |
| 124 | "List of command-line args not yet processed.") | 124 | "List of command-line args not yet processed.") |
| 125 | 125 | ||
| 126 | (defvaralias 'argv 'command-line-args-left | 126 | (with-no-warnings |
| 127 | "List of command-line args not yet processed. | 127 | (defvaralias 'argv 'command-line-args-left |
| 128 | This is a convenience alias, so that one can write \(pop argv) | 128 | "List of command-line args not yet processed. |
| 129 | This is a convenience alias, so that one can write (pop argv) | ||
| 129 | inside of --eval command line arguments in order to access | 130 | inside of --eval command line arguments in order to access |
| 130 | following arguments.") | 131 | following arguments.")) |
| 131 | (internal-make-var-non-special 'argv) | 132 | (internal-make-var-non-special 'argv) |
| 132 | 133 | ||
| 133 | (defvar argi nil | 134 | (with-no-warnings |
| 134 | "Current command-line argument.") | 135 | (defvar argi nil |
| 136 | "Current command-line argument.")) | ||
| 135 | (internal-make-var-non-special 'argi) | 137 | (internal-make-var-non-special 'argi) |
| 136 | 138 | ||
| 137 | (defvar command-line-functions nil ;; lrs 7/31/89 | 139 | (defvar command-line-functions nil ;; lrs 7/31/89 |
| @@ -894,75 +896,64 @@ init-file, or to a default value if loading is not possible." | |||
| 894 | (if (eq init-file-debug t) | 896 | (if (eq init-file-debug t) |
| 895 | 'startup | 897 | 'startup |
| 896 | init-file-debug))) | 898 | init-file-debug))) |
| 897 | (let ((debug-on-error debug-on-error-initial) | 899 | (let ((debug-on-error debug-on-error-initial)) |
| 898 | ;; We create an anonymous function here so that we can call | 900 | (condition-case-unless-debug error |
| 899 | ;; it in different contexts depending on the value of | 901 | (when init-file-user |
| 900 | ;; `debug-on-error'. | 902 | (let ((init-file-name (funcall filename-function))) |
| 901 | (read-init-file | 903 | |
| 902 | (lambda () | 904 | ;; If `user-init-file' is t, then `load' will store |
| 903 | (when init-file-user | 905 | ;; the name of the file that it loads into |
| 904 | (let ((init-file-name (funcall filename-function))) | 906 | ;; `user-init-file'. |
| 905 | 907 | (setq user-init-file t) | |
| 906 | ;; If `user-init-file' is t, then `load' will store | 908 | (load init-file-name 'noerror 'nomessage) |
| 907 | ;; the name of the file that it loads into | 909 | |
| 908 | ;; `user-init-file'. | 910 | (when (and (eq user-init-file t) alternate-filename-function) |
| 909 | (setq user-init-file t) | 911 | (load (funcall alternate-filename-function) |
| 910 | (load init-file-name 'noerror 'nomessage) | 912 | 'noerror 'nomessage)) |
| 911 | 913 | ||
| 912 | (when (and (eq user-init-file t) alternate-filename-function) | 914 | ;; If we did not find the user's init file, set |
| 913 | (load (funcall alternate-filename-function) | 915 | ;; user-init-file conclusively. Don't let it be |
| 914 | 'noerror 'nomessage)) | 916 | ;; set from default.el. |
| 915 | 917 | (when (eq user-init-file t) | |
| 916 | ;; If we did not find the user's init file, set | 918 | (setq user-init-file init-file-name))) |
| 917 | ;; user-init-file conclusively. Don't let it be | 919 | |
| 918 | ;; set from default.el. | 920 | ;; If we loaded a compiled file, set `user-init-file' to |
| 919 | (when (eq user-init-file t) | 921 | ;; the source version if that exists. |
| 920 | (setq user-init-file init-file-name))) | 922 | (when (equal (file-name-extension user-init-file) |
| 921 | 923 | "elc") | |
| 922 | ;; If we loaded a compiled file, set `user-init-file' to | 924 | (let* ((source (file-name-sans-extension user-init-file)) |
| 923 | ;; the source version if that exists. | 925 | (alt (concat source ".el"))) |
| 924 | (when (equal (file-name-extension user-init-file) | 926 | (setq source (cond ((file-exists-p alt) alt) |
| 925 | "elc") | 927 | ((file-exists-p source) source) |
| 926 | (let* ((source (file-name-sans-extension user-init-file)) | 928 | (t nil))) |
| 927 | (alt (concat source ".el"))) | 929 | (when source |
| 928 | (setq source (cond ((file-exists-p alt) alt) | 930 | (when (file-newer-than-file-p source user-init-file) |
| 929 | ((file-exists-p source) source) | 931 | (message "Warning: %s is newer than %s" |
| 930 | (t nil))) | 932 | source user-init-file) |
| 931 | (when source | 933 | (sit-for 1)) |
| 932 | (when (file-newer-than-file-p source user-init-file) | 934 | (setq user-init-file source)))) |
| 933 | (message "Warning: %s is newer than %s" | 935 | |
| 934 | source user-init-file) | 936 | (when load-defaults |
| 935 | (sit-for 1)) | 937 | |
| 936 | (setq user-init-file source)))) | 938 | ;; Prevent default.el from changing the value of |
| 937 | 939 | ;; `inhibit-startup-screen'. | |
| 938 | (when load-defaults | 940 | (let ((inhibit-startup-screen nil)) |
| 939 | 941 | (load "default" 'noerror 'nomessage)))) | |
| 940 | ;; Prevent default.el from changing the value of | 942 | (error |
| 941 | ;; `inhibit-startup-screen'. | 943 | (display-warning |
| 942 | (let ((inhibit-startup-screen nil)) | 944 | 'initialization |
| 943 | (load "default" 'noerror 'nomessage))))))) | 945 | (format-message "\ |
| 944 | ;; Now call our anonymous function. | ||
| 945 | (if init-file-debug | ||
| 946 | ;; Do this without a `condition-case' if the user wants to | ||
| 947 | ;; debug. | ||
| 948 | (funcall read-init-file) | ||
| 949 | (condition-case error | ||
| 950 | (funcall read-init-file) | ||
| 951 | (error | ||
| 952 | (display-warning | ||
| 953 | 'initialization | ||
| 954 | (format-message "\ | ||
| 955 | An error occurred while loading `%s':\n\n%s%s%s\n\n\ | 946 | An error occurred while loading `%s':\n\n%s%s%s\n\n\ |
| 956 | To ensure normal operation, you should investigate and remove the | 947 | To ensure normal operation, you should investigate and remove the |
| 957 | cause of the error in your initialization file. Start Emacs with | 948 | cause of the error in your initialization file. Start Emacs with |
| 958 | the `--debug-init' option to view a complete error backtrace." | 949 | the `--debug-init' option to view a complete error backtrace." |
| 959 | user-init-file | 950 | user-init-file |
| 960 | (get (car error) 'error-message) | 951 | (get (car error) 'error-message) |
| 961 | (if (cdr error) ": " "") | 952 | (if (cdr error) ": " "") |
| 962 | (mapconcat (lambda (s) (prin1-to-string s t)) | 953 | (mapconcat (lambda (s) (prin1-to-string s t)) |
| 963 | (cdr error) ", ")) | 954 | (cdr error) ", ")) |
| 964 | :warning) | 955 | :warning) |
| 965 | (setq init-file-had-error t)))) | 956 | (setq init-file-had-error t))) |
| 966 | 957 | ||
| 967 | ;; If we can tell that the init file altered debug-on-error, | 958 | ;; If we can tell that the init file altered debug-on-error, |
| 968 | ;; arrange to preserve the value that it set up. | 959 | ;; arrange to preserve the value that it set up. |