caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* RE: Configuring emacs to work with caml
@ 2010-01-17  8:06 C. Fr
  0 siblings, 0 replies; 2+ messages in thread
From: C. Fr @ 2010-01-17  8:06 UTC (permalink / raw)
  To: caml-list

Hello again!

I have found a solution to my portable emacs problem. The trick is to use
the program-dir variable defined in site-start.el to pass it to the run-caml
code, so that it can deal with absolute paths.

Thanks for Caml!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Configuring emacs to work with caml
@ 2010-01-16 22:33 C. Fr
  0 siblings, 0 replies; 2+ messages in thread
From: C. Fr @ 2010-01-16 22:33 UTC (permalink / raw)
  To: caml-list

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 ! 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-17  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-17  8:06 Configuring emacs to work with caml C. Fr
  -- strict thread matches above, loose matches on Subject: below --
2010-01-16 22:33 C. Fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).