Fork me on GitHub
#spacemacs
<
2017-10-28
>
ag01:10:05

alright... sorry for the rant. I think I got it. preamble: This is applicable for Spacemacs, and maybe to some degree to non-Spacemacs configs. "go-to-definition" or `g d` and `, g g` in Clojure modes for Spacemacs don't work reliably. `g d` works only and only if you are jacked-in. But even then it doesn't work in cljs, cljc files, cider-repl. and sometimes it prompts for the symbol (it simply wouldn't recognize it) - stupid thing so, solution? Maybe for whenever cider cannot jump to a definition is to use `dumb-jump` ? it is stupidly simple and works in most cases But that turned out to be not so trivial to set the way so it would work in Spacemacs. Here's how I did it:

``````(defun clj-find-var ()
"Attempts to jump-to-definition of the symbol-at-point. If CIDER fails, or not available, falls back to dumb-jump"
(interactive)
(let ((var (cider-symbol-at-point)))
(if (and (cider-connected-p) (cider-var-info var))
(unless (eq 'symbol (type-of (cider-find-var nil var)))
(dumb-jump-go))
(dumb-jump-go))))

(dolist (x '(spacemacs-jump-handlers-clojure-mode
spacemacs-jump-handlers-clojurec-mode
spacemacs-jump-handlers-clojurescript-mode
spacemacs-jump-handlers-clojurex-mode
spacemacs-jump-handlers-cider-repl-mode))
(set x '(clj-find-var))))``````

eggsyntax01:10:27

@ag sweet, I'll give that a try for myself. Wouldn't surprise me if the spacemacs folks would really appreciate that as a PR.

ag01:10:30

yeah, I will try to get it out, maybe someone smarter than me can help me to fix it better

eggsyntax01:10:00

Works perfectly so far, and initially seems faster than `jump-to-definition`

eggsyntax16:10:00

Should have named it `jump-of-indeterminate-intelligence` 😆

ag16:10:24

`intellij-gloat-killer`