title: lexical-binding not being enabled when evaluating .emacs
body: <p>Here are some excerpts from my <code>.emacs</code>:</p>
  
  <pre><code>(setq lexical-binding t)
  ;; .emacs
  
  (custom-set-variables
   ;; custom-set-variables was added by Custom.
   ;; If you edit it by hand, you could mess it up, so be careful.
   ;; Your init file should contain only one such instance.
   ;; If there is more than one, they won't work right.
   '(diff-switches "-u")
   '(tab-always-indent (quote complete)))
  
  ;...    
  
  (require 'dired)
  
  ;...    
  
  (dotimes (i 12) (define-key dired-mode-map (kbd (concat "&lt;f" (number-to-string (1+ i)) "&gt;"))
            (lambda ()
              (interactive)
              (goto-char (point-min))
              (forward-line (+ 4 i)))))
  </code></pre>
  
  <p>This should bind keys <code>f1</code> to <code>f12</code> in <code>dired-mode</code> to commands that jump to particular files in the list of files (ignoring <code>.</code> and <code>..</code>). However, initially, after starting emacs, these keys don't work - I get an error message <code>forward-line: Symbol's value as variable is void: i</code>. However, when I go to the top line of my <code>.emacs</code> and press C-x C-e to evaluate that line, and then go to the last line quoted above and press C-x C-e to evaluate that <code>dotimes</code> expression, those function keys start working!</p>
  
  <p>Why is that?</p>
  
  <p>By the way, it also doesn't work if I evaluate the whole buffer.</p>