Rate all the pieces of code below the current header in emacs org mode

I use org mode for reproducible research and literate programming, mostly using R for computing. I am new to emacs.

If I start a new R session or my session is interrupted, I will have to re-run some code snippets. This is very easy with speed commands (entering "e" to evaluate a piece, then "n" to go to the next). I like this feature, the only problem is that my headers and subtrees then expand and I have to close them again so that the page is neat.

Is there an existing function or lisp expression for evaluating all code fragments under the heading? And can this be done without expanding the content below?

many thanks

For example, if the cursor was at the beginning of heading 1, could you evaluate the code fragments under headings 2 and 3 with a single command?

* header 1
** header 2

#+BEGIN_SRC R
print("hello")
#+END_SRC

** header 3

#+BEGIN_SRC R
print("world")
#+END_SRC
+1
source share
1 answer

It looks like you want org-babel-execute-buffer or org-babel-execute-subtree (Cc Cv s).

+1
source

Source: https://habr.com/ru/post/1662436/


All Articles