help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I pass a variable defined in a wrapping let, to a lambda?


From: Steinar Bang
Subject: How do I pass a variable defined in a wrapping let, to a lambda?
Date: Fri, 11 Mar 2022 23:44:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (windows-nt)

I have been trying to write a restclient.el[1] result function that can be
used to save the body of a GET result to a file[2].

My first attempt didn't work[3].

I tried to look at an existing result function that actually worked[4],
and I finally figured it out: the final form of that function is a
lambda!

So it was probably that lambda that was run to create the result?

I rewrote my example code to this[5].

But it still didn't work.  And the reason it didn't work is that
filename didn't have a value set.

If I replace the filename variable with a text constant[6], then the
function works.

But as far as I can tell, the function in[4] uses variables defined in
the wrapping (let) in the lambda...?

So why is that working but my filename failing?

Thanks!


- Steinar

References:
[1] <https://github.com/pashky/restclient.el>
[2] <https://github.com/pashky/restclient.el/issues/275>
[3] <https://github.com/pashky/restclient.el/issues/275#issuecomment-1047537935>
[4] 
<https://github.com/pashky/restclient.el/blob/9e2cfa86529133eba6c9ef53794be182f15e4c21/restclient-jq.el#L49>
[5] <https://gist.github.com/steinarb/fe442b78fda5d70a2733785c8c50e976>
[6] <https://gist.github.com/steinarb/61ccca486827f84a08cbc3f414cfda27>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]