0
votes

I'm trying to learn OCaml, and install the environment. I'm using: https://github.com/realworldocaml/book/wiki/Installation-Instructions

I'm literally on the last step [Editors, Emacs] and can't get tuareg working. I downloaded the .tar file, and copy & pasted everything into .emacs file in my home directory. When I run emacs and M-x to utop, it gives me

Symbol's function definition is void: split-string-and-unquote

However, it says tuareg-abbrev in my console, so it's not that tuareg is isn't installed

1

1 Answers

1
votes

Update from comments: Your Emacs is version 22.1, which is ancient and too old for tuareg:

These instructions have been tested on emacs 24.2 and should work for that version and newer. There are some reports of problems with earlier emacsen.

My original answer recommending the use of MELPA follows, and still applies.

This site that you linked suggests an alternative to manually installing tuareg:

Using Emacs24 packages

As an alternative to the setup above, here is a simplified OCaml setup using MELPA packages.

Add to .emacs.d/init.el

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

Now do M-x package-install and install tuareg, utop and merlin.

Then add the rest of the configuration to .emacs.d/init.el

(add-hook 'tuareg-mode-hook 'tuareg-imenu-set-imenu)
(setq auto-mode-alist
      (append '(("\\.ml[ily]?$" . tuareg-mode)
                ("\\.topml$" . tuareg-mode))
              auto-mode-alist)) 
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer)
(add-hook 'tuareg-mode-hook 'merlin-mode)
(setq merlin-use-auto-complete-mode t)
(setq merlin-error-after-save nil)

In my opinion this is a much better solution. Packages like this are the future of Emacs, and they are often easier to install and work with.