diff options
| author | Stefan Monnier | 2010-12-13 22:37:44 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-13 22:37:44 -0500 |
| commit | defb141157dfa37c33cdcbfa4b29c702a8fc9edf (patch) | |
| tree | e0d40af60254aa9f680ce46f26c77bc47655b07f /src/lread.c | |
| parent | 7a600d54c026061eee6db4e499802f524e7ebe00 (diff) | |
| download | emacs-defb141157dfa37c33cdcbfa4b29c702a8fc9edf.tar.gz emacs-defb141157dfa37c33cdcbfa4b29c702a8fc9edf.zip | |
Try and be more careful about propagation of lexical environment.
* src/eval.c (apply_lambda, funcall_lambda): Remove lexenv arg.
(Feval): Always eval in the empty environment.
(eval_sub): New function. Use it for all calls to Feval that should
evaluate in the lexical environment of the caller.
Pass `closure's as is to apply_lambda.
(Ffuncall): Pass `closure's as is to funcall_lambda.
(funcall_lambda): Extract lexenv for `closure's, when applicable.
Also use lexical scoping for the &rest argument, if applicable.
* src/lisp.h (eval_sub): Declare.
* src/lread.c (readevalloop): Remove `evalfun' argument.
* src/print.c (Fwith_output_to_temp_buffer):
* src/data.c (Fsetq_default): Use eval_sub.
* lisp/emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lread.c b/src/lread.c index d85d146b157..550b5f076f9 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -220,8 +220,7 @@ static Lisp_Object Vbytecomp_version_regexp; | |||
| 220 | static int read_emacs_mule_char (int, int (*) (int, Lisp_Object), | 220 | static int read_emacs_mule_char (int, int (*) (int, Lisp_Object), |
| 221 | Lisp_Object); | 221 | Lisp_Object); |
| 222 | 222 | ||
| 223 | static void readevalloop (Lisp_Object, FILE*, Lisp_Object, | 223 | static void readevalloop (Lisp_Object, FILE*, Lisp_Object, int, |
| 224 | Lisp_Object (*) (Lisp_Object), int, | ||
| 225 | Lisp_Object, Lisp_Object, | 224 | Lisp_Object, Lisp_Object, |
| 226 | Lisp_Object, Lisp_Object); | 225 | Lisp_Object, Lisp_Object); |
| 227 | static Lisp_Object load_unwind (Lisp_Object); | 226 | static Lisp_Object load_unwind (Lisp_Object); |
| @@ -1355,13 +1354,13 @@ Return t if the file exists and loads successfully. */) | |||
| 1355 | 1354 | ||
| 1356 | if (! version || version >= 22) | 1355 | if (! version || version >= 22) |
| 1357 | readevalloop (Qget_file_char, stream, hist_file_name, | 1356 | readevalloop (Qget_file_char, stream, hist_file_name, |
| 1358 | Feval, 0, Qnil, Qnil, Qnil, Qnil); | 1357 | 0, Qnil, Qnil, Qnil, Qnil); |
| 1359 | else | 1358 | else |
| 1360 | { | 1359 | { |
| 1361 | /* We can't handle a file which was compiled with | 1360 | /* We can't handle a file which was compiled with |
| 1362 | byte-compile-dynamic by older version of Emacs. */ | 1361 | byte-compile-dynamic by older version of Emacs. */ |
| 1363 | specbind (Qload_force_doc_strings, Qt); | 1362 | specbind (Qload_force_doc_strings, Qt); |
| 1364 | readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name, Feval, | 1363 | readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name, |
| 1365 | 0, Qnil, Qnil, Qnil, Qnil); | 1364 | 0, Qnil, Qnil, Qnil, Qnil); |
| 1366 | } | 1365 | } |
| 1367 | unbind_to (count, Qnil); | 1366 | unbind_to (count, Qnil); |
| @@ -1726,7 +1725,6 @@ static void | |||
| 1726 | readevalloop (Lisp_Object readcharfun, | 1725 | readevalloop (Lisp_Object readcharfun, |
| 1727 | FILE *stream, | 1726 | FILE *stream, |
| 1728 | Lisp_Object sourcename, | 1727 | Lisp_Object sourcename, |
| 1729 | Lisp_Object (*evalfun) (Lisp_Object), | ||
| 1730 | int printflag, | 1728 | int printflag, |
| 1731 | Lisp_Object unibyte, Lisp_Object readfun, | 1729 | Lisp_Object unibyte, Lisp_Object readfun, |
| 1732 | Lisp_Object start, Lisp_Object end) | 1730 | Lisp_Object start, Lisp_Object end) |
| @@ -1872,7 +1870,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1872 | unbind_to (count1, Qnil); | 1870 | unbind_to (count1, Qnil); |
| 1873 | 1871 | ||
| 1874 | /* Now eval what we just read. */ | 1872 | /* Now eval what we just read. */ |
| 1875 | val = (*evalfun) (val); | 1873 | val = eval_sub (val); |
| 1876 | 1874 | ||
| 1877 | if (printflag) | 1875 | if (printflag) |
| 1878 | { | 1876 | { |
| @@ -1935,7 +1933,7 @@ This function preserves the position of point. */) | |||
| 1935 | BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); | 1933 | BUF_TEMP_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); |
| 1936 | if (lisp_file_lexically_bound_p (buf)) | 1934 | if (lisp_file_lexically_bound_p (buf)) |
| 1937 | Fset (Qlexical_binding, Qt); | 1935 | Fset (Qlexical_binding, Qt); |
| 1938 | readevalloop (buf, 0, filename, Feval, | 1936 | readevalloop (buf, 0, filename, |
| 1939 | !NILP (printflag), unibyte, Qnil, Qnil, Qnil); | 1937 | !NILP (printflag), unibyte, Qnil, Qnil, Qnil); |
| 1940 | unbind_to (count, Qnil); | 1938 | unbind_to (count, Qnil); |
| 1941 | 1939 | ||
| @@ -1969,7 +1967,7 @@ This function does not move point. */) | |||
| 1969 | specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); | 1967 | specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); |
| 1970 | 1968 | ||
| 1971 | /* readevalloop calls functions which check the type of start and end. */ | 1969 | /* readevalloop calls functions which check the type of start and end. */ |
| 1972 | readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, | 1970 | readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, |
| 1973 | !NILP (printflag), Qnil, read_function, | 1971 | !NILP (printflag), Qnil, read_function, |
| 1974 | start, end); | 1972 | start, end); |
| 1975 | 1973 | ||