unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* test whether init file loaded without error
@ 2008-03-21 16:49 Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2008-03-21 16:49 UTC (permalink / raw)
  To: Emacs-Devel

Is there an easy way for Lisp code to test whether a user's
init file was loaded without error? I imagine that it could
try to use `after-init-hook' in some way (not sure how,
though), but is there some straightforward way to test this?

For example: A user's init file might use code that sets up
`kill-emacs-hook' to save some custom variable. But it might
be inappropriate to do that if the init file was not loaded
successfully. The init file might, for example, define
`custom-file' at the end, and if an error were raised during
load, before the `custom-file' definition, then exiting
Emacs would cause `kill-emacs-hook' to write the
customization (incorrectly) to the init file instead of the
`custom-file'.







^ permalink raw reply	[flat|nested] 3+ messages in thread

* test whether init file loaded without error
@ 2008-04-11 19:43 Drew Adams
  2008-04-12  8:48 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2008-04-11 19:43 UTC (permalink / raw)
  To: emacs-devel

Resending -

----
From: Drew Adams Sent: Friday, March 21, 2008 9:49 AM
Is there an easy way for Lisp code to test whether a user's
init file was loaded without error? I imagine that it could
try to use `after-init-hook' in some way (not sure how,
though), but is there some straightforward way to test this?

For example: A user's init file might use code that sets up
`kill-emacs-hook' to save some custom variable. But it might
be inappropriate to do that if the init file was not loaded
successfully. The init file might, for example, define
`custom-file' at the end, and if an error were raised during
load, before the `custom-file' definition, then exiting
Emacs would cause `kill-emacs-hook' to write the
customization (incorrectly) to the init file instead of the
`custom-file'.













^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: test whether init file loaded without error
  2008-04-11 19:43 Drew Adams
@ 2008-04-12  8:48 ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2008-04-12  8:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Fri, 11 Apr 2008 12:43:12 -0700
> 
> Is there an easy way for Lisp code to test whether a user's
> init file was loaded without error?

From reading the code in startup.el, it looks like init-file-had-error
is set to a non-nil value when the user init file causes an error
during evaluation.  For a good measure, also check user-init-file for
a value that is a string (meaning that Emacs actually found a file to
serve as an init file).

If you already tried that and it didn't work, please post the details.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-12  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-21 16:49 test whether init file loaded without error Drew Adams
  -- strict thread matches above, loose matches on Subject: below --
2008-04-11 19:43 Drew Adams
2008-04-12  8:48 ` Eli Zaretskii

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).