0

我正在尝试学习 OCaml,并安装环境。我正在使用:https ://github.com/realworldocaml/book/wiki/Installation-Instructions

我真的处于最后一步 [Editors, Emacs] 并且无法让 tuareg 工作。我下载了 .tar 文件,并将所有内容复制并粘贴到我的主目录中的 .emacs 文件中。当我运行 emacs 和 Mx 到 utop 时,它给了我

Symbol 的函数定义为 void:split-string-and-unquote

但是,它在我的控制台中显示 tuareg-abbrev,所以并不是没有安装 tuareg

4

1 回答 1

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.

于 2014-12-24T03:47:09.757 回答