我目前使用的是tuareg-mode,但我也希望能够使用caml-mode的功能。特别是,我希望能够交互地使用类型注释,显然这发生在caml-types中。我试着在我的.emacs.d中加入http://cristal.inria.fr/~remy/poly/emacs/index.html,但我对这两种模式如何或者是否可以协同工作感到困惑。事实上,我根本不能让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类型,但注释似乎不起作用。我用-annot编译,但仍然被告知没有注释文件。
发布于 2012-07-09 15:19:23
您可以使用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.ml相同的目录中有一个文件foo.annot。
https://stackoverflow.com/questions/11388104
复制相似问题