I'm currently using tuareg-mode but I would like to be able to use the functionality of caml-mode as well. In particular I want to be able to use type annotations interactively, and apparently this occurs with caml-types. I tried putting http://cristal.inria.fr/~remy/poly/emacs/index.html in my .emacs.d, but I'm confused about how or if these two modes can work together. In fact, I can't get caml-mode to work at all.
I have this line in my init.el:
(add-to-list 'load-path "~/.emacs.d/modes/caml")
But the files are not loaded - at least, none of the function definitions or keybindings are. I really thought I was starting to grasp how these emacs plugins work, but I'm starting to wonder. Maybe someone can explain what else needs to happen?
Edit: I didn't realize I had to require 'caml
for this to work. Still, annotations don't seem to be working although I have caml-types from http://caml.inria.fr/svn/ocaml/branches/gadts/emacs/. I compile with -annot
but I'm still told there's no annotations file.
You can have type annotation with the tuareg mode. If I have this exact ~/.emacs file:
(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)
then pressing F10
shows the type of the expression under the point.
As you know, you need to compile your file foo.ml
with
ocamlc -annot foo.ml
so that there is a file foo.annot
in the same directory as foo.ml
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With