[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (load "file" 'noerror) could be more robust
From: |
Richard Stallman |
Subject: |
Re: (load "file" 'noerror) could be more robust |
Date: |
Sun, 15 Dec 2002 18:39:55 -0500 |
It seems to me that it would be useful for the NOERROR flag (or an
analogous flag) to the builtin function `load' to cause `load' to
refrain from signalling an error when a nonexistent environment
variable is part of the filename.
Does this do the job?
*** lread.c.~1.303.~ Sat Dec 7 07:25:43 2002
--- lread.c Sun Dec 15 14:36:51 2002
***************
*** 637,642 ****
--- 637,650 ----
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,698 ****
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);
/* Avoid weird lossage with null string as arg,
since it would try to load a directory as a Lisp file */
--- 700,715 ----
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. */
! 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,739 ****
if (fd == -1)
{
if (NILP (noerror))
! while (1)
! Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"),
! Fcons (file, Qnil)));
else
return Qnil;
}
--- 748,755 ----
if (fd == -1)
{
if (NILP (noerror))
! Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"),
! Fcons (file, Qnil)));
else
return Qnil;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: (load "file" 'noerror) could be more robust,
Richard Stallman <=