ocaml prog にアノテーションを付けることができると聞きました。それらのタイプによって。フォーラムの古いスレッドでは、 http: //cristal.inria.fr/~remy/poly/emacs/index.html の ocaml モードを使用することが提案されました。
私はトゥアレグ モードを使用してきました。このモードでは、「cc ct」を使用して型を取得することが提案されています。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)
すべてが適切に構成されているように見えますが、「cc ct」が未定義になりました。
ここに.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-mode のファイル (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
私は次のことをしました
--階乗関数を書きます。「annot.ml」と呼ばれるocamlで
let rec f n =
if n = 1 then 0 else n * f(n-1)
--ocamlc -annot annot.ml
-- emacs で annot.ml を開き、カーソルが "n" の下にある間に "cc ct" を押します。
emacsのミニバッファに入りました
c-c c-t undefined
結論として、私はまだタイプを取得できません。どうして???アイデアありがとうございます。
詳細: Mx 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