[英]Opam in Cygwin with Windows emacs
我在Cygwin中成功安裝了https://github.com/fdopen/opam-repository-mingw,merlin和tuareg。 現在,我已經安裝了Windows emacs並更改了.emacs以啟用用於編輯Ocaml文件的模式。
這是應該如何設置的嗎? Windows emacs可以與Cygwin OCaml工具一起使用嗎?
如果不是,那么我要求提供詳細信息以在Cygwin中設置emacs。
更新:現在我的init.el是這個
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(setenv "PATH" (concat "c:/OCaml64/bin;" (getenv "PATH")))
(setq exec-path (cons "c:/OCaml64/bin/" exec-path))
(require 'cygwin-mount)
(cygwin-mount-activate)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages (quote (company))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; OCaml code
(add-hook
'tuareg-mode-hook
(lambda ()
;; Add opam emacs directory to the load-path
(setq opam-share
(substring
(shell-command-to-string "opam config var share 2> /dev/null")
0 -1))
(add-to-list 'load-path (concat opam-share "/emacs/site-lisp"))
;; Load merlin-mode
(require 'merlin)
;; Start merlin on ocaml files
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)
;; Enable auto-complete
(setq merlin-use-auto-complete-mode 'easy)
;; Use opam switch to lookup ocamlmerlin binary
(setq merlin-command 'opam)
(company-mode)
(require 'ocp-indent)
(autoload 'utop-minor-mode "utop" "Minor mode for utop" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(autoload 'merlin-mode "merlin" "Merlin mode" t)
(utop-minor-mode)
(company-quickhelp-mode)
;; Important to note that setq-local is a macro and it needs to be
;; separate calls, not like setq
(setq-local merlin-completion-with-doc t)
(setq-local indent-tabs-mode nil)
(setq-local show-trailing-whitespace t)
(setq-local indent-line-function 'ocp-indent-line)
(setq-local indent-region-function 'ocp-indent-region)
(merlin-mode)))
(add-hook 'utop-mode-hook (lambda ()
(set-process-query-on-exit-flag
(Get-process "utop") nil)))
cygwin-mount.el在site-lisp文件夾中。
打開.ml文件或鍵入Mx merlin模式時,我看不到任何更改
您確定Tuareg
已實際加載嗎? 如果轉到*scratch*
,請鍵入(locate-library "tuareg")
並執行它(當光標位於(locate-library "tuareg")
括號后,鍵入C-xC-e
),在回顯區域中您會看到什么?
在您安裝Tuareg的目錄中,應該有一個文件tuareg-site-file.el
。 如果是這樣,請在~/.emacs
放入以下行: (load "/path/to/tuareg-site-file")
以啟用Tuareg。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.