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?

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.

  • 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 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.