Subject: bug#20139: 25.0.50; eval-buffer ignores lexical-binding

From: Nicolas Richard <[email-masked]>
Date: Thu, 19 Mar 2015 10:56:37 +0100

Jorgen Schäfer <[email-masked]> writes:
> . I.e. the following snippet will message (lambda nil t) and
> then (closure (t) nil t):
>
> (with-temp-buffer
>   (setq lexical-binding t)
>   (insert "(message \"%S\" (lambda () t))")
>   (eval-buffer)
>   (eval-region (point-min) (point-max)))

And this will reverse the behaviour :
(with-temp-buffer
  (insert ";; -*- lexical-binding: t; -*-\n(message \"%S\" (lambda () t))")
  (eval-buffer)
  (eval-region (point-min) (point-max)))

IOW eval-buffer obeys the "file"-local variable by calling
    specbind (Qlexical_binding, lisp_file_lexically_bound_p (buf) ? Qt : Qnil);
while eval-region simply uses the current value of lexical-binding.

-- 
Nicolas