Debugging revealed: a colon is missing in
#+name elispNumBlock
It must be:
#+name: elispNumBlock
The following advice delivers error messages of sbe
to the message buffer:
(defadvice sbe (around get-err-msg activate)
"Issue messages at errors."
(condition-case err
(progn
ad-do-it)
((error debug)
(message "Error in sbe: %S" err)
(signal (car err) (cdr err)))))
Without it error messages are just translated into the table cell content #ERROR
. Not so informative.
As I already commented: The N
output format does not really work as expected. The resulting strings are substituted into the command call. So you need additional quoting for strings.
For me, the following is working:
| | in: | in: | out: | out: | out: |
| ! | number | string | elispStr | elispNum | pythonStr |
|---+--------+---------+----------+----------+-----------|
| # | 5 | "fd" | fd | 5 | fd |
| # | 7 | "fadsf" | fadsf | 7 | fadsf |
#+TBLFM: $4='(sbe elispStrBlock (foo $string))::$5='(sbe elispNumBlock (a $number))::$6='(sbe pythonStrBlock (foo $string))
#+name: elispNumBlock
#+header: :var a=4
#+begin_src emacs-lisp :results value
(message (number-to-string a))
#+end_src
#+RESULTS:
: 4
#+name: elispStrBlock
#+header: :var foo="testing"
#+begin_src emacs-lisp :results value
(message foo)
#+end_src
#+name: pythonStrBlock
#+header: :var foo="testing"
#+begin_src python :results output
print foo
#+end_src
EDIT: About the cell references "$2". The following works for me:
| ! | arg | res |
|---+-----+-----|
| # | 1 | 2 |
| # | 2 | 3 |
#+TBLFM: $3='(sbe myColFm (el $2))
#+name: myColFm
#+header: :var el=1
#+begin_src emacs-lisp
(1+ el)
#+end_src
EDIT: With the additional advice
(defadvice sbe (before escape-args activate)
"Apply prin1 to argument values."
(mapc '(lambda (var) (setcdr var (list (prin1-to-string (cadr var))))) variables))
the command sbe
works as one would expect:
| ! | arg | res | |
|---+-----+-----+---|
| # | 1 | 3 | 5 |
| # | 2 | 4 | 6 |
#+TBLFM: $3='(sbe myStr (el $2))::$4='(sbe myColFm (el $2));N
#+name: myStr
#+header: :var el="1"
#+begin_src emacs-lisp
(+ 2 (string-to-number el))
#+end_src
#+name: myColFm
#+header: :var el=1
#+begin_src emacs-lisp
(+ 4 el)
#+end_src