cider icon indicating copy to clipboard operation
cider copied to clipboard

Add tap> to cider eval

Open archaic opened this issue 4 years ago • 4 comments

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)

archaic avatar Nov 25 '21 03:11 archaic

See also https://github.com/clojure-emacs/cider/issues/3055 for a different approach to doing this.

bbatsov avatar Dec 31 '21 10:12 bbatsov

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!

stale[bot] avatar Apr 17 '22 00:04 stale[bot]

@archaic this code example has been extremely useful to me!

daslu avatar May 05 '22 22:05 daslu

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.

bbatsov avatar Aug 23 '22 05:08 bbatsov

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

vemv avatar Oct 28 '23 20:10 vemv