2

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
  -1)
*** Eval error ***  Assertion failed: lexical-binding

This example is from ergoemacs

4

TL;DR

M-: (setq lexical-binding t)

Details

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

Evaluate

(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").

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.