* Re: (load "file" 'noerror) could be more robust
[not found] <200212140720.gBE7KOi3019851@beth.swift.xxx>
@ 2002-12-15 23:39 ` Richard Stallman
0 siblings, 0 replies; only message in thread
From: Richard Stallman @ 2002-12-15 23:39 UTC (permalink / raw)
Cc: emacs-devel
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-12-15 23:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200212140720.gBE7KOi3019851@beth.swift.xxx>
2002-12-15 23:39 ` (load "file" 'noerror) could be more robust Richard Stallman
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).