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

From: Stefan Monnier <[email-masked]>
Date: Wed, 18 Mar 2015 23:10:30 -0400

> (setq lexical-binding t)
> (message "%s" (lambda () a))

This is wrong.  The `setq' above is an expression evaluated at run-time,
whereas what you want to say (that this code is written in the lexical
version of the Elisp language) is something that needs to be known before
evaluation proceeds.

You can do M-: (setq lexical-binding t) from that buffer in order to
tell Emacs that the code in the buffer uses the lexical
version of the Elisp language, or better, you should put a "-*-
lexical-binding:t -*-" at the top of the file.

        Stefan