Reputation: 2424
In elisp I have the following
(setq lexical-binding t)
(fset 'boom (cl-flet*
((tickle ()
(message "hi"))
(pickle ()
(tickle)))
(lambda ()
(pickle))))
(boom)
When I run the boom function I get the error
Symbol's value as variable is void: --cl-pickle--
What's going on here?
My intent is I would like to wrap private/helper functions and variables in a closure so I can better organize my code than everything being global.
Upvotes: 3
Views: 324
Reputation: 28541
Don't (setq lexical-binding t)
. You don't want to execute a command that sets this variable. Instead you want to describe to Emacs that the code you write uses lexical binding, and for that you need to add:
-*- lexical-binding:t -*-
somewhere on the first line of the file.
Upvotes: 4