Questions tagged [lexical-binding]

26 questions
3
votes
1 answer

Can I determine the difference of declaring (and not declaring) a file to use lexical-binding?

I have been trying to understand what difference it makes if you set the file variable lexical-binding to t for a particular source file. As mentioned in emacswiki that in order to use lexical-bindings in your source files, you specifically have to…
myTerminal
  • 427
  • 1
  • 5
  • 15
1
vote
1 answer

lexical-binding: How to create a let-bound function that recursively calls itself

The custom function below my-jump-to works after being evaluated in a scratch buffer, but does not work when I stick it into a library with lexical-binding non-nil in the header. When byte-compiling, I get a warning: reference to free variable…
lawlist
  • 19,106
  • 5
  • 38
  • 120
1
vote
1 answer

Using new features in emacs 27 generators

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) ***…
anquegi
  • 749
  • 5
  • 22
0
votes
0 answers

Why symbol-value throws a void-variable error with a let form if lexical binding is on?

Here's a simple example from the manual: ;; Here the symbol ‘abracadabra’ ;; is the symbol whose value is examined. (let ((abracadabra 'foo)) (symbol-value 'abracadabra)) ⇒ foo Why does this throw an error with lexical binding? The variable is…
Tom
  • 1,260
  • 8
  • 16