inf-clojure 2018-03-20

@pri has joined the channel

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

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

there is no inf-clojure-lumo-cmd

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

because the -cmd are based on the project time

which dependency resolution mechanism are you using?

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

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

i have no idea what that means based on readme

> 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.

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

it defaults to lein

@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

so there is no need of a lumo project type

I agree with you that the README can be improved

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.

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

what is your suggestion?

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

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)))))

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

ok, let me try it now ...

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)))))

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

👍 1

I need two-three lines of the error

you can record and upload you voice as well 😄

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)

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

emacs version 25.3.1

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

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

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

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

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))

in init.el

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

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

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.

awesome

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

something like:

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

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

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

but where are the deps?

deps.edn or project.clj?

deps.edn, I don't use lein

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

that works

😉

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

you mean the PR? or the project detection thing?

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

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

because there are sections for socket REPLs

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

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

I would check the clojure socket REPL section for that

actually

(I have been using figwheel for three years)

with the new stuff on master cljs you can now do

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

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

where the cljsc_opts.edn contains the compiler option map

this will be the best way to launch a cljs REPL

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

need to write a blog post about it 😄

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

then connect inf-clojure to it

and execute the form that upgrades to a cljs REPL

we can probably automate the latter step, not sure though