Here is an example to let me explain what I would like to achieve:

#+NAME: heavy_computation
#+BEGIN_SRC shell :results table
echo -e "A\t32\nB\t17"

#+BEGIN_SRC python :var data=heavy_computation
return sum([i[1] for i in data])

The second code block uses the results of the first one. When running the second code block the result is correctly displayed:

: 49

However I would also like to see the results of the first code block, without having to run it independently. Therefore, under the first code block, I would like to see:

#+RESULTS: heavy_computation
| A | 32 |
| B | 17 |

How can I achieve that? My question looks similar to this question but as far as I understood, the anwser seemed specific to Lisp.

  • The feature you may be looking for is the header :cache yes but I’m uncertain if that’s what you want. If you add :cache yes to the expensive block and execute it, the results will be cached and viewable. Other code blocks will use the cached value instead of executing the expensive block again. Is this what you want?
    – Melioratus
    Dec 12, 2020 at 23:59

1 Answer 1


You can use a function like the one at https://github.com/jkitchin/scimax/blob/master/scimax-ob.el#L94 to achieve this. That will unfortunately run every block above the current point.

Otherwise, you can put the cursor in the first block, run it, then put the cursor in the second block and run it.

I think there are speed commands for src blocks, so if I have my cursor at the beginning of the first block, on the #, I can press e to execute the block, then n to jump to the next block, and e to execute that one. This works for me, but I am having difficulty finding where that is configured at the moment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.