Fork me on GitHub
#cider
<
2021-10-06
>
didibus04:10:02

Anyone getting: > nrepl-send-sync-request: Sync nREPL request timed out (op macroexpand expander macroexpand-1 code ... After upgrading to latest Cider?

vemv06:10:38

Resolution was to use cider-nrepl latest (0.27.2), it fixes this and other nasty issues related to *out* handling

vemv06:10:38

Resolution was to use cider-nrepl latest (0.27.2), it fixes this and other nasty issues related to *out* handling

lambdam09:10:49

Hello, I set up Emacs and Cider on a new computer and I can't figure how to activate the feature that when typing a short version of a namespace that has been already declared in another file (example [myproject.utils :as utils] ), the require entry is automatically added to the ns form. I looked into the clojure refactor options, found an entry for common namespaces (like io) but not for namespaces specific to the project. Thanks

vemv11:10:01

The answer has two parts :) For well-known aliases such as io , the list is static and the feature is controlled by these two variables: https://github.com/clojure-emacs/clj-refactor.el/blob/9e1f92033449a4abc6218ce31670d89e3e6a4dc5/clj-refactor.el#L67-L91 Personally I expand cljr-magic-require-namespaces with a few more entries of my liking

vemv11:10:44

Now, for dynamic alias completion depending on a specific project's used aliases, the feature is called cljr-slash . As the name suggests, it's good to bind it to the / keyboard shortcut if it's not already

lambdam15:10:24

Thanks for the info. The cljr-slash doesn't seem to work on my fresh Spacemacs install. When I type a short version of a namespace and the M-x cljr-slash , the slash is added but the namespace is not added to the ns form, while it is on my older Emacs installation (on my laptop).

vemv16:10:15

what versions of clj-refactor.el and refactor-nrepl are you running?

lambdam16:10:27

clj-refactor: 20211004.908 refactor-nrepl: 3.0.0-alpha12

lambdam16:10:38

Fresh install

vemv16:10:05

Lein or deps.edn?

vemv16:10:52

What does this return in a clojure repl? (@(requiring-resolve 'refactor-nrepl.ns.libspecs/namespace-aliases))

lambdam16:10:19

{:clj
 {sh (clojure.java.shell),
  t (tick.core clojure.test),
  x (net.cgrand.xforms),
  set (clojure.set),
  d (datomic.api)
  ... (namespaces from my project and more)
  },
 :cljs
 {x (net.cgrand.xforms),
  set (clojure.set),
  p (promesa.core),
  ... (namespaces from my project and more)
  }}

lambdam16:10:33

The correct list of namespaces

vemv16:10:42

So the 'backend' looks good Most likely the 'frontend' has an issue. Here is the list of recent commits https://github.com/clojure-emacs/clj-refactor.el/commits/master , you'll note there are a couple ones touching clj-slash Personally I'm maintaining the backend, but run a forked version of clj-refactor.el so my knowledge doesn't apply directly there. I would check if this condition successfully returns a truthy value: https://github.com/clojure-emacs/clj-refactor.el/blob/9e1f92033449a4abc6218ce31670d89e3e6a4dc5/clj-refactor.el#L2018-L2027 i.e., place the cursor right after a slash, press M-: (per https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html), and paste that (and ... sexpr. What does it return for you?

lambdam17:10:22

I did C-x C-e after the and parenthesis (to eval inline). It indeed returns an error :

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 0)
  replace-regexp-in-string("\n" " " nil)
  cljr--keywordp(nil)
  cljr--in-keyword-sans-alias-p()
  ...

lambdam17:10:01

Also, thanks for the debugging time.

vemv17:10:18

same :) you don't know how valuable this is for all of us cider

vemv17:10:22

so it seems easy at this point, is it for you? cljr--in-keyword-sans-alias-p appears to be the culprit, surely you can make it "nil-safe". I'd guess (cider-symbol-at-point) returning nil?

vemv17:10:13

I have to log off. My suggestion would be to replace (cider-symbol-at-point) with (thing-at-point 'symbol) , re-eval the surrounding defun and see if that works. Regardless of the outcome, feel free to share the problem / your findings over a GH issue. Most likely we'll commit a fix that would be made available very quickly.

lambdam08:10:03

Hello @U45T93RA6 I also had to log off yesterday night. I tried (cider-symbol-at-point) and it seems to work well. It returns the symbol at point surrounded with quotes:

student|
;; M-: (cider-symbol-at-point)
returns
"student"
(cljr--in-keyword-sans-alias-p) returns nil

lambdam08:10:24

Do I open an issue with those informations or are there more things to check?

lambdam08:10:29

Arff, I updated the packages since I saw that there was a new version of clj-refactor and now helm is broken

Error (use-package): helm/:config: Invalid read syntax: ")"
I'll use my .emacs.d from my laptop meanwhile and check later if the clj-refactor bug is still there.

lambdam09:10:44

Arff again. The version of Emacs is not the same so Spacemacs reinstalls all the packages at their latest version. 😞

👀 1
Frederico Benevides20:10:32

Hi all. I'm getting this error Error: Does anyone know about this error? (nrepl-connected-hook): Error running hook "cider--connected-handler" because: (cl-no-applicable-method map-into ((right-margin 80)) hash-table)

Frederico Benevides21:10:43

Thank you. It worked!

bubblebobble 1