Fork me on GitHub

Talking about documentation, maybe slightly related: I just found that my JDK sources folder was wrong and had to jump through a few hoops to set it right. In case anybody is interested, I documented what I found here:


If I get it right this should also gimme better javadocs for some stuff? Not sure... but jumping to source is for sure really useful 🙂


I tried your advice and this gives me access to Clojure sources but unfortunately it doesn't work with JDK sources for some reason. I added tha java.base module subpath but still nothing:

("~/workspace/clojure/clojure/clojure-1.10.1-sources" "~/workspace/java/jdk-sources/jdk-14-src" "~/workspace/java/jdk-sources/jdk-14-src/java.base" ...)


Oh, no - I was too optimistic - It doesn't work for clojure sources either. It's just that I added clojure source artifact directly to my project.clj in one particular project; but it doesn't work without this in another project


got it, sorry to hear that


perhaps there's a way you can instrument cider.el to print the paths it is using to look for the sources


That's an interesting tip. Without going through the whole machinery I tried this in ielm and that looks good:

(cider-resolve-java-class "java.lang.String")


I'm trying cider-find-var and also jump-to-definition but neither one works (while it works for Clojure sources when I add them as a dependency in project.clj)


I suspect it's something broken with JDK 8+ but your trickwith adding java.base subdirectory looked promising...


Ouch, so it works only in stacktraces! That's indeed where I've found the only reference to cider-resolve-java-class : @U051BLM8F is that intentional?


what version of cider is this?


bah, I'm sure you are using a recent one 🙂


Yes, I updated it the last week


Using Evil in spacemacs, I fail to evaluate top level forms using C-c C-e when in command mode, because i can't place the cursor outside the closing paren. I need to be in insert mode. Is there something I can do about it?


I don’t remember its name but there’s a setting which allows you to move the cursor beyond the last column in a row


It's evil-move-beyond-eol - this is what I have in my .spacemacs file:

;; evil-move-byond-eol true will alow you to move one position after the last char
  ;; which makes evaluation of Clojure sexps with Cider much more convenient
  (setq evil-move-beyond-eol t)


@U0ETXRFEW Why do you need to go to the end of a line to evaluate an expression? cider-eval-defun-at-point will evaluate the top-level form under the cursor. Or simply go to next line and evaluate the last sexp using cider-eval-last-sexp Also not sure why you are using Emacs keybindings if you are using Evil? In spacemacs you have , e f , , e e , , e ; and many more useful keybindings that dont require any changes to the way Evil works.


@U05254DQM it is all I remember from my short endeavour with Emacs some four years ago. 😃 That and M-x which I use for discovering commands. Is there a spacemacs equivalent?


(I only very seldom use Emacs, and only to investigate how something works there, since it is a source of Calva inspiration.)


SPC SPC is the Spacemacs M-x in Evil mode, or strangely enough M-x in Emacs (holy) mode. It did take me a while to learn Evil and get the most out of it, but its definately been worth it.


I use Evil in order to be able to do anything at all in Emacs. 😃


I am at the same point as well, I am lost without Evil. C-x C-e is the only Emacs shortcut I can remember, as I used it so much :)


If you want to know the Clojure commands in Spacemacs, just press , with a Clojure buffer open and you will get a which-key menu which has the command names organised by what they do 🙂


Cool! (A somewhat equiv in Calva is cmd+shift+p then type Calva, FYI, in case you get to help some Calva users.)


For me, cider-eval-last-sexp is quite useful to evaluate and that's what I use the setting for.


Emacs can be configured to do anything. It just seems a little strange to modify the behaviour of Evil when there are plenty of alternatives built in for evaluating Clojure. Evaluating the last sexp is great for nested expressions. It seems strange to jump to the end of a top level and then move past the end of the expression just to eval the top level, when you have , e f. When using Evil, then jumping to the next empty line after the top level is typically less keys than jumping past the end of expression on the same line. Of course you should use what ever works for you though, this is one of the benefits of Emacs.


I personally use cider-eval-sexp-at-point, which lets me eval from the beginning from the form rather the end. I'm using the vim keybindings so I just bound ; to eval this. Move the cursor to the first paren of the thing I want to eval, then hit ; and boom, it's eval'ed The config to do this goes in dotspacemacs/user-config

(evil-define-key 'normal clojurescript-mode-map ";" 'cider-eval-sexp-at-point)
  (evil-define-key 'normal clojure-mode-map ";" 'cider-eval-sexp-at-point)


@U0MF00YRX that command is already bound to , e v in the Clojure layer, assuming you are on a recent develop branch, along with several others commands that were missing. , e ; is already bound to cider-eval-defun-to-comment to match Spacemacs conventions.


Oh nice - I just mean use ; without even using , e , e ; actually will still work for eval to comment. Maybe there's a stock vim keybinding I'm breaking by overriding ;? I personally really like it, it's nice to be able to eval things with one keystroke


Oh, by default vim apparently uses ; to navigate to your most recently searched character from a f or t motion. So I guess I can't use that with my change, but this seems more useful to me.


Ah, ; works the same in Spacemacs, that's handy. I never knew that, thanks.


When running both CLJ and CLJS connections, I find that sometimes a code buffer reports ‘not connected’ or seems to drop the connection. This happens most often with CLJS, but sometimes with CLJ as well. The workaround is to open the REPL buffer and then go back to the code buffer, an CIDER generally has re-connected the buffer to the backend.


I should add, the CLJS connection is shadow, if that matters.


i don't think it matters. due to a limitation in the api of sesman CIDER only knows about the last connection. So when the clj repl last had focus the cljs code buffer thinks the repl type is clj and therefore not connected. you should see similar behavior if you have the cljs repl focused and a clj code buffer opened.


Ah! ok, good to know.


Yes, that’s exactly what I see.