[ocaml-platform] opam-in-a-box

Yaron Minsky yminsky at janestreet.com
Sat Jan 24 03:02:38 GMT 2015


I was thinking now would be a good time to return to this thread, now
that we have some experience trying out the current user-setup
package.

 http://lists.ocaml.org/pipermail/teaching/2015-January/thread.html

A few random thoughts.

- I have some concerns with the way the scripts are kicked off.  Right
  now, the way it works is you install the user-setup config, and it
  automatically modifies your dot files.  I wonder if it would be
  better to have a tool that you could run that would set up your
  dot-files, asking you along the way for permission to edit each file
  it edited.

- I wonder if more development work needs to go into the
  editor-customization files themselves.  For example, I think the
  current user-setup script tries to incrementally add support for the
  different needed tools, including the major hits: utop, merlin,
  ocp-indent, etc.  I wonder if instead we should write some elisp
  code that detects what tools are available by searching through the
  opam install, and conditionally sets up the emacs support when it's
  there.  That seems simpler and easier to think about, since there's
  one set of configurations that can be read and understood as a
  whole.

- I wonder how we should get opam -switch support to work effectively.
  user-setup hard-codes paths into the .emacs, which is awkward when
  you switch to a different compiler.

  One might just want to inherit the opam paths from the shell, but
  this doesn't work well on the mac. My .emacs setup has some code
  that tries to figure out what the relevant opam paths are by
  executing the shell, and that, though a terrible hack, seems to
  work.  Maybe we should include something like this, rather than
  hardcoding paths.

    ;; -- 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
    (defun set-exec-path-from-shell-PATH ()
      "Set up Emacs' `exec-path' and PATH environment variable to
      match that used by the user's shell.

    This is particularly useful under Mac OSX, where GUI apps are not
    started from a shell."
      (interactive)
      (let ((path-from-shell
    (replace-regexp-in-string
     "[ \t\n]*$" ""
     (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))
    ))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator)))
      )
    (cond
     ((eq window-system 'ns) ; macosx
      (set-exec-path-from-shell-PATH)))

Anyway, curious what others think on all this.

y


More information about the Platform mailing list