New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utop command in emacs #4
Comments
Yes.
(push "~/.opam/system/share/emacs/site-lisp" load-path) In your case replace |
And to dynamically find the right location: (let ((opam-prefix
(replace-regexp-in-string
"[ \r\n\t]*$" ""
(with-output-to-string
(with-current-buffer
standard-output
(call-process "opam" nil t nil "config" "var" "prefix"))))))
(push (concat opam-prefix "/share/emacs/site-lisp") load-path)) |
Thanks a bunch for your help with this. I'm not quite there yet. This is my current Ocaml config for emacs: (push "~/.opam/4.00.1+short-types/share/emacs/site-lisp/" load-path)
(let ((opam-prefix
(replace-regexp-in-string
"[ \r\n\t]*$" ""
(with-output-to-string
(with-current-buffer
standard-output
(call-process "opam" nil t nil "config" "var" "prefix"))))))
(push (concat opam-prefix "/share/emacs/site-lisp") load-path))
(autoload 'utop "utop" "Toplevel for OCaml" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t) The error I get when attempting to eval the let statement is this:
Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "opam")
call-process("opam" nil t nil "config" "var" "prefix")
(save-current-buffer (set-buffer standard-output) (call-process "opam" nil t nil "config" "var" "prefix"))
(with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix"))
(let ((standard-output standard-output)) (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix")))
(progn (let ((standard-output standard-output)) (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix"))) (with-current-buffer standard-output (buffer-string)))
(unwind-protect (progn (let ((standard-output standard-output)) (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix"))) (with-current-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)) (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix"))) (with-current-buffer standard-output (buffer-string))) (kill-buffer standard-output)))
(with-output-to-string (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix")))
(replace-regexp-in-string "[
\n ]_$" "" (with-output-to-string (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix"))))
(let ((opam-prefix (replace-regexp-in-string "[
\n ]_$" "" (with-output-to-string (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix")))))) (push (concat opam-prefix "/share/emacs/site-lisp") load-path))
eval((let ((opam-prefix (replace-regexp-in-string "[
\n ]*$" "" (with-output-to-string (with-current-buffer standard-output (call-process "opam" nil t nil "config" "var" "prefix")))))) (push (concat opam-prefix "/share/emacs/site-lisp") load-path)) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
|
Note that you only need one of the two expressions. The second one is if you are using several prefixes and want to automatically find the right one. Regarding the error it seems that "opam" is not in your PATH. |
I'm in basically the same situation - did this get resolved? opam is in my PATH I think as when I run opam from a terminal it works |
I wasn't able to resolve. On Jun 7, 2013, at 9:37 AM, Farhan Mannan notifications@github.com wrote:
|
Unfortunately there is nothing that can be done in utop. You have to add this line in your (push "~/.opam/system/share/emacs/site-lisp" load-path) utop installs the |
I already have that (well actually I have |
Can you check that |
What version of emacs are you using Jeremie? On what OS? On Jun 24, 2013, at 1:34 AM, Jérémie Dimino notifications@github.com wrote:
|
I am using different ones:
|
I'm having similar problems too. I have been manually able to I was not able to run utop in zsh until OPAM added this line to my
It seems that script modifies the environment variables necessary for Attempting to run utop in say I think the problem is that the path to utop isn't in the |
With a recent opam version you can add in your (dolist (var (car (read-from-string (shell-command-to-string "opam config env --sexp"))))
(setenv (car var) (cadr var))) |
Hello @diml, thanks for the suggestion, The relevant lines in my (add-to-list 'load-path "/home/samuel/.opam/4.01.0dev+trunk/share/emacs/site-lisp/")
(autoload 'utop "utop" "Toplevel for OCaml" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(dolist (var (car (read-from-string (shell-command-to-string "opam config env --sexp"))))
(setenv (car var) (cadr var))) Does that look right? The |
Yes.
Ah yes, that's because emacs parses (setq exec-path (split-string (getenv "PATH") path-separator)) |
Yay. It works now. Thanks a lot @diml. :-) I'll paste the following as a minimal (add-to-list 'load-path "/home/samuel/.opam/4.01.0dev+trunk/share/emacs/site-lisp/")
(autoload 'utop "utop" "Toplevel for OCaml" t)
(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t)
(dolist (var (car (read-from-string (shell-command-to-string "opam config env --sexp"))))
(setenv (car var) (cadr var)))
(setq exec-path (split-string (getenv "PATH") path-separator)) |
With the new intrusctions in the README it should now be easier to make utop work with emacs: https://github.com/diml/utop#integration-with-emacs |
Thank you for providing Emacs support! But I'm not sure I understand the instructions...what do you mean by executing "utop" in emacs? Do you mean
M-x utop
? If so that doesn't seem to work for me.I installed utop via opam like this:
$ opam init $ opam switch 4.00.1+short-types $ opam install utop core_extended $ eval `opam config -env`
I have an .omalinit that looks like this:
# use "topfind" # camlp4o # thread # require "core.top"
When I run
M-x utop
I getCannot open load file: utop
Thanks for your help,
C
The text was updated successfully, but these errors were encountered: