Can you use noweb? In the example below, if you run the top code block
babel will run the two that follow.

A drawback is that you have to redefine variables, but it might be a
benefit, since the individual blocks could be set with test data and
the "main driver" could point to real data.
-------

#+begin_src elisp :results output :noweb yes :var data=data1
  <<fun1>>
  <<fun2>>
#+end_src

#+RESULTS:
: called fun1: some data
: called fun2

#+name: data1
some data

#+name: fun1
#+begin_src elisp :var data=data1
(princ (format "called fun1: %s" data))
#+end_src

#+name: fun2
#+begin_src elisp
(princ "called fun2")
#+end_src

On Sat, Feb 20, 2021 at 2:11 PM Nathan Neff <nathan.n...@gmail.com> wrote:
>
> Hello all,
>
> I have some code like this:
>
> * Heading 1
>
> # code block name:FOO
>
> ** Subheading 1
>
> # code block
>
> ** Subheading 2
>
> # code block
>
> I find that I often want to evaluate the code in Heading 1 and its 
> subheadings.
>
> Currently, I navigate to Heading 1 and then use org-babel-execute-subtree
>
> I see that there's a function called org-babel-goto-named-src-block, so I 
> think
> I could write a small function to jump to FOO in Heading 1 and then run 
> execute subtree
> and then jump back to my previous location in Emacs.
>
> Is there a more programmatic or built-in way?  For example:
> org-babel-execute-block-and-subheadings FOO
>
> Thanks,
> --Nate

Reply via email to