2011-06-25 17 views
3

我聽說我們可以註釋ocaml編。由他們的類型。在論壇上一位年長的線程使用的 http://cristal.inria.fr/~remy/poly/emacs/index.html天真的問題,如何鍵入註釋我的ocaml編。在emacs

我一直在使用圖阿雷格模式,其中使用的「C-C C-T」檢索類型的建議ocaml的模式建議,比照。這段代碼在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 

我做了以下

--write一個因子函數。 OCaml中,被稱爲 「annot.ml」

let rec f n = 
if n = 1 then 0 else n * f(n-1) 

--ocamlc -annot annot.ml

通過emacs的,然後按 「CC CT」 而光標下的 「n」

--open annot.ml

我在Emacs

c-c c-t undefined 

結論,我仍然無法檢索類型的迷你緩衝區了。爲什麼???謝謝你的想法。

更多信息:當我嘗試M-X caml- [標籤]我得到了下面的列表,其中不包含CAML類型秀類型

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 
+0

? ['M-x caml-types-show-type'] – Orbling

+0

這確實有用! – zell

回答

1

你從ocaml.elocaml.elc自動加載caml-mode。但是沒有這樣的文件!官方Caml模式位於名爲caml.el的文件中,圖阿雷格模式位於名爲tuareg.el的文件中。這就解釋了爲什麼打開你的.ml文件不會讓你進入Ocaml模式,也不會加載Caml支持。改變你的自動加載要麼這個使用官方模式

(autoload 'caml-mode "caml" 
    "Major mode for editing Caml code." t) 

或本可以運行勢必`C-C直接C-t`命令使用圖阿雷格模式

(autoload 'caml-mode "tuareg" 
    "Major mode for editing Caml code." t) 
+0

ocaml.el存在 – zell

+0

但是它幾乎不會加載你所問的'tuareg.el'的東西。 – tripleee