skeeto / emacs-aio

async/await for Emacs Lisp
The Unlicense
218 stars 12 forks source link

"progn: Symbol’s value as variable is void: cps-state-terminal-1176" after M-x eval-buffer #18

Closed stevenfontanella closed 4 years ago

stevenfontanella commented 4 years ago

Minimal example:

(require 'aio)

(setq lexical-binding t)

(aio-defun test ()
  1)

(aio-wait-for (test))

Strangely this program works when I eval everything one-by-one using C-x C-e. I'm wondering if there's something wrong with using eval-buffer with this library. Thanks for the help.

Emacs version:

GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-12-02
skeeto commented 4 years ago

The problem is that setq lexical-binding isn't a reliable way to enable lexical scope. You must use the file-local-variable form in the header.