diff options
author | Richard M. Stallman <rms@gnu.org> | 2002-12-21 18:06:27 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2002-12-21 18:06:27 +0000 |
commit | 164c8bfebc21a91856e52a78e5425507d9a957b3 (patch) | |
tree | 51754a4b3c09458cbdc5a6ef1dec21649af6f88e /src | |
parent | 2659a09fb81fbf77dc75766d621aff0ba1c463e4 (diff) | |
download | emacs-164c8bfebc21a91856e52a78e5425507d9a957b3.tar.gz |
(load_error_handler): New function.
(Fload): Handle errors in Fsubstitute_in_file_name.
Don't expect Fsignal to return.
Diffstat (limited to 'src')
-rw-r--r-- | src/lread.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index 7235fdca212..5d5e6e67500 100644 --- a/src/lread.c +++ b/src/lread.c @@ -637,6 +637,14 @@ record_load_unwind (old) return Vloads_in_progress = old; } +/* This handler function is used via internal_condition_case_1. */ + +static Lisp_Object +load_error_handler (data) + Lisp_Object data; +{ + return Qnil; +} DEFUN ("load", Fload, Sload, 1, 5, 0, doc: /* Execute a file of Lisp code named FILE. @@ -692,7 +700,16 @@ Return t if file exists. */) everywhere, it accidentally stayed here. Since then, enough people supposedly have things like (load "$PROJECT/foo.el") in their .emacs that it seemed risky to remove. */ - file = Fsubstitute_in_file_name (file); + if (! NILP (noerror)) + { + file = internal_condition_case_1 (Fsubstitute_in_file_name, file, + Qt, load_error_handler); + if (NILP (file)) + return Qnil; + } + else + file = Fsubstitute_in_file_name (file); + /* Avoid weird lossage with null string as arg, since it would try to load a directory as a Lisp file */ @@ -731,9 +748,8 @@ Return t if file exists. */) if (fd == -1) { if (NILP (noerror)) - while (1) - Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), - Fcons (file, Qnil))); + Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"), + Fcons (file, Qnil))); else return Qnil; } |