首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Merlin on Emacs (GUI)没有得到沙丘提供的merlin配置

Merlin on Emacs (GUI)没有得到沙丘提供的merlin配置
EN

Stack Overflow用户
提问于 2022-02-20 11:04:19
回答 1查看 165关注 0票数 2

首先,请知道我是一个在奥卡姆沙丘和项目管理的初学者。尽管如此,我已经安装了沙丘,并创建了一个新的沙丘项目,该项目处理凸轮库、图形等。项目编译和执行在我通常做的工作中工作得很好:

  • opam exec沙丘建造
  • opam exec沙丘主管./myexecutable.exe

然而,无法在emacs中使用Tuareg模式,因为后者似乎没有很好地找到/理解沙丘项目配置文件,该文件代表沙丘v2.8之前的".merlin“(根据doc:https://dune.readthedocs.io/en/latest/usage.html?highlight=merlin)。当我尝试将当前的启动到Tuareg中时,这个就意味着大量的“未绑定模块”错误

我尝试手动添加包

  • Merlin >选择软件包

但是Merlin似乎并不关心这一点,即使它出现在merlin配置文件中。

某些假设

每次我想从沙丘访问外部“Opam安装的”库/包时,我都需要从Opam启动沙丘,以访问它们,而不是在shell中启动一个简单的“沙丘”命令。我觉得"Opam环境“是无法从”外壳环境“访问的。这在我的问题中起了作用吗?

您可以在下面找到一些相关信息,这些信息可能有助于理解我的问题:

  • 不手动添加包的情况下检查configuration

加载的自定义文件: /home/erwan/Bureau/Nextcloud/GIT/Projet_integrateur_L3OPTIM/dev/importimg/dune-project自定义缓冲区设置:-packages: none -flags:“-extensions: none Custom安装程序:((env”PATH=/home/erwan/..opam/ .merlin /bin“)”(命令)。“/home/erwan/..opam/default/bin/ocamlmerlin”)

  • 沙丘文件

(可执行文件(名称importimg) (库camlimages.core camlimages.png图形camlimages.graphics))

代码语言:javascript
复制
.
├── _build
│   ├── default
│   │   ├── dune
│   │   ├── dune-project
│   │   ├── image.png
│   │   ├── importimg.exe
│   │   └── importimg.ml
│   └── log
├── dune
├── dune-project
├── image.png
├── #importimg.ml#
└── importimg.ml
  • .emacs content
代码语言:javascript
复制
;; Basic .emacs with a good set of defaults, to be used as template for usage
;; with OCaml and OPAM
;;
;; Author: Louis Gesbert <louis.gesbert@ocamlpro.com>
;; Released under CC0

;; Generic, recommended configuration options

(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.
 '(ac-use-fuzzy nil)
 '(backup-directory-alist (quote (("." . "~/.local/share/emacs/backups"))))
 '(compilation-context-lines 2)
 '(compilation-error-screen-columns nil)
 '(compilation-scroll-output t)
 '(compilation-search-path (quote (nil "src")))
 '(custom-enabled-themes (quote (tango-dark)))
 '(electric-indent-mode nil)
 '(indent-tabs-mode nil)
 '(line-move-visual t)
 '(next-error-highlight t)
 '(next-error-highlight-no-select t)
 '(next-line-add-newlines nil)
 '(require-final-newline t)
 '(sentence-end-double-space nil)
 '(show-paren-mode t)
 '(show-trailing-whitespace t)
 '(visible-bell t))

;; ANSI color in compilation buffer
(require 'ansi-color)
(defun colorize-compilation-buffer ()
  (toggle-read-only)
  (ansi-color-apply-on-region (point-min) (point-max))
  (toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

;; Some key bindings

(global-set-key [f3] 'next-match)
(defun prev-match () (interactive nil) (next-match -1))
(global-set-key [(shift f3)] 'prev-match)
(global-set-key [backtab] 'auto-complete)
;; OCaml configuration
;;  - better error and backtrace matching

(defun set-ocaml-error-regexp ()
  (set
   'compilation-error-regexp-alist
   (list '("[Ff]ile \\(\"\\(.*?\\)\", line \\(-?[0-9]+\\)\\(, characters \\(-?[0-9]+\\)-\\([0-9]+\\)\\)?\\)\\(:\n\\(\\(Warning .*?\\)\\|\\(Error\\)\\):\\)?"
    2 3 (5 . 6) (9 . 11) 1 (8 compilation-message-face)))))

(add-hook 'tuareg-mode-hook 'set-ocaml-error-regexp)
(add-hook 'caml-mode-hook 'set-ocaml-error-regexp)
;; ## added by OPAM user-setup for emacs / base ## 56ab50dc8996d2bb95e7856a6eddb17b ## you can edit, but keep this line
(require 'opam-user-setup "~/.emacs.d/opam-user-setup.el")
;; ## end of OPAM user-setup addition for emacs / base ## keep this line
(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.
 )
  • 版本

梅林: 3.7.0

沙丘: 2.1.3

Emacs: 2020-03-26的GNU 26.3 (build 2,x86_64-pc-linux-gnu,GTK+版本3.24.14),由Debian修改

Opam: 2.0.5

Ocaml: 4.08.1

提前感谢

EN

回答 1

Stack Overflow用户

发布于 2022-03-16 15:38:35

我终于解决了我的问题,建立一个"opam开关“到我的工作目录(WD)。一旦进入WD,就必须启动以下命令:

代码语言:javascript
复制
opam switch create . ocaml-base-compiler

然后,我重新安装了所有所需的软件包。Utop意外地取代了emacs ^^‘中的ocaml REPL (但我不太介意.)。现在,沙丘和梅林“看”这些包裹。

尽管如此,本教程帮助我为您提供了这个答案;dune.html

(请注意,opam、emacs和utop已经安装在我的工作环境中)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71193744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档