# HG changeset patch # User Richard M. Stallman # Date 1040493987 0 # Node ID f1010d7b4fd942856b59d554cb96dd528dce1763 # Parent ac6f6d4b84ece321f15bffb0eff27bef33346fa0 (load_error_handler): New function. (Fload): Handle errors in Fsubstitute_in_file_name. Don't expect Fsignal to return. diff -r ac6f6d4b84ec -r f1010d7b4fd9 src/lread.c --- a/src/lread.c Sat Dec 21 18:05:00 2002 +0000 +++ b/src/lread.c Sat Dec 21 18:06:27 2002 +0000 @@ -637,6 +637,14 @@ 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 @@ 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 @@ 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; }