0

我在 mac os x 上运行。我在 /Users/Max/.emacs 有一个文件,里面有这个:

(添加到列表'加载路径“/Users/Max/emacs/tuareg-mode/”)
(加载“tuareg-mode-startup”)

我在 /Users/Max/emacs/tuareg-mode/ 有一个文件夹,其中包含我从 tuareg 2.0.6 获取并提取到我的“tuareg-mode”文件夹中的这些文件:

>Makefile  
ocamldebug.el  
README  
tuareg-pkg.el  
tuareg.el

编辑:在我的 'tuareg-mode' 文件夹中获得了 2.0.7 文件,它们是:

>Makefile  
ocamldebug.el  
README  
tuareg-pkg.el  
tuareg.el  
tuareg-site-file.el

我打开emacs时遇到的错误是这样的:

警告(初始化):加载“/Users/Max/.emacs”时出错:

Symbol 作为变量的值是 void:“/Users/Max/emacs/tuareg-mode/”</p>

为确保正常运行,您应该调查并删除初始化文件中的错误原因。使用 `--debug-init' 选项启动 Emacs 以查看完整的错误回溯。

使用 --debug-init 选项启动 emacs 给了我这个:

调试器进入--Lisp 错误: (void-variable “/Users/Max/emacs/tuareg-mode/”) (add-to-list (quote load-path) “/Users/Max/emacs/tuareg-mode/” ) eval-buffer(# nil "/Users/Max/.emacs" nil t) ; 读取缓冲区位置 57
load-with-code-conversion("/Users/Max/.emacs" "/Users/Max/.emacs" tt) load("~/.emacs" tt) #[0 "\205\ 262\306=\203\307\310Q\202;\311=\204\307\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317 #\203:\320\nB\321\202;\316\322\323\322\211#\210\322=\203a\324\325\326\307\327Q!\"\323\322\211 #\210\322=\203\210\203\243\330!\331\232\203\243\332!\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335\"\203\237\336\337#\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "_emacs' init 文件已弃用,请使用 `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension " elc" 文件名-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\ n\n(fn)"]() 命令行() 普通顶层()

我是新的 Mac OS,对 OCaml 完全陌生。我看不出我做错了什么。为什么不能加载路径?

非常感谢。

4

2 回答 2

4
于 2014-09-19T12:02:17.250 回答
1

If you've got a recent version of Emacs, I strongly recommend using package.el to install packages. It will take care of putting things in the right place for you. package.el ships with Emacs 24, and there is a version that you can install for Emacs 23.

Once you have package.el installed, you can install packages using M-x package-list-packages or M-x package-install. From the former, find a package you wish to install, mark it with i, and apply the marked actions with x.

Out of the box, package.el only gives you access to the GNU ELPA (Emacs Lisp Package Archive), which doesn't have very many packages. But there are third-party repositories that contain a lot more. I recommend using MELPA stable, which does provide tuareg. Something like this should get you started:

(require 'package)
(package-initialize)

(add-to-list 'package-archives
             '("melpa-stable" . "http://melpa-stable.milkbox.net/packages/") t)

There are other cool things you can do with package.el as well. If you're interested, I recommend checking out use-package in particular.

See EmacsWiki for more.

于 2014-09-19T12:04:29.123 回答