inf-clojure

GitHub: https://github.com/clojure-emacs/inf-clojure Discord (official chat): https://discord.gg/nFPpynQPME
pre 2018-03-20T22:12:28.000406Z

an experienced clojure/cider/linux dev here, interested in setting up new emacs setup with clojure-mode + inf-clojure + lumo + nodejs setup on a new osx without jvm, boot, or lein. As of now, I'm able to connect to lumo's socket repl by running lumo -n 5555 and M-x inf-clojure-connect. A repl opens up in a new buffer; however I can't evaluate or load the form in the source file: C-x e or C-c C-k throws the following error: cannot open load file: no such file or directory, lumo.build.api. In my other emacs/cider/lein setup, of course, evaluating forms or loading file always works.? Per the readme doc I added this in my new emacs config: (setf inf-clojure-lumo-cmd '("localhost" . 5555) and it didn't make any difference. Is anyone using inf-clojure with lumo successfully? Thanks! @bozhidar @richiardiandrea

richiardiandrea 2018-03-20T22:12:51.000229Z

@pri I am using lumo and inf-clojure every day 😄 😄

richiardiandrea 2018-03-20T22:13:04.000089Z

there is no inf-clojure-lumo-cmd

pre 2018-03-20T22:13:12.000317Z

great, what are the exact steps and config in your emacs?

richiardiandrea 2018-03-20T22:13:13.000421Z

because the -cmd are based on the project time

richiardiandrea 2018-03-20T22:13:43.000261Z

which dependency resolution mechanism are you using?

pre 2018-03-20T22:14:01.000133Z

none

pre 2018-03-20T22:14:15.000303Z

it's a hello world of lumo and shouldnt require deps.

richiardiandrea 2018-03-20T22:14:44.000271Z

ok so in that case inf-clojure does not detect any of that and you should be able to use inf-clojure-generic-cmd

pre 2018-03-20T22:15:05.000412Z

i have no idea what that means based on readme

richiardiandrea 2018-03-20T22:15:10.000271Z

> inf-clojure has several custom variables which control the command used to start a REPL for particular project type - inf-clojure-lein-cmd, inf-clojure-boot-cmd, inf-clojure-tools-deps-cmd and inf-clojure-generic-cmd. The inf-clojure-project-type can force a particular project type, skipping the project detection, which can be useful for projects that don't have standard layouts.

pre 2018-03-20T22:15:36.000130Z

yes, I trid reading the elisp code and lumo support is not its priority

pre 2018-03-20T22:15:50.000353Z

it defaults to lein

richiardiandrea 2018-03-20T22:16:57.000072Z

@pri you are probably assuming things. Inf-clojure is detecting the project, as in lein, boot, etc...but lumo is not a project per se because the dependency resolution can be done with any of the above tools

richiardiandrea 2018-03-20T22:17:07.000446Z

so there is no need of a lumo project type

richiardiandrea 2018-03-20T22:17:36.000055Z

I agree with you that the README can be improved

pre 2018-03-20T22:17:53.000092Z

it's fair to say the authors of inf-clojure are assuming a lot of things since lumo is not supported out of the box, of by following instructions in readme.

richiardiandrea 2018-03-20T22:18:42.000450Z

@pri the current main contributor of inf-clojure is telling you that you don't need that, but the readme can be improved 😄

pre 2018-03-20T22:19:04.000286Z

what is your suggestion?

pre 2018-03-20T22:19:55.000118Z

happy to send a PR if I can get it working 🙂

richiardiandrea 2018-03-20T22:20:06.000286Z

this is my .dir-locals.el, but you can have parts in your init.el:

((nil . ((eval . (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode))
         (inf-clojure-repl-use-same-window . nil)
         (inf-clojure-project-type . "generic")
         (inf-clojure-generic-cmd . ("localhost" . 5555)))))

richiardiandrea 2018-03-20T22:20:33.000014Z

in your case you would not need line 3 because you don't have any project.clj/`build.boot`...

pre 2018-03-20T22:21:13.000186Z

ok, let me try it now ...

pre 2018-03-20T22:26:47.000376Z

I get a lisp eval error with this in my init.el:

((nil . ((eval . (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode))
         (inf-clojure-repl-use-same-window . nil)
         (inf-clojure-generic-cmd . ("localhost" . 5555)))))

pre 2018-03-20T22:27:38.000302Z

