Anyone else gets annoyed with Cider?


#1

Disclaimer: rant incoming

Before I switched to Cider, I was using CounterClockWise. To this day, I still much prefer its UX.

The way what you eval doesn’t eval in the REPL buffer. How errors show up as a new buffer. Everything popping up in a new buffer really annoys me to be honest. Why can’t doc show up in the REPL buffer, or macroexpand, etc.

I also wish it was eval sexpr at point instead of eval last sexpr. And that it could auto complete function arguments.

I actually much prefer inf-clojure in that way, but it lacks more advanced features unfortunatly.

So, while I got used to Cider, I wish there was something simpler, more straightforward, which still supported the advanced features of Cider.

Anyone else feels this way?

P.S.: I’m very grateful for Cider though.


#2

Hi Didier

First of all I do not know CounterClockWise and it’s workflows.

Not sure if I understand you right but popping up error messages in Cider could be controlled by the variable cider-show-error-buffer.

(setq cider-show-error-buffer 'only-in-repl)

After setting this variable to only-in-repl it should not pop up error messages. It will only be shown in the REPL.

If you do not want to pop up ein documentation window for showing the doc-buffer for a given function, you could add a function which looks something like (not tested):

(defun cider-show-doc-in-repl (doc-str)
   (interactive
      (list (read-from-minibuffer "Doc for: " (thing-at-point 'symbol))))
   (let ((cider-buf (car (cider-repl-buffers))))
      (switch-to-buffer cider-buf)
      (end-of-buffer)
      (insert (format "(doc %s)" doc-str))
      (cider-repl-return)))

For macroexpand I am sure you can write a similar function. You can use e.g. cider-eval-region in combination with expand-region for evaluating.

What features do you exactly miss about inf-clojure?

The nice thing in Emacs is that you can extend it exactly to your workflow. I hope this helps a bit for you to configure your ‘perfect’ workflow within Emacs/Cider/inf-clojure!

br
\= odi


#3

The result of cider-eval-last-sexp (C-x C-e) displays in the buffer you’re working in, not a new temporary buffer.

cider-eval-defun-at-point (C-c C-c) evaluates the top-level sexp at point, is that what you mean?

Could you be more specific about what you want? CIDER integrates with company-mode.

So you want something simpler…that also has advanced features. :thinking: The problem is that “simple” for you might be complex or annoying for me. Or the basic features I want are, to you, “advanced”. CIDER has to support many different workflows.

I wonder if some digging in the documentation could get you to your ideal workflow. I certainly don’t know all the customizations available.


#4

Thanks for the suggestions, I guess I can probably spend some time to customize things to my liking.

I’ll try your suggestions @odi abd report back.

Right, I wish it displayed in the REPL buffer also.

I want something that eval sexpr at point, not the top level sexpr.

When writing a new function or macro, the arguments don’t autocomplete for me. Maybe I have something misconfigured.

I guess I meant the UX to be simpler. You’re right though, its possibly a personal preference.

Thanks for the help


#5

I fixed exactly this problem!

These three defcustoms will help you

(setq cider-invert-insert-eval-p t)                        ;; 1
(setq cider-switch-to-repl-after-insert-p nil)             ;; 2
(setq cider-eval-toplevel-inside-comment-form t)           ;; 3

I’ll explain them in turn.

  1. There was already some commands that would insert the current-sexp/defun/last-sexp/etc into the repl, but by default it would throw your cursor into the repl and not eval it. So This first one automatically causes it to insert the form into the repl and then eval it for you. Check out the map which is defined at C-c C-j. you’ll find d, e, r, and one other for defun expression and region.
  2. Don’t switch to the repl after running one of these insert commands. I, like you, like eval-ing code and seeing the repl contain a history of what i’ve done, similar to the way cursive works. When you use this it won’t plop your point back in the repl. So the combination of these two is to print a form in the repl and then eval that form there without dragging your cursor from where you currently are.
  3. Often people use (comment (form) (form) (form)) for interacting with the repl. I modified what “top level defun” is to be aware that if things are in a comment form find the form underneath the comment form and use that. Previously if you evaled this form you would just get nil back from the comment form. Now you will be able to get the top level form inside the comment form. Combined with the previous two options of inserting and evaling in teh repl it is quite nice. This was a feature request from Tim Baldridge and has really been nice.

For more info see the PRs for 1 and 2 here: https://github.com/clojure-emacs/cider/pull/2319 and for 3 here: https://github.com/clojure-emacs/cider/pull/2323.

I was hoping to see some more information in the docs but I can’t find it now (https://cider.readthedocs.io/en/latest/). I’ll update that when I have a chance.


Cursive vs Cider
#6

Try inf-clojure, combined with tool.deps has been a solid workflow for me.


#7

I just added those settings to my cider configuration, refreshed my snapshot version of cider and it worked like a charm. This is awesome, thank you!


#8

Thanks for the topic and answers!


#9

Thanks everyone for your tips. Turns out Cider is highly customizable, and after using it some more and tweaking things with people’s suggestions, it works pretty much how I want.