* Displaying errors during startup
@ 2006-04-26 15:13 Lennart Borgman
2006-04-26 18:41 ` Kevin Rodgers
2006-04-27 21:27 ` Richard Stallman
0 siblings, 2 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-04-26 15:13 UTC (permalink / raw)
After the recent discussion about error messages at startup (this time
it was about pure-space-overflow) it came to my mind I often tend to
miss errors at startup. You can not see them because of the splash
screen for example. I just started testing `lwarn' because of this. I
did something like this:
(condition-case err
(require 'something-bad)
(error
(lwarn '(.emacs) :error "%s" (error-message-string err))))
This displays the error in a nice way even during startup. Looking a bit
closer at it it seems to be some trouble with using `pop-to-buffer' in
startup.el when loading .emacs. I therefore suggest using
`display-buffer' instead like lwarn does. It would also be nice to have
a more visible face when putting this in the message buffer. I therefore
suggest using something like the code below in startup.el (around line 905):
(if init-file-debug
(load inner)
(condition-case error
(load inner)
(error
(let ((message-log-max nil))
(save-excursion
(set-buffer (get-buffer-create "*Messages*"))
(let ((s
(concat
"\n\n"
(format "An error has occurred while loading `%s':\n\n"
user-init-file)
(format "%s%s%s"
(get (car error) 'error-message)
(if (cdr error) ": " "")
(mapconcat (lambda (s) (prin1-to-string s t))
(cdr error) ", "))
"\n\n"
"To ensure normal operation, you should investigate
and remove the\n"
"cause of the error in your initialization file.
Start Emacs with\n"
"the `--debug-init' option to view a complete error
backtrace.\n\n")))
(put-text-property
0 (length s)
'face 'font-lock-warning-face
s)
(insert s)
(insert "\n") ;; Needed to get normal face again.
(message "Error in init file: %s%s%s"
(get (car error) 'error-message)
(if (cdr error) ": " "")
(mapconcat 'prin1-to-string (cdr error) ", "))
;;(let ((pop-up-windows nil))
;; (pop-to-buffer "*Messages*"))
(display-buffer "*Messages*") ;; display-buffer does the job.
(sit-for 10) ;; sit-for is necessary to display the info at
once.
(setq init-file-had-error t)))))))
Maybe this would be good to do before the release because it makes it
somewhat easier to trap errors.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Displaying errors during startup
2006-04-26 15:13 Displaying errors during startup Lennart Borgman
@ 2006-04-26 18:41 ` Kevin Rodgers
2006-04-27 21:27 ` Richard Stallman
1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2006-04-26 18:41 UTC (permalink / raw)
Lennart Borgman wrote:
> After the recent discussion about error messages at startup (this time
> it was about pure-space-overflow) it came to my mind I often tend to
> miss errors at startup. You can not see them because of the splash
> screen for example. I just started testing `lwarn' because of this. I
> did something like this:
>
> (condition-case err
> (require 'something-bad)
> (error
> (lwarn '(.emacs) :error "%s" (error-message-string err))))
I wasn't aware of lwarn, so I checked it's doc string and found a
really minor error: the first period in the description of the
TYPE argument should either be deleted or replaced by a comma:
,----[ C-h f lwarn RET ]
| lwarn is an autoloaded Lisp function in `warnings'.
| (lwarn TYPE LEVEL MESSAGE &rest ARGS)
|
| Display a warning message made from (format MESSAGE ARGS...).
| Aside from generating the message with `format',
| this is equivalent to `display-warning'.
|
| TYPE is the warning type: either a custom group name (a symbol).
| or a list of symbols whose first element is a custom group name.
| (The rest of the symbols represent subcategories and
| can be whatever you like.)
|
| LEVEL should be either :debug, :warning, :error, or :emergency
| (but see `warning-minimum-level' and `warning-minimum-log-level').
|
| :emergency -- a problem that will seriously impair Emacs operation soon
| if you do not attend to it promptly.
| :error -- invalid data or circumstances.
| :warning -- suspicious data or circumstances.
| :debug -- info for debugging only.
|
| [back]
`----
--
Kevin Rodgers
Sr. Software Engineer, IHS
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Displaying errors during startup
2006-04-26 15:13 Displaying errors during startup Lennart Borgman
2006-04-26 18:41 ` Kevin Rodgers
@ 2006-04-27 21:27 ` Richard Stallman
2006-04-27 21:34 ` Lennart Borgman
1 sibling, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2006-04-27 21:27 UTC (permalink / raw)
Cc: emacs-devel
Your idea seems like a good one, but
;;(let ((pop-up-windows nil))
;; (pop-to-buffer "*Messages*"))
(display-buffer "*Messages*") ;; display-buffer does the job.
(sit-for 10) ;; sit-for is necessary to display the info at
once.
if the idea is to display both buffers, why is the sit-for needed?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Displaying errors during startup
2006-04-27 21:27 ` Richard Stallman
@ 2006-04-27 21:34 ` Lennart Borgman
0 siblings, 0 replies; 4+ messages in thread
From: Lennart Borgman @ 2006-04-27 21:34 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman wrote:
> Your idea seems like a good one, but
>
> ;;(let ((pop-up-windows nil))
> ;; (pop-to-buffer "*Messages*"))
> (display-buffer "*Messages*") ;; display-buffer does the job.
> (sit-for 10) ;; sit-for is necessary to display the info at
> once.
>
> if the idea is to display both buffers, why is the sit-for needed?
>
Only a (sit-for 0) is necessary to update the screen I believe.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-04-27 21:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-26 15:13 Displaying errors during startup Lennart Borgman
2006-04-26 18:41 ` Kevin Rodgers
2006-04-27 21:27 ` Richard Stallman
2006-04-27 21:34 ` Lennart Borgman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).