3

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.

jacob
  • 2,284
  • 3
  • 20
  • 21

1 Answers1

4

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.

Stefan
  • 27,908
  • 4
  • 53
  • 82