diff options
| author | Gerd Moellmann | 2000-08-21 09:56:32 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-21 09:56:32 +0000 |
| commit | 42bb6910db8d7cdd02fd6c3de09a6c94fdd8565f (patch) | |
| tree | 3324b47b5fbd283a1d9ac3796e530d83fb4cb834 | |
| parent | 86293583814270b17549bb203a3d0d6925b3ccfc (diff) | |
| download | emacs-42bb6910db8d7cdd02fd6c3de09a6c94fdd8565f.tar.gz emacs-42bb6910db8d7cdd02fd6c3de09a6c94fdd8565f.zip | |
(command-line): If user's init file had an error,
add explanatory text to *Messages*.
| -rw-r--r-- | lisp/startup.el | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 50fbe937657..cf6208becd1 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -731,12 +731,28 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 731 | (progn | 731 | (progn |
| 732 | (funcall inner) | 732 | (funcall inner) |
| 733 | (setq init-file-had-error nil)) | 733 | (setq init-file-had-error nil)) |
| 734 | (error (message "Error in init file: %s%s%s" | 734 | (error |
| 735 | (get (car error) 'error-message) | 735 | (let ((message-log-max nil)) |
| 736 | (if (cdr error) ": " "") | 736 | (save-excursion |
| 737 | (mapconcat 'prin1-to-string (cdr error) ", ")) | 737 | (set-buffer (get-buffer-create "*Messages*")) |
| 738 | (pop-to-buffer "*Messages*") | 738 | (insert "\n\n" |
| 739 | (setq init-file-had-error t)))) | 739 | (format "An error has occurred while loading `%s':\n\n" |
| 740 | user-init-file) | ||
| 741 | (format "%s%s%s" | ||
| 742 | (get (car error) 'error-message) | ||
| 743 | (if (cdr error) ": " "") | ||
| 744 | (mapconcat 'prin1-to-string (cdr error) ", ")) | ||
| 745 | "\n\n" | ||
| 746 | "To ensure normal operation, you should investigate the cause\n" | ||
| 747 | "of the error in your initialization file and remove it. Start\n" | ||
| 748 | "Emacs with the `--debug-init' option to view a complete error\n" | ||
| 749 | "backtrace\n")) | ||
| 750 | (message "Error in init file: %s%s%s" | ||
| 751 | (get (car error) 'error-message) | ||
| 752 | (if (cdr error) ": " "") | ||
| 753 | (mapconcat 'prin1-to-string (cdr error) ", ")) | ||
| 754 | (pop-to-buffer "*Messages*") | ||
| 755 | (setq init-file-had-error t))))) | ||
| 740 | ;; If we can tell that the init file altered debug-on-error, | 756 | ;; If we can tell that the init file altered debug-on-error, |
| 741 | ;; arrange to preserve the value that it set up. | 757 | ;; arrange to preserve the value that it set up. |
| 742 | (or (eq debug-on-error debug-on-error-initial) | 758 | (or (eq debug-on-error debug-on-error-initial) |