0
votes

I'm running on mac os x. I have a file at /Users/Max/.emacs with this inside:

(add-to-list 'load-path “/Users/Max/emacs/tuareg-mode/”)
(load "tuareg-mode-startup”)

I have a folder at /Users/Max/emacs/tuareg-mode/ with these files inside which I got from tuareg 2.0.6 and extracted to my 'tuareg-mode' folder:

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

edit: Got the 2.0.7 files in my 'tuareg-mode' folder instead, here they are:

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

The error I'm getting when I open emacs is such:

Warning (initialization): An error occurred while loading `/Users/Max/.emacs':

Symbol's value as variable is void: “/Users/Max/emacs/tuareg-mode/”

To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the `--debug-init' option to view a complete error backtrace.

Starting emacs with the --debug-init option gives me this:

Debugger entered--Lisp error: (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) ; Reading at buffer position 57
load-with-code-conversion("/Users/Max/.emacs" "/Users/Max/.emacs" t t) load("~/.emacs" t t) #[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 file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-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)"]() command-line() normal-top-level()

I'm new Mac OS and completely new to OCaml. I don't see what I've done wrong. Why can't it load the path?

Thanks a lot.

2
Maybe you want (load "/Users/Max/emacs/tuareg-mode/tuareg-mode-startup.el") - beware of the double quotes!Basile Starynkevitch
Where exactly am I supposed to find this tuareg-mode-startup.el file? All the files that I downloaded in the 2.0.6 package are listed above in my questionSilent
Remove the trailing backslash from the path in your load-path.Dan
Still getting the same errorSilent
I found out there was a new version of tuareg (2.0.7) so I downloaded it and replaced the contents of the 'tuareg-mode' folder with the files in 2.0.7 Still the same errorSilent

2 Answers

4
votes

You don't have the correct quotes.

Strings must be surrounded by plain ascii "" quotes.

Otherwise the lisp reader will happily treat them as part of a symbol name, which is why it's treating “/Users/Max/emacs/tuareg-mode/” as a variable.

This:

(add-to-list 'load-path "/Users/Max/emacs/tuareg-mode/")
(load "tuareg-mode-startup")

Not:

(add-to-list 'load-path “/Users/Max/emacs/tuareg-mode/”)
(load "tuareg-mode-startup”)
1
votes

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.