Anyone else gets annoyed with Cider?

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: Feature/insert map by dpsutton · Pull Request #2319 · clojure-emacs/cider · GitHub 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.

10 Likes