Fork me on GitHub
#cider
<
2023-11-29
>
Jim Newton14:11:10

What is the correct way to jump to definition in cider? My M-. is bound to xref-find-definition

vemv14:11:55

cider by default integrates with xref, which is idiomatic but also occasionally complex, if there are other 'backends'. defcustom cider-use-xref t controls M-. behavior. Set it to nil, restart emacs, and the xref machinery will be skipped

Jim Newton14:11:39

hmmm. I haven't restarted emacs for 6 months.

👏 3
🤪 2
❤️ 1
😆 1
fvides14:11:49

Now I'm curious: what are the advantages or disadvantage of xref and the other backend?

vemv14:11:52

does that mean you also are running an older cider? cider<->xref integration had some bugs, fixed this summer

Jim Newton14:11:00

Debugger entered--Lisp error: (wrong-number-of-arguments #f(compiled-function (symbol standard doc &rest args) #<bytecode 0x40099fb3>) 2)
  #f(compiled-function (symbol standard doc &rest args) #<bytecode 0x40099fb3>)(cider-use-xref t)
  macroexpand((defcustom cider-use-xref t) nil)
  macroexp-macroexpand((defcustom cider-use-xref t) nil)
  macroexp--expand-all((defcustom cider-use-xref t))
  macroexpand-all((defcustom cider-use-xref t))
  eval-expression((defcustom cider-use-xref t) nil nil 127)
  funcall-interactively(eval-expression (defcustom cider-use-xref t) nil nil 127)
  #<subr call-interactively>(eval-expression nil nil)
  apply(#<subr call-interactively> eval-expression (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> eval-expression nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (eval-expression nil nil))
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

vemv14:11:31

> Now I'm curious: what are the advantages or disadvantage of xref and the other backend? 'backends' is xref terminology. For M-. there can be cider, lsp , ctags backends competing for priority When things go wrong, it can be a bit opaque to debug

vemv14:11:51

@U010VP3UY9X what had you tried?

Jim Newton14:11:49

M-: (defcustom cider-use-xref t)

Jim Newton14:11:14

I'm trying to update my packages and I see an error.

Compiling file /Users/jimka/.emacs.d/elpa/cider-1.12.0/cider-util.el at Wed Nov 29 15:20:49 2023

In cider-get-ns-name:
cider-util.el:123:4:Warning: clojure-find-ns called with 1 argument, but
    accepts only 0

Compiling file /Users/jimka/.emacs.d/elpa/cider-1.12.0/cider-xref-backend.el at Wed Nov 29 15:20:49 2023

Jim Newton14:11:36

is that a known issue?

vemv14:11:58

(setq cider-use-xref nil) disables xref, try that and you should upgrade clojure-mode, (and parseedn) along cider

Jim Newton14:11:48

sorry, is this upgrading an emacs melpa package, or is this updating from unix with brew upgrade?

vemv14:11:58

melpa :)

Jim Newton14:11:36

looks like clojure-mode is ok.

Jim Newton14:11:16

cider is marked as obsolete, is that normal?

vemv14:11:27

clojure-mode looks from 2020? latest is <tel:202311241721|20231124.1721>

vemv14:11:26

I'll check what that obsolence means. likely a false alarm / we have changed nothing, received zero reports

Jim Newton14:11:59

Not sure what this incompatible package is

vemv14:11:05

clojure-ts-mode is WIP, safe to skip

Jim Newton14:11:52

after upgrade, problem restarting emacs and cider-jack-in

vemv14:11:50

You need to upgrade cider-nrepl, as it says :)

Jim Newton14:11:39

emacs tells me nothing needs upgrading. I guess I need to force an upgrade?

vemv14:11:10

cider-nrepl is not an emacs package. check project.clj / deps.edn or so

Jim Newton14:11:33

nothing in project.clj that I can see.

Jim Newton14:11:39

is there something in my home directory?

Jim Newton14:11:24

I have ~/.clojure/deps.edn but everything is commented out

vemv14:11:48

~/.lein/profiles.clj ?

vemv14:11:42

or grep for 0.30.0 in your emacs dir, maybe there's some sort of remnant around

Jim Newton14:11:59

{:user {:jvm-opts ["-Djdk.attach.allowAttachSelf"]
        :plugins [[lein-license "0.1.8"]
                  [cider/cider-nrepl "0.30.0"]
                  [lein-cloverage "1.1.2"]
                  [jonase/eastwood "0.3.10"]
                  [lein-ns-dep-graph "0.2.0-SNAPSHOT"]
                  ]
        :dependencies [[com.clojure-goes-fast/clj-async-profiler "0.4.1"]
                       [org.clojure/clojure "1.11.1"]
                       [org.clojure/tools.trace "0.7.10"]]
        }}

Jim Newton14:11:09

that's ~/.lein/projects.clj

vemv14:11:32

yeah... good to upgrade! (Eastwood too)

Jim Newton14:11:37

not sure what eastwood is. upgrade to what?

Jim Newton14:11:54

cider-jack-in does not stacktrace, but still gives an emacs error.

Jim Newton14:11:04

same error even after upgrading eastwood

vemv14:11:18

your clojure-mode remains non-upgraded, should be 2023*

vemv14:11:43

(eastwood has nothing to do was simply an observation in case you are interested in using it)

Jim Newton14:11:13

sorry I don't know how to tell emacs to update a package which it thinks is up to date.

Jim Newton14:11:23

when I press shift-U it says nothing needs to be upgraded

Jim Newton14:11:08

should I delete it and reinstall?

vemv14:11:03

sounds like a good strategy :)

Jim Newton14:11:45

looks like i'm using emacs 26, I thought I upgraded to emacs 29... doing it now

Jim Newton15:11:45

upgraded to emacs 29

Jim Newton15:11:19

removed and reinstalled emacs packages cider clj-refactor clojure-mode clj-something-else

Jim Newton15:11:21

Now M-. seems to work. yipeee. thanks for the help.

Jim Newton15:11:32

I need a scotch

vemv15:11:02

here's 🥃 to another 6mo uptime!

Jim Newton15:11:10

6mo might be an exageration. an old friend of mine once advised me to restart emacs at least twice a year.

Jim Newton15:11:02

Oops. another error

Jim Newton15:11:04

stacktrace is not very helpful unfortunately

Jim Newton15:11:59

and now M-. no longer works

vemv15:11:59

perform (require 'cider) somewhere early in your init file

1
Jim Newton16:11:16

yes, some code somewhere depends on cider-mode, but does not require it.