Send Emacs keybinding to Clojure process through nrepl eval or something else?

I want to be able to connect emacs keybindings to specific evals in my running clojure process, and I don’t want these evals to result in text output in my cider-repl buffer.

Currently I am at

(ns user)

(defn keydown [] 
 ... some logic ...)

and in .dir-locals.el I’m at

(defun keydown-thing ()
  (interactive)
  (cider-nrepl-send-request 
    '("op" "eval"
      "ns" "user"
      "code" "(keydown)")
    (cider-repl-handler (current-buffer))))

(global-set-key (kbd "<f2>") 'keydown-thing)

When I press F2 in the some cider-buffer, it works, but there is also a nil output in the *cider-repl ...*-buffer.

What is a better way to send data “silently” to the clojure process from emacs? It really doesn’t have to be through cider-nrepl if there is some more efficient way.

Not an expert on CIDER (obviously :smile:), but got curious. Maybe you can go a bit lower level? With nrepl-request:eval you pass your own callback: