cider icon indicating copy to clipboard operation
cider copied to clipboard

Warn the user if there's no way to eval a s-exp within cider-scratch buffer

Open Ivanknmk opened this issue 4 years ago • 3 comments

Disclaimer: I'm a noob and didn't know having a nREPL server running was a requirement to eval a sexp inside a cider scratchpad. Feel free to ignore if this isn't relevant or if it is emacs related.

Is your feature request related to a problem? Please describe. I was trying to eval a sexp within a cider-scratch buffer but it didn't work. I checked the open buffers for erros, and saw nothing. Somehow, I discovered that I had to have a nREPL server running to be able to eval. This is probably a n00b fail but thought it wouldn't hurt to suggest a small tweak to it.

Describe the solution you'd like Log a message, show a warning, warn the user somehow that a nREPL instance needs to be running as a requirement to be able to eval something inside a cider scratchpad.

Describe alternatives you've considered None... I don't have enough knowledge to actually propose a concrete suggestion or fix.

Additional context Nothing happens when SPC m e e is entered. Note: SPC m e e triggers cider-eval-last-sexp.

Screen Shot 2021-07-25 at 11 15 06

Ivanknmk avatar Jul 25 '21 16:07 Ivanknmk

That's weird, I thought all evaluation commands were showing error messages if CIDER is not connected to nREPL. I'll take a look.

bbatsov avatar Aug 06 '21 06:08 bbatsov

I believe this might have been a regression brought by the change to cider-map-repls in #2558. Currently all cider-eval-* commands fail silently when there is no REPL connected, because cider-map-repls is called interactively with a hardcoded :auto arg https://github.com/clojure-emacs/cider/blob/9bc6a18f94bcce7d6412649b0aeffe588c4844fa/cider-eval.el#L956 which passes ensure = nil in the call to cider-repls, disabling the check and error messages when no REPLs are present. https://github.com/clojure-emacs/cider/blob/3eff4f9b10f9b748d752ff70a68b0ffa3be06419/cider-connection.el#L910

I don't quite understand the change in that PR, maybe it was an overcorrection that caused the check to be always disabled instead of that specific case of loading multiple clj(s/c) files.

yuhan0 avatar Apr 30 '22 16:04 yuhan0

Yeah, that's definitely a regression that we'll need to address.

bbatsov avatar Apr 30 '22 19:04 bbatsov