static void readevalloop (Lisp_Object, FILE *, Lisp_Object, bool,
Lisp_Object, Lisp_Object,
- Lisp_Object, Lisp_Object);
+ Lisp_Object, Lisp_Object, bool);
\f
/* Functions that read one byte from the current source READCHARFUN
or unreads one byte. If the integer argument C is -1, it returns
return Fnreverse (lst);
}
-DEFUN ("load", Fload, Sload, 1, 5, 0,
+DEFUN ("load", Fload, Sload, 1, 6, 0,
doc: /* Execute a file of Lisp code named FILE.
First try FILE with `.elc' appended, then try with `.el',
then try FILE unmodified (the exact suffixes in the exact order are
Return t if the file exists and loads successfully. */)
(Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage,
- Lisp_Object nosuffix, Lisp_Object must_suffix)
+ Lisp_Object nosuffix, Lisp_Object must_suffix, Lisp_Object recursive)
{
FILE *stream = NULL;
int fd;
emacs_close (fd);
fd = -1;
}
- val = call4 (Vload_source_file_function, found, hist_file_name,
+ val = call5 (Vload_source_file_function, found, hist_file_name,
NILP (noerror) ? Qnil : Qt,
- (NILP (nomessage) || force_load_messages) ? Qnil : Qt);
+ (NILP (nomessage) || force_load_messages) ? Qnil : Qt,
+ !NILP (recursive) ? Qnil : Qt);
dynwind_end ();
return val;
}
if (! version || version >= 22)
readevalloop (Qget_file_char, stream, hist_file_name,
- 0, Qnil, Qnil, Qnil, Qnil);
+ 0, Qnil, Qnil, Qnil, Qnil, NILP (recursive));
else
{
/* We can't handle a file which was compiled with
byte-compile-dynamic by older version of Emacs. */
specbind (Qload_force_doc_strings, Qt);
readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name,
- 0, Qnil, Qnil, Qnil, Qnil);
+ 0, Qnil, Qnil, Qnil, Qnil, NILP (recursive));
}
dynwind_end ();
Lisp_Object sourcename,
bool printflag,
Lisp_Object unibyte, Lisp_Object readfun,
- Lisp_Object start, Lisp_Object end)
+ Lisp_Object start, Lisp_Object end,
+ bool batch)
{
register int c;
register Lisp_Object val;
bool first_sexp = 1;
Lisp_Object form = Fcons (Qprogn, Qnil);
Lisp_Object tail = form;
- Lisp_Object compile_fn = 0;
+ static Lisp_Object compile_fn;
+
+ if (!NILP (Vload_compat))
+ batch = false;
if (SCM_UNLIKELY (! compile_fn))
compile_fn = scm_c_public_ref ("language elisp runtime", "compile-elisp");
/* Restore saved point and BEGV. */
dynwind_end ();
- tail = Fsetcdr (tail, Fcons (val, Qnil));
+ if (!batch)
+ {
+ val = eval_sub (val);
+ if (printflag)
+ {
+ Vvalues = Fcons (val, Vvalues);
+ Fprin1 (val, Qnil);
+ }
+ }
+ else
+ tail = Fsetcdr (tail, Fcons (val, Qnil));
first_sexp = 0;
}
- val = eval_sub (form);
-
- if (SCM_UNLIKELY (printflag))
+ if (batch)
{
- Vvalues = Fcons (val, Vvalues);
- Fprin1 (val, Qnil);
+ val = scm_call_1 (compile_fn, form);
+
+ if (SCM_UNLIKELY (printflag))
+ {
+ Vvalues = Fcons (val, Vvalues);
+ Fprin1 (val, Qnil);
+ }
}
build_load_history (sourcename,
dynwind_end ();
}
-DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 5, "",
+DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 6, "",
doc: /* Execute the current buffer as Lisp code.
When called from a Lisp program (i.e., not interactively), this
function accepts up to five optional arguments:
functions should work normally even if PRINTFLAG is nil.
This function preserves the position of point. */)
- (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print)
+ (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename,
+ Lisp_Object unibyte, Lisp_Object do_allow_print, Lisp_Object batch)
{
dynwind_begin ();
Lisp_Object tem, buf;
BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qnil);
readevalloop (buf, 0, filename,
- !NILP (printflag), unibyte, Qnil, Qnil, Qnil);
+ !NILP (printflag), unibyte, Qnil, Qnil, Qnil, !NILP (batch));
dynwind_end ();
return Qnil;
/* `readevalloop' calls functions which check the type of start and end. */
readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
!NILP (printflag), Qnil, read_function,
- start, end);
+ start, end, 0);
dynwind_end ();
return Qnil;
them. */);
load_dangerous_libraries = 0;
+ DEFVAR_LISP ("load-compat", Vload_compat, 0);
+ Vload_compat = Qnil;
+
DEFVAR_BOOL ("force-load-messages", force_load_messages,
doc: /* Non-nil means force printing messages when loading Lisp files.
This overrides the value of the NOMESSAGE argument to `load'. */);