Skip to content

Files

Latest commit

 

History

History
92 lines (77 loc) · 3.26 KB

ome-ocaml.org

File metadata and controls

92 lines (77 loc) · 3.26 KB

Oh My Emacs CC

This is part of oh-my-emacs.

Prerequisites

PackageWindowsUbuntu/Debian/MintArchLinuxFedoraMac OS XMandatory?
ocamlocamlYes

El-get packages

PackageStatusDescription
caml-modeRequiredOCaml code editing commands for Emacs
tuareg-modeRequiredA GOOD Emacs mode to edit Objective Caml code.

Things you should know about OCaml

I’m a newbie in OCaml, so I can’t provide too much help about how to do OCaml programming effectively in Emacs. Real World Ocaml provide really detailed instructions about how to install necessary tools to develop with OCaml. There’re also some good resources about OCaml:

OCaml-mode

Unlike python, there are not too many choices for OCaml in Emacs.

;; Keep an empty hook function for later customization.
(defun ome-caml-mode-setup ())

(when (executable-find "ocaml")
  (ome-install 'caml-mode))

Tuareg-mode

You may wonder what’s the relations between caml-mode and tuareg-mode? In fact, you can use tuareg-mode without caml-mode, but some basic functions depends on caml-mode, so we install both. See typerex’s FAQ for details.

(defun ome-tuareg-mode-setup ()
  ;; The following settings comes from tuareg-mode's README
  ;; use new SMIE engine
  (setq tuareg-use-smie t)
  ;; Indent `=' like a standard keyword.
  (setq tuareg-lazy-= t)
  ;; Indent [({ like standard keywords.
  (setq tuareg-lazy-paren t)
  ;; No indentation after `in' keywords.
  (setq tuareg-in-indent 0)
  ;; set ocaml library path
  (setq tuareg-library-path "/usr/lib/ocaml")
  (add-hook 'tuareg-mode-hook
            (lambda ()
              (define-key tuareg-mode-map (kbd "RET")
                'newline-and-indent))))

(when (executable-find "ocaml")
  (ome-install 'tuareg-mode))

Todos

  • Integrate merlin for auto-complete support.
  • Define a C-c C-z keybinding which switch to OCaml’s REPL buffer, just like SLIME/Geiser.
  • More investigation on Typerex.
  • Find a portable way to integrate utop to Emacs.