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.
This commit is contained in:
parent
7a600d54c0
commit
defb141157
11 changed files with 110 additions and 89 deletions
|
@ -2979,6 +2979,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
|
|||
|
||||
;; Given BYTECOMP-BODY, compile it and return a new body.
|
||||
(defun byte-compile-top-level-body (bytecomp-body &optional for-effect)
|
||||
;; FIXME: lexbind. Check all callers!
|
||||
(setq bytecomp-body
|
||||
(byte-compile-top-level (cons 'progn bytecomp-body) for-effect t))
|
||||
(cond ((eq (car-safe bytecomp-body) 'progn)
|
||||
|
@ -4083,8 +4084,8 @@ if LFORMINFO is nil (meaning all bindings are dynamic)."
|
|||
|
||||
(defun byte-compile-track-mouse (form)
|
||||
(byte-compile-form
|
||||
`(funcall '(lambda nil
|
||||
(track-mouse ,@(byte-compile-top-level-body (cdr form)))))))
|
||||
`(funcall #'(lambda nil
|
||||
(track-mouse ,@(byte-compile-top-level-body (cdr form)))))))
|
||||
|
||||
(defun byte-compile-condition-case (form)
|
||||
(let* ((var (nth 1 form))
|
||||
|
@ -4121,11 +4122,10 @@ if LFORMINFO is nil (meaning all bindings are dynamic)."
|
|||
;; "`%s' is not a known condition name (in condition-case)"
|
||||
;; condition))
|
||||
)
|
||||
(setq compiled-clauses
|
||||
(cons (cons condition
|
||||
(byte-compile-top-level-body
|
||||
(cdr clause) for-effect))
|
||||
compiled-clauses)))
|
||||
(push (cons condition
|
||||
(byte-compile-top-level-body
|
||||
(cdr clause) for-effect))
|
||||
compiled-clauses))
|
||||
(setq clauses (cdr clauses)))
|
||||
(byte-compile-push-constant (nreverse compiled-clauses)))
|
||||
(byte-compile-out 'byte-condition-case 0)))
|
||||
|
@ -4244,7 +4244,7 @@ if LFORMINFO is nil (meaning all bindings are dynamic)."
|
|||
`(if (not (default-boundp ',var)) (setq-default ,var ,value))))
|
||||
(when (eq fun 'defconst)
|
||||
;; This will signal an appropriate error at runtime.
|
||||
`(eval ',form)))
|
||||
`(eval ',form))) ;FIXME: lexbind
|
||||
`',var))))
|
||||
|
||||
(defun byte-compile-autoload (form)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue