Fork me on GitHub
#cider
<
2018-03-29
>
ajs07:03:03

According to https://cider.readthedocs.io/en/latest/interactive_programming/ there are two cider functions both called cider-eval-defun-at-point but with different keyboard shortcuts and a different explanation for their functionality. I assume this is a doc error?

ajs07:03:38

One of them does a "walk through its evaluation" and the other doesn't -- what does "walk through its evaluation" mean?

bozhidar09:03:25

@ajs No, that’s not a mistake - one function that does different things with and without a prefix argument. Perhaps we should merge the two descriptions, though.

ajs10:03:34

@bozhidar thanks for clarification

pez10:03:13

I’m building an extension for Clojure support in VS Code, using cider-nrepl. Is there a place where the various ops are documented? Right now I’m trying to figure out if there is a way to switch namespace without evaluating something like (in-ns 'foo.bar). But generally I find I am often in the wrong project digging around in the code.

dominicm10:03:22

the docs don't really exist

benedek11:03:17

@kingmob thinking if you override the source dirs for the repl profile to exclude your test dirs, would perhaps do the trick

benedek11:03:25

assuming you are using lein

benedek11:03:57

with the obv. drawback that you would not be able to work with them from that repl

benedek11:03:08

i also realised the middleware has such a config option

benedek11:03:26

but the client side of this stuff is not done 😕

pez11:03:04

@dominicm: Many thanks! How complete do you think that is? It seems quite tiny. And I don’t see eval or pprintthere. (I’m still hoping there is an op for switching namespace 😄)

dominicm11:03:29

eval is from tools.nrepl itself

dominicm11:03:50

pprint isn't an op, it's an extra flag to eval, I haven't documented that here.

pez11:03:48

It also is an op, somewhere, my extension is using it for formatting code.

pez11:03:02

I didn’t build the connector in the extension, so not very familiar with how it works. But looking at it it seems that it sends all ops over the same socket. I wonder how it is determined which op gets handled where…

bozhidar12:03:27

@dominicm Fair point. Sooner or later we should definitely level this up.

dominicm12:03:26

@bozhidar it's a hard problem. More friction to contribution won't help either.

bozhidar12:03:28

But is there any friction to contribution when it comes to documentation?

benedek13:03:43

PR always welcome…

dominicm13:03:17

@bozhidar I was unclear, enforcing that people adding new features must write extensive documentation is more friction.

pez14:03:19

I’m not sure there is that very much needed. Once you find the right source files most things are pretty easy to understand. Speaking for myself, what I would benefit from is some kind of overview, a guide, a hand to hold while exploring. I’m pretty new to the whole Clojure world, as well as Emacs and would benefit from something that shows how the toolings fit together. And some pointers: “If you want to do this, look here.”

tbaldridge15:03:39

I'm trying out Cider again after about 4 years 😄. I'm trying to migrate over my workflow from Cursive. The main keybinding I'm missing is "send-top-level-form-to-repl". What's the cider function to do this

tbaldridge15:03:14

preferably the command would ignore comments, so

(comment
   (+ 1 2)
)
Wouldn't send over (comment ...) but send over (+ 1 2).

tbaldridge15:03:50

I found some cider commands that do this, but they seem to either be in-line or in the minibuffer, neither of which I prefer

bozhidar15:03:59

@dominicm Yeah, of course. I was mostly referring to forcing myself to documenting the ops. 🙂 Something I should probably started doing at the very beginning.

bozhidar15:03:42

@tbaldridge Let me look that up. We have a few send to REPL commands.

bozhidar15:03:55

So, we’ve got cider-insert-defun-in-repl (`defun` -> top-level-form), but it’s not bound to any key, and it’s not mentioned in the menus as well. Another failure of mine. 😄

tbaldridge15:03:13

I was going to remap it anyways so that's fine

bozhidar15:03:15

Anyways, it’s there and you can map it to whatever you’d like.

tbaldridge15:03:28

I prefer C-` for this sort of thing, thanks!

tbaldridge15:03:38

and will that ignore (comment ...) ?

tbaldridge15:03:48

if not it's no big deal, but it would be nice

bozhidar15:03:18

It doesn’t do anything fancy with comment, though. I rarely use it, so it never crossed my mind to drop it something like this. Obviously doing this won’t be hard. 🙂

bozhidar15:03:50

Please, file a ticket about it and me or someone else from our team will take a look at this.

4
bozhidar15:03:20

P.S. Nice to see you back in Emacs-land! I hope you’ll like the progress we’ve made over the past 4 years. 🙂

tbaldridge15:03:14

Interestingly it does work, although I get an additional prompt: "No comment syntax is defined. Use: "

tbaldridge15:03:47

If I hit enter it ignores the comment and inserts the top level form I'm hovering over.

bozhidar15:03:37

> Interestingly it does work, although I get an additional prompt: “No comment syntax is defined. Use: ”

bozhidar15:03:22

That’s odd. Doesn’t happen when I try it. Such an error must be some unexpected interaction with clojure-mode. You might want to file a ticket about this problem as well.

tbaldridge15:03:09

yeah it was, clojure-mode was off so it grabbed from the start of the line

bozhidar15:03:54

OK. Glad to hear you sorted this out quickly!

richiardiandrea15:03:08

@bozhidar talking 'bout top level forms, I have an elisp function that brings the cursor at the top of the file but after the first sexp so that I can evaluate it (inf-clojure of course). Useful for evaluating the ns form with two key bindings. Is there a better way?

bozhidar15:03:34

clojure-mode already has a function that returns the ns form - I’d simply use it and pass the result to the REPL for evaluation.

richiardiandrea15:03:59

Uhm interesting. Yeah well that is an option I haven't considered. Cool thanks

richiardiandrea17:03:57

@bozhidar ok I thought the ns form was returned, clojure-find-ns only actually finds the symbol of the ns form

richiardiandrea17:03:23

my case is a bit more involved as I want to evaluate the first form of a file (typically the ns form)

bozhidar17:03:41

Yeah, yeah.

👍 4
bozhidar17:03:56

I guess we had this code in CIDER then. It’s certainly somewhere.

bozhidar17:03:18

I remember writing it, I don’t remember where exactly did I do it. 😄

richiardiandrea17:03:21

kk cool I was asking because it might be a nice addition to clojure-mode (maybe)

ajs20:03:20

@tbaldridge The interesting point of your story is why you are migrating back to Emacs from cursive? Seems that most people go the other way, and I also was thinking of moving over to cursive, so would enjoy your perspective

tbaldridge20:03:13

@ajs, I more said I was thinking about it

tbaldridge20:03:26

my team uses emacs, so I was trying it out

dpsutton22:03:22

i got to meet a few of your team in new orleans. super cool people

Michael Fiano22:03:09

So very frequently when using the CIDER REPL, it freezes my Emacs for anywhere from 10 seconds to infinity. This last freeze left me losing a few hours of work. Not even pkill -SIGUSR2 emacs would unfreeze it. I managed to capture this with the Emacs profiler: https://files.lispcoder.net/images/screenshots/img-20180327102725.png

xiongtx00:03:54

Can you save the profiler buffer and upload as an attachment? Also open an issue against CIDER if you can.

didibus23:03:41

Any way to format a long single line clojure map or vector so that it becomes multi-line?

didibus23:03:45

pretty-print style?