Integrate utop with emacs using tuareg (OCaml) on Mac OS
我正在尝试学习 OCaml,并安装环境。我正在使用:https://github.com/realworldocaml/book/wiki/Installation-Instructions
我确实在最后一步 [Editors, Emacs] 并且无法让 tuareg 工作。我下载了 .tar 文件,然后复制
评论更新:你的 Emacs 是 22.1 版,对于
来说太旧了
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.
以下是我推荐使用 MELPA 的原始答案,并且仍然适用。
您链接的该站点建议了手动安装
的替代方法
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
1
2
3 (require 'package)
(add-to-list 'package-archives
'("melpa" ."http://melpa.milkbox.net/packages/") t)Now do
M-x package-install and installtuareg ,utop andmerlin .Then add the rest of the configuration to
.emacs.d/init.el
1
2
3
4
5
6
7
8
9
10 (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)
在我看来,这是一个更好的解决方案。像这样的包是 Emacs 的未来,它们通常更容易安装和使用。