2

According to this, it seems to say setting lexical-binding only happens at the individual buffer level, i.e. I could not do (setq lexical-binding t) in my init file and have it apply to all subsequent buffers, right?

Drew
  • 75,699
  • 9
  • 109
  • 225
147pm
  • 2,907
  • 1
  • 18
  • 39

1 Answers1

2

Correct, it's set on a per-file/buffer basis.

I could not do (setq lexical-binding t) in my init file and have it apply to all subsequent buffers, right?

Indeed not, and nor would you want to do that. Libraries may behave differently with lexical binding enabled, and for the vast majority of the history of Emacs that wasn't an option, so no one was writing code with lexical binding in mind. Forcing it on libraries which aren't expecting it could break all manner of things.

Strictly speaking, setq-default might do this if there's no specific protection against it, but you'd never want to do that, and I have a feeling that Emacs requires it to be a file-local variable.

phils
  • 48,657
  • 3
  • 76
  • 115
  • Worse, it must be in the first line. And `eval-region` will fail to notice that, only `eval-buffer` will honor it. – wasamasa Nov 27 '15 at 08:24