1

I'm having trouble setting up spacemacs for ocaml on my mac. Specifically, spacemacs can't seem to find ocp-indent. Whenever I enter a new line, I get the following message: "Searching for program: No such file or directory, ocp-indent"

I confirmed that I have it installed, and there's a ocp-indent directory in my elpa directory. Merlin and utop, which I believe I installed the same way with opam, both seem to work in spacemacs.

Does anyone know how I can fix this, or at least debug the problem better?

Here is spacemacs' debugger output:

Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "ocp-indent")
  call-process-region(1 38 "ocp-indent" "/var/folders/vz/q3dgx5jj3y1989n9y7np1h8w0000gn/T/emacsCIYxzp" (#<buffer  *string-output*> "/var/folders/vz/q3dgx5jj3y1989n9y7np1h8w0000gn/T/ocp-indent-error97945Cyf") nil "--numeric" "--lines" "4-4")
  apply(call-process-region 1 38 "ocp-indent" nil (#<buffer  *string-output*> "/var/folders/vz/q3dgx5jj3y1989n9y7np1h8w0000gn/T/ocp-indent-error97945Cyf") nil ("--numeric" "--lines" "4-4"))
  (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line)))
  (if (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line))) (error "Can't indent: %s returned failure" ocp-indent-path))
  (let ((standard-output standard-output)) (if (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line))) (error "Can't indent: %s returned failure" ocp-indent-path)))
  (progn (let ((standard-output standard-output)) (if (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line))) (error "Can't indent: %s returned failure" ocp-indent-path))) (save-current-buffer (set-buffer standard-output) (buffer-string)))
  (unwind-protect (progn (let ((standard-output standard-output)) (if (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line))) (error "Can't indent: %s returned failure" ocp-indent-path))) (save-current-buffer (set-buffer standard-output) (buffer-string))) (kill-buffer standard-output))
  (let ((standard-output (get-buffer-create (generate-new-buffer-name " *string-output*")))) (unwind-protect (progn (let ((standard-output standard-output)) (if (/= 0 (apply (quote call-process-region) (point-min) (point-max) ocp-indent-path nil (list standard-output errfile) nil (ocp-indent-args start-line end-line))) (error "Can't indent: %s returned failure" ocp-indent-path))) (save-current-buffer (set-buffer standard-output) (buffer-string))) (kill-buffer standard-output)))
  (let* ((start-line (line-number-at-pos start)) (end-line (line-number-at-pos end)) (errfile (expand-file-name (make-temp-name "ocp-indent-error") temporary-file-directory)) (indents-str (let ((standard-output (get-buffer-create (generate-new-buffer-name " *string-output*")))) (unwind-protect (progn (let (...) (if ... ...)) (save-current-buffer (set-buffer standard-output) (buffer-string))) (kill-buffer standard-output)))) (indents (mapcar (quote string-to-number) (split-string indents-str)))) (if (file-exists-p errfile) (progn (message (ocp-indent-file-to-string errfile)) (delete-file errfile))) (save-excursion (goto-char start) (mapcar (function (lambda (indent) (indent-line-to indent) (forward-line))) indents)) (if (ocp-in-indentation-p) (progn (back-to-indentation))))
  ocp-indent-region(37 37)
  ocp-indent-line()
  indent-according-to-mode()
  electric-indent-post-self-insert-function()
  self-insert-command(1)
  newline(nil t)
  #[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 2329134 "*"]()
  ad-Advice-newline-and-indent(#[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 2329134 "*"])
  apply(ad-Advice-newline-and-indent #[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 2329134 "*"] nil)
  newline-and-indent()
  tuareg-newline-and-indent()
  funcall-interactively(tuareg-newline-and-indent)
  call-interactively(tuareg-newline-and-indent nil nil)
  command-execute(tuareg-newline-and-indent)
0

From what you say, it seems that you do have the ocp-indent Elisp package installed, but the error message says that this ocp-indent package can't find the ocp-indent program (which is not specific to Emacs, so the ocp-indent package expects to find it somewhere along your $PATH).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.