0

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 Answers1

1

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.

Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • Ok, so I actually tried this earlier, but it doesn't work either. When I M-x, and type package-install, I get [no match] – polarbeargirl Dec 24 '14 at 03:53
  • @polarbeargirl, that would have been a good thing to mention in your question. What does "doesn't work" mean? Do you get an error message? What does `M-x version` give? – ChrisGPT was on strike Dec 24 '14 at 03:54
  • M-x version gives **GNU Emacs 22.1.1 (mac-apple-darwin) of 2014-08-17 on moonwalk.apple.com**. However, when I brew install emacs (using homebrew), it says I have emacs 24.2. (sorry for not mentioning this earlier) – polarbeargirl Dec 24 '14 at 03:55
  • @polarbeargirl, that's probably your problem. The package approach I suggested works best with Emacs 24, though it can (probably) be made to work with v23 if you put some effort into it. But v22 is too old for either approach. From the site: "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." Install the [latest version](http://emacsformacosx.com/) and you will probably find that your problems go away. – ChrisGPT was on strike Dec 24 '14 at 03:58
  • ^ Ok. I will aggressively tackle this until I get the new version of emacs installed. Thank you so much for your help, Chris. – polarbeargirl Dec 24 '14 at 04:01
  • UPDATE: you're absolutely right. Downloaded the new emacs [had to rm -f the old emacs from my bin folder], and now it works perfectly. Thank you, Chris. – polarbeargirl Dec 24 '14 at 04:11