繁体   English   中英

图阿雷格模式和凸轮模式

[英]Tuareg-mode and caml-mode

我目前正在使用tuareg模式,但我希望能够使用caml-mode的功能。 特别是我希望能够以交互方式使用类型注释,并且显然这与caml类型一起发生。 我尝试将http://cristal.inria.fr/~remy/poly/emacs/index.html放在我的.emacs.d中,但我对这两种模式如何或如何协同工作感到困惑。 事实上,我根本无法使用caml-mode工作。

我在init.el中有这一行:

(add-to-list 'load-path "~/.emacs.d/modes/caml")

但是文件没有加载 - 至少没有函数定义或键绑定。 我真的以为我开始意识到这些emacs插件是如何工作的,但我开始怀疑。 也许有人可以解释还有什么需要发生?

编辑:我没有意识到我必须require 'caml才能工作。 尽管我有来自http://caml.inria.fr/svn/ocaml/branches/gadts/emacs/的 caml-types,但注释似乎并没有起作用。 我用-annot编译但是我仍然被告知没有注释文件。

您可以使用tuareg模式进行类型注释。 如果我有这个确切的〜/ .emacs文件:

(add-hook 'tuareg-mode-hook '(lambda ()
  (define-key tuareg-mode-map [f10] 'caml-types-show-type); requires caml-types
  ))
(add-to-list 'auto-mode-alist '("\\.ml\\w?" . tuareg-mode))
(autoload 'caml-types-show-type "caml-types" "Show the type of expression or pattern at point." t)

然后按F10显示该点下的表达式类型。 如您所知,您需要使用编译文件foo.ml

ocamlc -annot foo.ml

这样在foo.annot所在的目录中就有一个文件foo.ml

暂无
暂无

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

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