【发布时间】:2014-06-19 01:54:02
【问题描述】:
纠结这个:
#+BEGIN_SRC C :tangle no :noweb-ref begin
int main() {
printf("Line 1\n");
#+END_SRC
#+BEGIN_SRC C :tangle no :noweb-ref middle
printf("Second\n");
#+END_SRC
#+BEGIN_SRC C :tangle no :noweb-ref end
}
#+END_SRC
#+BEGIN_SRC C :tangle ~/test.c :noweb no-export
<<begin>>
<<middle>>
<<end>>
#+END_SRC
产生这个:
int main() {
printf("Line 1\n");
printf("Second\n");
}
我打开了 org-src-preserve-indentation,但它无法保留不存在的内容。如果代码编辑窗口看不到前面源代码块的部分,则无法正确设置。最后,我不想每次开始一个新的源代码块时都必须通过所有以前的 sn-ps 来确定缩进应该开始。
当前的 hack 是 tangle 源代码,在新缓冲区中打开 tangle 文件,全选并运行 c-indent-line-or-region,但我希望有更好的东西比那个。
组织模式版本:8.2.5h
【问题讨论】:
-
我认为你可以调用
indent-region或类似的后缠钩。
标签: emacs formatting org-mode org-babel noweb