I have the following code:
#+BEGIN_SRC emacs-lisp :results value table
(append '(("a" "b" "c" "d")
hline
(1 2 3 4)
(5 6 7 8)))
#+END_SRC
When I run this source block, that gives me the expected result
#+RESULTS:
| a | b | c | d |
|---+---+---+---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
What I want is to add a #+NAME
: to the table so that I can reference it later, like this:
#+RESULTS:
#+NAME: my-table
| a | b | c | d |
|---+---+---+---|
| 1 | 2 | 3 | 4 |
| 5 | 6 | 7 | 8 |
I have seen the example in the org mode manual in Section 15.6 that uses postprocessing, but that example uses sh for the processor and for various reasons I want to stick to emacs-lisp. I have tried various things but I can't get the postprocessing to work. The main problem seems to be that the postprocessing block has to be :results output
, not :results value
, but it is passed the table as a Lisp object, which I would have to format again as a string to prepend the #+NAME:
string.
How can I get a #+NAME: added to my table using only emacs lisp?