Fork me on GitHub
#cider
<
2015-10-13
>
reefersleep13:10:07

Is there any reason that cider can only eval the sexp immediately before the point? When outputting to minibuffer, that is. In vim-fireplace, I could just stand somewhere inside a sexp and have it be evaluated. I find it a bit awkward that, for example, for the last sexp in the file, I have to create whitespace immediately after, just to eval it.

reefersleep13:10:32

Or does Cider have a different way to eval to minibuffer that I cannot find?

chipf0rk13:10:06

Maybe sometimes you'd want a single expression inside a sexp evaluated?

chipf0rk13:10:39

Something to eval the "parent" would be useful though, that's right - but you could write something in Elisp using Paredit+Cider for that

chipf0rk13:10:35

On your last point... I'm not sure why you'd need that, jumping to the end of the file will put point behind the last character, not over it, right?

reefersleep13:10:03

let's say that this is the end of my file: (* 5 (+ 2 1))

reefersleep13:10:22

If I bring the point to the very end, I will be standing on the last )

reefersleep13:10:52

Now, if I eval to minibuffer here, I will receive the result "3", as I am evaluating the sexp before the point

reefersleep13:10:08

When what I wanted was to eval the entire thing.

reefersleep13:10:53

Nothing wrong with evaluating a nested sexp - I could do that the same way with vim-fireplace.

reefersleep13:10:19

Guess it's a config thing, I've got Spacemacs installed

chipf0rk13:10:00

then that's probably the issue here

reefersleep13:10:56

But (currently) I still find it a bit awkward. If I wanted to eval the entirety of ( 5 (+ 2 1)) with vim-fireplace, I could choose to do so if the point was on the first (, the , the space between * and 5, the 5, the space between the 5 and the second (, or on the last ).

reefersleep13:10:57

Is it just me, or does that seem... easier? Than having to navigate to after the sexp. simple_smile

chipf0rk13:10:54

I mean, what if you had (+ a b) and you wanted to eval a?

reefersleep13:10:17

Ah well, I found a way to do what I wanted to do after all - cider-eval-defun-at-point. My bad! simple_smile

chipf0rk13:10:47

oh, that's the top level form - I thought you meant the current parent form

reefersleep13:10:08

Well @chipf0rk , I am not sure - I haven't had the need yet. I'm just a newbie sparetime Clojure dabbler simple_smile

reefersleep13:10:31

Ah no. I don't think I meant that x)

chipf0rk13:10:04

my point is that it can be useful to depend directly on where point is and eval anything inside sexps, including things like just vars

chipf0rk13:10:18

which is what C-x C-e gives you

reefersleep13:10:46

All of the emacs/lisp terminology is perhaps a bit overwhelming for me at the moment simple_smile Being new to both emacs and lisp, and having English as a second language. So I might misunderstand some things.

reefersleep13:10:37

I see your point 😉 That's definitely handy.

reefersleep13:10:31

Hm, but still - couldn't that be on the point rather than after?

chipf0rk13:10:55

Don't worry, I'm an Emacs noob too... The whole system of different terminology for things like cursor, window, ... certainly doesn't help

reefersleep13:10:59

Sorry, *rather than before.

reefersleep13:10:09

Or is it on the point in your configuration?

chipf0rk13:10:14

It could be, but it isn't ;) I personally prefer that I think

chipf0rk13:10:16

No, it's after.

reefersleep13:10:43

Hm. I bet I'll get used to it. It just seems weird that I can shoot stuff with my gun, I just have to remember to aim next to the thing that I want to shoot rather than right at it x)

chipf0rk13:10:45

If you're inside a sexp and want to jump behind it, you can use Paredit's C-M-n

chipf0rk14:10:33

I guess if you come from vim, it's a bit of a change that the cursor being "on" something is more like being "before" it

reefersleep14:10:34

What's the command called? (I don't have Paredit, but perhaps I have an equivalent)

chipf0rk14:10:48

paredit-forward-up

reefersleep14:10:17

Can't find an equivalent as of now (using lisp mode)

reefersleep14:10:35

Anyway, thank you simple_smile

reefersleep14:10:49

I'll have to experience more.

chipf0rk14:10:02

No problem, have fun :)

jeremyraines14:10:28

I’m trying to get going with emacs and cider via spacemacs. When I try to send my buffer to cider in a clojurescript project, I get this error: No such var: clojure.core/require-macros

malabarba15:10:25

jeremyraines: Soundes like you're connected to a plain clojure repl

jeremyraines15:10:24

yeah, someone pointed out to me the limitations re: clojurescript

malabarba15:10:56

Well, this specifically is not really a limitation. You just didn't start the cljs repl :)

malabarba15:10:17

You need a cljs repl. There are many different ones, but if you have a look at the CIDER readme there are a couple of suggestions

malabarba15:10:29

The easiest one is rhyno

jeremyraines15:10:01

thanks @malabarba, I’ll check that out

malabarba15:10:36

reefersleep: I guess the logic is that if you're navigating around, then placing the cursor after the sexp is no harder than placing it before. However, if you've just finished typing the sexp (which is a common case), then the cursor is already after it (and so the C-x C-e behavior is more convenient).

malabarba15:10:30

Still, if it's a top-level sexp then you can just use eval-defun-at-point anywhere (as you've already figured out)

reefersleep16:10:28

@malabarba: I can see the point in evaluating something you've just finished typing simple_smile

bozhidar17:10:52

the reasons are mostly historical

bozhidar17:10:24

I’ve opted to keep the CIDER behaviour more or less consistent with the behaviour of Emacs for Emacs Lisp and SLIME for Common Lisp

bozhidar17:10:53

they don’t really have command for evaluating the surrounding sexp

bozhidar17:10:18

or the sexp after point for that matter

bozhidar17:10:39

obviously it’s easy to implement such commands, but there hasn’t been much interest in them

bozhidar17:10:14

and as @malabarba said - it’s so easy to go to the beginning of a sexp...

bozhidar17:10:38

anyways, I’m not against adding more evaluation commands in general

bozhidar17:10:47

as long as there’s strong interest in them

bozhidar17:10:01

naturally I’d like to maintain as little code as possible simple_smile

juhoteperi17:10:23

This discussion makes me think that I should make a screencast about Vim-fireplace/sexp commands and motions simple_smile

juhoteperi17:10:47

Might be useful for users of other editors to see how it works

seancorfield18:10:22

Any input on this question I asked last night: > A question came up on the EmacsLive mailing list about cider-browse-ns since it seems not to exist, even tho’ EmacsLive bundles CIDER 0.9.1 now. Is there any documentation on how to use the namespace browser? Do you have to be in a particular mode or something?

gtrak22:10:35

Why was the change to run tests with clojure 1.8 reverted? I ask because I'm seeing some issues with the pprint ns in 1.8-beta1.

gtrak22:10:59

though it doesn't seem to be cider's fault

malabarba22:10:07

gtrak: because the tests weren't passing :-)

gtrak22:10:54

been wringing my head around `clojure.pprint.proxy$java.io.Writer$IDeref$PrettyFlush$4923d848 cannot be cast to clojure.pprint.PrettyFlush`

gtrak22:10:07

which looked like some AOT issue, but I couldn't figure it out in a couple hours.

malabarba22:10:19

that's nasty =P

malabarba22:10:46

When does it happen?