Can anyone give examples of using the sbe function in ob-table.el? I must be missing something because I haven’t been able to get it to work with straight-up elisp.
#+name: add1(x=1) :results silent
#+begin_src python
return x + 1
#+end_src
This works:
| 1 | 2 | 3 | 4 |
#+TBLFM: @1$4='(sbe add1 (x $3))
But this does not:
#+begin_src emacs-lisp
(sbe add1 (x 2))
#+end_src
error: Wrong type argument: sequencep, 2
Changing 2 to a list just aggravates it further:
#+begin_src emacs-lisp
(sbe add1 (x (list 2))
#+end_src
error: Wrong type argument: buffer-or-string-p, 2
If I’m understanding your question correctly you’re trying to use your named source block outside of tables to call for results.
First of all, your
:results silentbelongs on the#+begin_srcline and not the#+name(only relevant if you ever evaluate that block directly). I’m switching to emacs-lisp from python simply because I don’t have python on this machine so can’t evaluate the block otherwise, the function remains equivalent.In Org Tables the proper command is the one you used:
#+tblfm: @1$4='(sbe add1 (x $3))When using code blocks outside of tables you have to use
#+CALL:instead (see Evaluating Code Blocks).For example:
Edit (Adding in answer from comment):
If you simply want to clean up your formulas and be better able to read through them to make changes, the formula editor
C-c 'will let you see them more clearly as well as highlight cell references to ensure you’re selecting the right regions.