did you know that emacs really, really doesn’t want anything but specifically a ...

@zzt@mas.to

did you know that emacs really, really doesn’t want anything but specifically a file-local variable in the first or second line of an emacs lisp file to toggle lexical binding on?

the load and eval-buffer C functions specifically call a hardcoded C parser that hackishly parses the first or second lines of the buffer for specifically the lexical-binding variable, with no way to advise or replace it

the byte and native compilers just use hack-file-local-variables (yes that is its name) which is the normal file local variable mechanism in lisp

there’s no reason for load or eval-buffer to do this. they each call multiple lisp functions after this.

so anyway now I’m dusting off load-with-code- conversion which is an old Lisp implementation of load built into emacs via mule, reimplementing eval-buffer with eval-region (which also uses the fucking normal file-local variable mechanism, there’s no reason for eval-buffer to be like this), and trying to figure out how to patch load-history