Running repl commands in cider (emacs)

Running repl commands in cider (emacs)

Ok, I will admit.. this took a while. But I have found a nice way of doing this.

What is this? Well, let’s say let’s say that you have a command to start your server in user namespace. With this cool feature, now you can run this with a emacs command (or shortcut if you bind it).

The cool thing about this is that the command will run with the namespace from the repl and not the last ns that you loaded with cider =].

Here is a taste:

(defun le2m/cool-repl-command ()
 (interactive)
 (cider-interactive-eval
  (cider-insert-in-repl (format "(clojure.core/require 'a-namespace)
                                  (a-namespace/do-something
                                  (fn lambda-example [t] (:get-a-key (meta t))))") 't)))

  1. stackoverflow reference that started this

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Running repl commands in cider (emacs)