I’ve played again with OCaml a bit today. Updated to latest versions using opam and merlin packages in Emacs.
When I open a .ml file in Emacs merlin-mode nicely activates itself. When I save the file C-x C-s I see an error Emacs:
Wrote /Me/ocaml_gol/lib/rules.ml
unknown flag /Me/ocaml_gol/lib/rules.ml
flag -filename: error, Unix.Unix_error(Unix.ENOENT, "create_process", "dot-merlin-reader")
flag -filename: error, Unix.Unix_error(Unix.ENOENT, "create_process", "dot-merlin-reader") (0 pending errors, use C-c C-x to jump)
I can’t make a lot of sense to this.
I’ve got ‘dot-merlin-reader’ installed and it’s executable.
However completion and other things in Emacs works, so I’m not sure what this error means.
Any idea?
Do yo know if the path that emacs has matches the path your shell has? My guess is your shell has the opam environment setup and your emacs runs in a configuration without that.
Emacs is configured with ~/.opam/default/bin added to exec-path and PATH env. So it should see those executables.
But when I run `(shell-command “dot-merlin-reader”) it can’t find it.
So this might be the problem.
I’m wondering though, the Unix.Unix_error(Unix.ENOENT, ...) isn’t this an OCaml error that just comes back from merlin?
When setting shell-command-switch: (setq shell-command-switch "-ic") in Emacs the shell-command will start the shell in interactive mode doing the full setup. And I can run ‘dot-merlin-reader’ from there.
But the problem persists.
I believe this comes from the server side. Is there a merlin log file to look?
On a mac, application bundles have no way to know the user’s dotfile settings for things like the path. I have code in my .emacs that notes if the path seems uninitialized and initializes it if so, to make sure that even when it is invoked as an application and not from the command line that the path is correct.