In org-mode
, I am trying to define a function, a variable, and then assigning to another variable the result of the function call on the first variable. However, then it seems that I cannot use this new variable in subsequent functions calls.
Inlining the function calls does work, but affecting the value to a variable first would allow for faster debug in case something goes wrong in the first function call, and to avoid duplicating potentially expensive computations.
MWE: (use (require 'ob-emacs-lisp)
if needed)
#+name: square
#+begin_src emacs-lisp :var x=3
(message (format "%s" (* x x)))
#+end_src
#+RESULTS: square
: 9
#+name: value
: 45
#+name: squaredvalue
#+call: square(x=value)
#+RESULTS: squaredvalue
: 2025
Now I try to reuse this value:
#+begin_src emacs-lisp :var res=squaredvalue
(message res)
#+end_src
#+RESULTS:
: nil
Inlined calls do work:
#+begin_src emacs-lisp :var res=square(value)
(message res)
#+end_src
#+RESULTS:
: 2025
Expanding the second code block shows:
(let ((res (quote "nil")))
(message res))
What am I missing?
(This has been tested on emacs 24.3.1, 24.4 and 24.5, using org 8.2.10)