I am experimenting with writing elisp in a more scheme-y style where helper functions are definded inside another function's lexical envirnonment like this (with lexical binding turned on):
(defun my-func (param)
"Outer function."
(defun helper ()
"Inner function."
(do-stuff param))
(helper))
I do this to not pollute the global environment with a lot of small helper functions.
But now I want to test the helper
function with ERT and cannot do it, because it is not in the global namespace.
Is it possible to turn off lexical binding for testing? If I evaluate the with eval-buffer
with lexical binding disabled, the helper
function still doesn't appear in the global environment.
Might there be another way?
EDIT:
I just noticed that when my-func
gets evaluated, it will put helper
in the global environment. Thus, these nested functions are unnecessary.