emacs already has lexical scope.
https://github.com/nicferrier/elnode/blob/master/elnode.el#L...
that's how you turn it on. you need a fairly recent version.
My bitbucket repo is here https://bitbucket.org/nic/emacs
but of course, the official bzr repo is good as well