Fork me on GitHub
#cider
<
2023-03-24
>
Drew Verlee04:03:11

I would love to see some examples of Emacs code that's interacting with cider for project management purposes or really any reason at all. It will help me get a sense of how things can or do fit together. No need to explain it, just drop links, i tried searching Google and failed hard to find examples.

practicalli-johnny09:03:20

https://practical.li/clojure/data-inspector/portal/#editor-nrepl-middleware Portal uses nrepl from Emacs commands, see the Emacs configuration part for example code, e.g.

;; def portal to the dev namespace to allow dereferencing via @dev/portal
(defun portal.api/open ()
 (interactive)
  (cider-nrepl-sync-request:eval
   "(do (ns dev) (def portal ((requiring-resolve 'portal.api/open))) (add-tap (requiring-resolve 'portal.api/submit)))"))

👍 2
Rupert (Sevva/All Street)14:04:16

I use some emacs -> cider code This snippet let's me restart my integrant system from with just a hotkey.

(defun cider-reset ()
  (interactive)
  (cider-interactive-eval "(require 'dev)(dev/reset)"))

(global-set-key (kbd "C-x C-j") 'cider-reset)
This snippet lets me start a bunch of repls up at once:
(defun cider-init ()
  (interactive)
  (find-file "~/a/project.clj")
  (call-interactively 'cider-jack-in)
  (find-file "~/b/project.clj")
  (call-interactively 'cider-jack-in)
  (find-file "~/c/project.clj")
  (call-interactively 'cider-jack-in-cljs))

(global-set-key (kbd "C-x C-y") 'cider-init)

👀 2
Zmicier Misiuk10:03:14

Hi there! I'm trying to working with cljs repl and clj (deps.edn and shadow). I found that there is cider-merge-sessions variable. How I can use this, can't find any doc.

Carlo12:03:24

When I want to start a repl in a remote machine, I issue:

$ /nix/store/yv4mc9dn4bs6hb4h6lsq345dnpgrv0xg-clojure-1.11.1.1224/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "1.0.0"} cider/cider-nrepl {:mvn/version "0.30.0"} refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
Is there a way to specify a particular port instead of getting a random one?

Carlo12:03:56

Found it, I have to create an .nrepl.edn file with content:

{:bind         "localhost"
 :port         12345}

jkxyz12:03:53

You can also pass the --port arg in the main-opts

dpsutton13:03:13

I suspect you can just pass them as args at the end of the command as well.

bozhidar15:03:27

Yesterday I released CIDER 1.7 (https://github.com/clojure-emacs/cider/releases/tag/v1.7.0), but I forgot to announce it. facepalm Enjoy!

❤️ 30
hifumi12317:03:40

autocompleting lexical bindings in cljs is a great addition -- looking forward to using it today 😁

practicalli-johnny17:03:04

What is cider-jack-in-dependencies used for? I haven't been able to find anything in the cider docs. I assume it's different to cider-clojure-cli-aliases

dpsutton18:03:22

cider-jack-in-dependencies is a variable defined in 'cider.el'.

Its value is (("nrepl/nrepl" "0.9.0"))

List of dependencies where elements are lists of artifact name and version.

💯 2
vemv20:03:52

More broadly it's for adding stuff necessary for cider itself to work, e.g. cider-nrepl, refactor-nrepl (if using clj-refactor), piggieback (if using cljs), enrich-classpath (disabled by default)

dpsutton18:03:33

c-h v cider-jac-in-dependencies

frozenlock20:03:18

When using CIDER with a cljs REPL, my namespace keeps getting reset to cljs.user. Does it ring a bell? I found a very old issue describing the problem, but apprently it's been fixed years ago. https://github.com/nrepl/piggieback/issues/33

frozenlock20:03:56

This only happens when I set the namespace using cider-repl-set-ns (via C-c M-n M-n)

frozenlock20:03:19

Manually selecting it (ns my.ns) will make it stay

frozenlock20:03:28

Here's how it looks when it automatically switches back to cljs.user:

my.ns> (+ 1 1)
2
cljs.user>

hifumi12321:03:13

I'm unable to reproduce this issue with CIDER 1.7.0 and shadow-cljs 2.22.2 running on Emacs 28.2

frozenlock21:03:32

CIDER 1.7.0 Emacs 28.2 figwheel-sidecar 0.5.20

hifumi12321:03:57

I want to say this is probably a bug with figwheel then

hifumi12321:03:46

Actually, are you using figwheel or figwheel-main? IIRC figwheel-sidecar is a middleware for the former, and figwheel has been deprecated in favor of figwheel-main I think

frozenlock21:03:24

Figwheel, the project only requires sporadic maintenance and wasn't worth the migration.

frozenlock21:03:42

And if the problem is not with figwheel and I do migrate, I'll be a sad panda 😞

hifumi12323:03:15

Doesn’t hurt to make an empty folder, npx shadow-cljs init , then M-x cider-jack-in-cljs 😉

frozenlock23:03:52

> cider--update-jack-in-cmd: The npx shadow-cljs executable isn’t on your ‘exec-path’

frozenlock23:03:06

Hmmm... I installed it with npm install -g shadow-cljs

hifumi12323:03:08

What is the output of (executable-find "npx") in IELM?

hifumi12323:03:52

This is basically a PATH issue and Emacs doesnt seem to know the directory where global NPM packages are installed