clojure-emacs / squiggly-clojure

Flycheck checker for Clojure, using eastwood and core.typed.
GNU General Public License v3.0
204 stars 25 forks source link

cider-default-connection deprecated in cider 0.18 #54

Closed pvik closed 5 years ago

pvik commented 6 years ago

Since cider has moved to sesman to handle connections to the repl, when using squiggly-clojure I am getting the following error:

Error while checking syntax automatically: (void-function cider-default-connection)

While compiling squiggly-clojure I have these messages in my *Compile-Log*

In flycheck-clojure-may-use-cider-checker:
flycheck-clojure.el:93:29:Warning: ‘cider-default-connection’ is an obsolete
    function (as of 0.18); see sesman.

In end of data:
flycheck-clojure.el:223:1:Warning: the function ‘cider-default-connection’ is
    not known to be defined.
roryhow commented 6 years ago

I had a quick investigation of this and seem to have it working by changing one of the functions in flycheck-clojure.el

(defun flycheck-clojure-may-use-cider-checker ()
  "Determine whether a cider checker may be used.

Checks for `cider-mode', and a current nREPL connection.

Standard predicate for cider checkers."
  (let ((connection-buffer (cider-current-repl)))
    (and (bound-and-true-p cider-mode)
         connection-buffer
         (buffer-live-p (get-buffer connection-buffer))
         (clojure-find-ns))))

Seems like cider's session management was updated and a lot of the API was trimmed (you can see the commit here). You can pull the repl buffer using the new cider-current-repl function rather than (cider-default-connection :no-error) which was being used previously.

I'm not involved in this project so maybe one of the maintainers wants to turn this into a PR (I'm not sure if theres other bugs introduced from the cider API refactor), but you can at least do this for a temporary fix.

pnf commented 6 years ago

Thanks for looking into this. I've merged your change, and it should make to melpa in a day or two.

divs1210 commented 5 years ago

Has this been resolved? I'm facing the same issue.

pnf commented 5 years ago

cider-default-connection has not been used since 353e6aa0b807f0126d145ac69443db1ee2b6b57c, last July. You must be using an old version.