Fork me on GitHub
#cider
<
2023-07-24
>
Breno Barreto12:07:33

With elisp, how do I print a dict response on the repl? 🧵

Breno Barreto12:07:03

I'm trying to build the following function:

(defun generate-mock ()
  (interactive)
  (let* ((sym (symbol-at-point))
         (current-ns (cider-current-ns))
         (require-code "(require '[common-test.generators :as gen])")
         (generate (concat "(gen/without-generated-keys (gen/generate " current-ns "/" (symbol-name sym) "))")))
    (cider-nrepl-sync-request:eval require-code)
    (let ((resp (cider-nrepl-sync-request:eval generate)))
      (cider-repl-emit-interactive-stdout (nrepl-dict-get resp "value")))))

Breno Barreto12:07:52

But cider-repl-emit-interactive-stdout seems to return "Wrong type argument: number-or-marker-p, nil"

vemv12:07:08

(nrepl-dict-get resp "value")
is returning nil grab the whole dict e.g. (setq debug1 resp), then inspect it in the elisp repl (ielm)