Evaluate all code chunks below current header in emacs org mode

与世无争的帅哥 提交于 2019-12-11 10:43:31

问题


I use org mode for reproducible research and literate programming, mainly using R for computations. I'm new to emacs.

If I'm starting a new R session or my session is interrupted, I will have to rerun a number of code chunks. This is very easy with the speed commands (typing "e" to evaluate the chunk, then "n" to move to the next). I love this feature, the only problem is that my headers and subtrees are then expanded and I have to close them again to keep the page tidy.

Is there an existing feature or lisp expression to evaluate all code chunks below a header? And is it possible to do this without expanding the content below?

many thanks

For example, if the cursor were at the start of header 1, could you evaluate the code chunks under header 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:


It sounds like you want org-babel-execute-buffer or org-babel-execute-subtree (C-c C-v s).



来源:https://stackoverflow.com/questions/35122379/evaluate-all-code-chunks-below-current-header-in-emacs-org-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!