0

Emacs 24 and Mac OSX Mavericks, and my emacs file is as follows:

(setq debug-on-error t)
;; -- common-lisp compatibility if not added earlier in your .emacs
(require 'cl)

;; -- Tuareg mode -----------------------------------------
;; Add Tuareg to your search path
(add-to-list
 'load-path
 ;; Change the path below to be wherever you've put your tuareg installation.
 (expand-file-name "~/.elisp/tuareg"))
(require 'tuareg)
(setq auto-mode-alist 
      (append '(("\\.ml[ily]?$" . tuareg-mode))
          auto-mode-alist))

;; -- Tweaks for OS X -------------------------------------
;; Tweak for problem on OS X where Emacs.app doesn't run the right
;; init scripts when invoking a sub-shell
(cond
 ((eq window-system 'ns) ; macosx
  ;; Invoke login shells, so that .profile or .bash_profile is read
  (setq shell-command-switch "-lc")))

;; -- opam and utop setup --------------------------------
;; Setup environment variables using opam
(defun opam-vars ()
  (let* ((x (shell-command-to-string "opam config env"))
     (x (split-string x "\n"))
     (x (remove-if (lambda (x) (equal x "")) x))
     (x (mapcar (lambda (x) (split-string x ";")) x))
     (x (mapcar (lambda (x) (car x)) x))
     (x (mapcar (lambda (x) (split-string x "=")) x))
     )
    x))
(dolist (var (opam-vars))
  (setenv (car var) (substring (cadr var) 1 -1)))
;; The following simpler alternative works as of opam 1.1
;; (dolist
;;    (var (car (read-from-string
;;         (shell-command-to-string "opam config env --sexp"))))
;;  (setenv (car var) (cadr var)))
;; Update the emacs path
(setq exec-path (split-string (getenv "PATH") path-separator))
;; Update the emacs load path
(push (concat (getenv "OCAML_TOPLEVEL_PATH")
          "/../../share/emacs/site-lisp") load-path)
;; Automatically load utop.el
(autoload 'utop "utop" "Toplevel for OCaml" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer)

Any help fixing this error would be great. Thanks!

Nots: I do have tuareg mode where I said it is (in~/.elisp/tuareg). I started getting this error after doing the following :

opam install \
   async yojson core_extended core_bench \
   cohttp async_graphics cryptokit menhir

Not sure whats wrong, but I had basically the same emacs file before installing those and had no issues. Now in emacs utop also doesn't run properly when I try to evaluate an ocaml file.

legoscia
  • 39,593
  • 22
  • 116
  • 167
  • 2
    run `Emacs --debug-init` and you will get the backtrace – sds Feb 11 '14 at 20:37
  • 1
    And bisect that init file, recursively, to narrow things down more. – Drew Feb 11 '14 at 21:06
  • If I had to guess, I would think that `opam config env` is now outputting something that is resistant to the manipulations of the function `opam-vars`. – clstrfsck Feb 11 '14 at 23:19

1 Answers1

0

As noted above:

If I had to guess, I would think that opam config env is now outputting something that is resistant to the manipulations of the function opam-vars

Run Emacs --debug-init and you will get the backtrace.

And bisect that init file, recursively, to narrow things down more.

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265