Add tap> to cider eval
Hello, I have got the functionality that I wanted using the code below. I don't know emacs lisp very well, so I thought I would post it here for suggestions, improvements or if anyone else wanted to use it. Everything I eval gets tapped (for use with add-taps such as portal)
(require 'cider-mode)
(defun cider-tap (&rest r)
(cons (concat "(let [__value "
(caar r)
"] (tap> __value) __value)")
(cdar r)))
(advice-add 'cider-nrepl-request:eval
:filter-args #'cider-tap)
See also https://github.com/clojure-emacs/cider/issues/3055 for a different approach to doing this.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
@archaic this code example has been extremely useful to me!
We'll likely merge a limited version of this as proposed in #3239. We can still include @archaic's code snippet in the evaluation docs, though, so it's easy for people to discover it.
Between https://github.com/clojure-emacs/cider/pull/3240, https://github.com/clojure-emacs/cider/commit/966cae463c65d0392d1148eb252912f31c03c881 and the future https://github.com/clojure-emacs/cider/issues/3055 our tapping needs will be well-served.
The (advice-add 'cider-nrepl-request:eval :filter-args #'cider-tap) is nice but a productionized approach would look like nREPL middleware instead.
Cheers - V