macos - tuareg 模式 emacs ocaml 未找到

标签 macos emacs ocaml tuareg

我在 mac os x 10.9 上运行 emacs 24.3。我已经安装了用于 ocaml 编程的 tuareg-mode,但无法使用命令 C-c C-b 进行编译。按下相同按钮后,迷你缓冲区会询问我“要运行的 Caml 顶层:ocaml”。当我按 Enter 时,它显示错误“搜索程序:没有这样的文件或目录,ocaml”。我错过了什么?

最佳答案

您需要将 PATH 环境变量和 Emacs 的 exec-path 变量设置为正确的值。一种可能性是使用类似的东西(在您的 ~/.emacs 中):

(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell (shell-command-to-string "$SHELL -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))
(when window-system (set-exec-path-from-shell-PATH))

从 shell 正确获取 PATH 和两个变量。这样做的一个优点是您只需在一处设置 PATH - 在 shell 初始化脚本中。

关于macos - tuareg 模式 emacs ocaml 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20801675/

相关文章:

macos - 让 Aquamacs 的滚动更像 Emacs

Emacs:在 ansi-term 中具有完全不同的背景颜色

OCaml:如何执行使用尾递归的程序?

functional-programming - 解决脆弱模式匹配的建议

python - cmake osx部署目标是 '10.11'但CMAKE_OSX_SYSROOT错误

macos - Launchpad 图标不再显示 NSDockTile 徽章

ruby-on-rails - `brew upgrade <package>` : "<package> cannot be built with any available compilers"

emacs - emacs gud 中的 lldb 不更新 'up' 的源文件

emacs - 如何设置带有 C-x 8 前缀的键?

types - 为什么不能使用行多态性将对象存储在异构容器中?