在emacs组织模式下评估当前标题下的所有代码块 [英] Evaluate all code chunks below current header in emacs org mode

查看:141
本文介绍了在emacs组织模式下评估当前标题下的所有代码块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用组织模式进行可重复的研究和识字编程,主要使用R进行计算。我是新来的emacs。



如果我开始一个新的R会话或者我的会话中断,我将不得不重新运行一些代码块。速度命令非常简单(输入e来评估块,然后n移动到下一个)。我喜欢这个功能,唯一的问题是我的标题和子树然后被扩展,我必须再次关闭它们来保持页面整洁。



是否有一个现有的功能或lisp表达式来评估标题下的所有代码块?是否可以这样做,而不扩大下面的内容?



许多谢谢



例如,如果光标位于标题1的开始位置,您可以用单个命令评估标题2和3下的代码块吗?

  *标题1 
**标题2

#+ BEGIN_SRC R
打印(你好)
#+ END_SRC

**标题3

#+ BEGIN_SRC R
print(world)
#+ END_SRC

$ b听起来像你想要的是org-babel-execute-buffer或org-babel-execute-subtree(Cc Cv s)。


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

解决方案

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

这篇关于在emacs组织模式下评估当前标题下的所有代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