(taking time to respond as I'm switching between two laptops)

👍 1
richiardiandrea 2018-03-20T22:28:08.000350Z

I need two-three lines of the error

richiardiandrea 2018-03-20T22:28:54.000193Z

you can record and upload you voice as well 😄

pre 2018-03-20T22:32:33.000353Z

Debugger entered--Lisp error: (invalid-function (nil (eval add-hook (quote clojure-mode-hook) (function inf-clojure-minor-mode)) (inf-clojure-repl-use-same-window) (inf-clojure-generic-cmd "localhost" . 5555)))
  ((nil (eval add-hook (quote clojure-mode-hook) (function inf-clojure-minor-mode)) (inf-clojure-repl-use-same-window) (inf-clojure-generic-cmd "localhost" . 5555)))
  eval(((nil (eval add-hook (quote clojure-mode-hook) (function inf-clojure-minor-mode)) (inf-clojure-repl-use-same-window) (inf-clojure-generic-cmd "localhost" . 5555))) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

pre 2018-03-20T22:34:04.000085Z

My steps (and expectations): 1. lumo -n 5555 2. inf-clojure-connect <enter> localhost <enter> 5555 3. C-x e or C-c C-k should evaluate form or file

pre 2018-03-20T22:34:55.000254Z

emacs version 25.3.1

richiardiandrea 2018-03-20T22:46:12.000124Z

can you paste your .dir-locals.el @pri

pre 2018-03-20T22:47:02.000180Z

I have not used .dir-locals.el but pasted the above in init.el

richiardiandrea 2018-03-20T22:47:48.000361Z

ok so that would not work in init.el, my bad

pre 2018-03-20T22:47:51.000390Z

should I create .dir-local.el in the same directory as init.el or in each lumo project root dir?

richiardiandrea 2018-03-20T22:48:39.000407Z

so for global conf, you should do:

(add-hook 'clojure-mode-hook #'inf-clojure-minor-mode)
(setq inf-clojure-repl-use-same-window . nil)
(setq inf-clojure-generic-cmd . ("localhost" . 5555))

richiardiandrea 2018-03-20T22:48:48.000038Z

in init.el

pre 2018-03-20T22:51:25.000112Z

the second line throws: "wrong number-of-arguments setq 1)`

richiardiandrea 2018-03-20T22:56:14.000017Z

@pri sorry man, I forgot to get rid of the dots as well

pre 2018-03-20T22:56:40.000124Z

np ...

pre 2018-03-20T23:04:19.000075Z

finally!

pre 2018-03-20T23:06:51.000073Z

I'm able to compile a lumo build.cljs and evaluate individual cljs files. Do you know the recommended way to add deps with inf-clojure/lumo? I assume the deps.edn works with the new clojure tools.

richiardiandrea 2018-03-20T23:06:58.000219Z

awesome

richiardiandrea 2018-03-20T23:08:17.000193Z

yes it works, I do clj -Spath to generate the classpath that I then use with lumo -c

richiardiandrea 2018-03-20T23:08:31.000326Z

something like:

cp=$(clojure -Srepro -C:dev -R:lumo-compile -Spath)

lumo -sfK -c "$cp" -n $port

richiardiandrea 2018-03-20T23:08:52.000344Z

of course the aliases there are in my own deps.edn

pre 2018-03-20T23:10:12.000399Z

but where are the deps?

pre 2018-03-20T23:10:24.000303Z

deps.edn or project.clj?

richiardiandrea 2018-03-20T23:17:38.000296Z

deps.edn, I don't use lein

pre 2018-03-20T23:51:22.000221Z

Thanks. I was able to run a clojure-tools repl---it works, and also run lumo with a classpath from deps.edn with the following

lumo -c `clj -Spath`-n 6666

richiardiandrea 2018-03-20T23:52:11.000155Z

that works

richiardiandrea 2018-03-20T23:52:15.000144Z

😉

pre 2018-03-20T23:52:30.000202Z

coincidentally, I saw your reply on https://github.com/anmonteiro/lumo/issues/328

pre 2018-03-20T23:53:13.000053Z

Before I send PRs to update README of inf-clojure and lumo, do you think this is the optimal way to go forward?

richiardiandrea 2018-03-20T23:53:35.000069Z

you mean the PR? or the project detection thing?

pre 2018-03-20T23:53:59.000077Z

ie., a minimal inf-clojure setup for lumo users / PullRequestr

richiardiandrea 2018-03-20T23:55:40.000229Z

I think we should maybe re-think how to organize information there

richiardiandrea 2018-03-20T23:55:48.000220Z

because there are sections for socket REPLs

pre 2018-03-20T23:55:50.000243Z

One final q --- what is your current way to start cljs repl via clj?

pre 2018-03-20T23:56:14.000210Z

ie., minimal setup with clojure/deps.edn to run pure cljs files.

richiardiandrea 2018-03-20T23:56:19.000232Z

I would check the clojure socket REPL section for that

richiardiandrea 2018-03-20T23:56:30.000110Z

actually

pre 2018-03-20T23:56:33.000193Z

(I have been using figwheel for three years)

richiardiandrea 2018-03-20T23:56:45.000175Z

with the new stuff on master cljs you can now do

pre 2018-03-20T23:56:51.000052Z

but that doesn't talk about inf-clojure ...

richiardiandrea 2018-03-20T23:57:03.000186Z

clojure -m cljs.main -co cljsc_opts.edn -r

richiardiandrea 2018-03-20T23:57:21.000323Z

where the cljsc_opts.edn contains the compiler option map

richiardiandrea 2018-03-20T23:57:38.000279Z

this will be the best way to launch a cljs REPL

richiardiandrea 2018-03-20T23:57:55.000002Z

and socket will be just adding a -J option to the above...

richiardiandrea 2018-03-20T23:58:03.000262Z

need to write a blog post about it 😄

richiardiandrea 2018-03-20T23:58:25.000174Z

so the trick is to launch whatever REPL you have that opens a Socket REPL

richiardiandrea 2018-03-20T23:58:33.000084Z

then connect inf-clojure to it

richiardiandrea 2018-03-20T23:58:47.000084Z

and execute the form that upgrades to a cljs REPL

richiardiandrea 2018-03-20T23:59:04.000092Z

we can probably automate the latter step, not sure though