I want to try new features in emacs 26, I'm using emacs 27, generators and threads, but when I try to use on ielm buffer, I get the same error:

ELISP> (iter-defun my-iter (x)
  (iter-yield (1+ (iter-yield (1+ x))))
   ;; Return normally
*** Eval error ***  Assertion failed: lexical-binding

This example is from ergoemacs



M-: (setq lexical-binding t)


A precondition for iterators in Emacs to work is that the variable binding is set to lexical binding for the respective file or buffer.


(setq lexical-binding t)

to turn on lexical binding.

The assertion can be interpreted to make sure that lexical binding is set when using iterators.

Find more about lexical binding in the elisp in the info pages. See section (info "(elisp) Variable Scoping").

| improve this answer | |

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.