简体   繁体   English

如何在Emacs中设置主模式来编辑babel src块?

[英]How to set the major-mode for edit babel src block in Emacs?

I try to use Cc ' to call org-edit-src-exit to edit "dot" source code. 我尝试使用Cc'调用org-edit-src-exit来编辑“点”源代码。 How could I make graphviz-mode the default major mode on that source code editing buffer? 如何将graphviz-mode设置为该源代码编辑缓冲区上的默认主模式?

I have this in some old files, but I'm not currently using any of it so you'll have to research if it works or if you can fix it to apply here. 我在一些旧文件中有此功能,但是我目前未使用任何文件,因此您必须研究它是否有效或是否可以在此处应用它。

(add-to-list 'org-src-lang-modes '("dot" . graphviz-dot))
(org-babel-do-load-languages
 'org-babel-load-languages
 '((dot . t)
   (emacs-lisp . t)
   (latex . t)
   (sh . t)
   ))

Be sure to use Ch f = Mx describe-function and Ch v = Mx describe variable , if you're not already familiar with them. 如果您还不熟悉Ch f = Mx describe-functionCh v = Mx describe variable ,请务必使用它们。 (With cursor on (or to the right of?) expression Emacs will guess what term you mean.) It may help you discover the solution given clues. (将光标放在(或在右边)表达式上时,Emacs会猜测您的意思。)它可能会帮助您根据提示找到解决方案。

The mode for Graphviz is graphviz-dot-mode , and it can be installed from MELPA or Marmalade. Graphviz的模式为graphviz-dot-mode ,可以从MELPA或Marmalade安装。 After that you can specify the mode in the source block like usual: 之后,您可以像通常一样在源代码块中指定模式:

#+BEGIN_SRC graphviz-dot
...
#_END_SRC

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM