Fork me on GitHub
#cider
<
2017-09-12
>
norman14:09:05

Can I send clojure expressions from emacs without updating *1 *2 *3? Right now I have emacs code that does cider-interactive-eval, but doing the eval updates *1 *2 *3, which negatively impacts my REPL experience

dpsutton14:09:39

there are two sessions open for CIDER. there's the main one and a tooling one

dpsutton14:09:52

if you send your expression in the tooling session it will not update *1, etc

dpsutton14:09:10

(defun cider-tooling-eval (input callback &optional ns)
  "Send the request INPUT and register the CALLBACK as the response handler.
NS specifies the namespace in which to evaluate the request."
  ;; namespace forms are always evaluated in the "user" namespace
  (nrepl-request:eval input
                      callback
                      (cider-current-connection)
                      ns nil nil nil t  ; tooling
                      ))

dpsutton14:09:55

if you look at nrepl-send-request, you'll see the last parameter is tooling controls this line in the ultimate nrepl send off function, nrepl-send-request

(when-let ((session (if tooling nrepl-tooling-session nrepl-session)))
      (setq request (append request `("session" ,session))))

dpsutton14:09:44

so however you want to do it, if you correctly set this var you can send forms without affecting the results

norman14:09:09

Thanks -I’ll try this out

pwrflx21:09:43

I'm using cider, but miss some features from IDEs 😞 eg. immediate highlighting of problematic code (eg wrong arity), or when the cursor is on a parameter, I'd like to have it highlighted where the parameter is used and such things.. any tips?

pwrflx21:09:11

@jmayaalv thx, I'll take a look