【问题标题】:ghci cabal sandbox flags for Emacs Haskell inferior modeEmacs Haskell 劣质模式的 ghci cabal 沙箱标志
【发布时间】:2014-11-05 11:25:57
【问题描述】:

当我在 emacs 中工作时,我希望 GHCI 将本地 cabal 沙箱纳入范围。 从bash来看,语法如下:

ghci -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d

我在 haskell-program-name 的定义中将标志添加到 inf-haskell.el 中,如下所示:

(defcustom haskell-program-name
  (or (cond
   ((executable-find "hugs") "hugs \"+.\"")
   ((executable-find "ghci") "ghci -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d"))
  "hugs \"+.\"")
  "The name of the command to start the inferior Haskell process.
   The command can include arguments."
   ;; Custom only supports the :options keyword for a few types, e.g. not
   ;; for string.
   ;; :options '("hugs \"+.\"" "ghci")
      :group 'inferior-haskell
      :type '(choice string (repeat string)))

但它似乎不起作用,即在重新加载 emacs 后,用C-h v haskell-program-name 检查值只是显示它等于"ghci",我需要的包当然不在范围内。 任何指针?谢谢!

【问题讨论】:

  • 您应该使用cabal repl,而不是使用沙箱手动启动ghci,并将emacs配置为使用带有(custom-set-variables '(haskell-process-type 'cabal-repl))的cabal repl
  • 感谢您的好主意,但这也意味着为每个小脚本设置一个 cabal 项目。我只是想尝试一些无法在全球范围内安装的库。阴谋集团,你知道的

标签: haskell emacs ghci


【解决方案1】:

经过一番苦战,我们终于弄明白了:relevant Github issue

如果您将 haskell-process-type 设置为 auto,并且在您的路径中有最新 (>= 1.20.x) cabal-install,则运行 C-c C-l 将在 emacs 中打开一个 cabal repl(即使您没有周围没有 .cabal 文件)并检测您的沙箱。这让你可以扔掉一个沙盒,快速安装一个库,然后在 emacs 中交互式地玩弄它。

祝你好运!

【讨论】:

  • 好先生,您是一位真正的绅士。我一回到我的盒子就会调查这个。
  • 唉,不。我有 cabal-install 1.20.0.3,这是我的 init.el 配置: (autoload 'ghc-init "ghc" nil t) (autoload 'ghc-debug "ghc" nil t) (add-hook 'haskell-mode -hook (lambda () (ghc-init))) (custom-set-variables '(haskell-process-type 'auto)) (add-hook 'after-init-hook #'global-flycheck-mode)跨度>
  • 嗨@fosskers,不幸的是我无法重现。我的问题专门针对 Emacs 的 GUI 版本,但终端内的版本按预期工作。我不明白这种不一致,因为两个版本都使用相同的 init.el
  • GUI 版本到底出了什么问题?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多