Fork me on GitHub
#cider
<
2020-06-16
>
practicalli-johnny10:06:01

@drewverlee I have just tried cider-eval-all-files from the project-name/src directory and it does load in new definitions (Edit: it does not unload stale definitions). I tested this function using the latest Cider 0.25 with Spacemacs and a deps.edn project. It does seem to run in the background if used on a larger project or code that is long running, so its not tying up Emacs. It fails if the code doesn't compile though, but I would expect that :) cider-ns-refresh is what I would probably use if I wanted to refresh all the code in the REPL

bozhidar10:06:22

It should not unload anything, as it’s pretty basic:

(defun cider-load-all-files (directory)
  "Load all files in DIRECTORY (recursively).
Useful when the running nREPL on remote host."
  (interactive "DLoad files beneath directory: ")
  (mapcar #'cider-load-file
          (directory-files-recursively directory "\\.clj[cs]?$")))

bozhidar10:06:38

(eval-all-files is just an alias for that one)

practicalli-johnny10:06:26

Ah my bad, the definitions are in the REPL, its just clj-kondo telling me the function doesnt exist anymore 🙂 I corrected the original reply to avoid confusion...

papachan12:06:03

Is it doable to keep the output from a cider-eval-sexp-at-point inside the clj file? so i can save it with all the results printed. i remember having this with lispxmp and emacs lisp.

dpsutton13:06:37

cider-eval-print-last-sexp and cider-pprint-eval-defun-at-point might be helpful for you

papachan21:06:54

Ah cool i just binding the cider-eval-print-last-sexp to a key and now i can C-c C̣-f and C-c C-ạ and it print the last output into the file.

Drew Verlee14:06:15

on a fresh project built with clj-new i can confirm that "cider-refresh" correctly finds new symobls (functions, etc). However, on the current project i'm working on, it doesn't. on top of which, after using it. when i eval my namespace it complains that i'm re aliasing something in the ns, which it doesn't. Does this sound familiar to anyone? In short, what works for me is directly re-evaling the new symbols/functions and killing and restarting my repl.

eval-on-point17:06:01

is there a variable that lets me specify how the inspector will display the inspected's contents? I want maps to generally be printed with a kv pair per line

yuhan17:06:15

you can toggle line truncation

yuhan17:06:54

and add that to cider-inspector-mode-hook to have it done all the time

eval-on-point17:06:52

close enough, thanks for the idea!