Browse thread
Configuring emacs to work with caml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | C. Fr <newsgroups.fr@g...> |
| Subject: | Configuring emacs to work with caml |
Hello everyone !
I’ve recently started coding in Caml, and I like it very much. I’m running
both Linux (Ubuntu) and windows, and on both systems I use emacs. However,
I’ve come into a few difficulties when configuring emacs under windows. More
specifically, I’ve been trying to create a portable setup of
camllight/ocaml, so as to run it from a USB stick.
My first step was to extract the contents of an Windows Caml package, to get
the binaries -- I couldn’t find anything but an installer, so I basically
copied the folders bin and lib to my USB. The files are organized in a tree
that looks like this :
--(USB Root)
-----(emacs files and folders)
-----\caml-bin
--------\camllight
-----------\bin
-----------\lib
--------\ocaml
-----------\bin
-----------\lib
Then, I installed the Caml mode for emacs by following that can be found
here : http://www.cs.jhu.edu/~scott/pl/caml/emacs.html
Of course, to make sure that my .emacs file could be found, I created the
following "site-start.el":
-- site-lisp\site-start.el --
(defvar program-dir (substring data-directory 0 -4))
(defvar caml-bin (concat program-dir "caml-bin"))
(defvar ocaml-bin (concat program-dir "caml-bin/ocaml/bin"))
(defvar ocaml-lib (concat program-dir "caml-bin/ocaml/lib"))
(defvar camllight-bin (concat program-dir "caml-bin/camllight/bin"))
(defvar camllight-lib (concat program-dir "caml-bin/camllight/lib"))
(setenv "HOME" program-dir)
(setenv "OCAMLLIB" ocaml-lib)
(setenv "CAMLLIB" camllight-lib)
(setenv "PATH" (concat (concat caml-bin ";") (getenv "PATH")))
(setenv "PATH" (concat (concat ocaml-bin ";") (getenv "PATH")))
(setenv "PATH" (concat (concat camllight-bin ";") (getenv "PATH")))
-- end of site-lisp\site-start.el --
Plus, I added to my .emacs file the following lines:
-- .emacs (USB drive root) --
(setq auto-mode-alist (cons '("\\.ml[iylp]?" . caml-mode) auto-mode-alist))
(autoload 'caml-mode "caml" "Major mode for editing Caml code." t)
(autoload 'run-caml "inf-caml" "Run an inferior Caml process." t)
(autoload 'camldebug "camldebug" "Run the Caml debugger." t)
-- end of .emacs --
Now, when I launch emacs, and use the built-in shell (M-!) to type ocaml or
caml, I get the regular caml prompt (adding CAMLLIB and OCAMLLIB solved a
few bugs), perfectly functional.
However, when I launch run-caml, and then type either "ocaml" or "caml" when
asked which toplevel to run ("Caml Toplevel to run:"), I invariably get the
message "Searching for program: no such file or directory, ocaml". However,
when I put the "ocaml.exe" file directly in emacs bin directory, the problem
vanishes.
Has someone ever encountered a similar problem? I just can't manage to find
a solution, and would like to preserve my directory tree...
Thanks a lot for your support !