/* Lisp parsing and input streams.
Copyright (C) 1985, 1986, 1987, 1988, 1989,
- 1992 Free Software Foundation, Inc.
+ 1993 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <sys/stat.h>
#include <sys/file.h>
#include <ctype.h>
-#undef NULL
-#include "config.h"
+#include <config.h>
#include "lisp.h"
#ifndef standalone
#endif
#ifdef LISP_FLOAT_TYPE
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
#include <math.h>
#endif /* LISP_FLOAT_TYPE */
-Lisp_Object Qread_char, Qget_file_char, Qstandard_input;
+Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list;
Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist;
-Lisp_Object Qascii_character;
+Lisp_Object Qascii_character, Qload;
extern Lisp_Object Qevent_symbol_element_mask;
Lisp_Object found;
/* 1 means inhibit the message at the beginning. */
int nomessage1 = 0;
+ Lisp_Object handler;
CHECK_STRING (str, 0);
str = Fsubstitute_in_file_name (str);
+ /* If file name is magic, call the handler. */
+ handler = Ffind_file_name_handler (str);
+ if (!NILP (handler))
+ return call5 (handler, Qload, str, noerror, nomessage, nosuffix);
+
/* Avoid weird lossage with null string as arg,
since it would try to load a directory as a Lisp file */
if (XSTRING (str)->size > 0)
register Lisp_Object tem, tem2;
register int foundit, loading;
+ /* Don't bother recording anything for preloaded files. */
+ if (!NILP (Vpurify_flag))
+ return;
+
loading = stream || !NARROWED;
tail = Vload_history;
QUIT;
}
- /* If we're loading, cons the new assoc onto the front of load-history,
- the most-recently-loaded position. Also do this if we didn't find
- an existing member for the current source. */
- if (loading || !foundit)
- Vload_history = Fcons (Fnreverse(Vcurrent_load_list),
- Vload_history);
+ /* If we're loading, cons the new assoc onto the front of load-history,
+ the most-recently-loaded position. Also do this if we didn't find
+ an existing member for the current source. */
+ if (loading || !foundit)
+ Vload_history = Fcons (Fnreverse (Vcurrent_load_list),
+ Vload_history);
}
Lisp_Object
{
register int c;
register Lisp_Object val;
- Lisp_Object oldlist;
int count = specpdl_ptr - specpdl;
- struct gcpro gcpro1, gcpro2;
+ struct gcpro gcpro1;
specbind (Qstandard_input, readcharfun);
+ specbind (Qcurrent_load_list, Qnil);
- oldlist = Vcurrent_load_list;
- GCPRO2 (sourcename, oldlist);
+ GCPRO1 (sourcename);
- Vcurrent_load_list = Qnil;
LOADHIST_ATTACH (sourcename);
while (1)
}
build_load_history (stream, sourcename);
-
- Vcurrent_load_list = oldlist;
UNGCPRO;
unbind_to (count, Qnil);
dump_path = decode_env_path (0, PATH_DUMPLOADSEARCH);
if (! NILP (Fequal (dump_path, Vload_path)))
- Vload_path = decode_env_path (0, normal);
+ {
+ Vload_path = decode_env_path (0, normal);
+ if (!NILP (Vinvocation_directory))
+ {
+ /* Add to the path the ../lisp dir of the Emacs executable,
+ if that dir exists. */
+ Lisp_Object tem, tem1;
+ tem = Fexpand_file_name (build_string ("../lisp"),
+ Vinvocation_directory);
+ tem1 = Ffile_exists_p (tem);
+ if (!NILP (tem1) && NILP (Fmember (tem, Vload_path)))
+ Vload_path = nconc2 (Vload_path, Fcons (tem, Qnil));
+ }
+ }
}
else
Vload_path = decode_env_path (0, normal);
or variables, and cons cells `(provide . FEATURE)' and `(require . FEATURE)'.");
Vload_history = Qnil;
- staticpro (&Vcurrent_load_list);
+ DEFVAR_LISP ("current-load-list", &Vcurrent_load_list,
+ "Used for internal purposes by `load'.");
Vcurrent_load_list = Qnil;
+ Qcurrent_load_list = intern ("current-load-list");
+ staticpro (&Qcurrent_load_list);
+
Qstandard_input = intern ("standard-input");
staticpro (&Qstandard_input);
Qascii_character = intern ("ascii-character");
staticpro (&Qascii_character);
+
+ Qload = intern ("load");
+ staticpro (&Qload);
}