OSX 10.13.4 / Emacs 25.3(9)/ OCaml toplevel,版本4.06.1。
OCAML和Emacs的新手,并尝试了解如何在点上进行自动完成。 我的init.el看起来像这样:
;;---------------------------------------
;; OCAML MODE CONFIGURATION
;; --------------------------------------
> (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-minor-mode) (add-hook 'tuareg-mode-hook 'merlin-mode) (setq
> merlin-use-auto-complete-mode t) (setq merlin-error-after-save nil)
由于某种原因,点上的完成说: apply:搜索程序:没有这样的文件或目录,/ Users / xxxx / .opam / system / bin / ocamlmerlin
我对这个OPAM有点失落......
opam switch system
给了我:
# To setup the new switch in the current shell, you need to run:
eval `opam config env`
和opam list
给了我:
# Installed packages for system:
base-bigarray base Bigarray library distributed with the OCaml compiler
base-bytes base Bytes library distributed with the OCaml compiler
base-threads base Threads library distributed with the OCaml compiler
base-unix base Unix library distributed with the OCaml compiler
conf-m4 1 Virtual package relying on m4
conf-which 1 Virtual package relying on which
jbuilder 1.0+beta20 Fast, portable and opinionated build system
ocamlfind 1.8.0 A library manager for OCaml
Thanks to @Lhooq: install merlin
有效!
# Installed packages for system:
base-bigarray base Bigarray library distributed with the OCaml compiler
base-bytes base Bytes library distributed with the OCaml compiler
base-threads base Threads library distributed with the OCaml compiler
base-unix base Unix library distributed with the OCaml compiler
biniou 1.2.0 Binary data format designed for speed, safety, ease o
conf-m4 1 Virtual package relying on m4
conf-which 1 Virtual package relying on which
cppo 1.6.4 Equivalent of the C preprocessor for OCaml programs
easy-format 1.3.1 High-level and functional interface to the Format mod
jbuilder 1.0+beta20 Fast, portable and opinionated build system
merlin 3.0.5 Editor helper, provides completion, typing and source
ocamlfind 1.8.0 A library manager for OCaml
yojson 1.4.1 Yojson is an optimized parsing and printing library f