[opam-devel] Opam 1.2 breaks emacs on the mac sortof

Yaron Minsky yminsky at janestreet.com
Tue Sep 9 03:08:09 BST 2014


Apologies for the following bits of emacs nonsense.

Sadly, I think that opam 1.2 has broken the emacs configuration that I
documented here:

https://github.com/realworldocaml/book/wiki/Installation-Instructions#emacs

I'm looking for advice as to how to fix things.  It has to do with how
paths are set up.  Emacs for the mac has the annoying property of not
propagating ordinary shell settings.  Instead what I did was this:

;; -- 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")))

This caused the .profile to get run again on every incoming shell.
This has the property of rerunning "eval `opam config env`".  That
used to work because opam would throw its entries on the path when it
ran.  But I believe opam has been changed to not re-add entries when
they're already there.  This means that when you run the shell with
"-lc", it redumps the entries from /etc/paths on top, thus shadowing
the opam entries.

We could change opam 1.2 so that instead of not adding entries when
they're already there, it instead deletes the old version of the entry
and re-adds it to the top.  Or we could come up with a more principled
emacs-on-the-mac setup, but I can't quite figure out a good way of
doing that.

Thoughts on how to fix this are very welcome!

y


More information about the opam-devel mailing list