我听说我们可以注释ocaml prog。根据它们的类型。论坛上的一个老帖子建议使用http://cristal.inria.fr/~remy/poly/emacs/index.html的ocaml模式
我一直在使用Tuareg模式,该模式建议使用"c-c c-t“来检索类型。tuareg.el中的这段代码
(when tuareg-with-caml-mode-p
;; Trigger caml-types
(define-key map [?\C-c ?\C-t] 'caml-types-show-type)
;; To prevent misbehavior in case of error during exploration.
(define-key map [(control mouse-2)] 'caml-types-mouse-ignore)
(define-key map [(control down-mouse-2)] 'caml-types-explore)我没有定义"c-c,c-t“,尽管一切似乎都配置得很好。
这是.emacs文件
(setq auto-mode-alist
(cons '("\\.ml[iyl]?$" . caml-mode) auto-mode-alist))
(autoload 'caml-mode "ocaml"
"Major mode for editing Caml code." t)
(autoload 'camldebug "camldebug"
"Call the camldebugger on FILE" t)
;; adjust paths for emacs source code
(add-to-list 'load-path "~/my-emacs-config/caml-mode")
;; adjust paths for emacs ocaml info sources
(require 'info)
(add-to-list 'Info-directory-list "~/my-emacs-config/caml-mode")以下是caml模式下的文件(其中包含ocaml.el)
bash-3.2$ ls ~/my-emacs-config/caml-mode/
caml-compat.el caml-emacs.el caml-font.el caml-help.el caml-hilit.el caml-types.el caml.el camldebug.el inf-caml.el ocaml.el我做了以下工作
--编写阶乘函数。在ocaml中,称为"annot.ml“
let rec f n =
if n = 1 then 0 else n * f(n-1)--ocamlc -annot annot.ml
--使用emacs打开annot.ml,并在光标位于"n“下方时按"c-c c-t”。
我进入了emacs的小缓冲区。
c-c c-t undefined结论,我仍然不能检索类型。为什么?谢谢你的点子。
更多信息:当我尝试M-x caml-tab时,我得到以下列表,其中不包含caml-types-show-types
Possible completions are:
caml-mode camldebug
camldebug-backtrace camldebug-break
camldebug-close camldebug-complete
camldebug-delete camldebug-display-frame
camldebug-down camldebug-finish
camldebug-goto camldebug-kill
camldebug-last camldebug-mode
camldebug-next camldebug-open
camldebug-print camldebug-refresh
camldebug-reverse camldebug-run
camldebug-step camldebug-up发布于 2011-06-26 21:09:10
您正在从ocaml.el或ocaml.elc自动加载caml-mode。但是没有这样的文件!官方Caml模式在一个名为caml.el的文件中,图阿雷格模式在一个名为tuareg.el的文件中。这解释了为什么打开.ml文件不会将您置于Ocaml模式,也不会加载Caml支持。将您的自动加载更改为使用官方模式
(autoload 'caml-mode "caml"
"Major mode for editing Caml code." t)或者使用Tuareg模式
(autoload 'caml-mode "tuareg"
"Major mode for editing Caml code." t)https://stackoverflow.com/questions/6480388
复制相似问题