cursive 2025-08-07

Is there a way to get an nREPL port from inside the running Clojure process of the REPL?

if you have access to the server handle you can get it via :port, where this handle lives kinda depends on what/how it was started 😛

➕ 1

that's... kinda helpful?

in my case I will probably have started the nRepl from Cursive

a quick googling yielded this: https://stackoverflow.com/questions/77364142/how-do-i-get-the-nrepl-port-for-a-running-repl this indeed works, for a local repl at least:

(slurp ".nrepl-port")
=> "56323"
otherwise im thinking something like this should work, but it doesn't:
(-> nrepl.middleware.interruptible-eval/*msg* :transport
    (nrepl.transport/send {:op "describe"})
    (nrepl.transport/recv 500))

(slurp ".nrepl-port") facepalm of course! thank you.

Hi, Intellij hangs after evaluating functions with long string output. Does it happens to anybody else?

Yes, I run into this but the output must be very large for the hang to be noticeable

Yeah. I slurp something and it completely hangs

I finally read through Cursive’s indentation options and found them very thoughtful. If I understand correctly: • Indent = no special rules (2-space indentation) • Function = function call (all lines indented to the first argument) • = any line carrying the first n arguments are indented to the first argument, the rest are indented to: ◦ 2-space if the n+1 argument is on its own line ◦ indented to the n+1 argument if not • Indent is an alias of 0 (oops, wrong if any args are on the first line) • Function is an alias of (oops, also wrong if multiple args are on the first line)

1

not having editor-independent tooling is causing social tension again in our company, because now the AI generated code has its own style too, which leads to lots of whitespace diffs in git commits. so i don't care too much about the actual choice of rules, as much as i care about the consistency. otherwise i also like tonsky's rules, though it results in some serious eye sores sometimes, so i don't mind some more complexity in the pursuit of better aesthetics.

I'm planning to implement standard-clojure-style in Cursive, except without the ns organisation which Cursive already implements using IntelliJ's Organise Imports feature. I believe it's possible to also get it to do that automatically on reformat, which would mean that you'd get basically the same behaviour.

I think these are the actual rules: • Indent (no special rules): ◦ any line => 2-space indent • Function (function call): ◦ if a line starts with arg 1 => 2-space indent ◦ any other line => hang to arg 1n (special rules): ◦ if a line starts with arg 1 => 2-space indent ◦ if a line starts with arg 2 ≤ i ≤ n => hang to arg 1 ◦ if a line starts with arg n+1 => 2-space indent ◦ any other line => hang to arg n+1

👍 1

cc @chrisoakman ^ These are cursive’s formatting rules if you want to consider for standard-clojure-style. Cursive can indent custom macros using any of the three types of indentation above. I believe this is based on the style/indent standard used by both cider and clojure-mode on emacs, though I’m not sure if they differ in implementation. You’ve probably already looked at it though?

there's also a related setting